Navier–Stokes: the Lean blow-up proof, cleaned up together
OpenAI's 2026 Lean proofs of blowup for forced Navier–Stokes and Euler, rerun by others, not refereed, no ruling from Clay; cleaned up together: more readable, faster to build

| 1 | import NavierStokes.OutgoingSchedule |
| 2 | import NavierStokes.OutgoingTail |
| 3 | import NavierStokes.TailEnergyBounds |
| 4 | import NavierStokes.OutgoingPulseBounds |
| 5 | import NavierStokes.RadialSchedule |
| 6 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 7 | import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals |
| 8 | import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics |
| 9 | import Mathlib.MeasureTheory.Function.Jacobian |
| 10 | |
| 11 | /-! |
| 12 | # Actual pulse energy and its scalar amplitude |
| 13 | |
| 14 | The pulse constant is the integral of the constructed smooth pulse from |
| 15 | `OutgoingSchedule`, rather than an abstract coefficient satisfying assumed |
| 16 | bounds. All energy coefficients below refer to the actual outgoing profiles. |
| 17 | -/ |
| 18 | |
| 19 | noncomputable section |
| 20 | |
| 21 | open Set Filter Function MeasureTheory |
| 22 | open scoped ContDiff Topology BigOperators |
| 23 | open NavierStokes.OutgoingSchedule |
| 24 | |
| 25 | namespace NavierStokes.PulseAmplitude |
| 26 | |
| 27 | theorem pulseRamp_nonneg {z : ℝ} (hz : 0 ≤ z) : 0 ≤ pulseRamp z := |
| 28 | intervalIntegral.integral_nonneg_of_forall hz (fun _ => sigma_nonneg _) |
| 29 | |
| 30 | theorem pulseRamp_le {z : ℝ} (hz : 0 ≤ z) : pulseRamp z ≤ z := by |
| 31 | have hi := intervalIntegral.integral_mono_on (μ := volume) hz |
| 32 | ((sigma_contDiff.continuous.comp (continuous_const.mul continuous_id)).intervalIntegrable 0 z) |
| 33 | (continuous_const.intervalIntegrable 0 z) |
| 34 | (fun t _ => sigma_le_one (50 * t)) |
| 35 | simpa only [pulseRamp, primitive, intervalIntegral.integral_const, sub_zero, smul_eq_mul, |
| 36 | mul_one, Function.comp_def, Pi.mul_apply, id_eq] using hi |
| 37 | |
| 38 | theorem pulseRamp_lower {z : ℝ} (hz : 1 / 50 ≤ z) : z - 1 / 50 ≤ pulseRamp z := by |
| 39 | have hc : Continuous (fun t : ℝ => sigma (50 * t)) := |
| 40 | sigma_contDiff.continuous.comp (continuous_const.mul continuous_id) |
| 41 | have hi := intervalIntegral.integral_mono_interval (μ := volume) (f := fun t : ℝ => sigma (50 * t)) |
| 42 | (by norm_num : (0 : ℝ) ≤ 1 / 50) hz le_rfl |
| 43 | (Eventually.of_forall (fun _ => sigma_nonneg _)) (hc.intervalIntegrable 0 z) |
| 44 | have he : (∫ t in (1 / 50 : ℝ)..z, sigma (50 * t)) = z - 1 / 50 := by |
| 45 | calc |
| 46 | _ = ∫ _t in (1 / 50 : ℝ)..z, (1 : ℝ) := by |
| 47 | apply intervalIntegral.integral_congr |
| 48 | intro t ht |
| 49 | apply sigma_one |
| 50 | have ht' := (uIcc_of_le hz ▸ ht).1 |
| 51 | linarith |
| 52 | _ = _ := by simp |
| 53 | simpa only [he, pulseRamp, primitive] using hi |
| 54 | |
| 55 | theorem mainPulse_nonneg {z : ℝ} (hz : 0 ≤ z) : 0 ≤ mainPulse z := |
| 56 | mul_nonneg (pulseRamp_nonneg hz) (sub_nonneg.mpr (sigma_le_one _)) |
| 57 | |
| 58 | theorem mainPulse_le {z : ℝ} (hz : 0 ≤ z) : mainPulse z ≤ z := by |
| 59 | have hp := pulseRamp_nonneg hz |
| 60 | have hs := sigma_nonneg (z - 10) |
| 61 | have hl := pulseRamp_le hz |
| 62 | unfold mainPulse |
| 63 | nlinarith |
| 64 | |
| 65 | theorem mainPulse_lower {z : ℝ} (hz : 1 / 50 ≤ z) (hz' : z ≤ 10) : |
| 66 | z - 1 / 50 ≤ mainPulse z := by |
| 67 | simpa [mainPulse, sigma_zero (by linarith : z - 10 ≤ 0)] using pulseRamp_lower hz |
| 68 | |
| 69 | def pulseConstant : ℝ := ∫ z in (0 : ℝ)..13, Real.exp (-2 * z) * mainPulse z ^ 2 |
| 70 | |
| 71 | theorem energyWeight_continuous : Continuous (fun z : ℝ => Real.exp (-2 * z)) := |
| 72 | Real.continuous_exp.comp (continuous_const.mul continuous_id) |
| 73 | |
| 74 | def weightedSquarePrimitive (a z : ℝ) : ℝ := |
| 75 | -Real.exp (-2 * z) * ((z - a) ^ 2 / 2 + (z - a) / 2 + 1 / 4) |
| 76 | |
| 77 | theorem weightedSquarePrimitive_hasDerivAt (a z : ℝ) : |
| 78 | HasDerivAt (weightedSquarePrimitive a) (Real.exp (-2 * z) * (z - a) ^ 2) z := by |
| 79 | have ht := (hasDerivAt_id z).sub_const a |
| 80 | have he := ((hasDerivAt_id z).const_mul (-2)).exp.fun_neg |
| 81 | convert! he.fun_mul (((ht.fun_pow 2).div_const 2 |>.fun_add (ht.div_const 2)).add_const (1 / 4)) using 1 |
| 82 | simp only [id_eq] |
| 83 | ring |
| 84 | |
| 85 | theorem weightedSquare_integral (a l u : ℝ) : |
| 86 | (∫ z in l..u, Real.exp (-2 * z) * (z - a) ^ 2) = |
| 87 | weightedSquarePrimitive a u - weightedSquarePrimitive a l := by |
| 88 | apply intervalIntegral.integral_eq_sub_of_hasDerivAt |
| 89 | (fun z _ => weightedSquarePrimitive_hasDerivAt a z) |
| 90 | exact (energyWeight_continuous.fun_mul |
| 91 | ((continuous_id.fun_sub continuous_const).fun_pow 2)).intervalIntegrable l u |
| 92 | |
| 93 | theorem pulseConstant_upper : pulseConstant ≤ 1 / 4 := by |
| 94 | have hm := intervalIntegral.integral_mono_on (μ := volume) (by norm_num : (0 : ℝ) ≤ 13) |
| 95 | ((energyWeight_continuous.fun_mul |
| 96 | (mainPulse_contDiff.continuous.fun_pow 2)).intervalIntegrable 0 13) |
| 97 | ((energyWeight_continuous.fun_mul (continuous_id.fun_pow 2)).intervalIntegrable 0 13) |
| 98 | (fun z hz => mul_le_mul_of_nonneg_left |
| 99 | (pow_le_pow_left₀ (mainPulse_nonneg hz.1) (mainPulse_le hz.1) 2) (Real.exp_pos _).le) |
| 100 | have hi := weightedSquare_integral 0 0 13 |
| 101 | norm_num [weightedSquarePrimitive] at hi |
| 102 | dsimp [pulseConstant] |
| 103 | have he := (Real.exp_pos (-26 : ℝ)).le |
| 104 | simp only [id_eq, neg_mul] at * |
| 105 | linarith |
| 106 | |
| 107 | private theorem exp_neg_ten_le : Real.exp (-10 : ℝ) ≤ 1 / 1024 := by |
| 108 | have he : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] |
| 109 | have hp : (1024 : ℝ) ≤ Real.exp 10 := calc |
| 110 | (1024 : ℝ) = 2 ^ 10 := by norm_num |
| 111 | _ ≤ (Real.exp 1) ^ 10 := pow_le_pow_left₀ (by norm_num) he 10 |
| 112 | _ = Real.exp 10 := by rw [← Real.exp_nat_mul]; norm_num |
| 113 | rw [Real.exp_neg] |
| 114 | simpa only [one_div] using one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 1024) hp |
| 115 | |
| 116 | theorem pulseConstant_lower : 1 / 5 < pulseConstant := by |
| 117 | have hw : Continuous (fun z : ℝ => Real.exp (-2 * z) * mainPulse z ^ 2) := |
| 118 | energyWeight_continuous.fun_mul (mainPulse_contDiff.continuous.fun_pow 2) |
| 119 | have hsub := intervalIntegral.integral_mono_interval (μ := volume) |
| 120 | (f := fun z : ℝ => Real.exp (-2 * z) * mainPulse z ^ 2) |
| 121 | (by norm_num : (0 : ℝ) ≤ 1 / 50) (by norm_num : (1 / 50 : ℝ) ≤ 5) |
| 122 | (by norm_num : (5 : ℝ) ≤ 13) |
| 123 | (Eventually.of_forall (fun z => mul_nonneg (Real.exp_pos _).le (sq_nonneg _))) |
| 124 | (hw.intervalIntegrable 0 13) |
| 125 | have hlo := intervalIntegral.integral_mono_on (μ := volume) (by norm_num : (1 / 50 : ℝ) ≤ 5) |
| 126 | ((energyWeight_continuous.fun_mul |
| 127 | ((continuous_id.fun_sub continuous_const).fun_pow 2)).intervalIntegrable (1 / 50) 5) |
| 128 | (hw.intervalIntegrable (1 / 50) 5) (fun z hz => |
| 129 | mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (sub_nonneg.mpr hz.1) |
| 130 | (mainPulse_lower hz.1 (by linarith [hz.2])) 2) (Real.exp_pos _).le) |
| 131 | have hi := weightedSquare_integral (1 / 50) (1 / 50) 5 |
| 132 | norm_num [weightedSquarePrimitive] at hi |
| 133 | have he : (24 / 25 : ℝ) ≤ Real.exp (-1 / 25) := by |
| 134 | linarith [Real.add_one_le_exp (-1 / 25 : ℝ)] |
| 135 | have hten := exp_neg_ten_le |
| 136 | change (∫ z in (1 / 50 : ℝ)..5, Real.exp (-2 * z) * mainPulse z ^ 2) ≤ pulseConstant at hsub |
| 137 | simp only [id_eq, neg_mul] at * |
| 138 | linarith |
| 139 | |
| 140 | theorem pulseConstant_bounds : 1 / 5 < pulseConstant ∧ pulseConstant ≤ 1 / 4 := |
| 141 | ⟨pulseConstant_lower, pulseConstant_upper⟩ |
| 142 | |
| 143 | /-! ## The actual affine correction and the actual pulse quadratic -/ |
| 144 | |
| 145 | def etaPolynomial (eta : ℝ) : ℝ := eta * (1 + eta ^ 2) |
| 146 | |
| 147 | def prefixRepair (c : Parameters) (y : ℝ) : ℝ := |
| 148 | LocalizedMomentRepair.repair c.exponents c.lower c.upper |
| 149 | (fun i => -prefixCoefficient c i) (Real.exp y) |
| 150 | |
| 151 | def amplitudeRepair (c : Parameters) (y : ℝ) : ℝ := |
| 152 | LocalizedMomentRepair.repair c.exponents c.lower c.upper |
| 153 | (fun i => -mainMoment c i) (Real.exp y) |
| 154 | |
| 155 | def amplitudeShape (c : Parameters) (y : ℝ) : ℝ := |
| 156 | mainPulse (c.lam * y) + amplitudeRepair c y |
| 157 | |
| 158 | theorem prefixRepair_contDiff (c : Parameters) : ContDiff ℝ ∞ (prefixRepair c) := |
| 159 | (LocalizedMomentRepair.repair_contDiff _ _ _ _).comp Real.contDiff_exp |
| 160 | |
| 161 | theorem amplitudeRepair_contDiff (c : Parameters) : ContDiff ℝ ∞ (amplitudeRepair c) := |
| 162 | (LocalizedMomentRepair.repair_contDiff _ _ _ _).comp Real.contDiff_exp |
| 163 | |
| 164 | theorem amplitudeShape_contDiff (c : Parameters) : ContDiff ℝ ∞ (amplitudeShape c) := |
| 165 | (mainPulse_contDiff.comp (contDiff_const.mul contDiff_id)).add (amplitudeRepair_contDiff c) |
| 166 | |
| 167 | theorem correction_eq_affine (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 168 | correction c amp eta (Real.exp y) = |
| 169 | etaPolynomial eta * prefixRepair c y + amp eta * amplitudeRepair c y := by |
| 170 | have he : debt c amp eta = |
| 171 | etaPolynomial eta • (fun i => -prefixCoefficient c i) + |
| 172 | amp eta • (fun i => -mainMoment c i) := by |
| 173 | funext i |
| 174 | simp only [debt, etaPolynomial, Pi.add_apply, Pi.smul_apply, smul_eq_mul] |
| 175 | ring |
| 176 | simp only [correction, he, LocalizedMomentRepair.repair_add, |
| 177 | LocalizedMomentRepair.repair_smul, Pi.add_apply, Pi.smul_apply, smul_eq_mul, |
| 178 | prefixRepair, amplitudeRepair] |
| 179 | |
| 180 | theorem pulseRatio_eq_affine (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 181 | pulseRatio c amp (y, eta) = |
| 182 | amp eta * amplitudeShape c y + etaPolynomial eta * prefixRepair c y := by |
| 183 | simp only [pulseRatio, correction_eq_affine, amplitudeShape] |
| 184 | ring |
| 185 | |
| 186 | theorem prefixRepair_eq_correction (c : Parameters) (y : ℝ) : |
| 187 | 2 * prefixRepair c y = correction c (fun _ => 0) 1 (Real.exp y) := by |
| 188 | rw [correction_eq_affine] |
| 189 | norm_num [etaPolynomial] |
| 190 | |
| 191 | theorem amplitudeRepair_eq_correction (c : Parameters) (y : ℝ) : |
| 192 | amplitudeRepair c y = correction c (fun _ => 1) 0 (Real.exp y) := by |
| 193 | rw [correction_eq_affine] |
| 194 | norm_num [etaPolynomial] |
| 195 | |
| 196 | theorem mainPulse_mul_correction (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 197 | mainPulse (c.lam * y) * correction c amp eta (Real.exp y) = 0 := by |
| 198 | by_cases hy : y ≤ 11 / c.lam |
| 199 | · rw [correction_zero_on_main_pulse c amp eta hy, mul_zero] |
| 200 | · have h : 11 ≤ c.lam * y := by |
| 201 | have hp := (div_lt_iff₀ c.lam_pos).mp (lt_of_not_ge hy) |
| 202 | linarith |
| 203 | rw [mainPulse_zero_right h, zero_mul] |
| 204 | |
| 205 | theorem mainPulse_mul_amplitudeRepair (c : Parameters) (y : ℝ) : |
| 206 | mainPulse (c.lam * y) * amplitudeRepair c y = 0 := by |
| 207 | rw [amplitudeRepair_eq_correction] |
| 208 | exact mainPulse_mul_correction c (fun _ => 1) 0 y |
| 209 | |
| 210 | theorem mainPulse_mul_prefixRepair (c : Parameters) (y : ℝ) : |
| 211 | mainPulse (c.lam * y) * prefixRepair c y = 0 := by |
| 212 | have he := mainPulse_mul_correction c (fun _ => 0) 1 y |
| 213 | rw [← prefixRepair_eq_correction] at he |
| 214 | nlinarith |
| 215 | |
| 216 | def pulseWeight (c : Parameters) (y : ℝ) : ℝ := Real.exp (-2 * c.lam * y) |
| 217 | |
| 218 | theorem pulseWeight_continuous (c : Parameters) : Continuous (pulseWeight c) := |
| 219 | Real.continuous_exp.comp (continuous_const.mul continuous_id) |
| 220 | |
| 221 | theorem pulse_rescale_integral (c : Parameters) (f : ℝ → ℝ) : |
| 222 | c.lam * (∫ y in (0 : ℝ)..c.pulseLength, f (c.lam * y)) = ∫ z in (0 : ℝ)..13, f z := by |
| 223 | simpa only [smul_eq_mul, mul_zero, Parameters.pulseLength, mul_div_cancel₀ _ c.lam_pos.ne'] using |
| 224 | intervalIntegral.smul_integral_comp_mul_left f c.lam (a := 0) (b := c.pulseLength) |
| 225 | |
| 226 | def quadraticCoefficient (c : Parameters) : ℝ := |
| 227 | c.lam * ∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * amplitudeShape c y ^ 2 |
| 228 | |
| 229 | def linearCoefficient (c : Parameters) : ℝ := |
| 230 | 2 * c.lam * ∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * amplitudeShape c y * prefixRepair c y |
| 231 | |
| 232 | def constantCorrection (c : Parameters) : ℝ := |
| 233 | c.lam * ∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * prefixRepair c y ^ 2 |
| 234 | |
| 235 | def scaledPulseEnergy (c : Parameters) (A eta : ℝ) : ℝ := |
| 236 | c.lam * ∫ y in (0 : ℝ)..c.pulseLength, |
| 237 | pulseWeight c y * (pulseRatio c (fun _ => A) (y, eta) ^ 2 - 1 / 2) |
| 238 | |
| 239 | theorem normalized_main_energy (c : Parameters) : |
| 240 | c.lam * (∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * mainPulse (c.lam * y) ^ 2) = |
| 241 | pulseConstant := by |
| 242 | convert! pulse_rescale_integral c (fun z => Real.exp (-2 * z) * mainPulse z ^ 2) using 1 |
| 243 | congr 1 |
| 244 | apply intervalIntegral.integral_congr |
| 245 | intro y _ |
| 246 | simp only [pulseWeight, mul_assoc] |
| 247 | |
| 248 | theorem normalized_negative_energy (c : Parameters) : |
| 249 | c.lam * (∫ y in (0 : ℝ)..c.pulseLength, (1 / 2 : ℝ) * pulseWeight c y) = |
| 250 | RadialSchedule.pulseEnergyDebt := by |
| 251 | rw [RadialSchedule.pulseEnergyDebt, ← RadialSchedule.pulse_negative_energy_integral] |
| 252 | convert! pulse_rescale_integral c (fun z => (1 / 2 : ℝ) * Real.exp (-2 * z)) using 1 |
| 253 | congr 1 |
| 254 | apply intervalIntegral.integral_congr |
| 255 | intro y _ |
| 256 | simp only [pulseWeight, mul_assoc] |
| 257 | |
| 258 | theorem quadraticCoefficient_eq (c : Parameters) : |
| 259 | quadraticCoefficient c = pulseConstant + |
| 260 | c.lam * ∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * amplitudeRepair c y ^ 2 := by |
| 261 | have hp : Continuous (fun y => pulseWeight c y * mainPulse (c.lam * y) ^ 2) := |
| 262 | (pulseWeight_continuous c).mul |
| 263 | ((mainPulse_contDiff.continuous.comp (continuous_const.mul continuous_id)).pow 2) |
| 264 | have hr : Continuous (fun y => pulseWeight c y * amplitudeRepair c y ^ 2) := |
| 265 | (pulseWeight_continuous c).mul ((amplitudeRepair_contDiff c).continuous.pow 2) |
| 266 | have he : (fun y => pulseWeight c y * amplitudeShape c y ^ 2) = |
| 267 | (fun y => pulseWeight c y * mainPulse (c.lam * y) ^ 2 + |
| 268 | pulseWeight c y * amplitudeRepair c y ^ 2) := by |
| 269 | funext y |
| 270 | unfold amplitudeShape |
| 271 | have hz := mainPulse_mul_amplitudeRepair c y |
| 272 | nlinarith [congrArg (fun x : ℝ => pulseWeight c y * x) hz] |
| 273 | unfold quadraticCoefficient |
| 274 | rw [he, intervalIntegral.integral_add (hp.intervalIntegrable _ _) (hr.intervalIntegrable _ _), |
| 275 | mul_add, normalized_main_energy] |
| 276 | |
| 277 | theorem quadraticCoefficient_ge (c : Parameters) : pulseConstant ≤ quadraticCoefficient c := by |
| 278 | rw [quadraticCoefficient_eq] |
| 279 | have hn := intervalIntegral.integral_nonneg_of_forall (μ := volume) c.pulseLength_pos.le |
| 280 | (fun y => mul_nonneg (Real.exp_pos (-2 * c.lam * y)).le (sq_nonneg (amplitudeRepair c y))) |
| 281 | exact le_add_of_nonneg_right (mul_nonneg c.lam_pos.le hn) |
| 282 | |
| 283 | theorem scaledPulseEnergy_eq (c : Parameters) (A eta : ℝ) : |
| 284 | scaledPulseEnergy c A eta = quadraticCoefficient c * A ^ 2 + |
| 285 | linearCoefficient c * etaPolynomial eta * A + |
| 286 | constantCorrection c * etaPolynomial eta ^ 2 - RadialSchedule.pulseEnergyDebt := by |
| 287 | have hq : Continuous (fun y => pulseWeight c y * amplitudeShape c y ^ 2) := |
| 288 | (pulseWeight_continuous c).mul ((amplitudeShape_contDiff c).continuous.pow 2) |
| 289 | have hl : Continuous (fun y => pulseWeight c y * amplitudeShape c y * prefixRepair c y) := |
| 290 | ((pulseWeight_continuous c).mul (amplitudeShape_contDiff c).continuous).mul |
| 291 | (prefixRepair_contDiff c).continuous |
| 292 | have hc : Continuous (fun y => pulseWeight c y * prefixRepair c y ^ 2) := |
| 293 | (pulseWeight_continuous c).mul ((prefixRepair_contDiff c).continuous.pow 2) |
| 294 | have hn : Continuous (fun y => (1 / 2 : ℝ) * pulseWeight c y) := |
| 295 | continuous_const.mul (pulseWeight_continuous c) |
| 296 | have he : (fun y => pulseWeight c y * (pulseRatio c (fun _ => A) (y, eta) ^ 2 - 1 / 2)) = |
| 297 | (fun y => A ^ 2 * (pulseWeight c y * amplitudeShape c y ^ 2) + |
| 298 | (2 * etaPolynomial eta * A) * (pulseWeight c y * amplitudeShape c y * prefixRepair c y) + |
| 299 | etaPolynomial eta ^ 2 * (pulseWeight c y * prefixRepair c y ^ 2) - |
| 300 | (1 / 2 : ℝ) * pulseWeight c y) := by |
| 301 | funext y |
| 302 | rw [pulseRatio_eq_affine] |
| 303 | ring |
| 304 | unfold scaledPulseEnergy |
| 305 | rw [he, intervalIntegral.integral_sub |
| 306 | ((((continuous_const.fun_mul hq).fun_add (continuous_const.fun_mul hl)).fun_add |
| 307 | (continuous_const.fun_mul hc)).intervalIntegrable _ _) |
| 308 | (hn.intervalIntegrable _ _)] |
| 309 | rw [intervalIntegral.integral_add |
| 310 | (((continuous_const.fun_mul hq).fun_add (continuous_const.fun_mul hl)).intervalIntegrable _ _) |
| 311 | ((continuous_const.fun_mul hc).intervalIntegrable _ _), |
| 312 | intervalIntegral.integral_add ((continuous_const.fun_mul hq).intervalIntegrable _ _) |
| 313 | ((continuous_const.fun_mul hl).intervalIntegrable _ _)] |
| 314 | simp only [intervalIntegral.integral_const_mul] |
| 315 | have hn' := normalized_negative_energy c |
| 316 | simp only [intervalIntegral.integral_const_mul] at hn' |
| 317 | unfold quadraticCoefficient linearCoefficient constantCorrection |
| 318 | nlinarith |
| 319 | |
| 320 | /-! ## Exact prefix coefficients and uniform bounds -/ |
| 321 | |
| 322 | def coreEnergyWeight (c : Parameters) (y : ℝ) : ℝ := |
| 323 | Real.exp y * radialAmplitude c.P c.dropLength c.lam y ^ 2 |
| 324 | |
| 325 | def normalization (c : Parameters) : ℝ := Real.exp c.pulseStart * pulseAmplitude c ^ 2 |
| 326 | |
| 327 | theorem normalization_pos (c : Parameters) : 0 < normalization c := |
| 328 | mul_pos (Real.exp_pos _) (sq_pos_of_pos (pulseAmplitude_pos c)) |
| 329 | |
| 330 | theorem coreEnergyWeight_nonneg (c : Parameters) (y : ℝ) : 0 ≤ coreEnergyWeight c y := |
| 331 | mul_nonneg (Real.exp_pos _).le (sq_nonneg _) |
| 332 | |
| 333 | theorem coreEnergyWeight_contDiff (c : Parameters) : ContDiff ℝ ∞ (coreEnergyWeight c) := |
| 334 | Real.contDiff_exp.mul ((radialAmplitude_contDiff _ _ _).pow 2) |
| 335 | |
| 336 | theorem coreEnergyWeight_hasDerivAt (c : Parameters) (y : ℝ) : |
| 337 | HasDerivAt (coreEnergyWeight c) (2 * slope c.dropLength c.lam y * coreEnergyWeight c y) y := by |
| 338 | convert! (Real.hasDerivAt_exp y).fun_mul ((radialAmplitude_hasDerivAt c.P c.dropLength c.lam y).fun_pow 2) |
| 339 | using 1 |
| 340 | simp only [coreEnergyWeight] |
| 341 | ring |
| 342 | |
| 343 | theorem slope_ge_neg_lambda (c : Parameters) (y : ℝ) : -c.lam ≤ slope c.dropLength c.lam y := by |
| 344 | have h0 := sigma_nonneg y |
| 345 | have h1 := sigma_le_one y |
| 346 | have h2 := sigma_le_one (y - (c.dropLength + 1)) |
| 347 | unfold OutgoingSchedule.slope |
| 348 | nlinarith [c.lam_pos] |
| 349 | |
| 350 | theorem weightedCore_monotone (c : Parameters) : |
| 351 | Monotone (fun y => coreEnergyWeight c y * Real.exp (2 * c.lam * y)) := by |
| 352 | have hd : ∀ y, HasDerivAt (fun y => coreEnergyWeight c y * Real.exp (2 * c.lam * y)) |
| 353 | (2 * (slope c.dropLength c.lam y + c.lam) * |
| 354 | (coreEnergyWeight c y * Real.exp (2 * c.lam * y))) y := by |
| 355 | intro y |
| 356 | convert! (coreEnergyWeight_hasDerivAt c y).mul |
| 357 | (((hasDerivAt_id y).const_mul (2 * c.lam)).exp) using 1 |
| 358 | simp only [id_eq] |
| 359 | ring |
| 360 | apply monotone_of_deriv_nonneg (fun y => (hd y).differentiableAt) |
| 361 | intro y |
| 362 | rw [(hd y).deriv] |
| 363 | exact mul_nonneg (mul_nonneg (by norm_num) (by linarith [slope_ge_neg_lambda c y])) |
| 364 | (mul_nonneg (coreEnergyWeight_nonneg c y) (Real.exp_pos _).le) |
| 365 | |
| 366 | theorem prefix_weight_bound (c : Parameters) {y : ℝ} (hy : 0 ≤ y) (hy' : y ≤ c.pulseStart) : |
| 367 | coreEnergyWeight c y ≤ normalization c * Real.exp (2 * c.lam * c.pulseStart) := by |
| 368 | have hm := weightedCore_monotone c hy' |
| 369 | have he : 1 ≤ Real.exp (2 * c.lam * y) := Real.one_le_exp |
| 370 | (mul_nonneg (mul_nonneg (by norm_num) c.lam_pos.le) hy) |
| 371 | exact (le_mul_of_one_le_right (coreEnergyWeight_nonneg c y) he).trans hm |
| 372 | |
| 373 | theorem initial_weight_bound (c : Parameters) : |
| 374 | c.P ^ 2 ≤ normalization c * Real.exp (2 * c.lam * c.pulseStart) := by |
| 375 | have h := prefix_weight_bound c (y := 0) le_rfl c.pulseStart_pos.le |
| 376 | simpa [coreEnergyWeight, radialAmplitude, logAmplitude, primitive] using h |
| 377 | |
| 378 | def prefixAxialEnergy (c : Parameters) : ℝ := |
| 379 | 16 + ∫ y in (0 : ℝ)..c.pulseStart, Real.exp y * dropCoefficient c.m y ^ 2 |
| 380 | |
| 381 | def prefixAngularEnergy (c : Parameters) : ℝ := |
| 382 | (5 / 12) * c.P ^ 2 + ∫ y in (0 : ℝ)..c.pulseStart, coreEnergyWeight c y / 2 |
| 383 | |
| 384 | def prefixEnergy (c : Parameters) (eta : ℝ) : ℝ := |
| 385 | prefixAxialEnergy c * eta ^ 2 - prefixAngularEnergy c * shape eta ^ 2 |
| 386 | |
| 387 | theorem prefixAngularEnergy_bound (c : Parameters) : |
| 388 | prefixAngularEnergy c ≤ (5 / 12 + c.pulseStart / 2) * |
| 389 | (normalization c * Real.exp (2 * c.lam * c.pulseStart)) := by |
| 390 | have hm := intervalIntegral.integral_mono_on (μ := volume) c.pulseStart_pos.le |
| 391 | (((coreEnergyWeight_contDiff c).continuous.div_const 2).intervalIntegrable 0 c.pulseStart) |
| 392 | (continuous_const.intervalIntegrable 0 c.pulseStart) |
| 393 | (fun y hy => div_le_div_of_nonneg_right (prefix_weight_bound c hy.1 hy.2) (by norm_num)) |
| 394 | simp only [intervalIntegral.integral_const, sub_zero, smul_eq_mul] at hm |
| 395 | unfold prefixAngularEnergy |
| 396 | nlinarith [initial_weight_bound c] |
| 397 | |
| 398 | theorem prefixAxialEnergy_bound (c : Parameters) : |
| 399 | prefixAxialEnergy c ≤ 16 * Real.exp (Real.exp c.m) := by |
| 400 | let L := Real.exp c.m |
| 401 | have hL : 0 ≤ L := (Real.exp_pos _).le |
| 402 | have hLB : L ≤ c.pulseStart := by |
| 403 | have h := c.pulseStart_ge_hold |
| 404 | dsimp [Parameters.holdStart, Parameters.dropLength, L] at * |
| 405 | linarith |
| 406 | have hc : Continuous (fun y => Real.exp y * dropCoefficient c.m y ^ 2) := |
| 407 | Real.continuous_exp.mul ((dropCoefficient_contDiff c.m_pos).continuous.pow 2) |
| 408 | have hz : (∫ y in L..c.pulseStart, Real.exp y * dropCoefficient c.m y ^ 2) = 0 := by |
| 409 | calc |
| 410 | _ = ∫ _y in L..c.pulseStart, (0 : ℝ) := by |
| 411 | apply intervalIntegral.integral_congr |
| 412 | intro y hy |
| 413 | change Real.exp y * dropCoefficient c.m y ^ 2 = 0 |
| 414 | rw [dropCoefficient_late c.m_pos ((uIcc_of_le hLB ▸ hy).1)] |
| 415 | ring |
| 416 | _ = 0 := by simp |
| 417 | have hs := intervalIntegral.integral_add_adjacent_intervals (μ := volume) |
| 418 | (hc.intervalIntegrable 0 L) (hc.intervalIntegrable L c.pulseStart) |
| 419 | have hm := intervalIntegral.integral_mono_on (μ := volume) (g := fun y => 16 * Real.exp y) |
| 420 | hL (hc.intervalIntegrable 0 L) |
| 421 | ((continuous_const.mul Real.continuous_exp).intervalIntegrable 0 L) |
| 422 | (fun y _ => by |
| 423 | have hb := dropCoefficient_bounds c.m y |
| 424 | nlinarith [mul_nonneg (Real.exp_pos y).le |
| 425 | (show 0 ≤ 16 - dropCoefficient c.m y ^ 2 by nlinarith)]) |
| 426 | rw [intervalIntegral.integral_const_mul, integral_exp] at hm |
| 427 | simp only [Real.exp_zero] at hm |
| 428 | rw [hz, add_zero] at hs |
| 429 | unfold prefixAxialEnergy |
| 430 | rw [← hs] |
| 431 | linarith |
| 432 | |
| 433 | /-! ## The complete outgoing energy is an actual improper integral -/ |
| 434 | |
| 435 | def energyIntegrand (d : OutgoingTail.TailData) (A eta y : ℝ) : ℝ := |
| 436 | Real.exp y * (axial d.core (fun _ => A) (y, eta) ^ 2 - |
| 437 | OutgoingTail.finalAngular d (y, eta) ^ 2 / 2) |
| 438 | |
| 439 | def totalEnergy (d : OutgoingTail.TailData) (A eta : ℝ) : ℝ := |
| 440 | ∫ y, energyIntegrand d A eta y |
| 441 | |
| 442 | def tailEnergy (d : OutgoingTail.TailData) (eta : ℝ) : ℝ := |
| 443 | ∫ y in Ioi d.core.endpoint, Real.exp y * OutgoingTail.finalAngular d (y, eta) ^ 2 |
| 444 | |
| 445 | theorem energyIntegrand_continuous (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 446 | Continuous (energyIntegrand d A eta) := |
| 447 | Real.continuous_exp.mul (((axial_radial_contDiff d.core (fun _ => A) eta).continuous.pow 2).sub |
| 448 | ((((OutgoingTail.finalAngular_contDiff d).comp |
| 449 | (contDiff_id.prodMk contDiff_const)).continuous.pow 2).div_const 2)) |
| 450 | |
| 451 | theorem coreEndpoint_pos (c : Parameters) : 0 < c.endpoint := by |
| 452 | unfold Parameters.endpoint |
| 453 | linarith [c.pulseStart_pos, c.pulseLength_pos] |
| 454 | |
| 455 | theorem pulseStart_le_endpoint (c : Parameters) : c.pulseStart ≤ c.endpoint := by |
| 456 | unfold Parameters.endpoint |
| 457 | linarith [c.pulseLength_pos] |
| 458 | |
| 459 | theorem energyIntegrand_ideal (d : OutgoingTail.TailData) (A eta : ℝ) {y : ℝ} (hy : y ≤ 0) : |
| 460 | energyIntegrand d A eta y = 16 * eta ^ 2 * Real.exp y - |
| 461 | (d.core.P ^ 2 * shape eta ^ 2 / 2) * Real.exp ((6 / 5) * y) := by |
| 462 | unfold energyIntegrand |
| 463 | rw [axial_ideal d.core (fun _ => A) eta hy, |
| 464 | OutgoingTail.finalAngular_before d eta (hy.trans (coreEndpoint_pos d.core).le), |
| 465 | angular_ideal d.core.dropLength_pos.le hy] |
| 466 | have he : Real.exp y * Real.exp (y / 10) ^ 2 = Real.exp ((6 / 5) * y) := by |
| 467 | rw [pow_two, ← Real.exp_add, ← Real.exp_add] |
| 468 | congr 1 |
| 469 | ring |
| 470 | calc |
| 471 | _ = 16 * eta ^ 2 * Real.exp y - |
| 472 | (d.core.P ^ 2 * shape eta ^ 2 / 2) * (Real.exp y * Real.exp (y / 10) ^ 2) := by ring |
| 473 | _ = _ := by rw [he] |
| 474 | |
| 475 | theorem energyIntegrand_integrable_ideal (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 476 | IntegrableOn (energyIntegrand d A eta) (Iic 0) := by |
| 477 | refine IntegrableOn.congr_fun (s := Iic (0 : ℝ)) |
| 478 | (((integrableOn_exp_Iic 0).const_mul (16 * eta ^ 2)).sub |
| 479 | ((integrableOn_exp_mul_Iic (by norm_num : (0 : ℝ) < 6 / 5) 0).const_mul |
| 480 | (d.core.P ^ 2 * shape eta ^ 2 / 2))) ?_ measurableSet_Iic |
| 481 | intro y hy |
| 482 | exact (energyIntegrand_ideal d A eta hy).symm |
| 483 | |
| 484 | theorem energyIntegrand_integral_ideal (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 485 | (∫ y in Iic 0, energyIntegrand d A eta y) = |
| 486 | 16 * eta ^ 2 - (5 / 12) * d.core.P ^ 2 * shape eta ^ 2 := by |
| 487 | have he : (∫ y in Iic 0, energyIntegrand d A eta y) = |
| 488 | ∫ y in Iic 0, 16 * eta ^ 2 * Real.exp y - |
| 489 | (d.core.P ^ 2 * shape eta ^ 2 / 2) * Real.exp ((6 / 5) * y) := by |
| 490 | apply setIntegral_congr_fun measurableSet_Iic |
| 491 | intro y hy |
| 492 | exact energyIntegrand_ideal d A eta hy |
| 493 | rw [he, integral_sub ((integrableOn_exp_Iic 0).const_mul _) |
| 494 | ((integrableOn_exp_mul_Iic (by norm_num : (0 : ℝ) < 6 / 5) 0).const_mul _), |
| 495 | integral_const_mul, integral_const_mul, integral_exp_Iic_zero, |
| 496 | integral_exp_mul_Iic (by norm_num : (0 : ℝ) < 6 / 5) 0] |
| 497 | norm_num |
| 498 | ring |
| 499 | |
| 500 | theorem energyIntegrand_prefix (d : OutgoingTail.TailData) (A eta : ℝ) {y : ℝ} |
| 501 | (hy : y ≤ d.core.pulseStart) : |
| 502 | energyIntegrand d A eta y = |
| 503 | eta ^ 2 * (Real.exp y * dropCoefficient d.core.m y ^ 2) - |
| 504 | shape eta ^ 2 * (coreEnergyWeight d.core y / 2) := by |
| 505 | unfold energyIntegrand |
| 506 | rw [axial_before_pulse d.core (fun _ => A) eta hy, |
| 507 | OutgoingTail.finalAngular_before d eta (hy.trans (pulseStart_le_endpoint d.core))] |
| 508 | unfold angular coreEnergyWeight |
| 509 | ring |
| 510 | |
| 511 | theorem energyIntegrand_integrable_Iic (d : OutgoingTail.TailData) (A eta : ℝ) {b : ℝ} |
| 512 | (hb : 0 ≤ b) : IntegrableOn (energyIntegrand d A eta) (Iic b) := by |
| 513 | rw [← Iic_union_Ioc_eq_Iic hb] |
| 514 | exact (energyIntegrand_integrable_ideal d A eta).union |
| 515 | (energyIntegrand_continuous d A eta).integrableOn_Ioc |
| 516 | |
| 517 | theorem energyIntegrand_integral_prefix (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 518 | (∫ y in Iic d.core.pulseStart, energyIntegrand d A eta y) = prefixEnergy d.core eta := by |
| 519 | have hfin : (∫ y in (0 : ℝ)..d.core.pulseStart, energyIntegrand d A eta y) = |
| 520 | eta ^ 2 * (∫ y in (0 : ℝ)..d.core.pulseStart, Real.exp y * dropCoefficient d.core.m y ^ 2) - |
| 521 | shape eta ^ 2 * (∫ y in (0 : ℝ)..d.core.pulseStart, coreEnergyWeight d.core y / 2) := by |
| 522 | calc |
| 523 | _ = ∫ y in (0 : ℝ)..d.core.pulseStart, |
| 524 | eta ^ 2 * (Real.exp y * dropCoefficient d.core.m y ^ 2) - |
| 525 | shape eta ^ 2 * (coreEnergyWeight d.core y / 2) := by |
| 526 | apply intervalIntegral.integral_congr |
| 527 | intro y hy |
| 528 | exact energyIntegrand_prefix d A eta ((uIcc_of_le d.core.pulseStart_pos.le ▸ hy).2) |
| 529 | _ = _ := by |
| 530 | rw [intervalIntegral.integral_sub |
| 531 | ((continuous_const.fun_mul (Real.continuous_exp.fun_mul |
| 532 | ((dropCoefficient_contDiff d.core.m_pos).continuous.fun_pow 2))).intervalIntegrable _ _) |
| 533 | ((continuous_const.fun_mul ((coreEnergyWeight_contDiff d.core).continuous.div_const 2)).intervalIntegrable _ _), |
| 534 | intervalIntegral.integral_const_mul, intervalIntegral.integral_const_mul] |
| 535 | have hs := intervalIntegral.integral_Iic_sub_Iic |
| 536 | (energyIntegrand_integrable_ideal d A eta) |
| 537 | (energyIntegrand_integrable_Iic d A eta d.core.pulseStart_pos.le) |
| 538 | rw [energyIntegrand_integral_ideal, hfin] at hs |
| 539 | unfold prefixEnergy prefixAxialEnergy prefixAngularEnergy |
| 540 | linarith |
| 541 | |
| 542 | theorem energyIntegrand_pulse (d : OutgoingTail.TailData) (A eta : ℝ) {y : ℝ} |
| 543 | (hy : d.core.pulseStart ≤ y) (hy' : y ≤ d.core.endpoint) : |
| 544 | energyIntegrand d A eta y = normalization d.core * shape eta ^ 2 * |
| 545 | (pulseWeight d.core (y - d.core.pulseStart) * |
| 546 | (pulseRatio d.core (fun _ => A) (y - d.core.pulseStart, eta) ^ 2 - 1 / 2)) := by |
| 547 | unfold energyIntegrand |
| 548 | rw [axial_pulse d.core (fun _ => A) eta hy, radialPulse_exp, |
| 549 | OutgoingTail.finalAngular_before d eta hy', angular_pulse d.core eta hy] |
| 550 | have he : Real.exp y * Real.exp (-(1 / 2 + d.core.lam) * (y - d.core.pulseStart)) ^ 2 = |
| 551 | Real.exp d.core.pulseStart * pulseWeight d.core (y - d.core.pulseStart) := by |
| 552 | unfold pulseWeight |
| 553 | rw [pow_two, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add] |
| 554 | congr 1 |
| 555 | ring |
| 556 | unfold normalization |
| 557 | calc |
| 558 | _ = pulseAmplitude d.core ^ 2 * shape eta ^ 2 * |
| 559 | (pulseRatio d.core (fun _ => A) (y - d.core.pulseStart, eta) ^ 2 - 1 / 2) * |
| 560 | (Real.exp y * Real.exp (-(1 / 2 + d.core.lam) * (y - d.core.pulseStart)) ^ 2) := by ring |
| 561 | _ = _ := by rw [he]; ring |
| 562 | |
| 563 | theorem energyIntegrand_integral_pulse (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 564 | (∫ y in d.core.pulseStart..d.core.endpoint, energyIntegrand d A eta y) = |
| 565 | normalization d.core * shape eta ^ 2 / d.core.lam * scaledPulseEnergy d.core A eta := by |
| 566 | calc |
| 567 | _ = ∫ y in d.core.pulseStart..d.core.endpoint, |
| 568 | normalization d.core * shape eta ^ 2 * |
| 569 | (pulseWeight d.core (y - d.core.pulseStart) * |
| 570 | (pulseRatio d.core (fun _ => A) (y - d.core.pulseStart, eta) ^ 2 - 1 / 2)) := by |
| 571 | apply intervalIntegral.integral_congr |
| 572 | intro y hy |
| 573 | have hm := uIcc_of_le (pulseStart_le_endpoint d.core) ▸ hy |
| 574 | exact energyIntegrand_pulse d A eta hm.1 hm.2 |
| 575 | _ = _ := by |
| 576 | rw [intervalIntegral.integral_const_mul, |
| 577 | intervalIntegral.integral_comp_sub_right |
| 578 | (fun t => pulseWeight d.core t * (pulseRatio d.core (fun _ => A) (t, eta) ^ 2 - 1 / 2))] |
| 579 | simp only [Parameters.endpoint, sub_self, add_sub_cancel_left] |
| 580 | unfold scaledPulseEnergy |
| 581 | field_simp [d.core.lam_pos.ne'] ; ring_nf |
| 582 | |
| 583 | theorem energyIntegrand_late (d : OutgoingTail.TailData) (A eta : ℝ) {y : ℝ} |
| 584 | (hy : d.core.endpoint ≤ y) : |
| 585 | energyIntegrand d A eta y = -(Real.exp y * OutgoingTail.finalAngular d (y, eta) ^ 2) / 2 := by |
| 586 | unfold energyIntegrand |
| 587 | rw [axial_after_pulse d.core (fun _ => A) eta hy] |
| 588 | ring |
| 589 | |
| 590 | theorem totalEnergy_eq_of_integrable (d : OutgoingTail.TailData) (A eta : ℝ) |
| 591 | (htail : IntegrableOn (fun y => Real.exp y * OutgoingTail.finalAngular d (y, eta) ^ 2) |
| 592 | (Ioi d.core.endpoint)) : |
| 593 | totalEnergy d A eta = prefixEnergy d.core eta + |
| 594 | normalization d.core * shape eta ^ 2 / d.core.lam * scaledPulseEnergy d.core A eta - |
| 595 | tailEnergy d eta / 2 := by |
| 596 | have hlate : IntegrableOn (energyIntegrand d A eta) (Ioi d.core.endpoint) := by |
| 597 | refine IntegrableOn.congr_fun (s := Ioi d.core.endpoint) (htail.neg.div_const 2) ?_ measurableSet_Ioi |
| 598 | intro y hy |
| 599 | exact (energyIntegrand_late d A eta hy.le).symm |
| 600 | have hI : (∫ y in Ioi d.core.endpoint, energyIntegrand d A eta y) = -tailEnergy d eta / 2 := by |
| 601 | calc |
| 602 | _ = ∫ y in Ioi d.core.endpoint, -(Real.exp y * OutgoingTail.finalAngular d (y, eta) ^ 2) / 2 := by |
| 603 | apply setIntegral_congr_fun measurableSet_Ioi |
| 604 | intro y hy |
| 605 | exact energyIntegrand_late d A eta hy.le |
| 606 | _ = _ := by rw [integral_div, integral_neg]; rfl |
| 607 | have hs := intervalIntegral.integral_Iic_sub_Iic |
| 608 | (energyIntegrand_integrable_Iic d A eta d.core.pulseStart_pos.le) |
| 609 | (energyIntegrand_integrable_Iic d A eta (coreEndpoint_pos d.core).le) |
| 610 | rw [energyIntegrand_integral_prefix, energyIntegrand_integral_pulse] at hs |
| 611 | unfold totalEnergy |
| 612 | rw [← intervalIntegral.integral_Iic_add_Ioi |
| 613 | (energyIntegrand_integrable_Iic d A eta (coreEndpoint_pos d.core).le) hlate, hI] |
| 614 | linarith |
| 615 | |
| 616 | theorem tailEnergy_eq (d : OutgoingTail.TailData) (eta : ℝ) : |
| 617 | tailEnergy d eta = TailEnergyBounds.postPulseEnergy d eta := rfl |
| 618 | |
| 619 | theorem tailEnergy_contDiff (d : OutgoingTail.TailData) : ContDiff ℝ ∞ (tailEnergy d) := |
| 620 | TailEnergyBounds.postPulseEnergy_contDiff d |
| 621 | |
| 622 | theorem totalEnergy_eq (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 623 | totalEnergy d A eta = prefixEnergy d.core eta + |
| 624 | normalization d.core * shape eta ^ 2 / d.core.lam * scaledPulseEnergy d.core A eta - |
| 625 | tailEnergy d eta / 2 := |
| 626 | totalEnergy_eq_of_integrable d A eta (TailEnergyBounds.energyDensity_integrable_postPulse d eta) |
| 627 | |
| 628 | def normalizedPrefixAxial (c : Parameters) : ℝ := c.lam * prefixAxialEnergy c / normalization c |
| 629 | def normalizedPrefixAngular (c : Parameters) : ℝ := c.lam * prefixAngularEnergy c / normalization c |
| 630 | def normalizedTail (d : OutgoingTail.TailData) (eta : ℝ) : ℝ := |
| 631 | d.core.lam * tailEnergy d eta / (2 * normalization d.core * shape eta ^ 2) |
| 632 | |
| 633 | def linearTerm (c : Parameters) (eta : ℝ) : ℝ := linearCoefficient c * etaPolynomial eta |
| 634 | def constantTerm (d : OutgoingTail.TailData) (eta : ℝ) : ℝ := |
| 635 | (constantCorrection d.core + normalizedPrefixAxial d.core) * etaPolynomial eta ^ 2 - |
| 636 | RadialSchedule.pulseEnergyDebt - normalizedPrefixAngular d.core - normalizedTail d eta |
| 637 | |
| 638 | def energyPolynomial (d : OutgoingTail.TailData) (A eta : ℝ) : ℝ := |
| 639 | quadraticCoefficient d.core * A ^ 2 + linearTerm d.core eta * A + constantTerm d eta |
| 640 | |
| 641 | theorem totalEnergy_normalized (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 642 | d.core.lam * totalEnergy d A eta / (normalization d.core * shape eta ^ 2) = |
| 643 | energyPolynomial d A eta := by |
| 644 | have hN := (normalization_pos d.core).ne' |
| 645 | have hf := (shape_pos eta).ne' |
| 646 | have hq : eta ^ 2 = shape eta ^ 2 * etaPolynomial eta ^ 2 := by |
| 647 | unfold shape etaPolynomial |
| 648 | field_simp [show (1 + eta ^ 2 : ℝ) ≠ 0 by positivity] |
| 649 | have hpre : d.core.lam * prefixEnergy d.core eta / (normalization d.core * shape eta ^ 2) = |
| 650 | normalizedPrefixAxial d.core * etaPolynomial eta ^ 2 - normalizedPrefixAngular d.core := by |
| 651 | unfold prefixEnergy normalizedPrefixAxial normalizedPrefixAngular |
| 652 | rw [hq] |
| 653 | field_simp [hN, hf] |
| 654 | rw [totalEnergy_eq] |
| 655 | calc |
| 656 | _ = scaledPulseEnergy d.core A eta + |
| 657 | d.core.lam * prefixEnergy d.core eta / (normalization d.core * shape eta ^ 2) - |
| 658 | d.core.lam * tailEnergy d eta / (2 * normalization d.core * shape eta ^ 2) := by |
| 659 | field_simp [hN, hf, d.core.lam_pos.ne'] ; ring |
| 660 | _ = _ := by |
| 661 | rw [hpre, scaledPulseEnergy_eq] |
| 662 | unfold energyPolynomial linearTerm constantTerm normalizedTail |
| 663 | ring |
| 664 | |
| 665 | theorem etaPolynomial_contDiff : ContDiff ℝ ∞ etaPolynomial := |
| 666 | contDiff_id.mul (contDiff_const.add (contDiff_id.pow 2)) |
| 667 | |
| 668 | theorem normalizedTail_contDiff (d : OutgoingTail.TailData) : ContDiff ℝ ∞ (normalizedTail d) := |
| 669 | (contDiff_const.mul (tailEnergy_contDiff d)).div |
| 670 | (contDiff_const.mul (shape_contDiff.pow 2)) (fun eta => by |
| 671 | exact ne_of_gt (mul_pos (mul_pos (by norm_num) (normalization_pos d.core)) |
| 672 | (sq_pos_of_pos (shape_pos eta)))) |
| 673 | |
| 674 | theorem linearTerm_contDiff (c : Parameters) : ContDiff ℝ ∞ (linearTerm c) := |
| 675 | contDiff_const.mul etaPolynomial_contDiff |
| 676 | |
| 677 | theorem constantTerm_contDiff (d : OutgoingTail.TailData) : ContDiff ℝ ∞ (constantTerm d) := |
| 678 | (((contDiff_const.mul (etaPolynomial_contDiff.pow 2)).sub contDiff_const).sub |
| 679 | contDiff_const).sub (normalizedTail_contDiff d) |
| 680 | |
| 681 | /-- A globally smooth extension of a negative constant coefficient. It |
| 682 | agrees with the original coefficient below `-1/5`; the physical parameter |
| 683 | band will be proved to lie strictly in that region. -/ |
| 684 | def negativeClamp (x : ℝ) : ℝ := |
| 685 | (1 - sigma (10 * (x + 1 / 5))) * x - sigma (10 * (x + 1 / 5)) / 10 |
| 686 | |
| 687 | theorem negativeClamp_contDiff : ContDiff ℝ ∞ negativeClamp := |
| 688 | ((contDiff_const.sub (sigma_contDiff.comp (contDiff_const.mul |
| 689 | (contDiff_id.add contDiff_const)))).mul contDiff_id).sub |
| 690 | ((sigma_contDiff.comp (contDiff_const.mul (contDiff_id.add contDiff_const))).div_const 10) |
| 691 | |
| 692 | theorem negativeClamp_eq {x : ℝ} (hx : x ≤ -(1 / 5)) : negativeClamp x = x := by |
| 693 | unfold negativeClamp |
| 694 | rw [sigma_zero (by linarith : 10 * (x + 1 / 5) ≤ 0)] |
| 695 | ring |
| 696 | |
| 697 | theorem negativeClamp_le (x : ℝ) : negativeClamp x ≤ -(1 / 10) := by |
| 698 | by_cases hx : x ≤ -(1 / 10) |
| 699 | · have h0 := sigma_nonneg (10 * (x + 1 / 5)) |
| 700 | have h1 := sigma_le_one (10 * (x + 1 / 5)) |
| 701 | unfold negativeClamp |
| 702 | nlinarith [mul_nonneg (sub_nonneg.mpr h1) (show 0 ≤ -(1 / 10) - x by linarith)] |
| 703 | · simp only [negativeClamp, sigma_one (by linarith : 1 ≤ 10 * (x + 1 / 5))] |
| 704 | norm_num |
| 705 | |
| 706 | theorem negativeClamp_neg (x : ℝ) : negativeClamp x < 0 := |
| 707 | lt_of_le_of_lt (negativeClamp_le x) (by norm_num) |
| 708 | |
| 709 | def discriminant (d : OutgoingTail.TailData) (eta : ℝ) : ℝ := |
| 710 | linearTerm d.core eta ^ 2 - |
| 711 | 4 * quadraticCoefficient d.core * negativeClamp (constantTerm d eta) |
| 712 | |
| 713 | theorem quadraticCoefficient_pos (c : Parameters) : 0 < quadraticCoefficient c := |
| 714 | lt_of_lt_of_le (lt_trans (by norm_num) pulseConstant_lower) (quadraticCoefficient_ge c) |
| 715 | |
| 716 | theorem discriminant_pos (d : OutgoingTail.TailData) (eta : ℝ) : 0 < discriminant d eta := by |
| 717 | unfold discriminant |
| 718 | have hp := quadraticCoefficient_pos d.core |
| 719 | have hn := negativeClamp_neg (constantTerm d eta) |
| 720 | nlinarith [sq_nonneg (linearTerm d.core eta), mul_neg_of_pos_of_neg hp hn] |
| 721 | |
| 722 | /-- A globally C∞ amplitude. The negative clamp only extends the formula |
| 723 | outside the physical parameter band; the theorem below proves its exact |
| 724 | agreement with the actual energy equation where the coefficient is small. -/ |
| 725 | def amplitude (d : OutgoingTail.TailData) (eta : ℝ) : ℝ := |
| 726 | (-linearTerm d.core eta + Real.sqrt (discriminant d eta)) / (2 * quadraticCoefficient d.core) |
| 727 | |
| 728 | theorem amplitude_contDiff (d : OutgoingTail.TailData) : ContDiff ℝ ∞ (amplitude d) := by |
| 729 | have hd : ContDiff ℝ ∞ (discriminant d) := |
| 730 | ((linearTerm_contDiff d.core).pow 2).sub (contDiff_const.mul |
| 731 | (negativeClamp_contDiff.comp (constantTerm_contDiff d))) |
| 732 | exact ((linearTerm_contDiff d.core).neg.add |
| 733 | (hd.sqrt (fun eta => (discriminant_pos d eta).ne'))).div_const _ |
| 734 | |
| 735 | theorem amplitude_pos (d : OutgoingTail.TailData) (eta : ℝ) : 0 < amplitude d eta := by |
| 736 | have ha := quadraticCoefficient_pos d.core |
| 737 | have hc := negativeClamp_neg (constantTerm d eta) |
| 738 | have hd := Real.sq_sqrt (discriminant_pos d eta).le |
| 739 | have hs := Real.sqrt_nonneg (discriminant d eta) |
| 740 | have hb : linearTerm d.core eta < Real.sqrt (discriminant d eta) := by |
| 741 | dsimp only [discriminant] at hd hs ⊢ |
| 742 | nlinarith [mul_neg_of_pos_of_neg ha hc] |
| 743 | exact div_pos (by linarith) (mul_pos (by norm_num) ha) |
| 744 | |
| 745 | theorem amplitude_clamped_equation (d : OutgoingTail.TailData) (eta : ℝ) : |
| 746 | quadraticCoefficient d.core * amplitude d eta ^ 2 + |
| 747 | linearTerm d.core eta * amplitude d eta + negativeClamp (constantTerm d eta) = 0 := by |
| 748 | have hs := Real.sq_sqrt (discriminant_pos d eta).le |
| 749 | have hp : Real.sqrt (discriminant d eta) ^ 2 - linearTerm d.core eta ^ 2 + |
| 750 | 4 * quadraticCoefficient d.core * negativeClamp (constantTerm d eta) = 0 := by |
| 751 | rw [hs] |
| 752 | unfold discriminant |
| 753 | ring |
| 754 | unfold amplitude |
| 755 | field_simp [(quadraticCoefficient_pos d.core).ne'] |
| 756 | linear_combination hp |
| 757 | |
| 758 | theorem amplitude_energy_equation (d : OutgoingTail.TailData) (eta : ℝ) |
| 759 | (hc : constantTerm d eta ≤ -(1 / 5)) : energyPolynomial d (amplitude d eta) eta = 0 := by |
| 760 | have h := amplitude_clamped_equation d eta |
| 761 | rwa [negativeClamp_eq hc] at h |
| 762 | |
| 763 | theorem amplitude_totalEnergy_zero (d : OutgoingTail.TailData) (eta : ℝ) |
| 764 | (hc : constantTerm d eta ≤ -(1 / 5)) : totalEnergy d (amplitude d eta) eta = 0 := by |
| 765 | have h := totalEnergy_normalized d (amplitude d eta) eta |
| 766 | rw [amplitude_energy_equation d eta hc] at h |
| 767 | have hmul := (div_eq_zero_iff).mp h |
| 768 | rcases hmul with hmul | hz |
| 769 | · exact (mul_eq_zero.mp hmul).resolve_left d.core.lam_pos.ne' |
| 770 | · exact False.elim ((mul_pos (normalization_pos d.core) (sq_pos_of_pos (shape_pos eta))).ne' hz) |
| 771 | |
| 772 | /-! ## Actual coefficient estimates for the paper's wait duration -/ |
| 773 | |
| 774 | def logarithmicRate (lam : ℝ) : ℝ := lam * (1 + Real.log (1 / lam)) |
| 775 | |
| 776 | theorem log_inverse_nonneg (c : Parameters) : 0 ≤ Real.log (1 / c.lam) := by |
| 777 | apply Real.log_nonneg |
| 778 | apply (le_div_iff₀ c.lam_pos).mpr |
| 779 | linarith [c.lam_lt] |
| 780 | |
| 781 | theorem logarithmicRate_pos (c : Parameters) : 0 < logarithmicRate c.lam := |
| 782 | mul_pos c.lam_pos (by linarith [log_inverse_nonneg c]) |
| 783 | |
| 784 | theorem lambda_le_logarithmicRate (c : Parameters) : c.lam ≤ logarithmicRate c.lam := by |
| 785 | unfold logarithmicRate |
| 786 | nlinarith [mul_nonneg c.lam_pos.le (log_inverse_nonneg c)] |
| 787 | |
| 788 | theorem prefixAxialEnergy_nonneg (c : Parameters) : 0 ≤ prefixAxialEnergy c := by |
| 789 | have hi := intervalIntegral.integral_nonneg_of_forall (μ := volume) c.pulseStart_pos.le |
| 790 | (fun y => mul_nonneg (Real.exp_pos y).le (sq_nonneg (dropCoefficient c.m y))) |
| 791 | unfold prefixAxialEnergy |
| 792 | linarith |
| 793 | |
| 794 | theorem prefixAngularEnergy_nonneg (c : Parameters) : 0 ≤ prefixAngularEnergy c := by |
| 795 | have hi := intervalIntegral.integral_nonneg_of_forall (μ := volume) c.pulseStart_pos.le |
| 796 | (fun y => div_nonneg (coreEnergyWeight_nonneg c y) (by norm_num : (0 : ℝ) ≤ 2)) |
| 797 | unfold prefixAngularEnergy |
| 798 | nlinarith [sq_nonneg c.P] |
| 799 | |
| 800 | theorem normalizedPrefix_nonneg (c : Parameters) : |
| 801 | 0 ≤ normalizedPrefixAxial c ∧ 0 ≤ normalizedPrefixAngular c := |
| 802 | ⟨div_nonneg (mul_nonneg c.lam_pos.le (prefixAxialEnergy_nonneg c)) (normalization_pos c).le, |
| 803 | div_nonneg (mul_nonneg c.lam_pos.le (prefixAngularEnergy_nonneg c)) (normalization_pos c).le⟩ |
| 804 | |
| 805 | theorem normalizedPrefix_bound_raw (c : Parameters) : |
| 806 | normalizedPrefixAxial c + normalizedPrefixAngular c ≤ |
| 807 | c.lam * Real.exp (2 * c.lam * c.pulseStart) * |
| 808 | (16 * Real.exp (Real.exp c.m) / c.P ^ 2 + 5 / 12 + c.pulseStart / 2) := by |
| 809 | have hN := normalization_pos c |
| 810 | have hP := sq_pos_of_pos c.P_pos |
| 811 | have hinv : 1 / normalization c ≤ Real.exp (2 * c.lam * c.pulseStart) / c.P ^ 2 := by |
| 812 | apply (div_le_div_iff₀ hN hP).mpr |
| 813 | simpa only [one_mul, mul_one, mul_comm] using initial_weight_bound c |
| 814 | have hax : prefixAxialEnergy c / normalization c ≤ |
| 815 | (16 * Real.exp (Real.exp c.m)) * (Real.exp (2 * c.lam * c.pulseStart) / c.P ^ 2) := by |
| 816 | simpa only [div_eq_mul_inv, one_mul] using |
| 817 | mul_le_mul (prefixAxialEnergy_bound c) hinv (by positivity) |
| 818 | (show 0 ≤ 16 * Real.exp (Real.exp c.m) by positivity) |
| 819 | have hang : prefixAngularEnergy c / normalization c ≤ |
| 820 | (5 / 12 + c.pulseStart / 2) * Real.exp (2 * c.lam * c.pulseStart) := by |
| 821 | apply (div_le_iff₀ hN).mpr |
| 822 | convert! prefixAngularEnergy_bound c using 1 |
| 823 | ring |
| 824 | have hsum := mul_le_mul_of_nonneg_left (add_le_add hax hang) c.lam_pos.le |
| 825 | unfold normalizedPrefixAxial normalizedPrefixAngular |
| 826 | convert! hsum using 1 <;> ring |
| 827 | |
| 828 | def prefixBoundConstant (P m : ℝ) : ℝ := |
| 829 | Real.exp ((Real.exp m + 12) / 5 + 120) * |
| 830 | (16 * Real.exp (Real.exp m) / P ^ 2 + 5 / 12 + (Real.exp m + 12) / 2 + 30) |
| 831 | |
| 832 | theorem prefixBoundConstant_pos (P m : ℝ) : 0 < prefixBoundConstant P m := by |
| 833 | unfold prefixBoundConstant |
| 834 | positivity |
| 835 | |
| 836 | theorem wait_exponential_bound (c : Parameters) |
| 837 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) : |
| 838 | Real.exp (2 * c.lam * c.pulseStart) ≤ Real.exp ((Real.exp c.m + 12) / 5 + 120) := by |
| 839 | have hl := Real.log_le_sub_one_of_pos (one_div_pos.mpr c.lam_pos) |
| 840 | have hm := mul_le_mul_of_nonneg_left hl c.lam_pos.le |
| 841 | have hc : c.lam * (1 / c.lam - 1) = 1 - c.lam := by field_simp [c.lam_pos.ne'] |
| 842 | rw [hc] at hm |
| 843 | have hb : c.pulseStart = Real.exp c.m + 12 + 60 * Real.log (1 / c.lam) := by |
| 844 | simp only [Parameters.pulseStart, Parameters.holdStart, Parameters.dropLength, hwait] |
| 845 | ring |
| 846 | apply Real.exp_le_exp.mpr |
| 847 | rw [hb] |
| 848 | nlinarith [c.lam_pos, mul_nonneg (show 0 ≤ Real.exp c.m + 12 by positivity) |
| 849 | (show 0 ≤ 1 / 10 - c.lam by linarith [c.lam_lt])] |
| 850 | |
| 851 | theorem normalizedPrefix_bound (c : Parameters) |
| 852 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) : |
| 853 | normalizedPrefixAxial c + normalizedPrefixAngular c ≤ |
| 854 | prefixBoundConstant c.P c.m * logarithmicRate c.lam := by |
| 855 | have hb : c.pulseStart = Real.exp c.m + 12 + 60 * Real.log (1 / c.lam) := by |
| 856 | simp only [Parameters.pulseStart, Parameters.holdStart, Parameters.dropLength, hwait] |
| 857 | ring |
| 858 | let F := 16 * Real.exp (Real.exp c.m) / c.P ^ 2 + 5 / 12 + (Real.exp c.m + 12) / 2 + 30 |
| 859 | have hF : 0 ≤ F := by dsimp [F]; positivity |
| 860 | have hfac : 16 * Real.exp (Real.exp c.m) / c.P ^ 2 + 5 / 12 + c.pulseStart / 2 ≤ |
| 861 | F * (1 + Real.log (1 / c.lam)) := by |
| 862 | rw [hb] |
| 863 | dsimp [F] |
| 864 | nlinarith [mul_nonneg (show 0 ≤ 16 * Real.exp (Real.exp c.m) / c.P ^ 2 + |
| 865 | 5 / 12 + (Real.exp c.m + 12) / 2 by positivity) (log_inverse_nonneg c)] |
| 866 | calc |
| 867 | normalizedPrefixAxial c + normalizedPrefixAngular c ≤ |
| 868 | c.lam * Real.exp (2 * c.lam * c.pulseStart) * |
| 869 | (16 * Real.exp (Real.exp c.m) / c.P ^ 2 + 5 / 12 + c.pulseStart / 2) := |
| 870 | normalizedPrefix_bound_raw c |
| 871 | _ ≤ c.lam * Real.exp ((Real.exp c.m + 12) / 5 + 120) * |
| 872 | (F * (1 + Real.log (1 / c.lam))) := by |
| 873 | apply mul_le_mul |
| 874 | · exact mul_le_mul_of_nonneg_left (wait_exponential_bound c hwait) c.lam_pos.le |
| 875 | · exact hfac |
| 876 | · exact add_nonneg (add_nonneg (div_nonneg (by positivity) (sq_nonneg _)) |
| 877 | (by norm_num)) (div_nonneg c.pulseStart_pos.le (by norm_num)) |
| 878 | · exact mul_nonneg c.lam_pos.le (Real.exp_pos _).le |
| 879 | _ = prefixBoundConstant c.P c.m * logarithmicRate c.lam := by |
| 880 | dsimp [prefixBoundConstant, logarithmicRate, F] |
| 881 | ring |
| 882 | |
| 883 | theorem normalizedTail_nonneg (d : OutgoingTail.TailData) (eta : ℝ) : 0 ≤ normalizedTail d eta := by |
| 884 | apply div_nonneg |
| 885 | · exact mul_nonneg d.core.lam_pos.le (TailEnergyBounds.postPulseEnergy_nonneg d eta) |
| 886 | · exact mul_nonneg (mul_nonneg (by norm_num) (normalization_pos d.core).le) (sq_nonneg _) |
| 887 | |
| 888 | theorem normalizedTail_bound (d : OutgoingTail.TailData) (eta : ℝ) (heta : eta ^ 2 ≤ 1) : |
| 889 | normalizedTail d eta ≤ (TailEnergyBounds.tailConstant / 2) * logarithmicRate d.core.lam := by |
| 890 | have h := TailEnergyBounds.normalized_postPulseEnergy_le d eta heta |
| 891 | unfold normalizedTail logarithmicRate normalization |
| 892 | change d.core.lam * TailEnergyBounds.postPulseEnergy d eta / |
| 893 | (2 * (Real.exp d.core.pulseStart * pulseAmplitude d.core ^ 2) * shape eta ^ 2) ≤ _ |
| 894 | calc |
| 895 | _ = (d.core.lam * TailEnergyBounds.postPulseEnergy d eta / |
| 896 | (Real.exp d.core.pulseStart * pulseAmplitude d.core ^ 2 * shape eta ^ 2)) / 2 := by ring |
| 897 | _ ≤ (TailEnergyBounds.tailConstant * d.core.lam * (1 + Real.log (1 / d.core.lam))) / 2 := by |
| 898 | exact div_le_div_of_nonneg_right h (by norm_num) |
| 899 | _ = _ := by ring |
| 900 | |
| 901 | theorem pulseWeight_le_one (c : Parameters) {y : ℝ} (hy : 0 ≤ y) : pulseWeight c y ≤ 1 := by |
| 902 | apply Real.exp_le_one_iff.mpr |
| 903 | nlinarith [mul_nonneg c.lam_pos.le hy] |
| 904 | |
| 905 | theorem weighted_square_bound (c : Parameters) (f : ℝ → ℝ) (hf : Continuous f) |
| 906 | (M : ℝ) (hM : 0 ≤ M) (hbound : ∀ y, |f y| ≤ M) : |
| 907 | 0 ≤ c.lam * (∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * f y ^ 2) ∧ |
| 908 | c.lam * (∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * f y ^ 2) ≤ 13 * M ^ 2 := by |
| 909 | have hw : Continuous (fun y => pulseWeight c y * f y ^ 2) := |
| 910 | (pulseWeight_continuous c).mul (hf.pow 2) |
| 911 | have hn := intervalIntegral.integral_nonneg_of_forall (μ := volume) c.pulseLength_pos.le |
| 912 | (fun y => mul_nonneg (Real.exp_pos (-2 * c.lam * y)).le (sq_nonneg (f y))) |
| 913 | have hi := intervalIntegral.integral_mono_on (μ := volume) c.pulseLength_pos.le |
| 914 | (hw.intervalIntegrable _ _) (continuous_const.intervalIntegrable _ _) |
| 915 | (fun y hy => show pulseWeight c y * f y ^ 2 ≤ M ^ 2 from by |
| 916 | have hs : f y ^ 2 ≤ M ^ 2 := by |
| 917 | simpa only [sq_abs] using (sq_le_sq₀ (abs_nonneg _) hM).mpr (hbound y) |
| 918 | exact (mul_le_mul_of_nonneg_right (pulseWeight_le_one c hy.1) (sq_nonneg _)).trans |
| 919 | (by simpa using hs)) |
| 920 | simp only [intervalIntegral.integral_const, sub_zero, smul_eq_mul] at hi |
| 921 | have hmul := mul_le_mul_of_nonneg_left hi c.lam_pos.le |
| 922 | have hL : c.lam * c.pulseLength = 13 := by |
| 923 | dsimp [Parameters.pulseLength] |
| 924 | field_simp [c.lam_pos.ne'] |
| 925 | refine ⟨mul_nonneg c.lam_pos.le hn, ?_⟩ |
| 926 | nlinarith [hmul, hL] |
| 927 | |
| 928 | theorem weighted_product_bound (c : Parameters) (f g : ℝ → ℝ) |
| 929 | (M : ℝ) (hM : 0 ≤ M) (hf : ∀ y, |f y| ≤ M) (hg : ∀ y, |g y| ≤ M) : |
| 930 | |c.lam * (∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * f y * g y)| ≤ 13 * M ^ 2 := by |
| 931 | have hi := intervalIntegral.norm_integral_le_of_norm_le_const |
| 932 | (a := 0) (b := c.pulseLength) (C := M ^ 2) |
| 933 | (f := fun y => pulseWeight c y * f y * g y) (fun y hy => by |
| 934 | have hy0 : 0 ≤ y := (uIoc_of_le c.pulseLength_pos.le ▸ hy).1.le |
| 935 | rw [Real.norm_eq_abs, abs_mul, abs_mul, |
| 936 | abs_of_pos (show 0 < pulseWeight c y from Real.exp_pos _)] |
| 937 | calc |
| 938 | pulseWeight c y * |f y| * |g y| ≤ 1 * M * M := by |
| 939 | exact mul_le_mul (mul_le_mul (pulseWeight_le_one c hy0) (hf y) |
| 940 | (abs_nonneg _) (by norm_num)) (hg y) (abs_nonneg _) (by simpa using hM) |
| 941 | _ = M ^ 2 := by ring) |
| 942 | simp only [Real.norm_eq_abs, sub_zero, abs_of_nonneg c.pulseLength_pos.le] at hi |
| 943 | rw [abs_mul, abs_of_pos c.lam_pos] |
| 944 | have hmul := mul_le_mul_of_nonneg_left hi c.lam_pos.le |
| 945 | have hL : c.lam * c.pulseLength = 13 := by |
| 946 | dsimp [Parameters.pulseLength] |
| 947 | field_simp [c.lam_pos.ne'] |
| 948 | nlinarith [hmul, hL] |
| 949 | |
| 950 | theorem etaPolynomial_hasDerivAt (eta : ℝ) : |
| 951 | HasDerivAt etaPolynomial (1 + 3 * eta ^ 2) eta := by |
| 952 | convert! (hasDerivAt_id eta).fun_mul (((hasDerivAt_id eta).fun_pow 2).const_add 1) using 1 |
| 953 | simp only [id_eq] |
| 954 | ring |
| 955 | |
| 956 | theorem etaPolynomial_bounds {eta : ℝ} (heta : eta ^ 2 ≤ 1) : |
| 957 | |etaPolynomial eta| ≤ 2 ∧ |deriv etaPolynomial eta| ≤ 4 := by |
| 958 | have he : |eta| ≤ 1 := abs_le.mpr ⟨by nlinarith, by nlinarith⟩ |
| 959 | constructor |
| 960 | · rw [etaPolynomial, abs_mul, abs_of_nonneg (by positivity : 0 ≤ 1 + eta ^ 2)] |
| 961 | nlinarith [mul_nonneg (show 0 ≤ 1 - |eta| by linarith) (show 0 ≤ 1 + eta ^ 2 by positivity)] |
| 962 | · rw [(etaPolynomial_hasDerivAt eta).deriv, abs_of_nonneg (by positivity : 0 ≤ 1 + 3 * eta ^ 2)] |
| 963 | linarith |
| 964 | |
| 965 | theorem quadratic_root_bracket {a b c r : ℝ} |
| 966 | (ha : 1 / 5 ≤ a) (ha' : a ≤ 13 / 50) (hb : |b| ≤ 1 / 100) |
| 967 | (hc : -(13 / 50) ≤ c) (hc' : c ≤ -(23 / 100)) |
| 968 | (hr : 0 < r) (heq : a * r ^ 2 + b * r + c = 0) : |
| 969 | 9 / 10 < r ∧ r < 6 / 5 := by |
| 970 | obtain ⟨hbl, hbu⟩ := abs_le.mp hb |
| 971 | constructor |
| 972 | · by_contra h |
| 973 | have hrl : r ≤ 9 / 10 := le_of_not_gt h |
| 974 | have hs : r ^ 2 ≤ (9 / 10 : ℝ) ^ 2 := by |
| 975 | nlinarith [mul_nonneg (show 0 ≤ 9 / 10 - r by linarith) (show 0 ≤ 9 / 10 + r by linarith)] |
| 976 | have haR := mul_le_mul_of_nonneg_right ha' (sq_nonneg r) |
| 977 | have hbR := mul_le_mul_of_nonneg_right hbu hr.le |
| 978 | nlinarith |
| 979 | · by_contra h |
| 980 | have hru : 6 / 5 ≤ r := le_of_not_gt h |
| 981 | have hs := mul_nonneg (show 0 ≤ r - 6 / 5 by linarith) hr.le |
| 982 | have haR := mul_le_mul_of_nonneg_right ha (sq_nonneg r) |
| 983 | have hbR := mul_le_mul_of_nonneg_right hbl hr.le |
| 984 | nlinarith |
| 985 | |
| 986 | theorem amplitude_derivative_identity (d : OutgoingTail.TailData) (eta : ℝ) |
| 987 | (hc : constantTerm d eta < -(1 / 5)) : |
| 988 | (2 * quadraticCoefficient d.core * amplitude d eta + linearTerm d.core eta) * |
| 989 | deriv (amplitude d) eta + |
| 990 | deriv (linearTerm d.core) eta * amplitude d eta + deriv (constantTerm d) eta = 0 := by |
| 991 | let F : ℝ → ℝ := fun t => energyPolynomial d (amplitude d t) t |
| 992 | have he : F =ᶠ[𝓝 eta] (fun _ => 0) := by |
| 993 | filter_upwards [(isOpen_lt (constantTerm_contDiff d).continuous continuous_const).mem_nhds hc] |
| 994 | with t ht |
| 995 | exact amplitude_energy_equation d t ht.le |
| 996 | have hz : deriv F eta = 0 := by rw [he.deriv_eq]; exact deriv_const _ _ |
| 997 | have hA := ((amplitude_contDiff d).differentiable (by simp) eta).hasDerivAt |
| 998 | have hb := ((linearTerm_contDiff d.core).differentiable (by simp) eta).hasDerivAt |
| 999 | have hcc := ((constantTerm_contDiff d).differentiable (by simp) eta).hasDerivAt |
| 1000 | have hd := (((hA.pow 2).const_mul (quadraticCoefficient d.core)).add (hb.mul hA)).add hcc |
| 1001 | change HasDerivAt F _ eta at hd |
| 1002 | rw [hd.deriv] at hz |
| 1003 | convert! hz using 1 |
| 1004 | ring |
| 1005 | |
| 1006 | theorem prefixRepair_eq_affineProfile (c : Parameters) (y : ℝ) : |
| 1007 | prefixRepair c y = OutgoingPulseBounds.affineProfile c 1 0 y := by |
| 1008 | unfold prefixRepair LocalizedMomentRepair.repair OutgoingPulseBounds.affineProfile |
| 1009 | OutgoingPulseBounds.affineCoefficients OutgoingPulseBounds.affineDebt |
| 1010 | simp only [one_mul, zero_mul, add_zero] |
| 1011 | apply Finset.sum_congr rfl |
| 1012 | intro j _ |
| 1013 | rw [OutgoingPulseBounds.bump_log_translate] |
| 1014 | |
| 1015 | theorem amplitudeRepair_eq_affineProfile (c : Parameters) (y : ℝ) : |
| 1016 | amplitudeRepair c y = OutgoingPulseBounds.affineProfile c 0 1 y := by |
| 1017 | unfold amplitudeRepair LocalizedMomentRepair.repair OutgoingPulseBounds.affineProfile |
| 1018 | OutgoingPulseBounds.affineCoefficients OutgoingPulseBounds.affineDebt |
| 1019 | simp only [one_mul, zero_mul, zero_add] |
| 1020 | apply Finset.sum_congr rfl |
| 1021 | intro j _ |
| 1022 | rw [OutgoingPulseBounds.bump_log_translate] |
| 1023 | |
| 1024 | theorem repairBasis_bound (c : Parameters) (hsmall : c.lam ≤ 1 / 120) (y : ℝ) : |
| 1025 | |prefixRepair c y| ≤ OutgoingPulseBounds.correctionJetBound c.P c.m 0 * |
| 1026 | Real.exp (-(1 / (4 * c.lam))) ∧ |
| 1027 | |amplitudeRepair c y| ≤ OutgoingPulseBounds.correctionJetBound c.P c.m 0 * |
| 1028 | Real.exp (-(1 / (4 * c.lam))) := by |
| 1029 | rw [prefixRepair_eq_affineProfile, amplitudeRepair_eq_affineProfile] |
| 1030 | constructor |
| 1031 | · simpa using OutgoingPulseBounds.affineProfile_jet_bound c hsmall 1 0 0 y |
| 1032 | · simpa using OutgoingPulseBounds.affineProfile_jet_bound c hsmall 0 1 0 y |
| 1033 | |
| 1034 | theorem exp_inverse_bound {lam : ℝ} (hlam : 0 < lam) : |
| 1035 | Real.exp (-(1 / (4 * lam))) ^ 2 ≤ 4 * lam := by |
| 1036 | have hp : 0 < 1 / (4 * lam) := by positivity |
| 1037 | have he : 1 / (4 * lam) ≤ Real.exp (1 / (4 * lam)) := by |
| 1038 | linarith [Real.add_one_le_exp (1 / (4 * lam))] |
| 1039 | have hinv := one_div_le_one_div_of_le hp he |
| 1040 | have hlin : Real.exp (-(1 / (4 * lam))) ≤ 4 * lam := by |
| 1041 | rw [Real.exp_neg] |
| 1042 | simpa only [one_div, inv_inv] using hinv |
| 1043 | have hu : Real.exp (-(1 / (4 * lam))) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith) |
| 1044 | have hm := mul_le_mul hlin hu (Real.exp_pos _).le (by positivity : 0 ≤ 4 * lam) |
| 1045 | nlinarith |
| 1046 | |
| 1047 | def correctionEnergyConstant (P m : ℝ) : ℝ := |
| 1048 | 104 * OutgoingPulseBounds.correctionJetBound P m 0 ^ 2 |
| 1049 | |
| 1050 | theorem correctionEnergyConstant_pos {P : ℝ} (hP : 0 < P) (m : ℝ) : |
| 1051 | 0 < correctionEnergyConstant P m := by |
| 1052 | unfold correctionEnergyConstant |
| 1053 | exact mul_pos (by norm_num) (sq_pos_of_pos (OutgoingPulseBounds.correctionJetBound_pos hP m 0)) |
| 1054 | |
| 1055 | theorem correctionEnergy_bounds (c : Parameters) (hsmall : c.lam ≤ 1 / 120) : |
| 1056 | 0 ≤ quadraticCoefficient c - pulseConstant ∧ |
| 1057 | quadraticCoefficient c - pulseConstant ≤ correctionEnergyConstant c.P c.m * c.lam ∧ |
| 1058 | |linearCoefficient c| ≤ correctionEnergyConstant c.P c.m * c.lam ∧ |
| 1059 | 0 ≤ constantCorrection c ∧ |
| 1060 | constantCorrection c ≤ correctionEnergyConstant c.P c.m * c.lam := by |
| 1061 | let M := OutgoingPulseBounds.correctionJetBound c.P c.m 0 * Real.exp (-(1 / (4 * c.lam))) |
| 1062 | have hM : 0 ≤ M := mul_nonneg (OutgoingPulseBounds.correctionJetBound_pos c.P_pos c.m 0).le |
| 1063 | (Real.exp_pos _).le |
| 1064 | have h0 : ∀ y, |prefixRepair c y| ≤ M := fun y => (repairBasis_bound c hsmall y).1 |
| 1065 | have h1 : ∀ y, |amplitudeRepair c y| ≤ M := fun y => (repairBasis_bound c hsmall y).2 |
| 1066 | have hb0 := weighted_square_bound c (prefixRepair c) (prefixRepair_contDiff c).continuous M hM h0 |
| 1067 | have hb1 := weighted_square_bound c (amplitudeRepair c) (amplitudeRepair_contDiff c).continuous M hM h1 |
| 1068 | have hcross := weighted_product_bound c (amplitudeRepair c) (prefixRepair c) M hM h1 h0 |
| 1069 | have hlin : linearCoefficient c = 2 * (c.lam * |
| 1070 | ∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * amplitudeRepair c y * prefixRepair c y) := by |
| 1071 | unfold linearCoefficient |
| 1072 | rw [mul_assoc] |
| 1073 | congr 2 |
| 1074 | apply intervalIntegral.integral_congr |
| 1075 | intro y _ |
| 1076 | dsimp only |
| 1077 | calc |
| 1078 | _ = pulseWeight c y * (mainPulse (c.lam * y) * prefixRepair c y) + |
| 1079 | pulseWeight c y * amplitudeRepair c y * prefixRepair c y := by unfold amplitudeShape; ring |
| 1080 | _ = _ := by rw [mainPulse_mul_prefixRepair, mul_zero, zero_add] |
| 1081 | have hqeq : quadraticCoefficient c - pulseConstant = |
| 1082 | c.lam * ∫ y in (0 : ℝ)..c.pulseLength, pulseWeight c y * amplitudeRepair c y ^ 2 := by |
| 1083 | rw [quadraticCoefficient_eq] |
| 1084 | ring |
| 1085 | rw [← hqeq] at hb1 |
| 1086 | have hlarge : 26 * M ^ 2 ≤ correctionEnergyConstant c.P c.m * c.lam := by |
| 1087 | have he := mul_le_mul_of_nonneg_left (exp_inverse_bound c.lam_pos) |
| 1088 | (sq_nonneg (OutgoingPulseBounds.correctionJetBound c.P c.m 0)) |
| 1089 | dsimp [M, correctionEnergyConstant] |
| 1090 | nlinarith |
| 1091 | have hq : 13 * M ^ 2 ≤ 26 * M ^ 2 := by nlinarith [sq_nonneg M] |
| 1092 | refine ⟨hb1.1, hb1.2.trans (hq.trans hlarge), ?_, hb0.1, hb0.2.trans (hq.trans hlarge)⟩ |
| 1093 | rw [hlin, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] |
| 1094 | exact (mul_le_mul_of_nonneg_left hcross (by norm_num : (0 : ℝ) ≤ 2)).trans |
| 1095 | (by nlinarith [hlarge]) |
| 1096 | |
| 1097 | def errorConstant (P m : ℝ) : ℝ := |
| 1098 | 1 + prefixBoundConstant P m + correctionEnergyConstant P m + |
| 1099 | 2 * OutgoingTail.flattenLength + 4 * TailEnergyBounds.tailConstant |
| 1100 | |
| 1101 | theorem errorConstant_pos {P : ℝ} (hP : 0 < P) (m : ℝ) : 0 < errorConstant P m := by |
| 1102 | unfold errorConstant |
| 1103 | linarith [prefixBoundConstant_pos P m, correctionEnergyConstant_pos hP m, |
| 1104 | OutgoingTail.flattenLength_pos, TailEnergyBounds.tailConstant_pos] |
| 1105 | |
| 1106 | theorem errorConstant_ge {P : ℝ} (hP : 0 < P) (m : ℝ) : |
| 1107 | prefixBoundConstant P m ≤ errorConstant P m ∧ |
| 1108 | correctionEnergyConstant P m ≤ errorConstant P m ∧ |
| 1109 | TailEnergyBounds.tailConstant / 2 ≤ errorConstant P m ∧ |
| 1110 | OutgoingTail.flattenLength + 2 * TailEnergyBounds.tailConstant ≤ errorConstant P m := by |
| 1111 | unfold errorConstant |
| 1112 | have hp := prefixBoundConstant_pos P m |
| 1113 | have hc := correctionEnergyConstant_pos hP m |
| 1114 | have hf := OutgoingTail.flattenLength_pos |
| 1115 | have ht := TailEnergyBounds.tailConstant_pos |
| 1116 | constructor |
| 1117 | · linarith |
| 1118 | constructor |
| 1119 | · linarith |
| 1120 | constructor <;> linarith |
| 1121 | |
| 1122 | def errorScale (c : Parameters) : ℝ := errorConstant c.P c.m * logarithmicRate c.lam |
| 1123 | |
| 1124 | theorem errorScale_pos (c : Parameters) : 0 < errorScale c := |
| 1125 | mul_pos (errorConstant_pos c.P_pos c.m) (logarithmicRate_pos c) |
| 1126 | |
| 1127 | /-- Bounds on the actual integral coefficients. This proposition is proved |
| 1128 | from the explicit schedule in `actual_energy_error_bounds` below. -/ |
| 1129 | structure EnergyErrorBounds (d : OutgoingTail.TailData) (eta e : ℝ) : Prop where |
| 1130 | scale_nonneg : 0 ≤ e |
| 1131 | quadratic_error : quadraticCoefficient d.core - pulseConstant ≤ e |
| 1132 | linear_error : |linearCoefficient d.core| ≤ e |
| 1133 | correction_nonneg : 0 ≤ constantCorrection d.core |
| 1134 | correction_error : constantCorrection d.core ≤ e |
| 1135 | prefix_axial_nonneg : 0 ≤ normalizedPrefixAxial d.core |
| 1136 | prefix_axial_error : normalizedPrefixAxial d.core ≤ e |
| 1137 | prefix_angular_nonneg : 0 ≤ normalizedPrefixAngular d.core |
| 1138 | prefix_angular_error : normalizedPrefixAngular d.core ≤ e |
| 1139 | tail_nonneg : 0 ≤ normalizedTail d eta |
| 1140 | tail_error : normalizedTail d eta ≤ e |
| 1141 | |
| 1142 | theorem actual_energy_error_bounds (d : OutgoingTail.TailData) |
| 1143 | (hsmall : d.core.lam ≤ 1 / 120) (hwait : d.core.wait = 60 * Real.log (1 / d.core.lam)) |
| 1144 | (eta : ℝ) (heta : eta ^ 2 ≤ 1) : EnergyErrorBounds d eta (errorScale d.core) := by |
| 1145 | obtain ⟨_, hq, hl, hc0, hc⟩ := correctionEnergy_bounds d.core hsmall |
| 1146 | have hC := errorConstant_ge d.core.P_pos d.core.m |
| 1147 | have hrate := logarithmicRate_pos d.core |
| 1148 | have hcorr : correctionEnergyConstant d.core.P d.core.m * d.core.lam ≤ errorScale d.core := by |
| 1149 | exact (mul_le_mul_of_nonneg_left (lambda_le_logarithmicRate d.core) |
| 1150 | (correctionEnergyConstant_pos d.core.P_pos d.core.m).le).trans |
| 1151 | (mul_le_mul_of_nonneg_right hC.2.1 hrate.le) |
| 1152 | have hpre : normalizedPrefixAxial d.core + normalizedPrefixAngular d.core ≤ errorScale d.core := |
| 1153 | (normalizedPrefix_bound d.core hwait).trans (mul_le_mul_of_nonneg_right hC.1 hrate.le) |
| 1154 | have hn := normalizedPrefix_nonneg d.core |
| 1155 | exact ⟨(errorScale_pos d.core).le, hq.trans hcorr, hl.trans hcorr, hc0, hc.trans hcorr, |
| 1156 | hn.1, by linarith, hn.2, by linarith, normalizedTail_nonneg d eta, |
| 1157 | (normalizedTail_bound d eta heta).trans (mul_le_mul_of_nonneg_right hC.2.2.1 hrate.le)⟩ |
| 1158 | |
| 1159 | theorem numerical_coefficient_bounds (d : OutgoingTail.TailData) (eta e : ℝ) |
| 1160 | (heta : eta ^ 2 ≤ 1) (h : EnergyErrorBounds d eta e) (he : e ≤ 1 / 1000) : |
| 1161 | 1 / 5 ≤ quadraticCoefficient d.core ∧ quadraticCoefficient d.core ≤ 13 / 50 ∧ |
| 1162 | |linearTerm d.core eta| ≤ 1 / 100 ∧ |
| 1163 | -(13 / 50) ≤ constantTerm d eta ∧ constantTerm d eta ≤ -(23 / 100) := by |
| 1164 | have hq := etaPolynomial_bounds heta |
| 1165 | have hq2 : etaPolynomial eta ^ 2 ≤ 4 := by |
| 1166 | have hb := abs_le.mp hq.1 |
| 1167 | nlinarith [sq_nonneg (etaPolynomial eta)] |
| 1168 | have hprod0 : 0 ≤ (constantCorrection d.core + normalizedPrefixAxial d.core) * etaPolynomial eta ^ 2 := |
| 1169 | mul_nonneg (add_nonneg h.correction_nonneg h.prefix_axial_nonneg) (sq_nonneg _) |
| 1170 | have hprod : (constantCorrection d.core + normalizedPrefixAxial d.core) * etaPolynomial eta ^ 2 ≤ 8 * e := by |
| 1171 | have hm := mul_le_mul (add_le_add h.correction_error h.prefix_axial_error) hq2 |
| 1172 | (sq_nonneg (etaPolynomial eta)) (by linarith [h.scale_nonneg]) |
| 1173 | nlinarith |
| 1174 | have hb : |linearTerm d.core eta| ≤ e * 2 := by |
| 1175 | unfold linearTerm |
| 1176 | rw [abs_mul] |
| 1177 | exact mul_le_mul h.linear_error hq.1 (abs_nonneg _) h.scale_nonneg |
| 1178 | have hD := RadialSchedule.pulse_energy_debt_bounds |
| 1179 | refine ⟨pulseConstant_lower.le.trans (quadraticCoefficient_ge d.core), ?_, by linarith, ?_, ?_⟩ |
| 1180 | · linarith [h.quadratic_error, pulseConstant_upper] |
| 1181 | · unfold constantTerm |
| 1182 | linarith [h.prefix_angular_error, h.tail_error] |
| 1183 | · unfold constantTerm |
| 1184 | linarith [h.prefix_angular_nonneg, h.tail_nonneg] |
| 1185 | |
| 1186 | theorem amplitude_spec_of_error_bound (d : OutgoingTail.TailData) (eta e : ℝ) |
| 1187 | (heta : eta ^ 2 ≤ 1) (h : EnergyErrorBounds d eta e) (he : e ≤ 1 / 1000) : |
| 1188 | 9 / 10 < amplitude d eta ∧ amplitude d eta < 6 / 5 ∧ |
| 1189 | totalEnergy d (amplitude d eta) eta = 0 := by |
| 1190 | obtain ⟨ha, ha', hb, hc, hc'⟩ := numerical_coefficient_bounds d eta e heta h he |
| 1191 | have hsmall : constantTerm d eta ≤ -(1 / 5) := by linarith |
| 1192 | have heq := amplitude_energy_equation d eta hsmall |
| 1193 | have hr := quadratic_root_bracket ha ha' hb hc hc' (amplitude_pos d eta) heq |
| 1194 | exact ⟨hr.1, hr.2, amplitude_totalEnergy_zero d eta hsmall⟩ |
| 1195 | |
| 1196 | theorem normalizedTail_derivative_bound (d : OutgoingTail.TailData) (eta : ℝ) |
| 1197 | (heta : eta ^ 2 ≤ 1) : |deriv (normalizedTail d) eta| ≤ errorScale d.core := by |
| 1198 | have he : normalizedTail d = (fun t => TailEnergyBounds.normalizedPostPulseEnergy d t / 2) := by |
| 1199 | funext t |
| 1200 | unfold normalizedTail TailEnergyBounds.normalizedPostPulseEnergy normalization |
| 1201 | rw [tailEnergy_eq] |
| 1202 | ring |
| 1203 | have hd := (((TailEnergyBounds.normalizedPostPulseEnergy_contDiff d).differentiable |
| 1204 | (by simp) eta).hasDerivAt.div_const 2).deriv |
| 1205 | rw [he, hd, abs_div, abs_of_pos (by norm_num : (0 : ℝ) < 2)] |
| 1206 | have h := TailEnergyBounds.abs_deriv_normalizedPostPulseEnergy_le d eta heta |
| 1207 | have hm := div_le_div_of_nonneg_right h (by norm_num : (0 : ℝ) ≤ 2) |
| 1208 | have hC := (errorConstant_ge d.core.P_pos d.core.m).2.2.2 |
| 1209 | calc |
| 1210 | _ ≤ (OutgoingTail.flattenLength + 2 * TailEnergyBounds.tailConstant) * |
| 1211 | logarithmicRate d.core.lam := by |
| 1212 | unfold logarithmicRate |
| 1213 | nlinarith |
| 1214 | _ ≤ errorScale d.core := mul_le_mul_of_nonneg_right hC (logarithmicRate_pos d.core).le |
| 1215 | |
| 1216 | theorem linearTerm_hasDerivAt (c : Parameters) (eta : ℝ) : |
| 1217 | HasDerivAt (linearTerm c) (linearCoefficient c * (1 + 3 * eta ^ 2)) eta := |
| 1218 | (etaPolynomial_hasDerivAt eta).const_mul _ |
| 1219 | |
| 1220 | theorem constantTerm_hasDerivAt (d : OutgoingTail.TailData) (eta : ℝ) : |
| 1221 | HasDerivAt (constantTerm d) |
| 1222 | (2 * (constantCorrection d.core + normalizedPrefixAxial d.core) * |
| 1223 | etaPolynomial eta * (1 + 3 * eta ^ 2) - deriv (normalizedTail d) eta) eta := by |
| 1224 | have hd := (((((etaPolynomial_hasDerivAt eta).pow 2).const_mul |
| 1225 | (constantCorrection d.core + normalizedPrefixAxial d.core)).sub_const |
| 1226 | RadialSchedule.pulseEnergyDebt).sub_const (normalizedPrefixAngular d.core)).sub |
| 1227 | (((normalizedTail_contDiff d).differentiable (by simp) eta).hasDerivAt) |
| 1228 | convert! hd using 1 |
| 1229 | ring |
| 1230 | |
| 1231 | theorem coefficient_derivative_bounds (d : OutgoingTail.TailData) (eta e : ℝ) |
| 1232 | (heta : eta ^ 2 ≤ 1) (h : EnergyErrorBounds d eta e) |
| 1233 | (hT : |deriv (normalizedTail d) eta| ≤ e) : |
| 1234 | |deriv (linearTerm d.core) eta| ≤ 4 * e ∧ |deriv (constantTerm d) eta| ≤ 33 * e := by |
| 1235 | have hq := etaPolynomial_bounds heta |
| 1236 | have hq' : 0 ≤ 1 + 3 * eta ^ 2 := by positivity |
| 1237 | have hq4 : 1 + 3 * eta ^ 2 ≤ 4 := by linarith |
| 1238 | have hsum : 0 ≤ constantCorrection d.core + normalizedPrefixAxial d.core := |
| 1239 | add_nonneg h.correction_nonneg h.prefix_axial_nonneg |
| 1240 | have hsum' : constantCorrection d.core + normalizedPrefixAxial d.core ≤ 2 * e := by |
| 1241 | linarith [h.correction_error, h.prefix_axial_error] |
| 1242 | constructor |
| 1243 | · rw [(linearTerm_hasDerivAt d.core eta).deriv, abs_mul, abs_of_nonneg hq'] |
| 1244 | have hm := mul_le_mul h.linear_error hq4 hq' h.scale_nonneg |
| 1245 | nlinarith |
| 1246 | · rw [(constantTerm_hasDerivAt d eta).deriv] |
| 1247 | calc |
| 1248 | _ ≤ |2 * (constantCorrection d.core + normalizedPrefixAxial d.core) * |
| 1249 | etaPolynomial eta * (1 + 3 * eta ^ 2)| + |deriv (normalizedTail d) eta| := abs_sub _ _ |
| 1250 | _ ≤ 32 * e + e := by |
| 1251 | apply add_le_add _ hT |
| 1252 | rw [abs_mul, abs_mul, abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2), |
| 1253 | abs_of_nonneg hsum, abs_of_nonneg hq'] |
| 1254 | have hm := mul_le_mul |
| 1255 | (mul_le_mul (mul_le_mul_of_nonneg_left hsum' (by norm_num : (0 : ℝ) ≤ 2)) hq.1 |
| 1256 | (abs_nonneg _) (by linarith [h.scale_nonneg])) hq4 hq' |
| 1257 | (by linarith [h.scale_nonneg]) |
| 1258 | nlinarith |
| 1259 | _ = 33 * e := by ring |
| 1260 | |
| 1261 | theorem amplitude_derivative_bound_of_error (d : OutgoingTail.TailData) (eta e : ℝ) |
| 1262 | (heta : eta ^ 2 ≤ 1) (h : EnergyErrorBounds d eta e) (he : e ≤ 1 / 1000) |
| 1263 | (hT : |deriv (normalizedTail d) eta| ≤ e) : |deriv (amplitude d) eta| ≤ 128 * e := by |
| 1264 | obtain ⟨ha, _, hb, _, hc⟩ := numerical_coefficient_bounds d eta e heta h he |
| 1265 | obtain ⟨hr, hr', _⟩ := amplitude_spec_of_error_bound d eta e heta h he |
| 1266 | obtain ⟨hdb, hdc⟩ := coefficient_derivative_bounds d eta e heta h hT |
| 1267 | have hden : 1 / 3 ≤ 2 * quadraticCoefficient d.core * amplitude d eta + linearTerm d.core eta := by |
| 1268 | have hm := mul_le_mul_of_nonneg_right ha (amplitude_pos d eta).le |
| 1269 | have hbl := (abs_le.mp hb).1 |
| 1270 | nlinarith |
| 1271 | have hid := amplitude_derivative_identity d eta (by linarith) |
| 1272 | have heq : (2 * quadraticCoefficient d.core * amplitude d eta + linearTerm d.core eta) * |
| 1273 | deriv (amplitude d) eta = |
| 1274 | -(deriv (linearTerm d.core) eta * amplitude d eta + deriv (constantTerm d) eta) := by linarith |
| 1275 | have hbound : (2 * quadraticCoefficient d.core * amplitude d eta + linearTerm d.core eta) * |
| 1276 | |deriv (amplitude d) eta| ≤ |
| 1277 | |deriv (linearTerm d.core) eta| * amplitude d eta + |deriv (constantTerm d) eta| := by |
| 1278 | calc |
| 1279 | _ = |(2 * quadraticCoefficient d.core * amplitude d eta + linearTerm d.core eta) * |
| 1280 | deriv (amplitude d) eta| := by |
| 1281 | rw [abs_mul, abs_of_nonneg (show 0 ≤ 2 * quadraticCoefficient d.core * |
| 1282 | amplitude d eta + linearTerm d.core eta by linarith)] |
| 1283 | _ = |deriv (linearTerm d.core) eta * amplitude d eta + deriv (constantTerm d) eta| := by |
| 1284 | rw [heq, abs_neg] |
| 1285 | _ ≤ |deriv (linearTerm d.core) eta * amplitude d eta| + |deriv (constantTerm d) eta| := abs_add_le _ _ |
| 1286 | _ = _ := by rw [abs_mul, abs_of_pos (amplitude_pos d eta)] |
| 1287 | have hupper := mul_le_mul hdb hr'.le (amplitude_pos d eta).le |
| 1288 | (by linarith [h.scale_nonneg] : 0 ≤ 4 * e) |
| 1289 | have hlower := mul_le_mul_of_nonneg_right hden (abs_nonneg (deriv (amplitude d) eta)) |
| 1290 | nlinarith [h.scale_nonneg] |
| 1291 | |
| 1292 | theorem logarithmicRate_tendsto_zero : Tendsto logarithmicRate (𝓝[>] (0 : ℝ)) (𝓝 0) := by |
| 1293 | have hid : Tendsto (fun x : ℝ => x) (𝓝[>] (0 : ℝ)) (𝓝 0) := |
| 1294 | continuousAt_id.tendsto.mono_left inf_le_left |
| 1295 | have hl : Tendsto (fun x : ℝ => Real.log x * x) (𝓝[>] (0 : ℝ)) (𝓝 0) := by |
| 1296 | simpa only [Real.rpow_one] using tendsto_log_mul_rpow_nhdsGT_zero (by norm_num : (0 : ℝ) < 1) |
| 1297 | have h := hid.sub hl |
| 1298 | convert! h using 1 |
| 1299 | · funext x |
| 1300 | simp only [logarithmicRate, one_div, Real.log_inv] |
| 1301 | ring |
| 1302 | · simp |
| 1303 | |
| 1304 | theorem exists_rate_threshold (C : ℝ) : |
| 1305 | ∃ delta : ℝ, 0 < delta ∧ ∀ lam : ℝ, 0 < lam → lam < delta → |
| 1306 | C * logarithmicRate lam ≤ 1 / 1000 := by |
| 1307 | have ht := logarithmicRate_tendsto_zero.const_mul C |
| 1308 | have he : ∀ᶠ lam in 𝓝[>] (0 : ℝ), C * logarithmicRate lam < 1 / 1000 := |
| 1309 | ht.eventually (gt_mem_nhds (by norm_num : C * (0 : ℝ) < 1 / 1000)) |
| 1310 | obtain ⟨delta, hd, hsub⟩ := mem_nhdsGT_iff_exists_Ioo_subset.mp he |
| 1311 | exact ⟨delta, hd, fun lam hl hu => (hsub ⟨hl, hu⟩).le⟩ |
| 1312 | |
| 1313 | theorem energyPolynomial_strictMonoOn (d : OutgoingTail.TailData) (eta e : ℝ) |
| 1314 | (heta : eta ^ 2 ≤ 1) (h : EnergyErrorBounds d eta e) (he : e ≤ 1 / 1000) : |
| 1315 | StrictMonoOn (fun A => energyPolynomial d A eta) (Ici (9 / 10 : ℝ)) := by |
| 1316 | obtain ⟨ha, _, hb, _, _⟩ := numerical_coefficient_bounds d eta e heta h he |
| 1317 | intro A hA B hB hAB |
| 1318 | have hsum : 0 ≤ A + B := by simp only [mem_Ici] at hA hB; linarith |
| 1319 | have hm := mul_le_mul_of_nonneg_right ha hsum |
| 1320 | have hcoef : 0 < quadraticCoefficient d.core * (A + B) + linearTerm d.core eta := by |
| 1321 | have hb' := (abs_le.mp hb).1 |
| 1322 | simp only [mem_Ici] at hA hB |
| 1323 | nlinarith |
| 1324 | have hp := mul_pos (sub_pos.mpr hAB) hcoef |
| 1325 | change quadraticCoefficient d.core * A ^ 2 + linearTerm d.core eta * A + constantTerm d eta < |
| 1326 | quadraticCoefficient d.core * B ^ 2 + linearTerm d.core eta * B + constantTerm d eta |
| 1327 | nlinarith only [hp] |
| 1328 | |
| 1329 | theorem amplitude_unique (d : OutgoingTail.TailData) (eta e : ℝ) |
| 1330 | (heta : eta ^ 2 ≤ 1) (h : EnergyErrorBounds d eta e) (he : e ≤ 1 / 1000) |
| 1331 | (A : ℝ) (hA : A ∈ Icc (9 / 10 : ℝ) (6 / 5)) (hzero : totalEnergy d A eta = 0) : |
| 1332 | A = amplitude d eta := by |
| 1333 | have hr := amplitude_spec_of_error_bound d eta e heta h he |
| 1334 | have hnorm := totalEnergy_normalized d A eta |
| 1335 | rw [hzero, mul_zero, zero_div] at hnorm |
| 1336 | have hnorm' := totalEnergy_normalized d (amplitude d eta) eta |
| 1337 | rw [hr.2.2, mul_zero, zero_div] at hnorm' |
| 1338 | exact (energyPolynomial_strictMonoOn d eta e heta h he).injOn hA.1 hr.1.le |
| 1339 | (hnorm.symm.trans hnorm') |
| 1340 | |
| 1341 | theorem axial_eq_of_amplitude_eq (c : Parameters) (amp₁ amp₂ : ℝ → ℝ) (eta y : ℝ) |
| 1342 | (hamp : amp₁ eta = amp₂ eta) : axial c amp₁ (y, eta) = axial c amp₂ (y, eta) := by |
| 1343 | have hd : debt c amp₁ eta = debt c amp₂ eta := by |
| 1344 | funext i |
| 1345 | simp only [debt, hamp] |
| 1346 | have hc : correction c amp₁ eta (Real.exp (y - c.pulseStart)) = |
| 1347 | correction c amp₂ eta (Real.exp (y - c.pulseStart)) := by |
| 1348 | unfold correction |
| 1349 | rw [hd] |
| 1350 | simp only [axial, pulseRatio, hamp, hc] |
| 1351 | |
| 1352 | theorem realized_energy_eq (d : OutgoingTail.TailData) (eta : ℝ) : |
| 1353 | (∫ y, Real.exp y * (axial d.core (amplitude d) (y, eta) ^ 2 - |
| 1354 | OutgoingTail.finalAngular d (y, eta) ^ 2 / 2)) = totalEnergy d (amplitude d eta) eta := by |
| 1355 | unfold totalEnergy energyIntegrand |
| 1356 | apply integral_congr_ae |
| 1357 | exact Eventually.of_forall (fun y => by |
| 1358 | dsimp only |
| 1359 | rw [axial_eq_of_amplitude_eq d.core (amplitude d) (fun _ => amplitude d eta) eta y rfl]) |
| 1360 | |
| 1361 | /-- All smallness conditions refer to proved explicit constants and the |
| 1362 | actual schedule parameter. The amplitude is a concrete globally C∞ function. -/ |
| 1363 | theorem amplitude_spec (d : OutgoingTail.TailData) |
| 1364 | (hsmall : d.core.lam ≤ 1 / 120) (hwait : d.core.wait = 60 * Real.log (1 / d.core.lam)) |
| 1365 | (hscale : errorScale d.core ≤ 1 / 1000) : |
| 1366 | ContDiff ℝ ∞ (amplitude d) ∧ ∀ eta : ℝ, eta ^ 2 ≤ 1 → |
| 1367 | 9 / 10 < amplitude d eta ∧ amplitude d eta < 6 / 5 ∧ |
| 1368 | (∫ y, Real.exp y * (axial d.core (amplitude d) (y, eta) ^ 2 - |
| 1369 | OutgoingTail.finalAngular d (y, eta) ^ 2 / 2)) = 0 ∧ |
| 1370 | |deriv (amplitude d) eta| ≤ 128 * errorScale d.core ∧ |
| 1371 | (∀ A ∈ Icc (9 / 10 : ℝ) (6 / 5), totalEnergy d A eta = 0 → A = amplitude d eta) := by |
| 1372 | refine ⟨amplitude_contDiff d, fun eta heta => ?_⟩ |
| 1373 | have h := actual_energy_error_bounds d hsmall hwait eta heta |
| 1374 | have hr := amplitude_spec_of_error_bound d eta (errorScale d.core) heta h hscale |
| 1375 | exact ⟨hr.1, hr.2.1, (realized_energy_eq d eta).trans hr.2.2, |
| 1376 | amplitude_derivative_bound_of_error d eta (errorScale d.core) heta h hscale |
| 1377 | (normalizedTail_derivative_bound d eta heta), |
| 1378 | fun A hA hz => amplitude_unique d eta (errorScale d.core) heta h hscale A hA hz⟩ |
| 1379 | |
| 1380 | /-- One threshold works for all terminal parameters `0 < h < lam/2`. |
| 1381 | The constructed core with `OutgoingTail.finalAngular` has zero total energy, |
| 1382 | with an actual smooth amplitude in the manuscript's bracket and the claimed |
| 1383 | derivative rate. The separate angular-moment reset is not included here. -/ |
| 1384 | theorem exists_uniform_amplitude_threshold (P m : ℝ) (hP : 0 < P) : |
| 1385 | ∃ lam₀ C : ℝ, 0 < lam₀ ∧ 0 < C ∧ ∀ d : OutgoingTail.TailData, |
| 1386 | d.core.P = P → d.core.m = m → d.core.wait = 60 * Real.log (1 / d.core.lam) → |
| 1387 | d.core.lam < lam₀ → |
| 1388 | ContDiff ℝ ∞ (amplitude d) ∧ ∀ eta : ℝ, eta ^ 2 ≤ 1 → |
| 1389 | 9 / 10 < amplitude d eta ∧ amplitude d eta < 6 / 5 ∧ |
| 1390 | (∫ y, Real.exp y * (axial d.core (amplitude d) (y, eta) ^ 2 - |
| 1391 | OutgoingTail.finalAngular d (y, eta) ^ 2 / 2)) = 0 ∧ |
| 1392 | |deriv (amplitude d) eta| ≤ C * d.core.lam * (1 + Real.log (1 / d.core.lam)) ∧ |
| 1393 | (∀ A ∈ Icc (9 / 10 : ℝ) (6 / 5), totalEnergy d A eta = 0 → A = amplitude d eta) := by |
| 1394 | obtain ⟨delta, hd, hsmall⟩ := exists_rate_threshold (errorConstant P m) |
| 1395 | refine ⟨min delta (1 / 120), 128 * errorConstant P m, lt_min hd (by norm_num), |
| 1396 | mul_pos (by norm_num) (errorConstant_pos hP m), ?_⟩ |
| 1397 | intro d hdP hdm hwait hlam |
| 1398 | have hl : d.core.lam ≤ 1 / 120 := |
| 1399 | (lt_of_lt_of_le hlam (min_le_right _ _)).le |
| 1400 | have hscale : errorScale d.core ≤ 1 / 1000 := by |
| 1401 | unfold errorScale |
| 1402 | rw [hdP, hdm] |
| 1403 | exact hsmall _ d.core.lam_pos (lt_of_lt_of_le hlam (min_le_left _ _)) |
| 1404 | obtain ⟨hs, hspec⟩ := amplitude_spec d hl hwait hscale |
| 1405 | refine ⟨hs, fun eta heta => ?_⟩ |
| 1406 | obtain ⟨hr, hr', hz, hderiv, huniq⟩ := hspec eta heta |
| 1407 | refine ⟨hr, hr', hz, ?_, huniq⟩ |
| 1408 | convert! hderiv using 1 |
| 1409 | unfold errorScale logarithmicRate |
| 1410 | rw [hdP, hdm] |
| 1411 | ring |
| 1412 | |
| 1413 | /-! ## The same equality in the actual radial variable -/ |
| 1414 | |
| 1415 | theorem energyIntegrand_integrable (d : OutgoingTail.TailData) (A eta : ℝ) : |
| 1416 | Integrable (energyIntegrand d A eta) := by |
| 1417 | have htail := TailEnergyBounds.energyDensity_integrable_postPulse d eta |
| 1418 | have hr : IntegrableOn (energyIntegrand d A eta) (Ioi d.core.endpoint) := by |
| 1419 | refine IntegrableOn.congr_fun (s := Ioi d.core.endpoint) (htail.neg.div_const 2) ?_ measurableSet_Ioi |
| 1420 | intro y hy |
| 1421 | exact (energyIntegrand_late d A eta hy.le).symm |
| 1422 | have h := (energyIntegrand_integrable_Iic d A eta (coreEndpoint_pos d.core).le).union hr |
| 1423 | simpa only [Iic_union_Ioi, integrableOn_univ] using h |
| 1424 | |
| 1425 | def radialEnergyIntegrand (d : OutgoingTail.TailData) (amp : ℝ → ℝ) (eta XR X : ℝ) : ℝ := |
| 1426 | axial d.core amp (Real.log (X / XR), eta) ^ 2 - |
| 1427 | OutgoingTail.finalAngular d (Real.log (X / XR), eta) ^ 2 / 2 |
| 1428 | |
| 1429 | private theorem radialCoordinate_image (XR : ℝ) (hXR : 0 < XR) : |
| 1430 | (fun y : ℝ => XR * Real.exp y) '' univ = Ioi 0 := by |
| 1431 | ext X |
| 1432 | constructor |
| 1433 | · rintro ⟨y, _, rfl⟩ |
| 1434 | exact mul_pos hXR (Real.exp_pos _) |
| 1435 | · intro hX |
| 1436 | refine ⟨Real.log (X / XR), mem_univ _, ?_⟩ |
| 1437 | dsimp only |
| 1438 | rw [Real.exp_log (div_pos hX hXR)] |
| 1439 | field_simp [hXR.ne'] |
| 1440 | |
| 1441 | private theorem radialCoordinate_transform (d : OutgoingTail.TailData) (amp : ℝ → ℝ) |
| 1442 | (eta XR : ℝ) (hXR : 0 < XR) : |
| 1443 | (fun y => |XR * Real.exp y| • radialEnergyIntegrand d amp eta XR (XR * Real.exp y)) = |
| 1444 | (fun y => XR * energyIntegrand d (amp eta) eta y) := by |
| 1445 | funext y |
| 1446 | have hlog : Real.log (XR * Real.exp y / XR) = y := by |
| 1447 | rw [mul_comm XR, mul_div_cancel_right₀ _ hXR.ne', Real.log_exp] |
| 1448 | simp only [radialEnergyIntegrand, hlog, abs_of_pos (mul_pos hXR (Real.exp_pos _)), smul_eq_mul, |
| 1449 | energyIntegrand] |
| 1450 | rw [axial_eq_of_amplitude_eq d.core amp (fun _ => amp eta) eta y rfl] |
| 1451 | ring |
| 1452 | |
| 1453 | theorem radialEnergy_integrable (d : OutgoingTail.TailData) (amp : ℝ → ℝ) |
| 1454 | (eta XR : ℝ) (hXR : 0 < XR) : |
| 1455 | IntegrableOn (radialEnergyIntegrand d amp eta XR) (Ioi 0) := by |
| 1456 | have hd : ∀ y ∈ (univ : Set ℝ), HasDerivWithinAt (fun y => XR * Real.exp y) |
| 1457 | (XR * Real.exp y) univ y := fun y _ => ((Real.hasDerivAt_exp y).const_mul XR).hasDerivWithinAt |
| 1458 | have hinj : InjOn (fun y : ℝ => XR * Real.exp y) univ := by |
| 1459 | intro x _ y _ h |
| 1460 | exact Real.exp_injective (mul_left_cancel₀ hXR.ne' h) |
| 1461 | have h := integrableOn_image_iff_integrableOn_abs_deriv_smul MeasurableSet.univ hd hinj |
| 1462 | (radialEnergyIntegrand d amp eta XR) |
| 1463 | rw [radialCoordinate_image XR hXR, radialCoordinate_transform d amp eta XR hXR, |
| 1464 | integrableOn_univ] at h |
| 1465 | exact h.mpr ((energyIntegrand_integrable d (amp eta) eta).const_mul XR) |
| 1466 | |
| 1467 | theorem radialEnergy_integral (d : OutgoingTail.TailData) (amp : ℝ → ℝ) |
| 1468 | (eta XR : ℝ) (hXR : 0 < XR) : |
| 1469 | (∫ X in Ioi 0, radialEnergyIntegrand d amp eta XR X) = XR * totalEnergy d (amp eta) eta := by |
| 1470 | have hd : ∀ y ∈ (univ : Set ℝ), HasDerivWithinAt (fun y => XR * Real.exp y) |
| 1471 | (XR * Real.exp y) univ y := fun y _ => ((Real.hasDerivAt_exp y).const_mul XR).hasDerivWithinAt |
| 1472 | have hinj : InjOn (fun y : ℝ => XR * Real.exp y) univ := by |
| 1473 | intro x _ y _ h |
| 1474 | exact Real.exp_injective (mul_left_cancel₀ hXR.ne' h) |
| 1475 | have h := integral_image_eq_integral_abs_deriv_smul MeasurableSet.univ hd hinj |
| 1476 | (radialEnergyIntegrand d amp eta XR) |
| 1477 | rw [radialCoordinate_image XR hXR, radialCoordinate_transform d amp eta XR hXR, |
| 1478 | setIntegral_univ, integral_const_mul] at h |
| 1479 | exact h |
| 1480 | |
| 1481 | theorem radialEnergy_zero (d : OutgoingTail.TailData) |
| 1482 | (hsmall : d.core.lam ≤ 1 / 120) (hwait : d.core.wait = 60 * Real.log (1 / d.core.lam)) |
| 1483 | (hscale : errorScale d.core ≤ 1 / 1000) (eta : ℝ) (heta : eta ^ 2 ≤ 1) |
| 1484 | (XR : ℝ) (hXR : 0 < XR) : |
| 1485 | (∫ X in Ioi 0, radialEnergyIntegrand d (amplitude d) eta XR X) = 0 := by |
| 1486 | rw [radialEnergy_integral d (amplitude d) eta XR hXR] |
| 1487 | have h := amplitude_spec_of_error_bound d eta (errorScale d.core) heta |
| 1488 | (actual_energy_error_bounds d hsmall hwait eta heta) hscale |
| 1489 | rw [h.2.2, mul_zero] |
| 1490 | |
| 1491 | end NavierStokes.PulseAmplitude |