import Euler.EulerProof import Euler.FiniteGradeSupport /-! The linear and bilinear packet operators on actual space-time value/derivative jets. -/ /-! ## From `Euler/PacketResidualGrades.lean` The text of `Euler/PacketResidualGrades.lean`, folded into this file, which was its only importer. -/ section /-! Exact grade expansion of a finite packet's momentum residual. The operators may be instantiated by the actual value/derivative jets at each space-time point; this file proves the finite algebra and does not assume an Euler solve. -/ noncomputable section namespace EulerPacketResidual open Finset EulerFiniteGrades variable {V Q W : Type*} [AddCommGroup V] [Module ℝ V] [AddCommGroup Q] [Module ℝ Q] [AddCommGroup W] [Module ℝ W] def residual (M : ℕ) (κ : ℝ) (L : V →ₗ[ℝ] W) (G H : Q →ₗ[ℝ] W) (B C : V →ₗ[ℝ] V →ₗ[ℝ] W) (u : ℕ → V) (p : ℕ → Q) : W := L (evaluate M κ u) + G (evaluate M κ p) + κ⁻¹ • H (evaluate M κ p) + B (evaluate M κ u) (evaluate M κ u) + κ⁻¹ • C (evaluate M κ u) (evaluate M κ u) def coefficient (M : ℕ) (L : V →ₗ[ℝ] W) (G H : Q →ₗ[ℝ] W) (B C : V →ₗ[ℝ] V →ₗ[ℝ] W) (u : ℕ → V) (p : ℕ → Q) (n : ℕ) : W := truncate M (fun j => L (u j)) n + truncate M (fun j => G (p j)) n + shiftDown M (fun j => H (p j)) n + convolution M B u u n + shiftDown (2*M) (convolution M C u u) n /-- The fast terms lose one grade, with their potentially negative grade proved absent. -/ theorem residual_eq_evaluate (M : ℕ) (κ : ℝ) (hκ : κ ≠ 0) (L : V →ₗ[ℝ] W) (G H : Q →ₗ[ℝ] W) (B C : V →ₗ[ℝ] V →ₗ[ℝ] W) (u : ℕ → V) (p : ℕ → Q) (hu : u 0=0) (hp : H (p 0)=0) : residual M κ L G H B C u p = evaluate (2*M) κ (coefficient M L G H B C u p) := by have hL := evaluate_truncate_extend M (2*M) (by omega) κ (fun j => L (u j)) have hG := evaluate_truncate_extend M (2*M) (by omega) κ (fun j => G (p j)) have hH := inverse_evaluate_shiftDown_extend M (2*M) (by omega) κ hκ (fun j => H (p j)) hp have hC := inverse_evaluate_shiftDown (2*M) κ hκ (convolution M C u u) (convolution_zero M C u u hu) unfold residual rw [bilinear_evaluate M κ B u u, bilinear_evaluate M κ C u u] rw [map_evaluate M κ L u, map_evaluate M κ G p, map_evaluate M κ H p] rw [← hL, ← hG, hH, hC] simp only [coefficient, evaluate, smul_add, sum_add_distrib] /-- Cancellation of each low coefficient removes precisely those grades from the actual residual. -/ theorem residual_eq_tail (M K : ℕ) (hK : K ≤ 2*M+1) (κ : ℝ) (hκ : κ ≠ 0) (L : V →ₗ[ℝ] W) (G H : Q →ₗ[ℝ] W) (B C : V →ₗ[ℝ] V →ₗ[ℝ] W) (u : ℕ → V) (p : ℕ → Q) (hu : u 0=0) (hp : H (p 0)=0) (hcancel : ∀ n < K, coefficient M L G H B C u p n=0) : residual M κ L G H B C u p = ∑ n ∈ Ico K (2*M+1), κ^n • coefficient M L G H B C u p n := by rw [residual_eq_evaluate M κ hκ L G H B C u p hu hp] exact evaluate_eq_tail (2*M) K hK κ _ hcancel /-- For N profiles plus the last divergence corrector, the remaining grades are N+1 through 2N+2. -/ theorem packet_residual_eq_tail (N : ℕ) (κ : ℝ) (hκ : κ ≠ 0) (L : V →ₗ[ℝ] W) (G H : Q →ₗ[ℝ] W) (B C : V →ₗ[ℝ] V →ₗ[ℝ] W) (u : ℕ → V) (p : ℕ → Q) (hu : u 0=0) (hp : H (p 0)=0) (hcancel : ∀ n ≤ N, coefficient (N+1) L G H B C u p n=0) : residual (N+1) κ L G H B C u p = ∑ n ∈ Ico (N+1) (2*N+3), κ^n • coefficient (N+1) L G H B C u p n := by have h := residual_eq_tail (N+1) (N+1) (by omega) κ hκ L G H B C u p hu hp (fun n hn => hcancel n (by omega)) simpa only [show 2*(N+1)+1 = 2*N+3 by omega] using h end EulerPacketResidual end end noncomputable section namespace EulerPacketPointJets open EulerSmoothLimit InnerProductSpace EulerFiniteGrades open scoped ContDiff abbrev Domain := ℝ × (Space × ℝ) abbrev Jet (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] := E × (Domain →L[ℝ] E) abbrev VectorJet := Jet Space abbrev ScalarJet := Jet ℝ def timeDirection : Domain := (1, (0, 0)) def angleDirection : Domain := (0, (0, 1)) def spatialInjection : Space →L[ℝ] Domain := (0 : Space →L[ℝ] ℝ).prod ((ContinuousLinearMap.id ℝ Space).prod (0 : Space →L[ℝ] ℝ)) def linearPart (M : Space →L[ℝ] Space) : VectorJet →ₗ[ℝ] Space where toFun J := J.2 timeDirection + M J.1 map_add' J K := by simp [add_add_add_comm] map_smul' c J := by simp [smul_add] def slowPressure (FInv : Space →L[ℝ] Space) : ScalarJet →ₗ[ℝ] Space where toFun J := FInv.adjoint ((toDual ℝ Space).symm (J.2.comp spatialInjection)) map_add' J K := by simp [ContinuousLinearMap.add_comp] map_smul' c J := by simp [ContinuousLinearMap.smul_comp] def fastPressure (m : Space) : ScalarJet →ₗ[ℝ] Space where toFun J := J.2 angleDirection • m map_add' J K := by simp [add_smul] map_smul' c J := by simp [smul_smul] def slowAdvection (FInv : Space →L[ℝ] Space) : VectorJet →ₗ[ℝ] VectorJet →ₗ[ℝ] Space where toFun J := { toFun := fun K => K.2 (spatialInjection (FInv J.1)) map_add' K H := by simp map_smul' c K := by simp } map_add' J K := by apply LinearMap.ext intro H simp map_smul' c J := by apply LinearMap.ext intro K simp def fastAdvection (m : Space) : VectorJet →ₗ[ℝ] VectorJet →ₗ[ℝ] Space where toFun J := { toFun := fun K => ⟪m, J.1⟫_ℝ • K.2 angleDirection map_add' K H := by simp [smul_add] map_smul' c K := by simp [smul_smul, mul_comm] } map_add' J K := by apply LinearMap.ext intro H simp [inner_add_right, add_smul] map_smul' c J := by apply LinearMap.ext intro K simp [inner_smul_right, smul_smul] def fieldSum {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (M : ℕ) (κ : ℝ) (u : ℕ → Domain → E) (z : Domain) : E := evaluate M κ (fun n => u n z) end EulerPacketPointJets