import NavierStokes.GluedStageEstimates import NavierStokes.SharpPhysicalLogBounds import NavierStokes.ActualCurrentParticularBounds import NavierStokes.SharpPhysicalLoss import NavierStokes.LocalPhysicalCopyBounds import NavierStokes.SharpPhaseJetAlgebra import NavierStokes.CurrentPhysicalRadialClosure import NavierStokes.CurrentParticularLabelBounds import NavierStokes.SharpWaveStageBounds import NavierStokes.ActualPhysicalStageBounds import NavierStokes.LocalMeanPhysicalBounds import NavierStokes.ActualCandidateAssembly /-! ## From `NavierStokes/SharpGeometricModeJets.lean` The text of `NavierStokes/SharpGeometricModeJets.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpGeometricModeJets open Set Function Filter LocalPhysicalCopyBounds open scoped ContDiff Topology BigOperators private theorem nat_le_infty (k : ℕ) : (k : WithTop ℕ∞) ≤ ∞ := WithTop.coe_le_coe.mpr le_top variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedSpace ℂ F] [IsScalarTower ℝ ℂ F] end NavierStokes.SharpGeometricModeJets end end /-! ## From `NavierStokes/SharpCommonGraphJets.lean` The text of `NavierStokes/SharpCommonGraphJets.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpCommonGraphJets open Set Function Filter ProblemStatement open PhysicalGraphBounds PhysicalWaveSum LocalPhysicalCopyBounds open scoped ContDiff Topology end NavierStokes.SharpCommonGraphJets end end /-! ## From `NavierStokes/SharpCurrentPhysicalPhase.lean` The text of `NavierStokes/SharpCurrentPhysicalPhase.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpCurrentPhysicalPhase open Set Function Filter ProblemStatement CorrectionInitialization open PhysicalGraphBounds PhysicalWaveSum LocalPhysicalCopyBounds open scoped ContDiff Topology abbrev Native := ActualParticularBackground.Native abbrev h : ℝ := ActualPrimary.h noncomputable def nativeMap (a : ℝ) (c : PolarCharts.Index) (n d : ℕ) : SpaceTime → Native := CurrentPhysicalChartJets.chartMap a c ∘ commonLift h n d noncomputable def fullMap (a : ℝ) (c : PolarCharts.Index) (n d : ℕ) : SpaceTime → ActualPrimary.FullPoint := ActualParticularBackground.nativeToFull ∘ nativeMap a c n d private theorem nat_le_infty (k : ℕ) : (k : WithTop ℕ∞) ≤ ∞ := WithTop.coe_le_coe.mpr le_top theorem smoothNear_comp {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup G] [NormedSpace ℝ G] {f : F → G} {g : E → F} {x : E} (hf : SmoothNear f (g x)) (hg : SmoothNear g x) : SmoothNear (f ∘ g) x := by obtain ⟨V,hV,hgx,hf⟩ := hf obtain ⟨U,hU,hx,hg⟩ := hg obtain ⟨W,hWV,hW,hxW⟩ := mem_nhds_iff.mp ((hg.contDiffAt (hU.mem_nhds hx)).continuousAt.preimage_mem_nhds (hV.mem_nhds hgx)) refine ⟨U ∩ W,hU.inter hW,⟨hx,hxW⟩,?_⟩ exact hf.comp (hg.mono inter_subset_left) (fun y hy => hWV hy.2) theorem nativeMap_smoothNear {a : ℝ} (ha : 0 < a) (c : PolarCharts.Index) (n d : ℕ) {w : SpaceTime} (hw : radialProjection w ≠ 0) : SmoothNear (nativeMap a c n d) w := by let U : Set SpaceTime := {w | radialProjection w ≠ 0} have hU : IsOpen U := axisFree_open.preimage radialProjection.continuous refine ⟨U,hU,hw,?_⟩ exact (CurrentPhysicalChartJets.chartMap_smooth ha c).comp_contDiffOn ((downLift d).contDiff.comp_contDiffOn (physicalLift_smooth h n)) theorem fullMap_smoothNear {a : ℝ} (ha : 0 < a) (c : PolarCharts.Index) (n d : ℕ) {w : SpaceTime} (hw : radialProjection w ≠ 0) : SmoothNear (fullMap a c n d) w := by obtain ⟨U,hU,hx,hs⟩ := nativeMap_smoothNear ha c n d hw exact ⟨U,hU,hx,ActualParticularBackground.nativeToFull.toContinuousLinearEquiv.contDiff.comp_contDiffOn hs⟩ noncomputable def remainder (n : ℕ) (i : ActualPhaseJetBounds.CopyIndex B N0) (x : ActualPrimary.FullPoint) : ℝ := ActualPhaseJetBounds.nativeRemainder i.1 ((ActualPrimaryBounds.fullCopy i.1 n i.2 x).1,(ActualPrimaryBounds.fullCopy i.1 n i.2 x).2.2) theorem weightedPhase_smoothNear {a : ℝ} (ha : 0 < a) (c : PolarCharts.Index) (n d : ℕ) {i : ActualPhaseJetBounds.CopyIndex B N0} {w : SpaceTime} (hw : radialProjection w ≠ 0) (hi : fullMap a c n d w ∈ ActualPhaseJetBounds.phaseCell n i) : SmoothNear (ActualCurrentCarrierJets.weightedPhase i.1 n ∘ nativeMap a c n d) w := by change SmoothNear (ActualPhaseJetBounds.weightedPhase i.1 n ∘ fullMap a c n d) w exact smoothNear_comp (ActualCurrentCarrierJets.full_weightedPhase_smoothNear hi) (fullMap_smoothNear ha c n d hw) end NavierStokes.SharpCurrentPhysicalPhase end end /-! ## From `NavierStokes/SharpMeanJetBounds.lean` The text of `NavierStokes/SharpMeanJetBounds.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpMeanJetBounds open Set Function Filter ProblemStatement PhysicalWaveSum LocalPhysicalCopyBounds open PhysicalMeanJetBounds LocalMeanPhysicalBounds open scoped Topology ContDiff BigOperators variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] noncomputable def meanLoss (h degree : ℝ) (m : ℕ) : ℝ := (m:ℝ)*(1+h)+degree variable {h degree a b : ℝ} {N Δ : ℕ} {U : Set PhysicalGraphBounds.Plane} end NavierStokes.SharpMeanJetBounds end end /-! ## From `NavierStokes/SharpMeanStageBounds.lean` The text of `NavierStokes/SharpMeanStageBounds.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.ActualPhysicalStageBounds.MeanInput open Set Function Filter ProblemStatement open SharpMeanJetBounds SharpPhysicalCarrier open scoped Topology ContDiff private theorem common_loss_bound {h degree q C α : ℝ} {m k : ℕ} (hh : 0 ≤ h) (hdegree : degree ≤ 2*CoordinateAlgebra.A h) (hkm : k ≤ m+1) (hq : 0 < q) (hq1 : q ≤ 1) (hC : 0 ≤ C) (N : ℕ) : C*q^(h*α-meanLoss h degree k)*(1+|Real.log q|)^N ≤ C*q^(h*α-physicalLoss h m)*(1+|Real.log q|)^N := by have hk : (k:ℝ) ≤ (m:ℝ)+1 := by exact_mod_cast hkm have hm : 0 ≤ (m:ℝ)+1 := by positivity have he : h*α-physicalLoss h m ≤ h*α-meanLoss h degree k := by unfold physicalLoss meanLoss derivativeCost nlinarith exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_ge hq hq1 he) hC) (by positivity) end NavierStokes.ActualPhysicalStageBounds.MeanInput end end /-! ## From `NavierStokes/SharpGluedStageBounds.lean` The text of `NavierStokes/SharpGluedStageBounds.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpGluedStageBounds open Set Function Filter ProblemStatement PhysicalWaveSum open scoped Topology ContDiff BigOperators open CorrectionInitialization CorrectionInitialization.ActualPrimary ActualStageEstimates section SignedAndMean variable {B N0 N : ℕ} {D : Type} [NormedAddCommGroup D] [NormedSpace ℝ D] {I K : Type*} (R : RunData B N0) (M : ActualMeanPhysicalData.InitialCycleInput B N0 N (fun _ => ActualCycleParameters.fixedParameters B N0)) (hN : 4 ≤ N) (W : GluedStageEstimates.SignedInputs D I K) private theorem potential_gain (j : ℕ) : ActualIterationLedger.gain h (j+1) ≤ h * (W.potential j).alpha := by have hg := ActualIterationLedger.gain_le_wave outgoing.data.h_pos.le ActualCyclePreservation.kappa_small (Nat.succ_pos j) rw [← nativePotential_eq_ledger j] at hg exact hg.trans (mul_le_mul_of_nonneg_left (W.potential_exponent j) outgoing.data.h_pos.le) private theorem pressure_gain (j : ℕ) : ActualIterationLedger.gain h (j+1) ≤ h * (W.pressure j).alpha := by have hg := ActualIterationLedger.gain_le_wavePressure outgoing.data.h_pos.le ActualCyclePreservation.kappa_small (Nat.succ_pos j) rw [← nativePressure_eq_ledger j] at hg exact hg.trans (mul_le_mul_of_nonneg_left (W.pressure_exponent j) outgoing.data.h_pos.le) private theorem mean_gain (j : ℕ) : ActualIterationLedger.gain h (j+1) ≤ h * (1+ActualIterationLedger.sigma j-2*ChartScales.kappa) := by rw [nativeMean_eq_ledger] exact ActualIterationLedger.gain_le_mean outgoing.data.h_pos.le ActualCyclePreservation.kappa_small (Nat.succ_pos j) private theorem mean_degree : CoordinateAlgebra.A h - 1/2 ≤ 2*CoordinateAlgebra.A h := by unfold CoordinateAlgebra.A linarith [outgoing.data.h_pos] end SignedAndMean end NavierStokes.SharpGluedStageBounds end end /-! ## From `NavierStokes/SharpParticularGluing.lean` The text of `NavierStokes/SharpParticularGluing.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpParticularGluing open Set Function Filter ProblemStatement PhysicalWaveSum SharpGluedStageBounds open CorrectionInitialization.ActualPrimary CorrectionStep open scoped Topology ContDiff BigOperators private theorem choose_mode_constants {P : ℤ → ℝ → ℕ → Prop} (hP : ∀ k, k ≠ 0 → ∃ C : ℝ, 0 ≤ C ∧ ∃ N : ℕ, P k C N) : ∃ C : ℤ → ℝ, (∀ k, 0 ≤ C k) ∧ ∃ N : ℤ → ℕ, ∀ k, k ≠ 0 → P k (C k) (N k) := by classical have hs (k : ℤ) : ∃ C : ℝ, 0 ≤ C ∧ ∃ N : ℕ, k ≠ 0 → P k C N := by by_cases hk : k = 0 · exact ⟨0,le_rfl,0,fun hn => (hn hk).elim⟩ · obtain ⟨C,hC,N,hb⟩ := hP k hk exact ⟨C,hC,N,fun _ => hb⟩ choose C hC N hb using hs exact ⟨C,hC,N,hb⟩ section HarmonicSums variable {B N0 : ℕ} {σ : ℝ} {x : CycleState (ActualInitialization.Index B N0)} (H : ActualParticularCycleData.Invariant σ x) (hGeom : ActualCarrierGeometry.geometricThreshold ≤ N0) include H hGeom end HarmonicSums end NavierStokes.SharpParticularGluing end end /-! ## From `NavierStokes/SharpCurrentModeJets.lean` The text of `NavierStokes/SharpCurrentModeJets.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpCurrentModeJets open Set Function Filter ProblemStatement CorrectionInitialization open LocalPhysicalCopyBounds SharpCurrentPhysicalPhase open scoped ContDiff Topology private theorem nat_le_infty (k : ℕ) : (k : WithTop ℕ∞) ≤ ∞ := WithTop.coe_le_coe.mpr le_top end NavierStokes.SharpCurrentModeJets end end /-! ## From `NavierStokes/SharpCurrentParticularBounds.lean` The text of `NavierStokes/SharpCurrentParticularBounds.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpCurrentParticularBounds open Set Function Filter ProblemStatement CorrectionStep open CorrectionInitialization ActualCurrentParticularBounds open CorrectionInitialization.ActualPrimary (h outgoing nominal) open LocalPhysicalCopyBounds SharpCurrentModeJets open SharpCurrentPhysicalPhase (nativeMap fullMap smoothNear_comp weightedPhase_smoothNear nativeMap_smoothNear) open scoped Topology ContDiff BigOperators variable {B N0 : ℕ} {σ : ℝ} {x : CycleState (ActualInitialization.Index B N0)} private theorem commonGap_bound (n : ℕ) : CurrentPhysicalModeGerms.commonGap n ≤ CommonWindow.gap h := by have hn := CommonWindow.native_le_index_add h outgoing.data.h_pos.le n unfold CurrentPhysicalModeGerms.commonGap omega end NavierStokes.SharpCurrentParticularBounds end end /-! ## From `NavierStokes/SharpActualStageBounds.lean` The text of `NavierStokes/SharpActualStageBounds.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.SharpActualStageBounds open Set Function Filter ProblemStatement PhysicalWaveSum SharpGluedStageBounds open CorrectionInitialization.ActualPrimary ActualCandidateAssembly open scoped Topology ContDiff BigOperators end NavierStokes.SharpActualStageBounds end end noncomputable section namespace NavierStokes.SharpParticularStageBounds open Set Function Filter ProblemStatement PhysicalWaveSum SharpGluedStageBounds open CorrectionInitialization.ActualPrimary ActualCandidateAssembly open scoped Topology ContDiff BigOperators private theorem common_loss (j m k : ℕ) {degree : ℝ} (hd : degree ≤ 2*CoordinateAlgebra.A h) (hk : k ≤ m+1) : ActualIterationLedger.gain h (j+1)-SharpPhysicalCarrier.physicalLoss h m ≤ h*(ActualIterationLedger.sigma j+1)-degree-(k:ℝ)*SharpPhysicalCarrier.derivativeCost h := by have hg := GluedStageEstimates.gain_le_current_exponent j have hk' : (k:ℝ) ≤ (m:ℝ)+1 := by exact_mod_cast hk have hc : 0 ≤ SharpPhysicalCarrier.derivativeCost h := by unfold SharpPhysicalCarrier.derivativeCost linarith [outgoing.data.h_pos] unfold SharpPhysicalCarrier.physicalLoss nlinarith end NavierStokes.SharpParticularStageBounds