import NavierStokes.CutStageEstimates import NavierStokes.GenericSupportedPolynomial import NavierStokes.DirectAngularDiagonal import NavierStokes.MixedPeriodicAssembly /-! ## From `NavierStokes/GenericDiagonalSchedule.lean` The text of `NavierStokes/GenericDiagonalSchedule.lean`, folded into this file, which was its only importer. -/ section /-! # A common diagonal schedule with arbitrary additional finite tests The same sequence of cutoff scales enforces all field jet estimates and any prescribed finite family of positive-power logarithmic tests at each stage. The bounds apply throughout the reciprocal interval, including its endpoint. -/ noncomputable section namespace NavierStokes.GenericDiagonalSchedule open Set Function Filter open scoped Topology ContDiff BigOperators section Fields variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] variable {ι : Type*} [Fintype ι] {W : ι → Type*} [∀ i, NormedAddCommGroup (W i)] [∀ i, NormedSpace ℝ (W i)] end Fields end NavierStokes.GenericDiagonalSchedule end end /-! ## From `NavierStokes/GenericRealization.lean` The text of `NavierStokes/GenericRealization.lean`, folded into this file, which was its only importer. -/ section /-! # A single smooth diagonal realization with finite differential-polynomial tests All estimates are on the actual cutoff series. The same schedule supplies every jet order and an arbitrary finite set of extra tests at each stage. Residual transfer permits independently varying residual gains and coefficient growth only on the common support of each nonconstant monomial. -/ noncomputable section namespace NavierStokes.GenericRealization open Set Filter DiagonalResidual GenericRealizationBounds GenericDifferentialPolynomial open scoped Topology ContDiff BigOperators variable {D : Type*} /-- Approach the singular scale uniformly over the full prescribed domain. -/ def scaleApproach (U : Set D) (q : D → ℝ) : Filter D := comap q (𝓝[>] (0 : ℝ)) ⊓ 𝓟 U variable [NormedAddCommGroup D] [NormedSpace ℝ D] variable {ι : Type*} /-- Properties derived for one selected schedule, rather than new schedules chosen after the derivative order or the polynomial has been supplied. -/ structure Properties (U : Set D) (q : D → ℝ) (base : ι → D → ℝ) (A : ι → ℕ → D → ℝ) (g L : ℕ → ℝ) (a : ℕ → ℕ) : Prop where positive : ∀ j, 0 < a j doubling : ∀ j, 2 * a j ≤ a (j + 1) strictMono : StrictMono a tends : Tendsto (fun j => (a j : ℝ)) atTop atTop locallyFinite : ∀ i, LocallyFinite (fun j => Function.support (fun x : U => SolenoidalDiagonal.cutStage (fun j => (a j : ℝ)) q (CutStageEstimates.positiveStages (A i)) j x)) smooth : ∀ i, ContDiffOn ℝ ∞ (realized (fun j => (a j : ℝ)) q (base i) (A i)) U approximation : ∀ i, Nonempty (ApproximationRates (scaleApproach U q) q (fun J => g (J + 1) / 2) (realized (fun j => (a j : ℝ)) q (base i) (A i)) (stage (base i) (A i))) exact_tail : ∀ i x, x ∈ U → ∀ J m, m ≤ J + 3 → q x < 1 / (2 * (a J : ℝ)) → ‖iteratedFDeriv ℝ m (fun y => realized (fun j => (a j : ℝ)) q (base i) (A i) y - stage (base i) (A i) J y) x‖ ≤ (1 / 2 : ℝ) ^ J * q x ^ (g (J + 1) / 2 - CutStageEstimates.cutLoss L m) outer_zero : ∀ i x, ContinuousAt q x → 1 / (a 0 : ℝ) < q x → SolenoidalDiagonal.potentialSum (fun j => (a j : ℝ)) q (CutStageEstimates.positiveStages (A i)) =ᶠ[𝓝 x] (fun _ => 0) end NavierStokes.GenericRealization end end /-! ## From `NavierStokes/GenericSolenoidalRealization.lean` The text of `NavierStokes/GenericSolenoidalRealization.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.GenericSolenoidalRealization open Set Filter ProblemStatement open scoped Topology ContDiff BigOperators /-- Literal curl-after-cutoff realization, with a separate uncut base. -/ def velocity (a : ℕ → ℝ) (q : SpaceTime → ℝ) (u0 : VelocityField) (A B : ℕ → VelocityField) : VelocityField := fun w => u0 w + SolenoidalDiagonal.velocitySum a q A w + SolenoidalDiagonal.potentialSum a q B w /-- The manuscript's sum starts at stage one; the base is left uncut. -/ def positiveVelocity (a : ℕ → ℝ) (q : SpaceTime → ℝ) (u0 : VelocityField) (A B : ℕ → VelocityField) : VelocityField := velocity a q u0 (CutStageEstimates.positiveStages A) (CutStageEstimates.positiveStages B) end NavierStokes.GenericSolenoidalRealization end end /-! ## From `NavierStokes/GenericVelocityRates.lean` The text of `NavierStokes/GenericVelocityRates.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.GenericDifferentialPolynomial open Set Filter DiagonalResidual open scoped Topology ContDiff variable {D V W : Type*} [NormedAddCommGroup D] [NormedSpace ℝ D] [NormedAddCommGroup V] [NormedSpace ℝ V] [NormedAddCommGroup W] [NormedSpace ℝ W] end NavierStokes.GenericDifferentialPolynomial namespace NavierStokes.GenericSolenoidalRealization open Set Filter ProblemStatement DiagonalResidual GenericRealizationBounds GenericDifferentialPolynomial open scoped Topology ContDiff BigOperators def positiveStage (u0 : VelocityField) (A B : ℕ → VelocityField) (J : ℕ) : VelocityField := fun w => u0 w + MixedDiagonalResidual.uncutVelocity (CutStageEstimates.positiveStages A) (CutStageEstimates.positiveStages B) J w end NavierStokes.GenericSolenoidalRealization end end /-! ## From `NavierStokes/GenericTupleRealization.lean` The text of `NavierStokes/GenericTupleRealization.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.GenericTupleRealization open Set Filter ProblemStatement DiagonalResidual GenericRealizationBounds GenericDifferentialPolynomial open GenericSolenoidalRealization GenericRealization open scoped Topology ContDiff BigOperators abbrev Entry (κ : Type*) := Bool ⊕ κ def Value {κ : Type*} : Entry κ → Type | .inl _ => Space | .inr _ => ℝ instance {κ : Type*} (e : Entry κ) : NormedAddCommGroup (Value e) := match e with | .inl _ => inferInstanceAs (NormedAddCommGroup Space) | .inr _ => inferInstanceAs (NormedAddCommGroup ℝ) instance {κ : Type*} (e : Entry κ) : NormedSpace ℝ (Value e) := match e with | .inl _ => inferInstanceAs (NormedSpace ℝ Space) | .inr _ => inferInstanceAs (NormedSpace ℝ ℝ) def representatives {κ : Type*} (A B : ℕ → VelocityField) (R : κ → ℕ → PressureField) : ∀ e : Entry κ, ℕ → SpaceTime → Value e | .inl false => A | .inl true => B | .inr k => R k /-- The optional scalar entries comprise pressure and any finite stress components. Taking a singleton retains pressure alone. -/ def components {κ : Type*} (a : ℕ → ℝ) (q : SpaceTime → ℝ) (u0 : VelocityField) (s0 : κ → PressureField) (A B : ℕ → VelocityField) (R : κ → ℕ → PressureField) : Fin 3 ⊕ κ → PressureField | .inl i => fun w => positiveVelocity a q u0 A B w i | .inr k => realized a q (s0 k) (R k) def stageComponents {κ : Type*} (u0 : VelocityField) (s0 : κ → PressureField) (A B : ℕ → VelocityField) (R : κ → ℕ → PressureField) (J : ℕ) : Fin 3 ⊕ κ → PressureField | .inl i => fun w => positiveStage u0 A B J w i | .inr k => stage (s0 k) (R k) J structure Result {κ : Type*} (U : Set SpaceTime) (q : SpaceTime → ℝ) (u0 : VelocityField) (s0 : κ → PressureField) (A B : ℕ → VelocityField) (R : κ → ℕ → PressureField) (g L : ℕ → ℝ) (a : ℕ → ℕ) : Prop where positive : ∀ j, 0 < a j doubling : ∀ j, 2 * a j ≤ a (j + 1) monotone : StrictMono a tends : Tendsto (fun j => (a j : ℝ)) atTop atTop locallyFinite_representatives : ∀ e, LocallyFinite (fun j => Function.support (fun w : U => SolenoidalDiagonal.cutStage (fun j => (a j : ℝ)) q (CutStageEstimates.positiveStages (representatives A B R e)) j w)) smooth_velocity : ContDiffOn ℝ ∞ (positiveVelocity (fun j => (a j : ℝ)) q u0 A B) U smooth_scalars : ∀ k, ContDiffOn ℝ ∞ (realized (fun j => (a j : ℝ)) q (s0 k) (R k)) U divergence : ∀ w ∈ U, spatialDivergence (positiveVelocity (fun j => (a j : ℝ)) q u0 A B) w.1 w.2 = 0 approximation : ∀ i, Nonempty (ApproximationRates (scaleApproach U q) q (fun J => g (J + 1) / 2) (components (fun j => (a j : ℝ)) q u0 s0 A B R i) (fun J => stageComponents u0 s0 A B R J i)) tail_velocity : ∀ w ∈ U, ∀ J m, m ≤ J + 2 → q w < 1 / (2 * (a J : ℝ)) → ‖iteratedFDeriv ℝ m (fun y => positiveVelocity (fun j => (a j : ℝ)) q u0 A B y - positiveStage u0 A B J y) w‖ ≤ (1 / 2 : ℝ) ^ J * q w ^ (g (J + 1) / 2 - (max (CutStageEstimates.cutLoss L (m + 1)) (CutStageEstimates.cutLoss L m) + 1)) tail_scalars : ∀ k w, w ∈ U → ∀ J m, m ≤ J + 3 → q w < 1 / (2 * (a J : ℝ)) → ‖iteratedFDeriv ℝ m (fun y => realized (fun j => (a j : ℝ)) q (s0 k) (R k) y - stage (s0 k) (R k) J y) w‖ ≤ (1 / 2 : ℝ) ^ J * q w ^ (g (J + 1) / 2 - CutStageEstimates.cutLoss L m) outer_velocity : ∀ w, ContinuousAt q w → 1 / (a 0 : ℝ) < q w → positiveVelocity (fun j => (a j : ℝ)) q u0 A B =ᶠ[𝓝 w] u0 outer_scalars : ∀ k w, ContinuousAt q w → 1 / (a 0 : ℝ) < q w → realized (fun j => (a j : ℝ)) q (s0 k) (R k) =ᶠ[𝓝 w] s0 k end NavierStokes.GenericTupleRealization end end /-! ## From `NavierStokes/GenericAngularRecovery.lean` The text of `NavierStokes/GenericAngularRecovery.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.GenericSolenoidalRealization open Set Filter ProblemStatement AxisymmetricFields DirectAngularDiagonal open scoped Topology ContDiff BigOperators private def radialFactor (w : SpaceTime) (p : ProfilePoint) : ℝ := Real.sqrt (p.2.1 / radialEnergy w.2) /-- A local section of the cylindrical coordinate map through the given off-axis Cartesian point, retaining its angular direction. -/ private def radialSection (w : SpaceTime) (p : ProfilePoint) : SpaceTime := (p.1, AxisymmetricResidual.pack (radialFactor w p * w.2 0) (radialFactor w p * w.2 1) p.2.2) private theorem radialFactor_at {w : SpaceTime} (hw : 0 < radialEnergy w.2) : radialFactor w (profilePoint w.1 w.2) = 1 := by simp only [radialFactor, profilePoint, div_self hw.ne', Real.sqrt_one] private theorem radialSection_at {w : SpaceTime} (hw : 0 < radialEnergy w.2) : radialSection w (profilePoint w.1 w.2) = w := by refine Prod.ext ?_ ?_ · rfl ext i fin_cases i <;> simp [radialSection, radialFactor, profilePoint, div_self hw.ne'] private theorem profile_radialSection {w : SpaceTime} (hw : 0 < radialEnergy w.2) {p : ProfilePoint} (hp : 0 < p.2.1) : profilePoint (radialSection w p).1 (radialSection w p).2 = p := by have hs : radialFactor w p ^ 2 = p.2.1 / radialEnergy w.2 := Real.sq_sqrt (div_pos hp hw).le have he : radialEnergy (radialSection w p).2 = p.2.1 := by simp only [radialEnergy, radialSection, AxisymmetricResidual.pack_zero, AxisymmetricResidual.pack_one] calc _ = radialFactor w p ^ 2 * radialEnergy w.2 := by unfold radialEnergy; ring _ = p.2.1 := by rw [hs, div_mul_cancel₀ _ hw.ne'] refine Prod.ext ?_ ?_ · rfl exact Prod.ext he (AxisymmetricResidual.pack_two _ _ _) private theorem radialFactor_smoothAt {w : SpaceTime} (hw : 0 < radialEnergy w.2) : ContDiffAt ℝ ∞ (radialFactor w) (profilePoint w.1 w.2) := by apply (contDiffAt_snd.fst.div_const (radialEnergy w.2)).sqrt change (profilePoint w.1 w.2).2.1 / radialEnergy w.2 ≠ 0 norm_num [profilePoint, div_self hw.ne'] private theorem radialSection_smoothAt {w : SpaceTime} (hw : 0 < radialEnergy w.2) : ContDiffAt ℝ ∞ (radialSection w) (profilePoint w.1 w.2) := by have hs := radialFactor_smoothAt hw have hv : ContDiffAt ℝ ∞ (fun p : ProfilePoint => AxisymmetricResidual.pack (radialFactor w p * w.2 0) (radialFactor w p * w.2 1) p.2.2) (profilePoint w.1 w.2) := by unfold AxisymmetricResidual.pack exact (((hs.mul contDiffAt_const).smul contDiffAt_const).add ((hs.mul contDiffAt_const).smul contDiffAt_const)).add (contDiffAt_snd.snd.smul contDiffAt_const) exact contDiffAt_fst.prodMk hv end NavierStokes.GenericSolenoidalRealization end end /-! ## From `NavierStokes/GenericFactorSupport.lean` The text of `NavierStokes/GenericFactorSupport.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.GenericDifferentialPolynomial open Set Filter open scoped Topology ContDiff BigOperators variable {D ι : Type*} [NormedAddCommGroup D] [NormedSpace ℝ D] /-- A single Cartesian field factor. Coordinate vectors give the usual multi-index derivatives; arbitrary fixed directions are also permitted. -/ inductive FieldFactor (D ι : Type*) where | input : ι → FieldFactor D ι | directional : D → FieldFactor D ι → FieldFactor D ι def FieldFactor.expression : FieldFactor D ι → Expression D ι Empty | .input i => .input i | .directional v f => .directional v f.expression def FieldFactor.eval (f : FieldFactor D ι) (u : ι → D → ℝ) : D → ℝ := f.expression.eval (fun k => Empty.elim k) u /-- Each leaf records the support of one differentiated field factor in the base and every increment. Multiplication constructs arbitrary positive-degree monomials without requiring undifferentiated components to share the support. -/ inductive FactorSupportAt (base : ι → D → ℝ) (inc : ℕ → ι → D → ℝ) (x : D) : Expression D ι Empty → Prop where | factor (f : FieldFactor D ι) (base_zero : f.eval base =ᶠ[𝓝 x] (fun _ => 0)) (increment_zero : ∀ j, f.eval (inc j) =ᶠ[𝓝 x] (fun _ => 0)) : FactorSupportAt base inc x f.expression | mul {e f : Expression D ι Empty} : FactorSupportAt base inc x e → FactorSupportAt base inc x f → FactorSupportAt base inc x (.mul e f) end NavierStokes.GenericDifferentialPolynomial end end /-! ## From `NavierStokes/GenericTupleSupport.lean` The text of `NavierStokes/GenericTupleSupport.lean`, folded into this file, which was its only importer. -/ section noncomputable section namespace NavierStokes.GenericTupleRealization open Set Filter ProblemStatement GenericSolenoidalRealization GenericDifferentialPolynomial open GenericRealizationBounds GenericRealization SolenoidalDiagonal open scoped Topology ContDiff BigOperators private theorem spatialCurl_sum_on {U : Set SpaceTime} (hU : IsOpen U) {A : ℕ → VelocityField} (hA : ∀ j, ContDiffOn ℝ ∞ (A j) U) (N : ℕ) {w : SpaceTime} (hw : w ∈ U) : SpatialCurl.spatialCurl (fun y => ∑ j ∈ Finset.range N, A j y) w = ∑ j ∈ Finset.range N, SpatialCurl.spatialCurl (A j) w := by have hd : ∀ j ∈ Finset.range N, DifferentiableAt ℝ (fun x : Space => A j (w.1, x)) w.2 := by intro j _ exact (((hA j).contDiffAt (hU.mem_nhds hw)).comp w.2 (contDiffAt_const.prodMk contDiffAt_id)).differentiableAt (by simp) simpa only [SpatialCurl.spatialCurl, SpatialCurl.curl, map_sum] using congrArg SpatialCurl.curlLinear (fderiv_fun_sum hd) end NavierStokes.GenericTupleRealization end end noncomputable section namespace NavierStokes.GenericTupleRealization open Set Filter ProblemStatement GenericDifferentialPolynomial DiagonalResidual open GenericRealizationBounds GenericRealization open scoped Topology ContDiff BigOperators end NavierStokes.GenericTupleRealization