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.FlatPrimitive |
| 2 | import NavierStokes.LocalizedMomentRepair |
| 3 | import Mathlib.Analysis.SpecialFunctions.Log.Deriv |
| 4 | import Mathlib.Analysis.SpecialFunctions.Integrals.Basic |
| 5 | import Mathlib.Analysis.Calculus.Deriv.MeanValue |
| 6 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts |
| 7 | import Mathlib.Tactic.FinCases |
| 8 | |
| 9 | /-! |
| 10 | # Constructed outgoing profiles through the axial pulse |
| 11 | |
| 12 | The clock is the global logarithmic radius, with the first ramp starting at zero. |
| 13 | All functions below are actual formulas. Stage inequalities are hypotheses on |
| 14 | real parameters, not assumptions that suitable profiles or corrections exist. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | |
| 19 | open Set Filter Function MeasureTheory |
| 20 | open scoped Topology ContDiff BigOperators |
| 21 | |
| 22 | namespace NavierStokes.OutgoingSchedule |
| 23 | |
| 24 | /-! ## The manuscript's smooth step -/ |
| 25 | |
| 26 | def sigma (x : ℝ) : ℝ := |
| 27 | FlatCutoff.edge 1 x / (FlatCutoff.edge 1 x + FlatCutoff.edge 1 (1 - x)) |
| 28 | |
| 29 | theorem sigma_denom_pos (x : ℝ) : |
| 30 | 0 < FlatCutoff.edge 1 x + FlatCutoff.edge 1 (1 - x) := by |
| 31 | by_cases hx : 0 < x |
| 32 | · exact add_pos_of_pos_of_nonneg (FlatCutoff.edge_pos 1 hx) |
| 33 | (FlatCutoff.edge_nonneg 1 _) |
| 34 | · exact add_pos_of_nonneg_of_pos (FlatCutoff.edge_nonneg 1 _) |
| 35 | (FlatCutoff.edge_pos 1 (by linarith)) |
| 36 | |
| 37 | theorem sigma_contDiff : ContDiff ℝ ∞ sigma := |
| 38 | (FlatCutoff.edge_contDiff (by norm_num : (0 : ℝ) < 1)).div |
| 39 | ((FlatCutoff.edge_contDiff (by norm_num : (0 : ℝ) < 1)).add |
| 40 | ((FlatCutoff.edge_contDiff (by norm_num : (0 : ℝ) < 1)).comp |
| 41 | (contDiff_const.sub contDiff_id))) |
| 42 | (fun x => (sigma_denom_pos x).ne') |
| 43 | |
| 44 | theorem sigma_zero {x : ℝ} (hx : x ≤ 0) : sigma x = 0 := by |
| 45 | simp [sigma, FlatCutoff.edge_of_nonpos 1 hx] |
| 46 | |
| 47 | theorem sigma_one {x : ℝ} (hx : 1 ≤ x) : sigma x = 1 := by |
| 48 | unfold sigma |
| 49 | rw [FlatCutoff.edge_of_nonpos 1 (by linarith : 1 - x ≤ 0), add_zero] |
| 50 | exact div_self (FlatCutoff.edge_pos 1 (by linarith)).ne' |
| 51 | |
| 52 | theorem sigma_nonneg (x : ℝ) : 0 ≤ sigma x := |
| 53 | div_nonneg (FlatCutoff.edge_nonneg 1 x) (sigma_denom_pos x).le |
| 54 | |
| 55 | theorem sigma_le_one (x : ℝ) : sigma x ≤ 1 := by |
| 56 | apply (div_le_one (sigma_denom_pos x)).mpr |
| 57 | exact le_add_of_nonneg_right (FlatCutoff.edge_nonneg 1 _) |
| 58 | |
| 59 | theorem edge_monotone : Monotone (FlatCutoff.edge 1) := by |
| 60 | apply monotone_of_deriv_nonneg |
| 61 | ((FlatCutoff.edge_contDiff (by norm_num : (0 : ℝ) < 1) : |
| 62 | ContDiff ℝ ∞ _).differentiable (by simp)) |
| 63 | intro x |
| 64 | rw [(FlatPrimitive.edge_hasDerivAt (by norm_num : (0 : ℝ) < 1) x).deriv] |
| 65 | by_cases hx : 0 < x |
| 66 | · exact div_nonneg (mul_nonneg (by norm_num) (FlatCutoff.edge_nonneg 1 x)) |
| 67 | (pow_nonneg hx.le 3) |
| 68 | · simp [FlatCutoff.edge_of_nonpos 1 (le_of_not_gt hx)] |
| 69 | |
| 70 | theorem sigma_monotone : Monotone sigma := by |
| 71 | intro x y hxy |
| 72 | apply (div_le_div_iff₀ (sigma_denom_pos x) (sigma_denom_pos y)).mpr |
| 73 | have ha := edge_monotone hxy |
| 74 | have hb := edge_monotone (show 1 - y ≤ 1 - x by linarith) |
| 75 | have hcross := mul_le_mul ha hb (FlatCutoff.edge_nonneg 1 _) (FlatCutoff.edge_nonneg 1 _) |
| 76 | nlinarith |
| 77 | |
| 78 | /-! ## Smooth primitives and the single global slope -/ |
| 79 | |
| 80 | def primitive (g : ℝ → ℝ) (y : ℝ) : ℝ := ∫ t in (0 : ℝ)..y, g t |
| 81 | |
| 82 | theorem primitive_hasDerivAt {g : ℝ → ℝ} (hg : Continuous g) (y : ℝ) : |
| 83 | HasDerivAt (primitive g) (g y) y := |
| 84 | intervalIntegral.integral_hasDerivAt_right (hg.intervalIntegrable 0 y) |
| 85 | hg.aestronglyMeasurable.stronglyMeasurableAtFilter hg.continuousAt |
| 86 | |
| 87 | theorem primitive_contDiff {g : ℝ → ℝ} (hg : ContDiff ℝ ∞ g) : |
| 88 | ContDiff ℝ ∞ (primitive g) := by |
| 89 | apply contDiff_infty_iff_deriv.mpr |
| 90 | constructor |
| 91 | · exact fun y => (primitive_hasDerivAt hg.continuous y).differentiableAt |
| 92 | · have hd : deriv (primitive g) = g := by |
| 93 | funext y |
| 94 | exact (primitive_hasDerivAt hg.continuous y).deriv |
| 95 | rwa [hd] |
| 96 | |
| 97 | theorem primitive_increment {g : ℝ → ℝ} (hg : Continuous g) (a b c : ℝ) |
| 98 | (hc : ∀ t ∈ uIcc a b, g t = c) : |
| 99 | primitive g b = primitive g a + (b - a) * c := by |
| 100 | have hi : (∫ t in a..b, g t) = (b - a) * c := by |
| 101 | calc |
| 102 | _ = ∫ _t in a..b, c := intervalIntegral.integral_congr hc |
| 103 | _ = _ := by simp |
| 104 | have h := intervalIntegral.integral_add_adjacent_intervals (μ := volume) |
| 105 | (hg.intervalIntegrable 0 a) (hg.intervalIntegrable a b) |
| 106 | simpa only [primitive, hi] using h.symm |
| 107 | |
| 108 | def slope (dropLength lam y : ℝ) : ℝ := |
| 109 | (3 / 5) * (1 - sigma y) - lam * sigma (y - (dropLength + 1)) |
| 110 | |
| 111 | theorem slope_contDiff (dropLength lam : ℝ) : ContDiff ℝ ∞ (slope dropLength lam) := |
| 112 | (contDiff_const.mul (contDiff_const.sub sigma_contDiff)).sub |
| 113 | (contDiff_const.mul (sigma_contDiff.comp (contDiff_id.sub contDiff_const))) |
| 114 | |
| 115 | theorem slope_ideal {dropLength lam y : ℝ} (hd : 0 ≤ dropLength) (hy : y ≤ 0) : |
| 116 | slope dropLength lam y = 3 / 5 := by |
| 117 | simp [slope, sigma_zero hy, sigma_zero (by linarith : y - (dropLength + 1) ≤ 0)] |
| 118 | |
| 119 | theorem slope_drop {dropLength lam y : ℝ} (hy : 1 ≤ y) (hy' : y ≤ dropLength + 1) : |
| 120 | slope dropLength lam y = 0 := by |
| 121 | simp [slope, sigma_one hy, sigma_zero (by linarith : y - (dropLength + 1) ≤ 0)] |
| 122 | |
| 123 | theorem slope_hold {dropLength lam y : ℝ} (hd : 0 ≤ dropLength) |
| 124 | (hy : dropLength + 2 ≤ y) : slope dropLength lam y = -lam := by |
| 125 | simp [slope, sigma_one (by linarith : 1 ≤ y), |
| 126 | sigma_one (by linarith : 1 ≤ y - (dropLength + 1))] |
| 127 | |
| 128 | def logAmplitude (dropLength lam : ℝ) : ℝ → ℝ := |
| 129 | primitive (fun y => slope dropLength lam y - 1 / 2) |
| 130 | |
| 131 | def radialAmplitude (P dropLength lam y : ℝ) : ℝ := |
| 132 | P * Real.exp (logAmplitude dropLength lam y) |
| 133 | |
| 134 | def shape (eta : ℝ) : ℝ := (1 + eta ^ 2)⁻¹ |
| 135 | |
| 136 | def angular (P dropLength lam : ℝ) (p : ℝ × ℝ) : ℝ := |
| 137 | radialAmplitude P dropLength lam p.1 * shape p.2 |
| 138 | |
| 139 | theorem logAmplitude_contDiff (dropLength lam : ℝ) : |
| 140 | ContDiff ℝ ∞ (logAmplitude dropLength lam) := |
| 141 | primitive_contDiff ((slope_contDiff dropLength lam).sub contDiff_const) |
| 142 | |
| 143 | theorem radialAmplitude_contDiff (P dropLength lam : ℝ) : |
| 144 | ContDiff ℝ ∞ (radialAmplitude P dropLength lam) := |
| 145 | contDiff_const.mul (logAmplitude_contDiff dropLength lam).exp |
| 146 | |
| 147 | theorem shape_pos (eta : ℝ) : 0 < shape eta := by |
| 148 | unfold shape |
| 149 | positivity |
| 150 | |
| 151 | theorem shape_contDiff : ContDiff ℝ ∞ shape := |
| 152 | (contDiff_const.add (contDiff_id.pow 2)).inv (fun eta => by positivity) |
| 153 | |
| 154 | theorem angular_contDiff (P dropLength lam : ℝ) : |
| 155 | ContDiff ℝ ∞ (angular P dropLength lam) := |
| 156 | ((radialAmplitude_contDiff P dropLength lam).comp contDiff_fst).mul |
| 157 | (shape_contDiff.comp contDiff_snd) |
| 158 | |
| 159 | theorem angular_pos {P : ℝ} (hP : 0 < P) (dropLength lam : ℝ) (p : ℝ × ℝ) : |
| 160 | 0 < angular P dropLength lam p := |
| 161 | mul_pos (mul_pos hP (Real.exp_pos _)) (shape_pos _) |
| 162 | |
| 163 | theorem radialAmplitude_hasDerivAt (P dropLength lam y : ℝ) : |
| 164 | HasDerivAt (radialAmplitude P dropLength lam) |
| 165 | (radialAmplitude P dropLength lam y * (slope dropLength lam y - 1 / 2)) y := by |
| 166 | have h := ((primitive_hasDerivAt |
| 167 | (g := fun y => slope dropLength lam y - 1 / 2) |
| 168 | ((slope_contDiff dropLength lam).continuous.sub continuous_const) y).exp).const_mul P |
| 169 | unfold radialAmplitude logAmplitude |
| 170 | simpa only [mul_assoc] using h |
| 171 | |
| 172 | theorem logAmplitude_ideal {dropLength lam y : ℝ} (hd : 0 ≤ dropLength) (hy : y ≤ 0) : |
| 173 | logAmplitude dropLength lam y = y / 10 := by |
| 174 | have h := primitive_increment |
| 175 | (g := fun y => slope dropLength lam y - 1 / 2) |
| 176 | ((slope_contDiff dropLength lam).continuous.sub continuous_const) 0 y (1 / 10) ?_ |
| 177 | · simpa [logAmplitude, primitive, div_eq_mul_inv] using h |
| 178 | · intro t ht |
| 179 | have ht0 : t ≤ 0 := (uIcc_of_ge hy ▸ ht).2 |
| 180 | rw [slope_ideal hd ht0] |
| 181 | norm_num |
| 182 | |
| 183 | theorem angular_ideal {dropLength lam y eta P : ℝ} (hd : 0 ≤ dropLength) (hy : y ≤ 0) : |
| 184 | angular P dropLength lam (y, eta) = P * shape eta * Real.exp (y / 10) := by |
| 185 | simp only [angular, radialAmplitude, logAmplitude_ideal hd hy] |
| 186 | ring |
| 187 | |
| 188 | theorem radialAmplitude_hold {dropLength lam a y P : ℝ} (hd : 0 ≤ dropLength) |
| 189 | (ha : dropLength + 2 ≤ a) (hay : a ≤ y) : |
| 190 | radialAmplitude P dropLength lam y = |
| 191 | radialAmplitude P dropLength lam a * Real.exp (-(1 / 2 + lam) * (y - a)) := by |
| 192 | have h := primitive_increment |
| 193 | (g := fun y => slope dropLength lam y - 1 / 2) |
| 194 | ((slope_contDiff dropLength lam).continuous.sub continuous_const) a y (-(1 / 2 + lam)) ?_ |
| 195 | · have he : logAmplitude dropLength lam y = |
| 196 | logAmplitude dropLength lam a + -(1 / 2 + lam) * (y - a) := by |
| 197 | simpa only [logAmplitude, mul_comm (y - a)] using h |
| 198 | rw [radialAmplitude, he, Real.exp_add] |
| 199 | simp only [radialAmplitude, mul_assoc] |
| 200 | · intro t ht |
| 201 | have hat : a ≤ t := (uIcc_of_le hay ▸ ht).1 |
| 202 | rw [slope_hold hd (ha.trans hat)] |
| 203 | ring |
| 204 | |
| 205 | /-! ## The logarithmically slow axial drop -/ |
| 206 | |
| 207 | def dropCoefficient (m y : ℝ) : ℝ := |
| 208 | if y ≤ 1 then 4 else 4 * (1 - sigma (Real.log y / m)) |
| 209 | |
| 210 | theorem dropCoefficient_early (m : ℝ) {y : ℝ} (hy : y ≤ 1) : |
| 211 | dropCoefficient m y = 4 := by simp [dropCoefficient, hy] |
| 212 | |
| 213 | theorem dropCoefficient_eq {m y : ℝ} (hm : 0 < m) (hy : 0 < y) : |
| 214 | dropCoefficient m y = 4 * (1 - sigma (Real.log y / m)) := by |
| 215 | by_cases hy1 : y ≤ 1 |
| 216 | · have hs := sigma_zero (div_nonpos_of_nonpos_of_nonneg (Real.log_nonpos hy.le hy1) hm.le) |
| 217 | simp [dropCoefficient, hy1, hs] |
| 218 | · simp [dropCoefficient, hy1] |
| 219 | |
| 220 | theorem dropCoefficient_contDiff {m : ℝ} (hm : 0 < m) : |
| 221 | ContDiff ℝ ∞ (dropCoefficient m) := by |
| 222 | rw [contDiff_iff_contDiffAt] |
| 223 | intro y |
| 224 | by_cases hy : y < 1 |
| 225 | · apply (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : ℝ => (4 : ℝ)) y).congr_of_eventuallyEq |
| 226 | filter_upwards [gt_mem_nhds hy] with t ht |
| 227 | exact dropCoefficient_early m ht.le |
| 228 | · have hy0 : 0 < y := by linarith |
| 229 | have hf : ContDiffAt ℝ ∞ (fun t : ℝ => 4 * (1 - sigma (Real.log t / m))) y := |
| 230 | contDiffAt_const.mul (contDiffAt_const.sub |
| 231 | (sigma_contDiff.contDiffAt.comp y ((Real.contDiffAt_log.mpr hy0.ne').div_const m))) |
| 232 | apply hf.congr_of_eventuallyEq |
| 233 | filter_upwards [lt_mem_nhds hy0] with t ht |
| 234 | exact dropCoefficient_eq hm ht |
| 235 | |
| 236 | theorem dropCoefficient_late {m y : ℝ} (hm : 0 < m) (hy : Real.exp m ≤ y) : |
| 237 | dropCoefficient m y = 0 := by |
| 238 | have hy0 : 0 < y := (Real.exp_pos m).trans_le hy |
| 239 | have hlog : m ≤ Real.log y := (Real.le_log_iff_exp_le hy0).mpr hy |
| 240 | rw [dropCoefficient_eq hm hy0, sigma_one ((le_div_iff₀ hm).mpr (by simpa using hlog))] |
| 241 | ring |
| 242 | |
| 243 | theorem dropCoefficient_bounds (m y : ℝ) : |
| 244 | 0 ≤ dropCoefficient m y ∧ dropCoefficient m y ≤ 4 := by |
| 245 | by_cases hy : y ≤ 1 |
| 246 | · simp [dropCoefficient, hy] |
| 247 | · have hlo := sigma_nonneg (Real.log y / m) |
| 248 | have hhi := sigma_le_one (Real.log y / m) |
| 249 | simp only [dropCoefficient, ite_eq_right hy] |
| 250 | constructor <;> linarith |
| 251 | |
| 252 | def initialAxial (m : ℝ) (p : ℝ × ℝ) : ℝ := dropCoefficient m p.1 * p.2 |
| 253 | |
| 254 | theorem initialAxial_contDiff {m : ℝ} (hm : 0 < m) : |
| 255 | ContDiff ℝ ∞ (initialAxial m) := |
| 256 | ((dropCoefficient_contDiff hm).comp contDiff_fst).mul contDiff_snd |
| 257 | |
| 258 | /-! ## The main pulse and fixed, separated repair intervals -/ |
| 259 | |
| 260 | def pulseRamp : ℝ → ℝ := primitive (fun z => sigma (50 * z)) |
| 261 | |
| 262 | def mainPulse (z : ℝ) : ℝ := pulseRamp z * (1 - sigma (z - 10)) |
| 263 | |
| 264 | theorem pulseRamp_contDiff : ContDiff ℝ ∞ pulseRamp := |
| 265 | primitive_contDiff (sigma_contDiff.comp (contDiff_const.mul contDiff_id)) |
| 266 | |
| 267 | theorem mainPulse_contDiff : ContDiff ℝ ∞ mainPulse := |
| 268 | pulseRamp_contDiff.mul (contDiff_const.sub |
| 269 | (sigma_contDiff.comp (contDiff_id.sub contDiff_const))) |
| 270 | |
| 271 | theorem pulseRamp_zero {z : ℝ} (hz : z ≤ 0) : pulseRamp z = 0 := by |
| 272 | unfold pulseRamp primitive |
| 273 | calc |
| 274 | _ = ∫ _t in (0 : ℝ)..z, (0 : ℝ) := by |
| 275 | apply intervalIntegral.integral_congr |
| 276 | intro t ht |
| 277 | apply sigma_zero |
| 278 | have ht0 : t ≤ 0 := (uIcc_of_ge hz ▸ ht).2 |
| 279 | linarith |
| 280 | _ = 0 := by simp |
| 281 | |
| 282 | theorem mainPulse_zero_left {z : ℝ} (hz : z ≤ 0) : mainPulse z = 0 := by |
| 283 | simp [mainPulse, pulseRamp_zero hz] |
| 284 | |
| 285 | theorem mainPulse_zero_right {z : ℝ} (hz : 11 ≤ z) : mainPulse z = 0 := by |
| 286 | simp [mainPulse, sigma_one (by linarith : 1 ≤ z - 10)] |
| 287 | |
| 288 | /-- Only finite real parameters and their elementary inequalities are input. -/ |
| 289 | structure Parameters where |
| 290 | P : ℝ |
| 291 | m : ℝ |
| 292 | lam : ℝ |
| 293 | wait : ℝ |
| 294 | P_pos : 0 < P |
| 295 | m_pos : 0 < m |
| 296 | lam_pos : 0 < lam |
| 297 | lam_lt : lam < 1 / 10 |
| 298 | wait_gt : 25 < wait |
| 299 | |
| 300 | namespace Parameters |
| 301 | |
| 302 | def dropLength (c : Parameters) : ℝ := Real.exp c.m + 10 |
| 303 | def holdStart (c : Parameters) : ℝ := c.dropLength + 2 |
| 304 | def pulseStart (c : Parameters) : ℝ := c.holdStart + c.wait |
| 305 | def pulseLength (c : Parameters) : ℝ := 13 / c.lam |
| 306 | def endpoint (c : Parameters) : ℝ := c.pulseStart + c.pulseLength |
| 307 | |
| 308 | theorem dropLength_pos (c : Parameters) : 0 < c.dropLength := by |
| 309 | dsimp [dropLength] |
| 310 | positivity |
| 311 | |
| 312 | theorem holdStart_pos (c : Parameters) : 0 < c.holdStart := by |
| 313 | dsimp [holdStart] |
| 314 | linarith [c.dropLength_pos] |
| 315 | |
| 316 | theorem pulseStart_ge_hold (c : Parameters) : c.holdStart ≤ c.pulseStart := by |
| 317 | dsimp [pulseStart] |
| 318 | linarith [c.wait_gt] |
| 319 | |
| 320 | theorem pulseStart_pos (c : Parameters) : 0 < c.pulseStart := |
| 321 | c.holdStart_pos.trans_le c.pulseStart_ge_hold |
| 322 | |
| 323 | theorem pulseLength_pos (c : Parameters) : 0 < c.pulseLength := |
| 324 | div_pos (by norm_num) c.lam_pos |
| 325 | |
| 326 | def exponents (c : Parameters) (i : Fin 2) : ℝ := |
| 327 | if i = 0 then -(1 / 2 + c.lam) else -(1 / 2 + 2 * c.lam) |
| 328 | |
| 329 | /-- The log supports lie inside `(L-3.15,L-2.85)` and `(L-1.15,L-.85)`. -/ |
| 330 | def lower (c : Parameters) (i : Fin 2) : ℝ := |
| 331 | Real.exp (c.pulseLength - if i = 0 then 63 / 20 else 23 / 20) |
| 332 | |
| 333 | def upper (c : Parameters) (i : Fin 2) : ℝ := |
| 334 | Real.exp (c.pulseLength - if i = 0 then 57 / 20 else 17 / 20) |
| 335 | |
| 336 | theorem exponents_injective (c : Parameters) : Injective c.exponents := by |
| 337 | intro i j hij |
| 338 | fin_cases i <;> fin_cases j <;> norm_num [exponents] at hij ⊢ |
| 339 | all_goals linarith [c.lam_pos] |
| 340 | |
| 341 | theorem lower_pos (c : Parameters) (i : Fin 2) : 0 < c.lower i := Real.exp_pos _ |
| 342 | |
| 343 | theorem lower_lt_upper (c : Parameters) (i : Fin 2) : c.lower i < c.upper i := by |
| 344 | apply Real.exp_lt_exp.mpr |
| 345 | fin_cases i <;> norm_num [lower, upper] |
| 346 | |
| 347 | theorem intervals_separated (c : Parameters) (i j : Fin 2) (hij : i < j) : |
| 348 | c.upper i ≤ c.lower j := by |
| 349 | fin_cases i <;> fin_cases j <;> norm_num at hij |
| 350 | apply Real.exp_le_exp.mpr |
| 351 | norm_num [upper, lower] |
| 352 | linarith |
| 353 | |
| 354 | theorem one_lt_lower (c : Parameters) (i : Fin 2) : 1 < c.lower i := by |
| 355 | have hL : 4 < c.pulseLength := by |
| 356 | apply (lt_div_iff₀ c.lam_pos).mpr |
| 357 | nlinarith [c.lam_lt] |
| 358 | change 1 < Real.exp _ |
| 359 | rw [← Real.exp_zero] |
| 360 | apply Real.exp_lt_exp.mpr |
| 361 | fin_cases i <;> norm_num <;> linarith |
| 362 | |
| 363 | theorem upper_lt_end (c : Parameters) (i : Fin 2) : |
| 364 | c.upper i < Real.exp c.pulseLength := by |
| 365 | apply Real.exp_lt_exp.mpr |
| 366 | fin_cases i <;> norm_num [upper] |
| 367 | |
| 368 | theorem main_end_lt_lower (c : Parameters) (i : Fin 2) : |
| 369 | Real.exp (11 / c.lam) < c.lower i := by |
| 370 | apply Real.exp_lt_exp.mpr |
| 371 | have hgap : (63 / 20 : ℝ) * c.lam < 2 := by nlinarith [c.lam_lt] |
| 372 | have hgap' := (lt_div_iff₀ c.lam_pos).mpr hgap |
| 373 | have hid : 13 / c.lam - 11 / c.lam = 2 / c.lam := by ring |
| 374 | dsimp [lower, pulseLength] |
| 375 | fin_cases i <;> norm_num <;> linarith |
| 376 | |
| 377 | end Parameters |
| 378 | |
| 379 | /-! ## Explicit smooth debts and constructed corrections -/ |
| 380 | |
| 381 | def prefixM (c : Parameters) : ℝ := |
| 382 | 4 + ∫ y in (0 : ℝ)..c.pulseStart, Real.exp y * dropCoefficient c.m y |
| 383 | |
| 384 | def prefixJ (c : Parameters) : ℝ := |
| 385 | (5 / 2) * Real.sqrt 2 * c.P + |
| 386 | ∫ y in (0 : ℝ)..c.pulseStart, |
| 387 | Real.sqrt 2 * Real.exp (3 * y / 2) * |
| 388 | radialAmplitude c.P c.dropLength c.lam y * dropCoefficient c.m y |
| 389 | |
| 390 | def pulseAmplitude (c : Parameters) : ℝ := |
| 391 | radialAmplitude c.P c.dropLength c.lam c.pulseStart |
| 392 | |
| 393 | def momentScale (c : Parameters) (i : Fin 2) : ℝ := |
| 394 | if i = 0 then Real.exp c.pulseStart * pulseAmplitude c |
| 395 | else Real.sqrt 2 * Real.exp (3 * c.pulseStart / 2) * pulseAmplitude c ^ 2 |
| 396 | |
| 397 | theorem pulseAmplitude_pos (c : Parameters) : 0 < pulseAmplitude c := |
| 398 | mul_pos c.P_pos (Real.exp_pos _) |
| 399 | |
| 400 | theorem momentScale_pos (c : Parameters) (i : Fin 2) : 0 < momentScale c i := by |
| 401 | unfold momentScale |
| 402 | split_ifs |
| 403 | · exact mul_pos (Real.exp_pos _) (pulseAmplitude_pos c) |
| 404 | · exact mul_pos (mul_pos (Real.sqrt_pos.mpr (by norm_num)) (Real.exp_pos _)) |
| 405 | (sq_pos_of_pos (pulseAmplitude_pos c)) |
| 406 | |
| 407 | def prefixCoefficient (c : Parameters) (i : Fin 2) : ℝ := |
| 408 | (if i = 0 then prefixM c else prefixJ c) / momentScale c i |
| 409 | |
| 410 | def mainMoment (c : Parameters) (i : Fin 2) : ℝ := |
| 411 | ∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 412 | x ^ c.exponents i * mainPulse (c.lam * Real.log x) |
| 413 | |
| 414 | def debt (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) (i : Fin 2) : ℝ := |
| 415 | -(prefixCoefficient c i * eta * (1 + eta ^ 2) + amp eta * mainMoment c i) |
| 416 | |
| 417 | theorem debt_contDiff (c : Parameters) {amp : ℝ → ℝ} (ha : ContDiff ℝ ∞ amp) |
| 418 | (i : Fin 2) : ContDiff ℝ ∞ (fun eta => debt c amp eta i) := |
| 419 | ((contDiff_const.mul contDiff_id).mul (contDiff_const.add (contDiff_id.pow 2)) |>.add |
| 420 | (ha.mul contDiff_const)).neg |
| 421 | |
| 422 | def correction (c : Parameters) (amp : ℝ → ℝ) (eta x : ℝ) : ℝ := |
| 423 | LocalizedMomentRepair.repair c.exponents c.lower c.upper (debt c amp eta) x |
| 424 | |
| 425 | theorem correction_exact (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) (i : Fin 2) : |
| 426 | (∫ x, x ^ c.exponents i * correction c amp eta x) = debt c amp eta i := |
| 427 | LocalizedMomentRepair.repair_exact c.exponents c.lower c.upper (debt c amp eta) |
| 428 | c.exponents_injective c.lower_pos c.lower_lt_upper c.intervals_separated i |
| 429 | |
| 430 | theorem correction_contDiff_joint (c : Parameters) {amp : ℝ → ℝ} |
| 431 | (ha : ContDiff ℝ ∞ amp) : |
| 432 | ContDiff ℝ ∞ (fun p : ℝ × ℝ => correction c amp p.2 (Real.exp p.1)) := by |
| 433 | have heq : (fun p : ℝ × ℝ => correction c amp p.2 (Real.exp p.1)) = |
| 434 | (fun p : ℝ × ℝ => ∑ i : Fin 2, debt c amp p.2 i * |
| 435 | LocalizedMomentRepair.repair c.exponents c.lower c.upper (Pi.single i 1) |
| 436 | (Real.exp p.1)) := by |
| 437 | funext p |
| 438 | exact congrFun (LocalizedMomentRepair.repair_eq_sum_coordinate |
| 439 | c.exponents c.lower c.upper (debt c amp p.2)) (Real.exp p.1) |
| 440 | rw [heq] |
| 441 | apply ContDiff.sum |
| 442 | intro i _ |
| 443 | exact ((debt_contDiff c ha i).comp contDiff_snd).mul |
| 444 | ((LocalizedMomentRepair.repair_contDiff c.exponents c.lower c.upper (Pi.single i 1)).comp |
| 445 | contDiff_fst.exp) |
| 446 | |
| 447 | theorem correction_zero_of_outside (c : Parameters) (amp : ℝ → ℝ) (eta x : ℝ) |
| 448 | (hx : ∀ i : Fin 2, x ∉ Ioo (c.lower i) (c.upper i)) : |
| 449 | correction c amp eta x = 0 := by |
| 450 | by_contra h |
| 451 | have hs := (LocalizedMomentRepair.repair_tsupport_subset_open |
| 452 | c.exponents c.lower c.upper (debt c amp eta) c.lower_lt_upper) |
| 453 | (subset_tsupport _ h) |
| 454 | obtain ⟨i, hi⟩ := mem_iUnion.mp hs |
| 455 | exact hx i hi |
| 456 | |
| 457 | theorem correction_zero_early (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 458 | (hy : y ≤ 0) : correction c amp eta (Real.exp y) = 0 := by |
| 459 | apply correction_zero_of_outside |
| 460 | intro i hi |
| 461 | have hey : Real.exp y ≤ 1 := by simpa using Real.exp_le_exp.mpr hy |
| 462 | linarith [c.one_lt_lower i, hi.1] |
| 463 | |
| 464 | theorem correction_zero_late (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 465 | (hy : c.pulseLength ≤ y) : correction c amp eta (Real.exp y) = 0 := by |
| 466 | apply correction_zero_of_outside |
| 467 | intro i hi |
| 468 | have hey := Real.exp_le_exp.mpr hy |
| 469 | linarith [c.upper_lt_end i, hi.2] |
| 470 | |
| 471 | def pulseRatio (c : Parameters) (amp : ℝ → ℝ) (p : ℝ × ℝ) : ℝ := |
| 472 | amp p.2 * mainPulse (c.lam * p.1) + correction c amp p.2 (Real.exp p.1) |
| 473 | |
| 474 | theorem pulseRatio_contDiff (c : Parameters) {amp : ℝ → ℝ} |
| 475 | (ha : ContDiff ℝ ∞ amp) : ContDiff ℝ ∞ (pulseRatio c amp) := |
| 476 | ((ha.comp contDiff_snd).mul |
| 477 | (mainPulse_contDiff.comp (contDiff_const.mul contDiff_fst))).add |
| 478 | (correction_contDiff_joint c ha) |
| 479 | |
| 480 | theorem pulseRatio_zero_early (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 481 | (hy : y ≤ 0) : pulseRatio c amp (y, eta) = 0 := by |
| 482 | simp only [pulseRatio] |
| 483 | rw [mainPulse_zero_left (mul_nonpos_of_nonneg_of_nonpos c.lam_pos.le hy), |
| 484 | correction_zero_early c amp eta hy] |
| 485 | ring |
| 486 | |
| 487 | theorem pulseRatio_zero_late (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 488 | (hy : c.pulseLength ≤ y) : pulseRatio c amp (y, eta) = 0 := by |
| 489 | have h13 : 13 ≤ c.lam * y := by |
| 490 | have h := (div_le_iff₀ c.lam_pos).mp hy |
| 491 | nlinarith |
| 492 | simp only [pulseRatio] |
| 493 | rw [mainPulse_zero_right (by linarith : 11 ≤ c.lam * y), |
| 494 | correction_zero_late c amp eta hy] |
| 495 | ring |
| 496 | |
| 497 | def axial (c : Parameters) (amp : ℝ → ℝ) (p : ℝ × ℝ) : ℝ := |
| 498 | initialAxial c.m p + angular c.P c.dropLength c.lam p * |
| 499 | pulseRatio c amp (p.1 - c.pulseStart, p.2) |
| 500 | |
| 501 | theorem axial_contDiff (c : Parameters) {amp : ℝ → ℝ} |
| 502 | (ha : ContDiff ℝ ∞ amp) : ContDiff ℝ ∞ (axial c amp) := |
| 503 | (initialAxial_contDiff c.m_pos).add ((angular_contDiff c.P c.dropLength c.lam).mul |
| 504 | ((pulseRatio_contDiff c ha).comp |
| 505 | ((contDiff_fst.sub contDiff_const).prodMk contDiff_snd))) |
| 506 | |
| 507 | theorem axial_before_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 508 | (hy : y ≤ c.pulseStart) : axial c amp (y, eta) = dropCoefficient c.m y * eta := by |
| 509 | simp [axial, initialAxial, pulseRatio_zero_early c amp eta (by linarith : y - c.pulseStart ≤ 0)] |
| 510 | |
| 511 | theorem axial_shaped_wait (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 512 | (hy : c.holdStart ≤ y) (hy' : y ≤ c.pulseStart) : axial c amp (y, eta) = 0 := by |
| 513 | rw [axial_before_pulse c amp eta hy', dropCoefficient_late c.m_pos] |
| 514 | · ring |
| 515 | · dsimp [Parameters.holdStart, Parameters.dropLength] at hy |
| 516 | linarith |
| 517 | |
| 518 | theorem axial_after_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 519 | (hy : c.endpoint ≤ y) : axial c amp (y, eta) = 0 := by |
| 520 | have hlate : c.pulseLength ≤ y - c.pulseStart := by |
| 521 | dsimp [Parameters.endpoint] at hy |
| 522 | linarith |
| 523 | have hdrop : Real.exp c.m ≤ y := by |
| 524 | have hB := c.pulseStart_ge_hold |
| 525 | have hL := c.pulseLength_pos |
| 526 | dsimp [Parameters.endpoint] at hy |
| 527 | dsimp [Parameters.holdStart, Parameters.dropLength] at hB |
| 528 | linarith |
| 529 | simp [axial, initialAxial, pulseRatio_zero_late c amp eta hlate, |
| 530 | dropCoefficient_late c.m_pos hdrop] |
| 531 | |
| 532 | theorem angular_shaped_wait (c : Parameters) (eta : ℝ) {y : ℝ} |
| 533 | (hy : c.holdStart ≤ y) : |
| 534 | angular c.P c.dropLength c.lam (y, eta) = |
| 535 | radialAmplitude c.P c.dropLength c.lam c.holdStart * shape eta * |
| 536 | Real.exp (-(1 / 2 + c.lam) * (y - c.holdStart)) := by |
| 537 | unfold angular |
| 538 | rw [radialAmplitude_hold c.dropLength_pos.le (by rfl) hy] |
| 539 | ring |
| 540 | |
| 541 | /-! ## Exact finite radial moments of the pulse -/ |
| 542 | |
| 543 | def radialPulse (c : Parameters) (amp : ℝ → ℝ) (eta x : ℝ) : ℝ := |
| 544 | amp eta * mainPulse (c.lam * Real.log x) + correction c amp eta x |
| 545 | |
| 546 | theorem radialPulse_exp (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 547 | radialPulse c amp eta (Real.exp y) = pulseRatio c amp (y, eta) := by |
| 548 | simp [radialPulse, pulseRatio] |
| 549 | |
| 550 | theorem radialPulse_continuousOn (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 551 | ContinuousOn (radialPulse c amp eta) (Ioi 0) := by |
| 552 | have hlog : ContinuousOn Real.log (Ioi (0 : ℝ)) := |
| 553 | continuousOn_id.log (fun _ hx => ne_of_gt hx) |
| 554 | exact (continuousOn_const.mul |
| 555 | (mainPulse_contDiff.continuous.comp_continuousOn (continuousOn_const.mul hlog))).add |
| 556 | ((LocalizedMomentRepair.repair_contDiff c.exponents c.lower c.upper |
| 557 | (debt c amp eta)).continuous.continuousOn) |
| 558 | |
| 559 | theorem correction_interval_exact (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) (i : Fin 2) : |
| 560 | (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 561 | x ^ c.exponents i * correction c amp eta x) = debt c amp eta i := by |
| 562 | rw [intervalIntegral.integral_eq_integral_of_support_subset] |
| 563 | · exact correction_exact c amp eta i |
| 564 | · intro x hx |
| 565 | have hc : correction c amp eta x ≠ 0 := by |
| 566 | intro hzero |
| 567 | exact hx (by simp [hzero]) |
| 568 | have hs := (LocalizedMomentRepair.repair_tsupport_subset_open |
| 569 | c.exponents c.lower c.upper (debt c amp eta) c.lower_lt_upper) |
| 570 | (subset_tsupport _ hc) |
| 571 | obtain ⟨j, hj⟩ := mem_iUnion.mp hs |
| 572 | exact ⟨(c.one_lt_lower j).trans hj.1, hj.2.le.trans (c.upper_lt_end j).le⟩ |
| 573 | |
| 574 | theorem pulse_moment_exact (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) (i : Fin 2) : |
| 575 | (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 576 | x ^ c.exponents i * radialPulse c amp eta x) = |
| 577 | -(prefixCoefficient c i * eta * (1 + eta ^ 2)) := by |
| 578 | have hle : 1 ≤ Real.exp c.pulseLength := by |
| 579 | simpa using Real.exp_le_exp.mpr c.pulseLength_pos.le |
| 580 | have hpos : ∀ x ∈ Icc (1 : ℝ) (Real.exp c.pulseLength), x ≠ 0 := by |
| 581 | intro x hx |
| 582 | linarith [hx.1] |
| 583 | have hpow : ContinuousOn (fun x : ℝ => x ^ c.exponents i) |
| 584 | (Icc 1 (Real.exp c.pulseLength)) := |
| 585 | continuousOn_id.rpow_const (fun x hx => Or.inl (hpos x hx)) |
| 586 | have hlog : ContinuousOn Real.log (Icc (1 : ℝ) (Real.exp c.pulseLength)) := |
| 587 | continuousOn_id.log hpos |
| 588 | have hmain : IntervalIntegrable |
| 589 | (fun x : ℝ => x ^ c.exponents i * (amp eta * mainPulse (c.lam * Real.log x))) |
| 590 | volume 1 (Real.exp c.pulseLength) := |
| 591 | ContinuousOn.intervalIntegrable_of_Icc hle |
| 592 | (hpow.mul (continuousOn_const.mul |
| 593 | (mainPulse_contDiff.continuous.comp_continuousOn (continuousOn_const.mul hlog)))) |
| 594 | have hcorr : IntervalIntegrable |
| 595 | (fun x : ℝ => x ^ c.exponents i * correction c amp eta x) |
| 596 | volume 1 (Real.exp c.pulseLength) := |
| 597 | ContinuousOn.intervalIntegrable_of_Icc hle |
| 598 | (hpow.mul ((LocalizedMomentRepair.repair_contDiff |
| 599 | c.exponents c.lower c.upper (debt c amp eta)).continuous.continuousOn)) |
| 600 | calc |
| 601 | _ = (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 602 | x ^ c.exponents i * (amp eta * mainPulse (c.lam * Real.log x))) + |
| 603 | (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 604 | x ^ c.exponents i * correction c amp eta x) := by |
| 605 | simp only [radialPulse, mul_add] |
| 606 | exact intervalIntegral.integral_add hmain hcorr |
| 607 | _ = amp eta * mainMoment c i + debt c amp eta i := by |
| 608 | rw [correction_interval_exact] |
| 609 | congr 1 |
| 610 | unfold mainMoment |
| 611 | rw [← intervalIntegral.integral_const_mul] |
| 612 | apply intervalIntegral.integral_congr |
| 613 | intro x _ |
| 614 | ring |
| 615 | _ = _ := by unfold debt; ring |
| 616 | |
| 617 | /-- Reattaching the actual prefix gives zero total mass and angular moments. |
| 618 | The two components have physical factors `shape η` and `(shape η)^2`. -/ |
| 619 | theorem pulse_closes_prefix (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 620 | prefixM c * eta + momentScale c 0 * shape eta * |
| 621 | (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 622 | x ^ c.exponents 0 * radialPulse c amp eta x) = 0 ∧ |
| 623 | prefixJ c * eta * shape eta + momentScale c 1 * (shape eta)^2 * |
| 624 | (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 625 | x ^ c.exponents 1 * radialPulse c amp eta x) = 0 := by |
| 626 | rw [pulse_moment_exact, pulse_moment_exact] |
| 627 | have hs : 1 + eta ^ 2 ≠ 0 := by positivity |
| 628 | have hM := (momentScale_pos c 0).ne' |
| 629 | have hJ := (momentScale_pos c 1).ne' |
| 630 | simp only [prefixCoefficient, shape, Fin.isValue, reduceIte, one_ne_zero] |
| 631 | constructor <;> field_simp <;> ring |
| 632 | |
| 633 | /-! ## The moments of the combined log-radius profile -/ |
| 634 | |
| 635 | theorem exp_weight_substitution {R : ℝ → ℝ} (hR : ContinuousOn R (Ioi 0)) |
| 636 | (a B L : ℝ) : |
| 637 | (∫ y in B..B + L, Real.exp ((a + 1) * (y - B)) * R (Real.exp (y - B))) = |
| 638 | ∫ x in (1 : ℝ)..Real.exp L, x ^ a * R x := by |
| 639 | have hpos : ∀ x ∈ (fun y : ℝ => Real.exp (y - B)) '' uIcc B (B + L), 0 < x := by |
| 640 | rintro x ⟨y, hy, rfl⟩ |
| 641 | exact Real.exp_pos _ |
| 642 | have hpow : ContinuousOn (fun x : ℝ => x ^ a) |
| 643 | ((fun y : ℝ => Real.exp (y - B)) '' uIcc B (B + L)) := |
| 644 | continuousOn_id.rpow_const (fun x hx => Or.inl (hpos x hx).ne') |
| 645 | have hsub := intervalIntegral.integral_comp_mul_deriv' |
| 646 | (a := B) (b := B + L) (f := fun y : ℝ => Real.exp (y - B)) |
| 647 | (f' := fun y : ℝ => Real.exp (y - B)) (g := fun x : ℝ => x ^ a * R x) |
| 648 | (fun y _ => by simpa using ((hasDerivAt_id y).sub_const B).exp) |
| 649 | ((Real.continuous_exp.comp (continuous_id.sub continuous_const)).continuousOn) |
| 650 | (hpow.mul (hR.mono (fun x hx => hpos x hx))) |
| 651 | calc |
| 652 | _ = ∫ y in B..B + L, |
| 653 | ((fun x : ℝ => x ^ a * R x) ∘ (fun y : ℝ => Real.exp (y - B))) y * |
| 654 | Real.exp (y - B) := by |
| 655 | apply intervalIntegral.integral_congr |
| 656 | intro y _ |
| 657 | simp only [Function.comp_apply, Real.rpow_def_of_pos (Real.exp_pos _), Real.log_exp] |
| 658 | rw [show (a + 1) * (y - B) = (y - B) * a + (y - B) by ring, Real.exp_add] |
| 659 | ring |
| 660 | _ = _ := by simpa using hsub |
| 661 | |
| 662 | theorem axial_radial_contDiff (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 663 | ContDiff ℝ ∞ (fun y => axial c amp (y, eta)) := by |
| 664 | have he : ContDiff ℝ ∞ (fun y => angular c.P c.dropLength c.lam (y, eta)) := |
| 665 | (angular_contDiff c.P c.dropLength c.lam).comp (contDiff_id.prodMk contDiff_const) |
| 666 | have hr : ContDiff ℝ ∞ (fun y => pulseRatio c amp (y - c.pulseStart, eta)) := |
| 667 | by |
| 668 | change ContDiff ℝ ∞ (fun y => amp eta * mainPulse (c.lam * (y - c.pulseStart)) + |
| 669 | LocalizedMomentRepair.repair c.exponents c.lower c.upper (debt c amp eta) |
| 670 | (Real.exp (y - c.pulseStart))) |
| 671 | exact (contDiff_const.mul (mainPulse_contDiff.comp |
| 672 | (contDiff_const.mul (contDiff_id.sub contDiff_const)))).add |
| 673 | ((LocalizedMomentRepair.repair_contDiff c.exponents c.lower c.upper (debt c amp eta)).comp |
| 674 | (contDiff_id.sub contDiff_const).exp) |
| 675 | exact ((dropCoefficient_contDiff c.m_pos).mul contDiff_const).add (he.mul hr) |
| 676 | |
| 677 | theorem angular_pulse (c : Parameters) (eta : ℝ) {y : ℝ} (hy : c.pulseStart ≤ y) : |
| 678 | angular c.P c.dropLength c.lam (y, eta) = |
| 679 | pulseAmplitude c * shape eta * Real.exp (-(1 / 2 + c.lam) * (y - c.pulseStart)) := by |
| 680 | unfold angular |
| 681 | rw [radialAmplitude_hold c.dropLength_pos.le c.pulseStart_ge_hold hy] |
| 682 | unfold pulseAmplitude |
| 683 | ring |
| 684 | |
| 685 | theorem axial_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 686 | (hy : c.pulseStart ≤ y) : |
| 687 | axial c amp (y, eta) = angular c.P c.dropLength c.lam (y, eta) * |
| 688 | radialPulse c amp eta (Real.exp (y - c.pulseStart)) := by |
| 689 | have hdrop : Real.exp c.m ≤ y := by |
| 690 | have hb := c.pulseStart_ge_hold |
| 691 | dsimp [Parameters.holdStart, Parameters.dropLength] at hb |
| 692 | linarith |
| 693 | simp [axial, initialAxial, dropCoefficient_late c.m_pos hdrop, radialPulse_exp] |
| 694 | |
| 695 | theorem mass_integrand_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 696 | (hy : c.pulseStart ≤ y) : |
| 697 | Real.exp y * axial c amp (y, eta) = |
| 698 | (momentScale c 0 * shape eta) * |
| 699 | (Real.exp ((c.exponents 0 + 1) * (y - c.pulseStart)) * |
| 700 | radialPulse c amp eta (Real.exp (y - c.pulseStart))) := by |
| 701 | rw [axial_pulse c amp eta hy, angular_pulse c eta hy] |
| 702 | have he : Real.exp y * Real.exp (-(1 / 2 + c.lam) * (y - c.pulseStart)) = |
| 703 | Real.exp c.pulseStart * Real.exp ((c.exponents 0 + 1) * (y - c.pulseStart)) := by |
| 704 | rw [← Real.exp_add, ← Real.exp_add] |
| 705 | congr 1 |
| 706 | norm_num [Parameters.exponents] |
| 707 | ring |
| 708 | norm_num [momentScale] |
| 709 | calc |
| 710 | _ = (pulseAmplitude c * shape eta) * |
| 711 | (Real.exp y * Real.exp (-(1 / 2 + c.lam) * (y - c.pulseStart))) * |
| 712 | radialPulse c amp eta (Real.exp (y - c.pulseStart)) := by ring_nf |
| 713 | _ = _ := by rw [he]; ring |
| 714 | |
| 715 | theorem angular_integrand_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 716 | (hy : c.pulseStart ≤ y) : |
| 717 | Real.sqrt 2 * Real.exp (3 * y / 2) * angular c.P c.dropLength c.lam (y, eta) * |
| 718 | axial c amp (y, eta) = |
| 719 | (momentScale c 1 * (shape eta)^2) * |
| 720 | (Real.exp ((c.exponents 1 + 1) * (y - c.pulseStart)) * |
| 721 | radialPulse c amp eta (Real.exp (y - c.pulseStart))) := by |
| 722 | rw [axial_pulse c amp eta hy, angular_pulse c eta hy] |
| 723 | have he : Real.exp (3 * y / 2) * |
| 724 | Real.exp (-(1 / 2 + c.lam) * (y - c.pulseStart)) ^ 2 = |
| 725 | Real.exp (3 * c.pulseStart / 2) * |
| 726 | Real.exp ((c.exponents 1 + 1) * (y - c.pulseStart)) := by |
| 727 | rw [pow_two, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add] |
| 728 | congr 1 |
| 729 | norm_num [Parameters.exponents] |
| 730 | ring |
| 731 | norm_num [momentScale] |
| 732 | calc |
| 733 | _ = (Real.sqrt 2 * pulseAmplitude c ^ 2 * shape eta ^ 2) * |
| 734 | (Real.exp (3 * y / 2) * Real.exp (-(1 / 2 + c.lam) * (y - c.pulseStart)) ^ 2) * |
| 735 | radialPulse c amp eta (Real.exp (y - c.pulseStart)) := by ring_nf |
| 736 | _ = _ := by rw [he]; ring |
| 737 | |
| 738 | /-- `X=e^y`; the first term is the exact mass of the ideal prefix `0<X≤1`. -/ |
| 739 | def massMoment (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : ℝ := |
| 740 | 4 * eta + ∫ t in (0 : ℝ)..y, Real.exp t * axial c amp (t, eta) |
| 741 | |
| 742 | /-- The first term integrates `U H` over the ideal prefix `0<X≤1`. -/ |
| 743 | def angularMoment (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : ℝ := |
| 744 | (5 / 2) * Real.sqrt 2 * c.P * eta * shape eta + |
| 745 | ∫ t in (0 : ℝ)..y, |
| 746 | Real.sqrt 2 * Real.exp (3 * t / 2) * angular c.P c.dropLength c.lam (t, eta) * |
| 747 | axial c amp (t, eta) |
| 748 | |
| 749 | theorem massMoment_at_pulseStart (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 750 | massMoment c amp eta c.pulseStart = prefixM c * eta := by |
| 751 | have hI : (∫ t in (0 : ℝ)..c.pulseStart, Real.exp t * axial c amp (t, eta)) = |
| 752 | (∫ t in (0 : ℝ)..c.pulseStart, Real.exp t * dropCoefficient c.m t) * eta := by |
| 753 | rw [← intervalIntegral.integral_mul_const] |
| 754 | apply intervalIntegral.integral_congr |
| 755 | intro t ht |
| 756 | dsimp only |
| 757 | rw [axial_before_pulse c amp eta ((uIcc_of_le c.pulseStart_pos.le ▸ ht).2)] |
| 758 | ring |
| 759 | unfold massMoment prefixM |
| 760 | rw [hI] |
| 761 | ring |
| 762 | |
| 763 | theorem angularMoment_at_pulseStart (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 764 | angularMoment c amp eta c.pulseStart = prefixJ c * eta * shape eta := by |
| 765 | have hI : (∫ t in (0 : ℝ)..c.pulseStart, |
| 766 | Real.sqrt 2 * Real.exp (3 * t / 2) * angular c.P c.dropLength c.lam (t, eta) * |
| 767 | axial c amp (t, eta)) = |
| 768 | (∫ t in (0 : ℝ)..c.pulseStart, |
| 769 | Real.sqrt 2 * Real.exp (3 * t / 2) * |
| 770 | radialAmplitude c.P c.dropLength c.lam t * dropCoefficient c.m t) * |
| 771 | (eta * shape eta) := by |
| 772 | rw [← intervalIntegral.integral_mul_const] |
| 773 | apply intervalIntegral.integral_congr |
| 774 | intro t ht |
| 775 | dsimp only |
| 776 | rw [axial_before_pulse c amp eta ((uIcc_of_le c.pulseStart_pos.le ▸ ht).2)] |
| 777 | unfold angular |
| 778 | ring |
| 779 | unfold angularMoment prefixJ |
| 780 | rw [hI] |
| 781 | ring |
| 782 | |
| 783 | theorem axial_reserved_band (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) |
| 784 | (hy : c.pulseStart - 25 ≤ y) (hy' : y ≤ c.pulseStart - 3) : |
| 785 | axial c amp (y, eta) = 0 := by |
| 786 | apply axial_shaped_wait c amp eta |
| 787 | · dsimp [Parameters.pulseStart] at hy |
| 788 | linarith [c.wait_gt] |
| 789 | · linarith |
| 790 | |
| 791 | theorem correction_zero_on_main_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) |
| 792 | {y : ℝ} (hy : y ≤ 11 / c.lam) : correction c amp eta (Real.exp y) = 0 := by |
| 793 | apply correction_zero_of_outside |
| 794 | intro i hi |
| 795 | have hey := Real.exp_le_exp.mpr hy |
| 796 | linarith [c.main_end_lt_lower i, hi.1] |
| 797 | |
| 798 | theorem pulseRatio_on_main_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) |
| 799 | {y : ℝ} (hy : y ≤ 11 / c.lam) : |
| 800 | pulseRatio c amp (y, eta) = amp eta * mainPulse (c.lam * y) := by |
| 801 | simp [pulseRatio, correction_zero_on_main_pulse c amp eta hy] |
| 802 | |
| 803 | theorem axial_ideal (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} (hy : y ≤ 0) : |
| 804 | axial c amp (y, eta) = 4 * eta := by |
| 805 | rw [axial_before_pulse c amp eta (hy.trans c.pulseStart_pos.le), |
| 806 | dropCoefficient_early c.m (by linarith)] |
| 807 | |
| 808 | theorem axial_drop (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {t : ℝ} |
| 809 | (ht : 0 ≤ t) (ht' : t ≤ c.dropLength) : |
| 810 | axial c amp (1 + t, eta) = |
| 811 | 4 * (1 - sigma (Real.log (1 + t) / c.m)) * eta := by |
| 812 | have hB := c.pulseStart_ge_hold |
| 813 | have hy : 1 + t ≤ c.pulseStart := by |
| 814 | dsimp [Parameters.holdStart] at hB |
| 815 | linarith |
| 816 | rw [axial_before_pulse c amp eta hy, dropCoefficient_eq c.m_pos (by linarith)] |
| 817 | |
| 818 | theorem radialAmplitude_drop {dropLength lam y P : ℝ} |
| 819 | (hy : 1 ≤ y) (hy' : y ≤ dropLength + 1) : |
| 820 | radialAmplitude P dropLength lam y = |
| 821 | radialAmplitude P dropLength lam 1 * Real.exp (-(y - 1) / 2) := by |
| 822 | have h := primitive_increment (g := fun t => slope dropLength lam t - 1 / 2) |
| 823 | ((slope_contDiff dropLength lam).continuous.sub continuous_const) 1 y (-1 / 2) ?_ |
| 824 | · have he : logAmplitude dropLength lam y = |
| 825 | logAmplitude dropLength lam 1 + -(y - 1) / 2 := by |
| 826 | unfold logAmplitude |
| 827 | rw [h] |
| 828 | ring |
| 829 | simp only [radialAmplitude, he, Real.exp_add, mul_assoc] |
| 830 | · intro t ht |
| 831 | have ht' := uIcc_of_le hy ▸ ht |
| 832 | rw [slope_drop ht'.1 (ht'.2.trans hy')] |
| 833 | ring |
| 834 | |
| 835 | theorem ideal_mass_prefix_integral (eta : ℝ) : |
| 836 | (∫ _x in (0 : ℝ)..1, 4 * eta) = 4 * eta := by simp |
| 837 | |
| 838 | theorem ideal_angular_prefix_integral (P eta : ℝ) : |
| 839 | (∫ x in (0 : ℝ)..1, (4 * eta * Real.sqrt 2 * P * shape eta) * x ^ (3 / 5 : ℝ)) = |
| 840 | (5 / 2) * Real.sqrt 2 * P * eta * shape eta := by |
| 841 | rw [intervalIntegral.integral_const_mul, integral_rpow (Or.inl (by norm_num))] |
| 842 | norm_num |
| 843 | ring |
| 844 | |
| 845 | /-- Both moments are the actual log-coordinate integrals of the combined fields. -/ |
| 846 | theorem massMoment_endpoint (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 847 | massMoment c amp eta c.endpoint = 0 := by |
| 848 | have hF : Continuous (fun t => Real.exp t * axial c amp (t, eta)) := |
| 849 | Real.continuous_exp.mul (axial_radial_contDiff c amp eta).continuous |
| 850 | have hsplit := intervalIntegral.integral_add_adjacent_intervals (μ := volume) |
| 851 | (hF.intervalIntegrable 0 c.pulseStart) (hF.intervalIntegrable c.pulseStart c.endpoint) |
| 852 | have hI : (∫ t in c.pulseStart..c.endpoint, Real.exp t * axial c amp (t, eta)) = |
| 853 | (momentScale c 0 * shape eta) * |
| 854 | (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 855 | x ^ c.exponents 0 * radialPulse c amp eta x) := by |
| 856 | calc |
| 857 | _ = ∫ t in c.pulseStart..c.pulseStart + c.pulseLength, |
| 858 | (momentScale c 0 * shape eta) * |
| 859 | (Real.exp ((c.exponents 0 + 1) * (t - c.pulseStart)) * |
| 860 | radialPulse c amp eta (Real.exp (t - c.pulseStart))) := by |
| 861 | apply intervalIntegral.integral_congr |
| 862 | intro t ht |
| 863 | dsimp only |
| 864 | apply mass_integrand_pulse c amp eta |
| 865 | exact (uIcc_of_le (show c.pulseStart ≤ c.endpoint by |
| 866 | dsimp [Parameters.endpoint]; linarith [c.pulseLength_pos]) ▸ ht).1 |
| 867 | _ = _ := by |
| 868 | rw [intervalIntegral.integral_const_mul, |
| 869 | exp_weight_substitution (radialPulse_continuousOn c amp eta)] |
| 870 | calc |
| 871 | massMoment c amp eta c.endpoint = massMoment c amp eta c.pulseStart + |
| 872 | (∫ t in c.pulseStart..c.endpoint, Real.exp t * axial c amp (t, eta)) := by |
| 873 | unfold massMoment |
| 874 | rw [← hsplit] |
| 875 | ring |
| 876 | _ = 0 := by |
| 877 | rw [massMoment_at_pulseStart, hI] |
| 878 | exact (pulse_closes_prefix c amp eta).1 |
| 879 | |
| 880 | theorem angularMoment_endpoint (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 881 | angularMoment c amp eta c.endpoint = 0 := by |
| 882 | have hE : Continuous (fun t => angular c.P c.dropLength c.lam (t, eta)) := |
| 883 | ((angular_contDiff c.P c.dropLength c.lam).comp |
| 884 | (contDiff_id.prodMk contDiff_const)).continuous |
| 885 | have hF : Continuous (fun t => Real.sqrt 2 * Real.exp (3 * t / 2) * |
| 886 | angular c.P c.dropLength c.lam (t, eta) * axial c amp (t, eta)) := |
| 887 | ((continuous_const.mul (Real.continuous_exp.comp |
| 888 | ((continuous_const.mul continuous_id).div_const 2))).mul hE).mul |
| 889 | (axial_radial_contDiff c amp eta).continuous |
| 890 | have hsplit := intervalIntegral.integral_add_adjacent_intervals (μ := volume) |
| 891 | (hF.intervalIntegrable 0 c.pulseStart) (hF.intervalIntegrable c.pulseStart c.endpoint) |
| 892 | have hI : (∫ t in c.pulseStart..c.endpoint, |
| 893 | Real.sqrt 2 * Real.exp (3 * t / 2) * angular c.P c.dropLength c.lam (t, eta) * |
| 894 | axial c amp (t, eta)) = |
| 895 | (momentScale c 1 * shape eta ^ 2) * |
| 896 | (∫ x in (1 : ℝ)..Real.exp c.pulseLength, |
| 897 | x ^ c.exponents 1 * radialPulse c amp eta x) := by |
| 898 | calc |
| 899 | _ = ∫ t in c.pulseStart..c.pulseStart + c.pulseLength, |
| 900 | (momentScale c 1 * shape eta ^ 2) * |
| 901 | (Real.exp ((c.exponents 1 + 1) * (t - c.pulseStart)) * |
| 902 | radialPulse c amp eta (Real.exp (t - c.pulseStart))) := by |
| 903 | apply intervalIntegral.integral_congr |
| 904 | intro t ht |
| 905 | dsimp only |
| 906 | apply angular_integrand_pulse c amp eta |
| 907 | exact (uIcc_of_le (show c.pulseStart ≤ c.endpoint by |
| 908 | dsimp [Parameters.endpoint]; linarith [c.pulseLength_pos]) ▸ ht).1 |
| 909 | _ = _ := by |
| 910 | rw [intervalIntegral.integral_const_mul, |
| 911 | exp_weight_substitution (radialPulse_continuousOn c amp eta)] |
| 912 | calc |
| 913 | angularMoment c amp eta c.endpoint = angularMoment c amp eta c.pulseStart + |
| 914 | (∫ t in c.pulseStart..c.endpoint, |
| 915 | Real.sqrt 2 * Real.exp (3 * t / 2) * angular c.P c.dropLength c.lam (t, eta) * |
| 916 | axial c amp (t, eta)) := by |
| 917 | unfold angularMoment |
| 918 | rw [← hsplit] |
| 919 | ring |
| 920 | _ = 0 := by |
| 921 | rw [angularMoment_at_pulseStart, hI] |
| 922 | exact (pulse_closes_prefix c amp eta).2 |
| 923 | |
| 924 | /-- The constructed profiles satisfy both endpoint equations for every parameter value. -/ |
| 925 | theorem exact_axial_moments (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) : |
| 926 | massMoment c amp eta c.endpoint = 0 ∧ angularMoment c amp eta c.endpoint = 0 := |
| 927 | ⟨massMoment_endpoint c amp eta, angularMoment_endpoint c amp eta⟩ |
| 928 | |
| 929 | theorem massMoment_after_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 930 | (hy : c.endpoint ≤ y) : massMoment c amp eta y = 0 := by |
| 931 | have hF : Continuous (fun t => Real.exp t * axial c amp (t, eta)) := |
| 932 | Real.continuous_exp.mul (axial_radial_contDiff c amp eta).continuous |
| 933 | have hI : (∫ t in c.endpoint..y, Real.exp t * axial c amp (t, eta)) = 0 := by |
| 934 | calc |
| 935 | _ = ∫ _t in c.endpoint..y, (0 : ℝ) := by |
| 936 | apply intervalIntegral.integral_congr |
| 937 | intro t ht |
| 938 | dsimp only |
| 939 | rw [axial_after_pulse c amp eta ((uIcc_of_le hy ▸ ht).1), mul_zero] |
| 940 | _ = 0 := by simp |
| 941 | have hsplit := intervalIntegral.integral_add_adjacent_intervals (μ := volume) |
| 942 | (hF.intervalIntegrable 0 c.endpoint) (hF.intervalIntegrable c.endpoint y) |
| 943 | calc |
| 944 | massMoment c amp eta y = massMoment c amp eta c.endpoint := by |
| 945 | unfold massMoment |
| 946 | rw [← hsplit, hI, add_zero] |
| 947 | _ = 0 := massMoment_endpoint c amp eta |
| 948 | |
| 949 | theorem angularMoment_after_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) {y : ℝ} |
| 950 | (hy : c.endpoint ≤ y) : angularMoment c amp eta y = 0 := by |
| 951 | have hE : Continuous (fun t => angular c.P c.dropLength c.lam (t, eta)) := |
| 952 | ((angular_contDiff c.P c.dropLength c.lam).comp |
| 953 | (contDiff_id.prodMk contDiff_const)).continuous |
| 954 | have hF : Continuous (fun t => Real.sqrt 2 * Real.exp (3 * t / 2) * |
| 955 | angular c.P c.dropLength c.lam (t, eta) * axial c amp (t, eta)) := |
| 956 | ((continuous_const.mul (Real.continuous_exp.comp |
| 957 | ((continuous_const.mul continuous_id).div_const 2))).mul hE).mul |
| 958 | (axial_radial_contDiff c amp eta).continuous |
| 959 | have hI : (∫ t in c.endpoint..y, |
| 960 | Real.sqrt 2 * Real.exp (3 * t / 2) * angular c.P c.dropLength c.lam (t, eta) * |
| 961 | axial c amp (t, eta)) = 0 := by |
| 962 | calc |
| 963 | _ = ∫ _t in c.endpoint..y, (0 : ℝ) := by |
| 964 | apply intervalIntegral.integral_congr |
| 965 | intro t ht |
| 966 | dsimp only |
| 967 | rw [axial_after_pulse c amp eta ((uIcc_of_le hy ▸ ht).1), mul_zero] |
| 968 | _ = 0 := by simp |
| 969 | have hsplit := intervalIntegral.integral_add_adjacent_intervals (μ := volume) |
| 970 | (hF.intervalIntegrable 0 c.endpoint) (hF.intervalIntegrable c.endpoint y) |
| 971 | calc |
| 972 | angularMoment c amp eta y = angularMoment c amp eta c.endpoint := by |
| 973 | unfold angularMoment |
| 974 | rw [← hsplit, hI, add_zero] |
| 975 | _ = 0 := angularMoment_endpoint c amp eta |
| 976 | |
| 977 | /-- The manuscript's precise shaped-wait duration is a valid instance. -/ |
| 978 | def paperParameters (P m lam : ℝ) (hP : 0 < P) (hm : 0 < m) |
| 979 | (hlam : 0 < lam) (hlam' : lam < 1 / 10) : Parameters where |
| 980 | P := P |
| 981 | m := m |
| 982 | lam := lam |
| 983 | wait := 60 * Real.log (1 / lam) |
| 984 | P_pos := hP |
| 985 | m_pos := hm |
| 986 | lam_pos := hlam |
| 987 | lam_lt := hlam' |
| 988 | wait_gt := by |
| 989 | have h := Real.one_sub_inv_le_log_of_pos (one_div_pos.mpr hlam) |
| 990 | simp only [one_div, inv_inv] at h ⊢ |
| 991 | nlinarith |
| 992 | |
| 993 | /-- A compact interface for using the constructed profiles in later stages. -/ |
| 994 | theorem constructed_core (c : Parameters) {amp : ℝ → ℝ} (ha : ContDiff ℝ ∞ amp) : |
| 995 | ContDiff ℝ ∞ (angular c.P c.dropLength c.lam) ∧ |
| 996 | ContDiff ℝ ∞ (axial c amp) ∧ |
| 997 | (∀ p, 0 < angular c.P c.dropLength c.lam p) ∧ |
| 998 | (∀ eta y, c.endpoint ≤ y → |
| 999 | axial c amp (y, eta) = 0 ∧ massMoment c amp eta y = 0 ∧ |
| 1000 | angularMoment c amp eta y = 0) ∧ |
| 1001 | (∀ eta y, c.holdStart ≤ y → y ≤ c.pulseStart → |
| 1002 | axial c amp (y, eta) = 0 ∧ |
| 1003 | angular c.P c.dropLength c.lam (y, eta) = |
| 1004 | radialAmplitude c.P c.dropLength c.lam c.holdStart * shape eta * |
| 1005 | Real.exp (-(1 / 2 + c.lam) * (y - c.holdStart))) := by |
| 1006 | refine ⟨angular_contDiff _ _ _, axial_contDiff c ha, angular_pos c.P_pos _ _, ?_, ?_⟩ |
| 1007 | · intro eta y hy |
| 1008 | exact ⟨axial_after_pulse c amp eta hy, massMoment_after_pulse c amp eta hy, |
| 1009 | angularMoment_after_pulse c amp eta hy⟩ |
| 1010 | · intro eta y hy hy' |
| 1011 | exact ⟨axial_shaped_wait c amp eta hy hy', angular_shaped_wait c eta hy⟩ |
| 1012 | |
| 1013 | end NavierStokes.OutgoingSchedule |