import Euler.PacketPrimaryUncut import Euler.PacketInitialGeometry import Euler.TransverseHistoryLipschitz import Euler.TransverseSourceCoefficientPath import Mathlib.Analysis.Calculus.MeanValue /-! Genuine label sensitivity of the stationary source history. All constants below are computed from the supplied smooth coefficient paths; no continuity or estimate for the solved history is assumed. -/ /-! ## From `Euler/PacketNeighborInitial.lean` The text of `Euler/PacketNeighborInitial.lean`, folded into this file, which was its only importer. -/ section /-! The actual fixed-terminal history estimate controls the scaled neighbor initial velocity. The loss `ε⁻¹` comes from the specified coordinate rescaling and is independent of the oscillation frequency. -/ noncomputable section namespace EulerPacketMovingFrame open Set EulerSmoothLimit EulerPacketNormalizedPrimary EulerPacketRay InnerProductSpace ContinuousLinearMap EulerTimeLp EulerVolterraConvolution EulerTimeH1FrameTransport EulerTransverseEndpointCoordinates EulerTransverseHistoryBounds theorem frame_pair_difference_le {p q x y : Space} {ε D : ℝ} (hp : ‖p‖ = 1) (hq : ‖q‖ = 1) (hε : 0 < ε) (hε1 : ε ≤ 1) (hxy : ‖x-y‖ ≤ D) : |⟪p,x⟫_ℝ/ε-⟪p,y⟫_ℝ/ε|+|⟪q,x⟫_ℝ-⟪q,y⟫_ℝ| ≤ 2*D/ε := by have hp' : |⟪p,x-y⟫_ℝ| ≤ ‖x-y‖ := by simpa only [hp, one_mul] using abs_real_inner_le_norm p (x-y) have hq' : |⟪q,x-y⟫_ℝ| ≤ ‖x-y‖ := by simpa only [hq, one_mul] using abs_real_inner_le_norm q (x-y) have hU : |⟪p,x⟫_ℝ/ε-⟪p,y⟫_ℝ/ε| ≤ ‖x-y‖/ε := by rw [← sub_div, ← inner_sub_right, abs_div, abs_of_pos hε] exact div_le_div_of_nonneg_right hp' hε.le have hV : |⟪q,x⟫_ℝ-⟪q,y⟫_ℝ| ≤ ‖x-y‖/ε := by rw [← inner_sub_right] apply hq'.trans apply (le_div_iff₀ hε).mpr exact mul_le_of_le_one_right (norm_nonneg _) hε1 have hD := div_le_div_of_nonneg_right hxy hε.le calc _ ≤ D/ε+D/ε := add_le_add (hU.trans hD) (hV.trans hD) _ = 2*D/ε := by ring theorem scaledVelocity_initial_difference_le {m v x y : ℝ → Space} {t₀ a ε D : ℝ} (hm0 : m t₀ ≠ 0) (hv0 : v t₀ ≠ 0) (hε : 0 < ε) (hε1 : ε ≤ 1) (hxy : ‖x t₀-y t₀‖ ≤ D) : |scaledVelocity m v x t₀ a ε 0 0-scaledVelocity m v y t₀ a ε 0 0|+ |scaledVelocity m v x t₀ a ε 0 1-scaledVelocity m v y t₀ a ε 0 1| ≤ 2*D/ε := by simpa [scaledVelocity, movingVelocity, physicalTime, normalizedFrame, frame, velocityScale, Fin.ext_iff] using frame_pair_difference_le (unit_norm hm0) (unit_norm hv0) hε hε1 hxy theorem scaled_inner_difference_le {p x y : Space} {b D : ℝ} (hp : ‖p‖ = 1) (hb : 0 < b) (hxy : ‖x-y‖ ≤ D) : |⟪p,x⟫_ℝ/b-⟪p,y⟫_ℝ/b| ≤ D/b := by rw [← sub_div, ← inner_sub_right, abs_div, abs_of_pos hb] apply div_le_div_of_nonneg_right _ hb.le exact ((abs_real_inner_le_norm p (x-y)).trans_eq (by rw [hp, one_mul])).trans hxy theorem scaledRay_initial_difference_le {m v x y : ℝ → Space} {s₀ t₀ a ε D : ℝ} (hs₀ : 0 < s₀) (hm0 : m t₀ ≠ 0) (hv0 : v t₀ ≠ 0) (hmv : ⟪m t₀,v t₀⟫_ℝ = 0) (hε : 0 < ε) (hε1 : ε ≤ 1) (hxy : ‖x t₀-y t₀‖ ≤ D) : norm3 (scaledRay m v x s₀ t₀ a ε 0 0-scaledRay m v y s₀ t₀ a ε 0 0) (scaledRay m v x s₀ t₀ a ε 0 1-scaledRay m v y s₀ t₀ a ε 0 1) (scaledRay m v x s₀ t₀ a ε 0 2-scaledRay m v y s₀ t₀ a ε 0 2) ≤ 3*D/(s₀*ε) := by have hn := (frame_orthonormal (unit (m t₀)) (unit (v t₀)) (unit_inner_self hm0) (unit_inner_self hv0) (unit_inner_zero hmv)).norm_eq_one 2 have hpn := scaled_inner_difference_le (unit_norm hm0) hs₀ hxy have hqn := scaled_inner_difference_le (unit_norm hv0) (mul_pos hs₀ hε) hxy have hnn := scaled_inner_difference_le hn hs₀ hxy have hD0 : 0 ≤ D := (norm_nonneg _).trans hxy have hden : D/s₀ ≤ D/(s₀*ε) := div_le_div_of_nonneg_left hD0 (mul_pos hs₀ hε) (mul_le_of_le_one_right hs₀.le hε1) have hall := add_le_add (add_le_add (hpn.trans hden) hqn) (hnn.trans hden) have hthree : D/(s₀*ε)+D/(s₀*ε)+D/(s₀*ε) = 3*D/(s₀*ε) := by ring rw [hthree] at hall simpa [norm3, scaledRay, movingRay, physicalTime, normalizedFrame, frame, rayScale, Fin.ext_iff] using hall /-- A physical initial-ray error around the chosen normal becomes the source's scaled ray error with the fixed factor `(s₀ ε)⁻¹`. -/ theorem scaledRay_initial_error {m v r : ℝ → Space} {s₀ t₀ a ε D : ℝ} (hs₀ : 0 < s₀) (hm0 : m t₀ ≠ 0) (hv0 : v t₀ ≠ 0) (hmv : ⟪m t₀,v t₀⟫_ℝ = 0) (hε : 0 < ε) (hε1 : ε ≤ 1) (hr : ‖r t₀-s₀ • EulerPacketCrossProduct.cross (unit (m t₀)) (unit (v t₀))‖ ≤ D) : norm3 (scaledRay m v r s₀ t₀ a ε 0 0) (scaledRay m v r s₀ t₀ a ε 0 1) (scaledRay m v r s₀ t₀ a ε 0 2-1) ≤ 3*D/(s₀*ε) := by let r₀ : ℝ → Space := fun _ => s₀ • EulerPacketCrossProduct.cross (unit (m t₀)) (unit (v t₀)) have hi : scaledRay m v r₀ s₀ t₀ a ε 0 = ![0,0,1] := scaledRay_initial (ne_of_gt hs₀) hm0 hv0 hmv rfl have h := scaledRay_initial_difference_le (a := a) hs₀ hm0 hv0 hmv hε hε1 (y := r₀) hr simpa [hi] using h variable {U : Type*} [NormedAddCommGroup U] [InnerProductSpace ℝ U] [CompleteSpace U] variable (T : ℝ) (hT : 0 ≤ T) (Q Q₁ : C(Icc (0 : ℝ) T, U →L[ℝ] Space)) (H : C(Icc (0 : ℝ) T, Space →L[ℝ] Space)) (c : ℝ) (hc : 0 < c) (hQ : ∀ t ξ, c*‖ξ‖^2 ≤ ‖Q t ξ‖^2) (hd : ∀ t : Icc (0:ℝ) T, HasDerivWithinAt (extendPath T hT Q) (Q₁ t) (Icc (0:ℝ) T) t) (K : ℝ) (hK : 0 ≤ K) (hH : ∀ t z, ⟪H t z,z⟫_ℝ ≤ K*‖z‖^2) (hsmall : K*(T^2/2) ≤ 1/2) (P P₁ : C(Icc (0:ℝ) T, U →L[ℝ] Space)) (G : C(Icc (0:ℝ) T, Space →L[ℝ] Space)) (hP : ∀ t ξ, c*‖ξ‖^2 ≤ ‖P t ξ‖^2) (hp : ∀ t : Icc (0:ℝ) T, HasDerivWithinAt (extendPath T hT P) (P₁ t) (Icc (0:ℝ) T) t) (hG : ∀ t z, ⟪G t z,z⟫_ℝ ≤ K*‖z‖^2) end EulerPacketMovingFrame end end /-! ## From `Euler/PacketCoefficientLipschitz.lean` The text of `Euler/PacketCoefficientLipschitz.lean`, folded into this file, which was its only importer. -/ section /-! Uniform label difference estimates from genuine coefficient derivatives. -/ noncomputable section namespace EulerPacketActivationHistory open Set InnerProductSpace ContinuousLinearMap EulerSmoothLimit EulerMeanCoefficients EulerTransverseSourceCoefficientPath open scoped BoundedContinuousFunction section Coefficients variable {T : ℝ} {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] private local instance : NormedAddCommGroup (Space →ᵇ V) := inferInstance private local instance : NormedSpace ℝ (Space →ᵇ V) := inferInstance private local instance : NormedAddCommGroup C(Icc (0 : ℝ) T,Space →ᵇ V) := inferInstance private local instance : NormedSpace ℝ C(Icc (0 : ℝ) T,Space →ᵇ V) := inferInstance private local instance : NormedAddCommGroup (Space →L[ℝ] V) := inferInstance private local instance : NormedSpace ℝ (Space →L[ℝ] V) := inferInstance private local instance : NormedAddCommGroup (Space →ᵇ (Space →L[ℝ] V)) := inferInstance private local instance : NormedSpace ℝ (Space →ᵇ (Space →L[ℝ] V)) := inferInstance private local instance : NormedAddCommGroup C(Icc (0 : ℝ) T,Space →ᵇ (Space →L[ℝ] V)) := inferInstance private local instance : NormedSpace ℝ C(Icc (0 : ℝ) T,Space →ᵇ (Space →L[ℝ] V)) := inferInstance theorem coefficient_label_norm (A : SmoothCoefficientPath (Icc (0 : ℝ) T) V) (x : Space) : ‖pathEvaluation x A.field‖ ≤ ‖A.field‖ := by apply (ContinuousMap.norm_le _ (norm_nonneg _)).mpr intro t exact ((A.field t).norm_coe_le_norm x).trans (A.field.norm_coe_le_norm t) theorem coefficient_difference (A : SmoothCoefficientPath (Icc (0 : ℝ) T) V) (t : Icc (0 : ℝ) T) (x y : Space) : ‖A.field t x-A.field t y‖ ≤ ‖A.derivative.field‖*‖x-y‖ := by apply Convex.norm_image_sub_le_of_norm_fderiv_le (𝕜 := ℝ) (s := Set.univ) (fun z _ => (A.smooth t).differentiable (by simp) z) (fun z _ => ?_) (convex_univ : Convex ℝ (Set.univ : Set Space)) (mem_univ y) (mem_univ x) rw [← A.derivativeField_eq] exact ((A.derivative.field t).norm_coe_le_norm z).trans (A.derivative.field.norm_coe_le_norm t) theorem coefficient_label_difference (A : SmoothCoefficientPath (Icc (0 : ℝ) T) V) (x y : Space) : ‖pathEvaluation x A.field-pathEvaluation y A.field‖ ≤ ‖A.derivative.field‖*‖x-y‖ := by apply (ContinuousMap.norm_le _ (mul_nonneg (norm_nonneg _) (norm_nonneg _))).mpr intro t exact coefficient_difference A t x y end Coefficients end EulerPacketActivationHistory end end noncomputable section namespace EulerPacketActivationHistory open Set InnerProductSpace ContinuousLinearMap EulerSmoothLimit EulerMeanCoefficients EulerTransversePacketProvider EulerTransverseSourceCoefficientPath EulerTransverseHistoryBounds EulerTimeH1FrameTransport EulerTransverseEndpointCoordinates open scoped BoundedContinuousFunction private theorem transport_polynomial_mono {ci T q Q p P : ℝ} (hci : 0 ≤ ci) (hT : 0 ≤ T) (hq0 : 0 ≤ q) (hp0 : 0 ≤ p) (hq : q ≤ Q) (hp : p ≤ P) : 1+((2*ci^2*q^2*p+ci*p)*T+ci*q) ≤ 1+((2*ci^2*Q^2*P+ci*P)*T+ci*Q) := by gcongr variable {U : Type*} [NormedAddCommGroup U] [InnerProductSpace ℝ U] [CompleteSpace U] {D : Data U} (B : HistoryData D) private local instance : NormedAddCommGroup (U →L[ℝ] Space) := inferInstance private local instance : NormedSpace ℝ (U →L[ℝ] Space) := inferInstance private local instance : NormedAddCommGroup (Space →ᵇ (U →L[ℝ] Space)) := inferInstance private local instance : NormedSpace ℝ (Space →ᵇ (U →L[ℝ] Space)) := inferInstance private local instance : NormedAddCommGroup C(Icc (0 : ℝ) D.T,Space →ᵇ (U →L[ℝ] Space)) := inferInstance private local instance : NormedSpace ℝ C(Icc (0 : ℝ) D.T,Space →ᵇ (U →L[ℝ] Space)) := inferInstance private local instance : NormedAddCommGroup (Space →L[ℝ] (U →L[ℝ] Space)) := inferInstance private local instance : NormedSpace ℝ (Space →L[ℝ] (U →L[ℝ] Space)) := inferInstance private local instance : NormedAddCommGroup (Space →ᵇ (Space →L[ℝ] (U →L[ℝ] Space))) := inferInstance private local instance : NormedSpace ℝ (Space →ᵇ (Space →L[ℝ] (U →L[ℝ] Space))) := inferInstance private local instance : NormedAddCommGroup C(Icc (0 : ℝ) D.T,Space →ᵇ (Space →L[ℝ] (U →L[ℝ] Space))) := inferInstance private local instance : NormedSpace ℝ C(Icc (0 : ℝ) D.T,Space →ᵇ (Space →L[ℝ] (U →L[ℝ] Space))) := inferInstance private local instance : NormedAddCommGroup (Space →L[ℝ] Space) := inferInstance private local instance : NormedSpace ℝ (Space →L[ℝ] Space) := inferInstance private local instance : NormedAddCommGroup (Space →ᵇ (Space →L[ℝ] Space)) := inferInstance private local instance : NormedSpace ℝ (Space →ᵇ (Space →L[ℝ] Space)) := inferInstance private local instance : NormedAddCommGroup C(Icc (0 : ℝ) D.T,Space →ᵇ (Space →L[ℝ] Space)) := inferInstance private local instance : NormedSpace ℝ C(Icc (0 : ℝ) D.T,Space →ᵇ (Space →L[ℝ] Space)) := inferInstance def historyTransportCost : ℝ := 1+((2*(D.frameLower⁻¹)^2*‖D.frame.field‖^2*‖D.frameDerivative.field‖+ D.frameLower⁻¹*‖D.frameDerivative.field‖)*D.T+D.frameLower⁻¹*‖D.frame.field‖) def historyLabelSizeCost : ℝ := historyCost D.T D.frameLower ‖D.frame.field‖ ‖D.frameDerivative.field‖ (D.T*‖D.frameDerivative.field‖+‖D.frame.field‖) (1+D.T^2*‖B.H.field‖) (historyTransportCost (D := D)) def historyLabelDifferenceCost : ℝ := historyDifferenceCost D.T D.frameLower ‖D.frame.field‖ ‖D.frameDerivative.field‖ (D.T*‖D.frameDerivative.field‖+‖D.frame.field‖) (1+D.T^2*‖B.H.field‖) (historyTransportCost (D := D)) ‖D.frame.derivative.field‖ ‖D.frameDerivative.derivative.field‖ ‖B.H.derivative.field‖ omit [CompleteSpace U] in theorem historyTransportCost_nonneg : 0 ≤ historyTransportCost (D := D) := by have := D.T_pos have := D.frameLower_pos unfold historyTransportCost positivity omit [CompleteSpace U] in theorem label_transportCost_le (x : Space) : transportCost D.T (B.coefficients.labelFrame x) (B.coefficients.labelFrameDerivative x) D.frameLower ≤ historyTransportCost (D := D) := by have hq := coefficient_label_norm D.frame x have hq₁ := coefficient_label_norm D.frameDerivative x unfold transportCost historyTransportCost change 1+((2*(D.frameLower⁻¹)^2*‖pathEvaluation x D.frame.field‖^2* ‖pathEvaluation x D.frameDerivative.field‖+ D.frameLower⁻¹*‖pathEvaluation x D.frameDerivative.field‖)*D.T+ D.frameLower⁻¹*‖pathEvaluation x D.frame.field‖) ≤ _ exact transport_polynomial_mono (inv_nonneg.mpr D.frameLower_pos.le) D.T_pos.le (norm_nonneg _) (norm_nonneg _) hq hq₁ omit [CompleteSpace U] in theorem label_derivative_size (x : Space) : D.T*‖B.coefficients.labelFrameDerivative x‖+‖B.coefficients.labelFrame x‖ ≤ D.T*‖D.frameDerivative.field‖+‖D.frame.field‖ := add_le_add (mul_le_mul_of_nonneg_left (coefficient_label_norm D.frameDerivative x) D.T_pos.le) (coefficient_label_norm D.frame x) omit [CompleteSpace U] in theorem label_energy_size (x : Space) : 1+D.T^2*‖B.coefficients.labelHessian x‖ ≤ 1+D.T^2*‖B.H.field‖ := add_le_add le_rfl (mul_le_mul_of_nonneg_left (coefficient_label_norm B.H x) (sq_nonneg D.T)) omit [CompleteSpace U] in theorem historyLabelDifferenceCost_nonneg : 0 ≤ historyLabelDifferenceCost B := by apply historyDifferenceCost_nonneg · exact D.T_pos.le · exact D.frameLower_pos.le · positivity · positivity · positivity [D.T_pos] · positivity · exact historyTransportCost_nonneg (D := D) · positivity · positivity · positivity theorem labelVelocity_norm (x : Space) : ‖B.coefficients.labelVelocity x‖ ≤ historyLabelSizeCost B := by exact historyVelocity_norm_le D.T D.T_pos.le (B.coefficients.labelFrame x) (B.coefficients.labelFrameDerivative x) (B.coefficients.labelHessian x) D.frameLower D.frameLower_pos (B.coefficients.labelFrame_lower x) (B.coefficients.labelFrame_derivative x) B.potential B.potential_nonneg (B.coefficients.labelHessian_upper x) B.small D.T_pos ‖D.frame.field‖ ‖D.frameDerivative.field‖ (D.T*‖D.frameDerivative.field‖+‖D.frame.field‖) (1+D.T^2*‖B.H.field‖) (historyTransportCost (D := D)) (coefficient_label_norm D.frame x) (coefficient_label_norm D.frameDerivative x) (label_derivative_size B x) (label_energy_size B x) (label_transportCost_le B x) theorem labelVelocity_difference (x y : Space) : ‖B.coefficients.labelVelocity x-B.coefficients.labelVelocity y‖ ≤ historyLabelDifferenceCost B*‖x-y‖ := by exact historyVelocity_sub_norm_le_of_coefficient_bounds D.T D.T_pos.le (B.coefficients.labelFrame x) (B.coefficients.labelFrameDerivative x) (B.coefficients.labelHessian x) D.frameLower D.frameLower_pos (B.coefficients.labelFrame_lower x) (B.coefficients.labelFrame_derivative x) B.potential B.potential_nonneg (B.coefficients.labelHessian_upper x) B.small (B.coefficients.labelFrame y) (B.coefficients.labelFrameDerivative y) (B.coefficients.labelHessian y) (B.coefficients.labelFrame_lower y) (B.coefficients.labelFrame_derivative y) (B.coefficients.labelHessian_upper y) D.T_pos ‖D.frame.field‖ ‖D.frameDerivative.field‖ (D.T*‖D.frameDerivative.field‖+‖D.frame.field‖) (1+D.T^2*‖B.H.field‖) (historyTransportCost (D := D)) (coefficient_label_norm D.frame x) (coefficient_label_norm D.frame y) (coefficient_label_norm D.frameDerivative x) (coefficient_label_norm D.frameDerivative y) (label_derivative_size B x) (label_derivative_size B y) (label_energy_size B x) (label_energy_size B y) (label_transportCost_le B x) (label_transportCost_le B y) ‖D.frame.derivative.field‖ ‖D.frameDerivative.derivative.field‖ ‖B.H.derivative.field‖ ‖x-y‖ (coefficient_label_difference D.frame x y) (coefficient_label_difference D.frameDerivative x y) (coefficient_label_difference B.H x y) theorem labelVelocity_point_difference (x y : Space) (ξ : U) (t : Icc (0 : ℝ) D.T) : ‖B.coefficients.labelVelocity x ξ t-B.coefficients.labelVelocity y ξ t‖ ≤ historyLabelDifferenceCost B*‖x-y‖*‖ξ‖ := by exact (((B.coefficients.labelVelocity x-B.coefficients.labelVelocity y) ξ).norm_coe_le_norm t).trans (((B.coefficients.labelVelocity x-B.coefficients.labelVelocity y).le_opNorm ξ).trans (mul_le_mul_of_nonneg_right (labelVelocity_difference B x y) (norm_nonneg ξ))) end EulerPacketActivationHistory