import NavierStokes.ClosedIntervalJetAlgebra import NavierStokes.NaturalAxisData import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic /-! # Parameter-jet comparison for the actual five cumulative seed histories The comparison is on the closed parameter interval, using one-sided derivatives at its endpoints. Profiles need not be regular at the axis. The constants are uniform over all profiles with the stated positivity and finite jet bounds. -/ noncomputable section namespace NavierStokes.SeedHandbackJets open Set ClosedIntervalJetAlgebra open scoped ContDiff abbrev Packet := Fin 12 → ℝ → ℝ abbrev Basis := Fin 19 → ℝ → ℝ def basis (h X : ℝ) (p : Packet) : Basis := ![p 0, p 1, p 2, p 3, p 4, p 5, p 6, p 7, p 8, p 9, p 10, p 11, (fun η => η), (fun _ => X), (fun _ => X⁻¹), (fun _ => (Real.sqrt (2*X))⁻¹), (fun η => (p 0 η)⁻¹), (fun η => (NaturalAxisData.L h η)⁻¹), NaturalAxisData.d] abbrev Expr := PolynomialExpression (Fin 19) private def v (i : Fin 19) : Expr := .input i private def c (x : ℝ) : Expr := .constant x private def inputBounds (k : ℕ) (D X₀ X₁ T L : ℝ) : Fin 19 → ℝ := ![D,D,D,D,D,D,D,D,D,D,D,D,1,X₁,X₀⁻¹,(Real.sqrt (2*X₀))⁻¹,T,L,1+(2:ℝ)^k] private def differenceBounds (CI : ℝ) : Fin 19 → ℝ := ![1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,CI,0,0] private theorem L_lower {h : ℝ} (hh : 0 ≤ h) {η : ℝ} (hη : η ∈ J) : 1-2*h ≤ NaturalAxisData.L h η := by have hs : η^2 ≤ 1 := by nlinarith [hη.1, hη.2] dsimp [NaturalAxisData.L] nlinarith private theorem fixed_L_bound (k : ℕ) (h : ℝ) : Bound k (NaturalAxisData.L h) (1+(2:ℝ)^k*(|2*h| *((2:ℝ)^k))) := by have he := (Bound.id k).mul contDiffOn_id contDiffOn_id (Bound.id k) have hc := (Bound.const k (2*h)).mul contDiffOn_const (contDiffOn_id.mul contDiffOn_id) he have hb := (Bound.const k 1).sub contDiffOn_const (contDiffOn_const.mul (contDiffOn_id.mul contDiffOn_id)) hc convert hb using 1 · ext η; simp only [NaturalAxisData.L, id_eq]; ring · simp only [abs_one, mul_one]; ring private theorem fixed_d_bound (k : ℕ) : Bound k NaturalAxisData.d (1+(2:ℝ)^k) := by have he := (Bound.id k).mul contDiffOn_id contDiffOn_id (Bound.id k) have hb := (Bound.const k 1).sub contDiffOn_const (contDiffOn_id.mul contDiffOn_id) he convert hb using 1 · ext η; simp only [NaturalAxisData.d, id_eq]; ring · simp private theorem basis_pairBound {k : ℕ} {h X₀ X₁ X μ D T L ε : ℝ} (hh : 0 ≤ h) (hh' : h < 1/2) (hX₀ : 0 < X₀) (hX : X ∈ Icc X₀ X₁) (hμ : 0 < μ) {p q : Packet} (hpq : ∀ i, PairBound k (p i) (q i) D 1 ε) (hp : ∀ η ∈ J, μ ≤ p 0 η) (hq : ∀ η ∈ J, μ ≤ q 0 η) (hT : ∀ z : ℝ → ℝ, ContDiffOn ℝ ∞ z J → (∀ η ∈ J, μ ≤ z η) → Bound k z D → Bound k (fun η => (z η)⁻¹) T) (hL : Bound k (fun η => (NaturalAxisData.L h η)⁻¹) L) : ∀ i, PairBound k (basis h X p i) (basis h X q i) (inputBounds k D X₀ X₁ T L i) (differenceBounds ((2:ℝ)^k*((2:ℝ)^k*1*T)*T) i) ε := by have hXp : 0 < X := hX₀.trans_le hX.1 have hX₁ : 0 < X₁ := hXp.trans_le hX.2 have hXs : Bound k (fun _ : ℝ => X) X₁ := (Bound.const k X).mono (by simpa only [abs_of_pos hXp] using hX.2) have hXi : Bound k (fun _ : ℝ => X⁻¹) X₀⁻¹ := (Bound.const k X⁻¹).mono (by rw [abs_of_pos (inv_pos.mpr hXp)]; exact inv_anti₀ hX₀ hX.1) have hroot0 : 0 < Real.sqrt (2*X₀) := Real.sqrt_pos.mpr (by positivity) have hroot : 0 < Real.sqrt (2*X) := Real.sqrt_pos.mpr (by positivity) have hXsroot : Bound k (fun _ : ℝ => (Real.sqrt (2*X))⁻¹) (Real.sqrt (2*X₀))⁻¹ := (Bound.const k (Real.sqrt (2*X))⁻¹).mono (by rw [abs_of_pos (inv_pos.mpr hroot)] exact inv_anti₀ hroot0 (Real.sqrt_le_sqrt (by linarith [hX.1]))) have hLs : ContDiffOn ℝ ∞ (NaturalAxisData.L h) J := by unfold NaturalAxisData.L fun_prop have hds : ContDiffOn ℝ ∞ NaturalAxisData.d J := by unfold NaturalAxisData.d fun_prop have hLp : ∀ η ∈ J, NaturalAxisData.L h η ≠ 0 := fun η hη => (lt_of_lt_of_le (by linarith : 0 < 1-2*h) (L_lower hh hη)).ne' intro i fin_cases i · exact hpq 0 · exact hpq 1 · exact hpq 2 · exact hpq 3 · exact hpq 4 · exact hpq 5 · exact hpq 6 · exact hpq 7 · exact hpq 8 · exact hpq 9 · exact hpq 10 · exact hpq 11 · exact PairBound.same contDiffOn_id (Bound.id k) ε · exact PairBound.same contDiffOn_const hXs ε · exact PairBound.same contDiffOn_const hXi ε · exact PairBound.same contDiffOn_const hXsroot ε · exact (hpq 0).inverse hμ hp hq hT · exact PairBound.same (hLs.inv hLp) hL ε · exact PairBound.same hds (fixed_d_bound k) ε /-- An arbitrary positive-radius comparison profile; no regular-axis representation is required. -/ structure Profile where E : (ℝ × ℝ) → ℝ U : (ℝ × ℝ) → ℝ namespace Profile end Profile /-- Values of all component parameter derivatives through order `k`, including zero. -/ def jetValues {m : ℕ} (k : ℕ) (X₀ X₁ : ℝ) (f : Fin m → ℝ → ℝ → ℝ) : Set ℝ := {z | z = 0 ∨ ∃ i X, X ∈ Icc X₀ X₁ ∧ ∃ n, n ≤ k ∧ ∃ η, η ∈ J ∧ z = ‖iteratedFDerivWithin ℝ n (f i X) J η‖} private theorem jetValues_nonempty {m k : ℕ} {X₀ X₁ : ℝ} {f : Fin m → ℝ → ℝ → ℝ} : (jetValues k X₀ X₁ f).Nonempty := ⟨0, Or.inl rfl⟩ private theorem jetValues_bddAbove {m k : ℕ} {X₀ X₁ B : ℝ} {f : Fin m → ℝ → ℝ → ℝ} (hB : 0 ≤ B) (hb : ∀ i X, X ∈ Icc X₀ X₁ → Bound k (f i X) B) : BddAbove (jetValues k X₀ X₁ f) := by refine ⟨B, ?_⟩ intro z hz rcases hz with rfl | ⟨i,X,hX,n,hn,η,hη,rfl⟩ · exact hB · exact hb i X hX n hn η hη end NavierStokes.SeedHandbackJets