import Euler.PacketGeometryData import Euler.PacketPhysicalCoefficients /-! Consequences of the literal numerical guards for a physical geometry stage. -/ /-! ## From `Euler/PacketShearMotion.lean` The text of `Euler/PacketShearMotion.lean`, folded into this file, which was its only importer. -/ section /-! Actual shear motion, exposed for the compression scale guard. -/ noncomputable section namespace EulerPacketMovingFrame open Set EulerSmoothLimit EulerPacketNormalizedPrimary EulerPacketRay EulerPacketCoefficientControl InnerProductSpace ContinuousLinearMap theorem physical_shear_motion_bound {B B₁ E : ℝ → Space →L[ℝ] Space} {m v : ℝ → Space} {c t₀ a ε Θ G d β : ℝ} {S : Set ℝ} (ha : 1/2 ≤ a) (hε : 0 < ε) (hΘ : 1 ≤ Θ) (hG : 1 ≤ G) (hd : 0 ≤ d) (hsmall : 16*(ε*Θ*(4*G)^2+d) ≤ 1) (hmap : MapsTo (physicalTime t₀ a ε) (Icc 0 Θ) S) (hBd : ∀ t ∈ S, HasDerivWithinAt B (B₁ t) S t) (hmd : ∀ t ∈ S, HasDerivWithinAt m (-(B t).adjoint (m t)) S t) (hvd : ∀ t ∈ S, HasDerivWithinAt v (-(B t) (v t)+ (2*⟪m t,(B t) (v t)⟫_ℝ/‖m t‖^2) • m t) S t) (hm0 : ∀ t ∈ S, m t ≠ 0) (hv0 : ∀ t ∈ S, v t ≠ 0) (hmv : ∀ t ∈ S, ⟪m t,v t⟫_ℝ = 0) (hB : ∀ t ∈ S, ‖B t‖ ≤ G) (hB₁ : ∀ t ∈ S, ‖B₁ t‖ ≤ G^2) (hE : ∀ t ∈ S, ‖E t‖ ≤ d) (hb0 : rescaledFrame B m v t₀ a ε 0 0 1 = a) (hk0 : rescaledFrame B m v t₀ a ε 0 2 1 = a*β) (hh0 : rescaledShear c m v t₀ a ε 0 = a/ε^2) : let e := 16*(ε*Θ*(4*G)^2+d) ε ≤ e ∧ ∀ τ ∈ Icc 0 Θ, |ε^2*rescaledShear c m v t₀ a ε τ/a-1| ≤ e := by let e := 16*(ε*Θ*(4*G)^2+d) let Bf := rescaledFrame B m v t₀ a ε let Ef := rescaledFrame E m v t₀ a ε let Hf := rescaledShear c m v t₀ a ε let Df : ℝ → Fin 3 → Fin 3 → ℝ := fun τ i j => frameMatrixRate (B (physicalTime t₀ a ε τ)) (B₁ (physicalTime t₀ a ε τ)) (unit (m (physicalTime t₀ a ε τ))) (unit (v (physicalTime t₀ a ε τ))) i j*(ε/a) let H₁f : ℝ → ℝ := fun τ => -(Bf τ 0 0+Bf τ 1 1)*Hf τ*(ε/a) have ha0 : 0 < a := by linarith have hG0 : 0 ≤ G := by linarith have hscale : |ε/a| ≤ 2*ε := by rw [abs_div, abs_of_pos hε, abs_of_pos ha0, div_le_iff₀ ha0] linarith only [mul_nonneg hε.le (sub_nonneg.mpr ha)] have hBF : ∀ τ ∈ Icc 0 Θ, ∀ i j, |Bf τ i j| ≤ 4*G := by intro τ hτ i j have ht := hmap hτ exact (frameMatrix_abs_le _ _ _ (unit_inner_self (hm0 _ ht)) (unit_inner_self (hv0 _ ht)) (unit_inner_zero (hmv _ ht)) i j).trans ((hB _ ht).trans (by linarith)) have hEF : ∀ τ ∈ Icc 0 Θ, ∀ i j, |Ef τ i j| ≤ d := by intro τ hτ i j have ht := hmap hτ exact (frameMatrix_abs_le _ _ _ (unit_inner_self (hm0 _ ht)) (unit_inner_self (hv0 _ ht)) (unit_inner_zero (hmv _ ht)) i j).trans (hE _ ht) have hDF : ∀ τ ∈ Icc 0 Θ, ∀ i j, HasDerivWithinAt (fun s => Bf s i j) (Df τ i j) (Icc 0 Θ) τ := by intro τ hτ i j have ht := hmap hτ exact (frameMatrix_hasDerivWithinAt (hBd _ ht) (hmd _ ht) (hvd _ ht) (hm0 _ ht) (hv0 _ ht) (hmv _ ht) i j).comp τ (physicalTime_hasDerivAt t₀ a ε τ).hasDerivWithinAt hmap have hDFbound : ∀ τ ∈ Icc 0 Θ, ∀ i j, |Df τ i j| ≤ 2*ε*(4*G)^2 := by intro τ hτ i j have ht := hmap hτ have hrate := frameMatrixRate_abs_le (B (physicalTime t₀ a ε τ)) (B₁ (physicalTime t₀ a ε τ)) _ _ (unit_inner_self (hm0 _ ht)) (unit_inner_self (hv0 _ ht)) (unit_inner_zero (hmv _ ht)) i j have hnormsq : ‖B (physicalTime t₀ a ε τ)‖^2 ≤ G^2 := pow_le_pow_left₀ (norm_nonneg _) (hB _ ht) 2 have hrate' : |frameMatrixRate (B (physicalTime t₀ a ε τ)) (B₁ (physicalTime t₀ a ε τ)) (unit (m (physicalTime t₀ a ε τ))) (unit (v (physicalTime t₀ a ε τ))) i j| ≤ 13*G^2 := by linarith only [hrate, hnormsq, hB₁ _ ht] dsimp [Df] rw [abs_mul] calc _ ≤ (13*G^2)*(2*ε) := mul_le_mul hrate' hscale (abs_nonneg _) (by positivity) _ ≤ 2*ε*(4*G)^2 := by linarith only [mul_nonneg hε.le (sq_nonneg G)] have hHF : ∀ τ ∈ Icc 0 Θ, HasDerivWithinAt Hf (H₁f τ) (Icc 0 Θ) τ := by intro τ hτ have ht := hmap hτ exact (primaryShear_hasDerivWithinAt (B (physicalTime t₀ a ε τ)) c (hmd _ ht) (hvd _ ht) (hm0 _ ht) (hv0 _ ht) (hmv _ ht)).comp τ (physicalTime_hasDerivAt t₀ a ε τ).hasDerivWithinAt hmap have hHFbound : ∀ τ ∈ Icc 0 Θ, |H₁f τ| ≤ (4*ε*(4*G))*|Hf τ| := by intro τ hτ have ht := hmap hτ have hrate := primaryShear_rate_bound (B (physicalTime t₀ a ε τ)) c m v _ (hm0 _ ht) (hv0 _ ht) (hmv _ ht) have hrate' : |-(Bf τ 0 0+Bf τ 1 1)*Hf τ| ≤ 2*G*|Hf τ| := by exact hrate.trans (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (hB _ ht) (by norm_num)) (abs_nonneg _)) dsimp [H₁f] rw [abs_mul] calc _ ≤ (2*G*|Hf τ|)*(2*ε) := mul_le_mul hrate' hscale (abs_nonneg _) (by positivity) _ ≤ (4*ε*(4*G))*|Hf τ| := by linarith only [mul_nonneg (mul_nonneg hε.le hG0) (abs_nonneg (Hf τ))] have herr := normalized_motion_errors_within ha hε hΘ (show 1 ≤ 4*G by linarith) hd hsmall hBF hEF (fun τ hτ => hDF τ hτ 0 1) (fun τ hτ => hDF τ hτ 2 1) (fun τ hτ => hDFbound τ hτ 0 1) (fun τ hτ => hDFbound τ hτ 2 1) hHF hHFbound hb0 hk0 hh0 exact ⟨herr.1, fun τ hτ => (herr.2 τ hτ).2.2.1⟩ end EulerPacketMovingFrame end end noncomputable section namespace EulerPacketMovingFrame.PhysicalGeometryData open Set Real EulerSmoothLimit EulerPacketRay EulerPacketFrameQuantitative variable {α : Type*} (D : PhysicalGeometryData α) theorem a_pos : 0 < D.a := by linarith only [D.a_lower] theorem Theta_pos : 0 < D.Θ := by linarith only [D.Theta_lower] theorem error_nonneg : 0 ≤ D.error := by unfold error; positivity [D.epsilon_pos, D.Theta_pos, D.d_nonneg] theorem target_from_sigma : 1/D.σ ≤ D.target := by have hy : 1 ≤ D.y⁻¹ := by rw [← one_div] apply (le_div_iff₀ D.y_pos).mpr linarith only [D.y_small] exact div_le_div_of_nonneg_right hy D.sigma_pos.le theorem target_one : 1 ≤ D.target := by have hs : 1 ≤ 1/D.σ := (le_div_iff₀ D.sigma_pos).mpr (by linarith only [D.sigma_small]) exact hs.trans D.target_from_sigma theorem target_pos : 0 < D.target := lt_of_lt_of_le zero_lt_one D.target_one theorem horizon_one : 1 ≤ D.H := D.target_one.trans D.target_le_horizon theorem horizon_pos : 0 < D.H := lt_of_lt_of_le zero_lt_one D.horizon_one theorem target_le_Theta : D.target ≤ D.Θ := D.target_le_horizon.trans D.horizon_le_Theta theorem sigma_Theta : 1 ≤ D.σ*D.Θ := by have h := (div_le_iff₀ D.sigma_pos).mp (D.target_from_sigma.trans D.target_le_Theta) linarith only [h] theorem target_scale : 1 ≤ D.σ^2*D.target^2 := by have h : 1 ≤ D.σ*D.target := by have hh := (div_le_iff₀ D.sigma_pos).mp D.target_from_sigma linarith only [hh] have hh := mul_le_mul h h (by norm_num : (0:ℝ) ≤ 1) (by positivity : 0 ≤ D.σ*D.target) linarith only [hh] theorem time_mem {τ : ℝ} (hτ : τ ∈ Icc 0 D.H) : D.time τ ∈ D.S := D.time_maps ⟨hτ.1, hτ.2.trans D.horizon_le_Theta⟩ theorem target_time_mem : D.targetTime ∈ D.S := D.time_mem ⟨D.target_pos.le, D.target_le_horizon⟩ theorem error_le_half : D.error ≤ 1/2 := by have hp := scaled_power_le D.Theta_lower ((by norm_num : (1:ℝ) ≤ 1000000000).trans neighborStabilityConstant_ge) D.error_nonneg (by decide : 0 ≤ 40) have hs := D.small change 1000000*neighborStabilityConstant*D.error*D.Θ^40 ≤ 1 at hs norm_num only [pow_zero, mul_one] at hp linarith only [hp, hs] theorem error_le_one : D.error ≤ 1 := D.error_le_half.trans (by norm_num) theorem epsilon_le_error : D.ε ≤ D.error := by have hg : 1 ≤ (4*D.G)^2 := by linarith only [D.G_lower, sq_nonneg (D.G-1)] have hc : 1 ≤ D.Θ*(4*D.G)^2 := by simpa only [one_mul] using mul_le_mul D.Theta_lower hg (by norm_num : (0:ℝ) ≤ 1) D.Theta_pos.le have hh := mul_le_mul_of_nonneg_left hc D.epsilon_pos.le unfold error linarith only [hh, D.d_nonneg, D.epsilon_pos] theorem epsilon_le_one : D.ε ≤ 1 := D.epsilon_le_error.trans D.error_le_one theorem ray_error_small : 800*D.error*D.Θ^5 ≤ 1/2 := by have hp := scaled_power_le D.Theta_lower ((by norm_num : (1:ℝ) ≤ 1000000000).trans neighborStabilityConstant_ge) D.error_nonneg (by decide : 5 ≤ 40) have hs := D.small change 1000000*neighborStabilityConstant*D.error*D.Θ^40 ≤ 1 at hs linarith only [hp, hs] theorem relative_error_small : neighborStabilityConstant*D.error*D.Θ^29 ≤ 1/2 := by have hK : 0 ≤ neighborStabilityConstant := (by norm_num : (0:ℝ) ≤ 1000000000).trans neighborStabilityConstant_ge have hp := mul_le_mul_of_nonneg_left (pow_le_pow_right₀ D.Theta_lower (by decide : 29 ≤ 40)) (mul_nonneg hK D.error_nonneg) have hs := D.small change 1000000*neighborStabilityConstant*D.error*D.Θ^40 ≤ 1 at hs linarith only [hp, hs] theorem scalar_error_small : 4*exp 6*(400000000*D.error*D.Θ^29) ≤ 1 := by have hr := D.relative_error_small have hK : 0 ≤ neighborStabilityConstant := (by norm_num : (0:ℝ) ≤ 1000000000).trans neighborStabilityConstant_ge have hp := mul_le_mul_of_nonneg_left (pow_le_pow_right₀ D.Theta_lower (by decide : 29 ≤ 40)) (mul_nonneg hK D.error_nonneg) have hs := D.small change 1000000*neighborStabilityConstant*D.error*D.Θ^40 ≤ 1 at hs unfold neighborStabilityConstant at hp hs hr linarith only [hp, hs, hr] theorem propagator_small : 8000000*D.error*D.Θ^21 ≤ 1 := by have hp := mul_le_mul_of_nonneg_left (pow_le_pow_right₀ D.Theta_lower (by decide : 21 ≤ 40)) D.error_nonneg have hk : 0 ≤ neighborStabilityConstant-8 := by linarith only [neighborStabilityConstant_ge] have hmul := mul_nonneg hk (mul_nonneg D.error_nonneg (pow_nonneg D.Theta_pos.le 40)) have hs := D.small change 1000000*neighborStabilityConstant*D.error*D.Θ^40 ≤ 1 at hs linarith only [hp, hmul, hs] theorem action_error (ξ : α) {τ : ℝ} (hτ : τ ∈ Icc 0 D.H) : ∀ i j, |scaledAction (D.M ξ (D.time τ)) D.m D.v D.a D.ε (D.time τ) i j- idealVelocityEntry (D.σ^2) i j| ≤ 3*D.error := by have h := physical_matrix_errors D.a_lower D.epsilon_pos D.Theta_lower D.G_lower D.d_nonneg D.error_le_one D.time_maps D.B_derivative D.old_ray_equation D.old_velocity_equation D.old_ray_nonzero D.old_velocity_nonzero D.old_tangent D.B_bound D.B_derivative_bound (D.E_bound ξ) (D.parent_decomposition ξ) D.initial_coupling D.initial_tilt D.initial_shear exact (h.2 τ ⟨hτ.1, hτ.2.trans D.horizon_le_Theta⟩).2.1 theorem target_shear_lower : D.a/(2*D.ε^2) ≤ D.targetShear := by have hh := physical_shear_motion_bound D.a_lower D.epsilon_pos D.Theta_lower D.G_lower D.d_nonneg D.error_le_one D.time_maps D.B_derivative D.old_ray_equation D.old_velocity_equation D.old_ray_nonzero D.old_velocity_nonzero D.old_tangent D.B_bound D.B_derivative_bound (D.E_bound D.center) D.initial_coupling D.initial_tilt D.initial_shear have hb := (abs_le.mp (hh.2 D.target ⟨D.target_pos.le, D.target_le_Theta⟩)).1 have hratio : 1/2 ≤ D.ε^2*D.targetShear/D.a := by change -D.error ≤ D.ε^2*D.targetShear/D.a-1 at hb linarith only [hb, D.error_le_half] have hmul := (le_div_iff₀ D.a_pos).mp hratio apply (div_le_iff₀ (show 0 < 2*D.ε^2 by positivity [D.epsilon_pos])).mpr linarith only [hmul] theorem target_shear_pos : 0 < D.targetShear := lt_of_lt_of_le (by positivity [D.a_pos, D.epsilon_pos]) D.target_shear_lower theorem compression_domination : 30*(‖D.B D.targetTime‖+‖D.E D.center D.targetTime‖)*D.target < D.targetShear*D.ε := by have hguard := D.compression_guard change 60*(D.G+D.d)*D.target*D.ε < D.a at hguard have hlower := mul_le_mul_of_nonneg_right D.target_shear_lower D.epsilon_pos.le have heq : (D.a/(2*D.ε^2))*D.ε = D.a/(2*D.ε) := by field_simp [ne_of_gt D.epsilon_pos] rw [heq] at hlower have hsmall : 30*(D.G+D.d)*D.target < D.a/(2*D.ε) := (lt_div_iff₀ (show 0 < 2*D.ε by positivity [D.epsilon_pos])).mpr (by linarith only [hguard]) have hnorm := add_le_add (D.B_bound _ D.target_time_mem) (D.E_bound D.center _ D.target_time_mem) have hm := mul_le_mul_of_nonneg_right hnorm (show 0 ≤ 30*D.target by positivity [D.target_pos]) have hfirst : 30*(‖D.B D.targetTime‖+‖D.E D.center D.targetTime‖)*D.target ≤ 30*(D.G+D.d)*D.target := by linarith only [hm] exact hfirst.trans_lt (hsmall.trans_le hlower) end EulerPacketMovingFrame.PhysicalGeometryData