import NavierStokes.DiagonalResidual import NavierStokes.MixedFiniteBackground /-! ## From `NavierStokes/GenericJetRateAlgebra.lean` The text of `NavierStokes/GenericJetRateAlgebra.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 : Type*} [NormedAddCommGroup D] [NormedSpace ℝ D] private local instance : NormedAddCommGroup ((D →L[ℝ] ℝ) →L[ℝ] ℝ) := inferInstance private local instance : NormedSpace ℝ ((D →L[ℝ] ℝ) →L[ℝ] ℝ) := inferInstance variable {l : Filter D} {q : D → ℝ} {U : Set D} {f g : D → ℝ} end NavierStokes.GenericDifferentialPolynomial end end /-! ## From `NavierStokes/GenericDifferentialPolynomial.lean` The text of `NavierStokes/GenericDifferentialPolynomial.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 : Type*} [NormedAddCommGroup D] [NormedSpace ℝ D] /-- Quantitative approximation data. Constants may depend on the stage, while the power losses and derivative thresholds are fixed functions of the jet order. -/ structure ApproximationRates (l : Filter D) (q : D → ℝ) (gain : ℕ → ℝ) (f : D → ℝ) (stage : ℕ → D → ℝ) where growthLoss : ℕ → ℝ tailLoss : ℕ → ℝ threshold : ℕ → ℕ stage_growth : ∀ J m, JetRate l q (stage J) m (-growthLoss m) tail_rate : ∀ m J, threshold m ≤ J → JetRate l q (fun x => f x - stage J x) m (gain J - tailLoss m) private def maxThreshold (M : ℕ → ℕ) (m : ℕ) : ℕ := (Finset.range (m + 1)).sup M private theorem le_maxThreshold (M : ℕ → ℕ) {k m : ℕ} (hk : k ≤ m) : M k ≤ maxThreshold M m := Finset.le_sup (f := M) (Finset.mem_range.mpr (Nat.lt_succ_of_le hk)) variable {l : Filter D} {q : D → ℝ} {gain : ℕ → ℝ} {U : Set D} variable {f g : D → ℝ} {fs gs : ℕ → D → ℝ} /-- A finite differential expression in scalar components with fixed variable coefficients. Products, sums, and arbitrary fixed directional derivatives are allowed at every node; consequently the order and polynomial degree are finite. -/ inductive Expression (D ι κ : Type*) where | input : ι → Expression D ι κ | coeff : κ → Expression D ι κ | add : Expression D ι κ → Expression D ι κ → Expression D ι κ | mul : Expression D ι κ → Expression D ι κ → Expression D ι κ | directional : D → Expression D ι κ → Expression D ι κ namespace Expression variable {ι κ : Type*} /-- Evaluation uses actual Fréchet derivatives, including at derivative nodes. -/ def eval (c : κ → D → ℝ) (u : ι → D → ℝ) : Expression D ι κ → D → ℝ | .input i => u i | .coeff i => c i | .add a b => fun x => eval c u a x + eval c u b x | .mul a b => fun x => eval c u a x * eval c u b x | .directional v a => fun x => fderiv ℝ (eval c u a) x v end Expression end NavierStokes.GenericDifferentialPolynomial end end /-! ## From `NavierStokes/GenericRealizationBounds.lean` The text of `NavierStokes/GenericRealizationBounds.lean`, folded into this file, which was its only importer. -/ section /-! # Quantitative bounds for general diagonal realizations The base is retained without a cutoff. The positive corrections are actual locally finite cutoff sums. Logarithmic losses are absorbed at each fixed stage, while the resulting power loss is independent of the stage. -/ noncomputable section namespace NavierStokes.GenericRealizationBounds open Set Filter DiagonalResidual open scoped Topology ContDiff BigOperators variable {E V : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup V] [NormedSpace ℝ V] /-- The uncut base plus the actual positive cutoff series. -/ def realized (a : ℕ → ℝ) (q : E → ℝ) (base : E → V) (A : ℕ → E → V) : E → V := fun x => base x + SolenoidalDiagonal.potentialSum a q (CutStageEstimates.positiveStages A) x /-- The corresponding finite approximation, including exactly stages `1,…,J`. -/ def stage (base : E → V) (A : ℕ → E → V) (J : ℕ) : E → V := fun x => base x + DiagonalJetBounds.uncutPrefix (CutStageEstimates.positiveStages A) (J + 1) x end NavierStokes.GenericRealizationBounds end end noncomputable section namespace NavierStokes.GenericDifferentialPolynomial open Set Filter DiagonalResidual open scoped Topology ContDiff BigOperators variable {D : Type*} [NormedAddCommGroup D] [NormedSpace ℝ D] variable {l : Filter D} {q : D → ℝ} {U S : Set D} /-- Tail data suffice for residual transfer; a coefficient independent of the fields cancels exactly and therefore needs no growth bound in this step. -/ structure TailRates (l : Filter D) (q : D → ℝ) (gain : ℕ → ℝ) (f : D → ℝ) (stage : ℕ → D → ℝ) where loss : ℕ → ℝ threshold : ℕ → ℕ rate : ∀ m J, threshold m ≤ J → JetRate l q (fun x => f x - stage J x) m (gain J - loss m) /-- A finite differential polynomial in normal form, allowing coefficients whose growth bounds are local to a different common support for every term. -/ structure SupportedPolynomial (D ι : Type*) where constant : D → ℝ terms : List ((D → ℝ) × Expression D ι Empty) namespace SupportedPolynomial variable {ι : Type*} end SupportedPolynomial end NavierStokes.GenericDifferentialPolynomial