import Euler.AllOrderDriftFinite import Euler.CorrectionAssemblyRealizations import Euler.CorrectionAssemblyTime import Euler.CorrectionAssemblyParity /-! # One all-order correction from the actual small-drift construction The finite solutions used here are `Budget.solution` from `AllOrderDriftFinite`. Their existence is proved by the drift-aware finite-Sobolev solver. The generic assembly proves compatibility from their literal equations and uniqueness; it does not require the coarse full-velocity shrinking-radius assumption. The resulting single field retains the residual and target-error estimates at every external cutoff and satisfies the actual equation in every finite Sobolev order. Smoothness asserted here is spatial smoothness, with a jointly continuous representative and its genuine first time derivative. -/ noncomputable section namespace EulerAllOrderDriftCorrection open MeasureTheory Set EulerLiftedGradientSpace EulerCylinderSobolevSpace EulerCylinderSobolev EulerSpatialSobolevInverse EulerCorrectionOperators EulerAllOrderCorrectionData EulerCorrectionAssembly EulerGevreyMetricEstimate EulerVolterraConvolution EulerInviscidSobolevEvolution EulerMetricTransport EulerTransportDerivatives EulerSobolevPointEvaluation EulerCylinderReflection EulerSobolevReflection EulerSobolevCoefficientPressure open scoped ContDiff variable (period : ℝ) [Fact (0 < period)] variable {T : ℝ} {hT : 0 < T} {A : Data period T} /-- The common continuous L² correction constructed by the small-drift solver. -/ def Budget.commonPath (B : Budget period hT A) : C(Icc (0 : ℝ) T, LiftL2 period) := (B.family period).commonPath period /-- Every actual drift-aware finite solution represents this same common field. -/ theorem Budget.solution_value_common (B : Budget period hT A) (q : ℕ) (hq : 6 ≤ q) (t : Icc (0 : ℝ) T) : value period (B.solution period q hq t) = B.commonPath period t := (B.family period).value_common period (B.comparisonData period) q hq t /-- The common correction has zero initial trace. -/ theorem Budget.commonPath_initial (B : Budget period hT A) : B.commonPath period ⟨0, le_rfl, hT.le⟩ = 0 := (B.family period).commonPath_initial period /-- The common correction satisfies the genuine closed lifted divergence constraint. -/ theorem Budget.commonPath_divergence (B : Budget period hT A) (t : Icc (0 : ℝ) T) : B.commonPath period t ∈ divergenceFreeSpace period A.κ A.direction := (B.family period).commonPath_divergence period t /-- The common correction, with genuine continuous Sobolev realizations at all orders. -/ def Budget.fieldTower (B : Budget period hT A) : FieldTower period T := (B.family period).fieldTower period (B.comparisonData period) /-- Every Sobolev realization of the common correction has zero initial data. -/ theorem Budget.fieldTower_initial (B : Budget period hT A) (q : ℕ) : (B.fieldTower period).realization q ⟨0, le_rfl, hT.le⟩ = 0 := by apply value_injective period calc value period ((B.fieldTower period).realization q ⟨0, le_rfl, hT.le⟩) = (B.fieldTower period).field ⟨0, le_rfl, hT.le⟩ := (B.fieldTower period).value_eq q ⟨0, le_rfl, hT.le⟩ _ = 0 := B.commonPath_initial period _ = value period (0 : SobolevSpace period q) := rfl /-- A finite drift-aware solution equals the common tower's realization at its order. -/ theorem Budget.solution_eq_realization (B : Budget period hT A) (q : ℕ) (hq : 6 ≤ q) : B.solution period q hq = (B.fieldTower period).realization (q+1) := (B.family period).solution_eq_realization period (B.comparisonData period) q hq /-- Both quantitative finite-solver bounds hold for the actual common realization. The radius and residual envelope are the drift-aware input budgets. -/ theorem Budget.fieldTower_energy (B : Budget period hT A) (P : ℕ) (t : Icc (0 : ℝ) T) : energyNorm period P (by omega : P+6 ≤ (P+6)+1) (B.radius t) (B.metric.operatorPath period t) ((B.fieldTower period).realization ((P+6)+1) t) ≤ 2*(B.spatial (P+6) (by omega)).full.residual* Real.exp (3*B.growthCoefficient*t.val) ∧ energyNorm period P (by omega : P+6 ≤ (P+6)+1) (B.radius t) (B.metric.operatorPath period t) ((B.fieldTower period).realization ((P+6)+1) t) ≤ B.delta/2 := by rw [← B.solution_eq_realization period (P+6) (by omega)] exact B.solution_energy period (P+6) (by omega) P (by omega) (by omega) t /-- The constructed finite solution has its genuine time derivative in Hq. -/ theorem Budget.solution_sobolev_hasDerivAt (B : Budget period hT A) (q : ℕ) (hq : 6 ≤ q) (t : ℝ) (ht : t ∈ Ioo 0 T) : HasDerivAt (fun r => truncateOperator period q (extendPath T hT.le (B.solution period q hq) r)) (((A.atOrder period q).coefficients period hq).apply ⟨t, ht.1.le, ht.2.le⟩ (B.solution period q hq ⟨t, ht.1.le, ht.2.le⟩)) t := sobolev_hasDerivAt period T hT.le ((A.atOrder period q).coefficients period hq) (B.solution period q hq) ((B.family period).equation q hq) t ht /-- Every finite Sobolev realization of the common correction satisfies the actual projected nonlinear evolution, not merely an equation for an unrelated finite solve. -/ theorem Budget.fieldTower_hasDerivAt (B : Budget period hT A) (q : ℕ) (hq : 6 ≤ q) (t : ℝ) (ht : t ∈ Ioo 0 T) : HasDerivAt (extendPath T hT.le ((B.fieldTower period).realization q)) (((A.atOrder period q).coefficients period hq).apply ⟨t, ht.1.le, ht.2.le⟩ ((B.fieldTower period).realization (q+1) ⟨t, ht.1.le, ht.2.le⟩)) t := by have hs := B.solution_sobolev_hasDerivAt period q hq t ht rw [B.solution_eq_realization period q hq] at hs have hpath := (B.fieldTower period).truncate period q have heq : (fun r => truncateOperator period q (extendPath T hT.le ((B.fieldTower period).realization (q+1)) r)) = extendPath T hT.le ((B.fieldTower period).realization q) := by funext r exact congrArg (fun f => f (projIcc 0 T hT.le r)) hpath rw [heq] at hs exact hs /-- The common realization's actual derivative is the literal raw source plus signed pressure. -/ theorem Budget.fieldTower_hasDerivAt_pressure (B : Budget period hT A) (q : ℕ) (hq : 6 ≤ q) (t : ℝ) (ht : t ∈ Ioo 0 T) : HasDerivAt (extendPath T hT.le ((B.fieldTower period).realization q)) (-(A.atOrder period q).rawSource period hq ⟨t, ht.1.le, ht.2.le⟩ ((B.fieldTower period).realization (q+1) ⟨t, ht.1.le, ht.2.le⟩) - coefficientSobolevOperator period (A.metric.jet q ⟨t, ht.1.le, ht.2.le⟩) ((A.atOrder period q).pressure period hq ⟨t, ht.1.le, ht.2.le⟩ ((B.fieldTower period).realization (q+1) ⟨t, ht.1.le, ht.2.le⟩))) t := by simpa only [CorrectionData.source_sobolev, Data.atOrder] using B.fieldTower_hasDerivAt period q hq t ht /-- Canonical bounded evaluation fixes a pointwise representative of the correction. -/ def Budget.pointField (B : Budget period hT A) (t : Icc (0 : ℝ) T) (x : LiftDomain period) : Vector3 := (B.family period).pointField period t x /-- The pointwise correction is an actual representative of the constructed L² field. -/ theorem Budget.pointField_ae (B : Budget period hT A) (t : Icc (0 : ℝ) T) : (B.commonPath period t : LiftDomain period → Vector3) =ᵐ[liftMeasure period] B.pointField period t := (B.family period).pointField_ae period t /-- The canonical correction vanishes pointwise at the initial time. -/ theorem Budget.pointField_initial (B : Budget period hT A) (x : LiftDomain period) : B.pointField period ⟨0, le_rfl, hT.le⟩ x = 0 := by change pointEvaluation period x (restrictOperator period (by omega : 3 ≤ 7) ((B.family period).solution 6 le_rfl ⟨0, le_rfl, hT.le⟩)) = 0 simp only [(B.family period).initial, map_zero] /-- The canonical correction is jointly continuous in time and the cylinder point. -/ theorem Budget.pointField_joint_continuous (B : Budget period hT A) : Continuous (B.pointField period).uncurry := (B.family period).pointField_joint_continuous period /-- The one common correction has a spatially smooth representative at every time. -/ theorem Budget.pointField_smooth (B : Budget period hT A) (t : Icc (0 : ℝ) T) (x : LiftDomain period) : ContDiff ℝ ∞ (localFieldLift period (B.pointField period t) x) := (B.family period).pointField_smooth period (B.comparisonData period) t x /-- Odd input data give an odd common correction by the proved PDE uniqueness. -/ theorem Budget.commonPath_odd (B : Budget period hT A) (P : ParityData period A) (t : Icc (0 : ℝ) T) : -reflection period (B.commonPath period t) = B.commonPath period t := (B.family period).commonPath_odd period (B.comparisonData period) P t end EulerAllOrderDriftCorrection