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.OutgoingPulseBounds |
| 2 | import NavierStokes.PulseAmplitude |
| 3 | import NavierStokes.CorrectedPulseAmplitude |
| 4 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts |
| 5 | import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas |
| 6 | |
| 7 | /-! |
| 8 | # The actual outgoing pulse lag |
| 9 | |
| 10 | The exponential convolution is expanded by two integrations by parts. |
| 11 | The resulting remainder is controlled by the actual second derivative of |
| 12 | the forcing, with constants uniform in the pulse duration. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | |
| 17 | namespace NavierStokes.PulseLag |
| 18 | |
| 19 | open Set MeasureTheory |
| 20 | open scoped Topology ContDiff |
| 21 | |
| 22 | noncomputable def kernel (β y t : ℝ) : ℝ := Real.exp (-β * (y - t)) |
| 23 | |
| 24 | noncomputable def convolution (β : ℝ) (f : ℝ → ℝ) (y : ℝ) : ℝ := |
| 25 | ∫ t in (0 : ℝ)..y, kernel β y t * f t |
| 26 | |
| 27 | noncomputable def lag (β m₀ : ℝ) (f : ℝ → ℝ) (y : ℝ) : ℝ := |
| 28 | m₀ * Real.exp (-β * y) + convolution β f y |
| 29 | |
| 30 | theorem kernel_pos (β y t : ℝ) : 0 < kernel β y t := Real.exp_pos _ |
| 31 | |
| 32 | theorem kernel_continuous (β y : ℝ) : Continuous (kernel β y) := |
| 33 | Real.continuous_exp.comp (continuous_const.fun_mul (continuous_const.sub continuous_id)) |
| 34 | |
| 35 | theorem kernel_hasDerivAt (β y t : ℝ) : |
| 36 | HasDerivAt (kernel β y) (β * kernel β y t) t := by |
| 37 | convert! (((hasDerivAt_const t y).fun_sub (hasDerivAt_id t)).const_mul (-β)).exp using 1 |
| 38 | simp only [kernel, id_eq] |
| 39 | ring |
| 40 | |
| 41 | theorem convolution_eq_weighted (β : ℝ) (f : ℝ → ℝ) (y : ℝ) : |
| 42 | convolution β f y = Real.exp (-β * y) * ∫ t in (0 : ℝ)..y, Real.exp (β * t) * f t := by |
| 43 | rw [← intervalIntegral.integral_const_mul] |
| 44 | apply intervalIntegral.integral_congr |
| 45 | intro t _ |
| 46 | dsimp only [kernel] |
| 47 | rw [show -β * (y - t) = -β * y + β * t by ring, Real.exp_add] |
| 48 | ring |
| 49 | |
| 50 | theorem kernel_integral {β : ℝ} (hβ : β ≠ 0) (y : ℝ) : |
| 51 | (∫ t in (0 : ℝ)..y, kernel β y t) = (1 - Real.exp (-β * y)) / β := by |
| 52 | have hd (t : ℝ) : HasDerivAt (fun s => kernel β y s / β) (kernel β y t) t := by |
| 53 | convert! (kernel_hasDerivAt β y t).div_const β using 1 |
| 54 | field_simp |
| 55 | have he := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _ => hd t) |
| 56 | ((kernel_continuous β y).intervalIntegrable 0 y) |
| 57 | simpa only [kernel, sub_self, mul_zero, Real.exp_zero, sub_zero, div_sub_div_same] using he |
| 58 | |
| 59 | theorem convolution_abs_le {β M y : ℝ} (hβ : 0 < β) (hM : 0 ≤ M) (hy : 0 ≤ y) |
| 60 | {f : ℝ → ℝ} (hf : Continuous f) (hbound : ∀ t ∈ Icc (0 : ℝ) y, |f t| ≤ M) : |
| 61 | |convolution β f y| ≤ M / β := by |
| 62 | have hi : IntervalIntegrable (fun t => kernel β y t * f t) volume 0 y := |
| 63 | ((kernel_continuous β y).fun_mul hf).intervalIntegrable 0 y |
| 64 | have hj : IntervalIntegrable (fun t => kernel β y t * M) volume 0 y := |
| 65 | ((kernel_continuous β y).fun_mul continuous_const).intervalIntegrable 0 y |
| 66 | calc |
| 67 | |convolution β f y| ≤ ∫ t in (0 : ℝ)..y, |kernel β y t * f t| := by |
| 68 | simpa only [convolution, Real.norm_eq_abs] using |
| 69 | (intervalIntegral.norm_integral_le_integral_norm (f := fun t => kernel β y t * f t) hy) |
| 70 | _ ≤ ∫ t in (0 : ℝ)..y, kernel β y t * M := by |
| 71 | apply intervalIntegral.integral_mono_on hy hi.norm hj |
| 72 | intro t ht |
| 73 | rw [Real.norm_eq_abs] |
| 74 | rw [abs_mul, abs_of_pos (kernel_pos β y t)] |
| 75 | exact mul_le_mul_of_nonneg_left (hbound t ht) (kernel_pos β y t).le |
| 76 | _ = M * ((1 - Real.exp (-β * y)) / β) := by |
| 77 | rw [intervalIntegral.integral_mul_const, kernel_integral hβ.ne'] |
| 78 | ring |
| 79 | _ ≤ M / β := by |
| 80 | have he : 0 ≤ Real.exp (-β * y) := (Real.exp_pos _).le |
| 81 | have hdiv : (1 - Real.exp (-β * y)) / β ≤ 1 / β := |
| 82 | div_le_div_of_nonneg_right (by linarith) hβ.le |
| 83 | simpa only [mul_one_div] using mul_le_mul_of_nonneg_left hdiv hM |
| 84 | |
| 85 | /-- Exact second-order integration-by-parts identity, including the |
| 86 | initial boundary terms. -/ |
| 87 | theorem convolution_second_order {β : ℝ} (hβ : β ≠ 0) |
| 88 | {f f₁ f₂ : ℝ → ℝ} (hf : ∀ t, HasDerivAt f (f₁ t) t) |
| 89 | (hf₁ : ∀ t, HasDerivAt f₁ (f₂ t) t) (hf₂ : Continuous f₂) (y : ℝ) : |
| 90 | convolution β f y = f y / β - f₁ y / β ^ 2 - |
| 91 | Real.exp (-β * y) * (f 0 / β - f₁ 0 / β ^ 2) + convolution β f₂ y / β ^ 2 := by |
| 92 | have hc : Continuous f := continuous_iff_continuousAt.mpr (fun t => (hf t).continuousAt) |
| 93 | have hc₁ : Continuous f₁ := continuous_iff_continuousAt.mpr (fun t => (hf₁ t).continuousAt) |
| 94 | have hd (t : ℝ) : HasDerivAt |
| 95 | (fun s => kernel β y s * (f s / β - f₁ s / β ^ 2)) |
| 96 | (kernel β y t * f t - (kernel β y t * f₂ t) / β ^ 2) t := by |
| 97 | convert! (kernel_hasDerivAt β y t).fun_mul ((hf t).div_const β |>.fun_sub |
| 98 | ((hf₁ t).div_const (β ^ 2))) using 1 |
| 99 | field_simp ; ring |
| 100 | have hi : IntervalIntegrable (fun t => kernel β y t * f t) volume 0 y := |
| 101 | ((kernel_continuous β y).fun_mul hc).intervalIntegrable 0 y |
| 102 | have hi₂ : IntervalIntegrable (fun t => (kernel β y t * f₂ t) / β ^ 2) volume 0 y := |
| 103 | (((kernel_continuous β y).fun_mul hf₂).div_const (β ^ 2)).intervalIntegrable 0 y |
| 104 | have he := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _ => hd t) (hi.sub hi₂) |
| 105 | rw [intervalIntegral.integral_sub hi hi₂, intervalIntegral.integral_div] at he |
| 106 | simp only [kernel, sub_self, mul_zero, Real.exp_zero, one_mul, sub_zero] at he |
| 107 | dsimp only [convolution, kernel] |
| 108 | linarith |
| 109 | |
| 110 | theorem lag_second_order_error {β M y : ℝ} (hβ : 0 < β) (hM : 0 ≤ M) (hy : 0 ≤ y) |
| 111 | {f f₁ f₂ : ℝ → ℝ} (hf : ∀ t, HasDerivAt f (f₁ t) t) |
| 112 | (hf₁ : ∀ t, HasDerivAt f₁ (f₂ t) t) (hf₂ : Continuous f₂) |
| 113 | (hzero : f 0 = 0) (hzero₁ : f₁ 0 = 0) |
| 114 | (hbound : ∀ t ∈ Icc (0 : ℝ) y, |f₂ t| ≤ M) (m₀ : ℝ) : |
| 115 | |lag β m₀ f y - (f y / β - f₁ y / β ^ 2 + m₀ * Real.exp (-β * y))| ≤ M / β ^ 3 := by |
| 116 | have he := convolution_second_order hβ.ne' hf hf₁ hf₂ y |
| 117 | rw [hzero, hzero₁] at he |
| 118 | simp only [zero_div, sub_zero, mul_zero] at he |
| 119 | have herr : lag β m₀ f y - (f y / β - f₁ y / β ^ 2 + m₀ * Real.exp (-β * y)) = |
| 120 | convolution β f₂ y / β ^ 2 := by rw [lag, he]; ring |
| 121 | rw [herr, abs_div, abs_of_pos (sq_pos_of_pos hβ)] |
| 122 | have hb := div_le_div_of_nonneg_right (convolution_abs_le hβ hM hy hf₂ hbound) |
| 123 | (sq_nonneg β) |
| 124 | refine hb.trans_eq ?_ |
| 125 | rw [div_div] |
| 126 | congr 1 |
| 127 | ring |
| 128 | |
| 129 | theorem convolution_linear (β q A y : ℝ) {f g : ℝ → ℝ} |
| 130 | (hf : Continuous f) (hg : Continuous g) : |
| 131 | convolution β (fun t => q * f t + A * g t) y = |
| 132 | q * convolution β f y + A * convolution β g y := by |
| 133 | have heq : (fun t => kernel β y t * (q * f t + A * g t)) = |
| 134 | (fun t => q * (kernel β y t * f t) + A * (kernel β y t * g t)) := by |
| 135 | funext t |
| 136 | ring |
| 137 | unfold convolution |
| 138 | rw [heq, intervalIntegral.integral_add |
| 139 | ((continuous_const.fun_mul ((kernel_continuous β y).fun_mul hf)).intervalIntegrable 0 y) |
| 140 | ((continuous_const.fun_mul ((kernel_continuous β y).fun_mul hg)).intervalIntegrable 0 y), |
| 141 | intervalIntegral.integral_const_mul, intervalIntegral.integral_const_mul] |
| 142 | |
| 143 | section ActualPulse |
| 144 | |
| 145 | open OutgoingSchedule OutgoingPulseBounds |
| 146 | |
| 147 | noncomputable def decay (c : Parameters) : ℝ := 1 / 2 - c.lam |
| 148 | |
| 149 | theorem decay_pos (c : Parameters) : 0 < decay c := by |
| 150 | dsimp [decay] |
| 151 | linarith [c.lam_lt] |
| 152 | |
| 153 | theorem decay_inv_cube_le (c : Parameters) {M : ℝ} (hM : 0 ≤ M) : |
| 154 | M / decay c ^ 3 ≤ 16 * M := by |
| 155 | have hd : (2 / 5 : ℝ) ≤ decay c := by dsimp [decay]; linarith [c.lam_lt] |
| 156 | have hp := pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 2 / 5) hd 3 |
| 157 | have hb : 1 ≤ 16 * decay c ^ 3 := by norm_num at hp; linarith |
| 158 | apply (div_le_iff₀ (pow_pos (decay_pos c) 3)).mpr |
| 159 | nlinarith [mul_le_mul_of_nonneg_right hb hM] |
| 160 | |
| 161 | /-- The exponential correction is smaller than a fixed quadratic rate, |
| 162 | uniformly for every positive lambda. -/ |
| 163 | theorem exponential_correction_quadratic {lam : ℝ} (hlam : 0 < lam) : |
| 164 | Real.exp (-(1 / (4 * lam))) ≤ 64 * lam ^ 2 := by |
| 165 | have hx : 0 < 1 / (8 * lam) := by positivity |
| 166 | have he : 1 / (8 * lam) ≤ Real.exp (1 / (8 * lam)) := by |
| 167 | linarith [Real.add_one_le_exp (1 / (8 * lam))] |
| 168 | have hs := pow_le_pow_left₀ hx.le he 2 |
| 169 | rw [← Real.exp_nat_mul] at hs |
| 170 | have hi := one_div_le_one_div_of_le (sq_pos_of_pos hx) hs |
| 171 | have harg : (2 : ℝ) * (1 / (8 * lam)) = 1 / (4 * lam) := by ring |
| 172 | norm_num only [Nat.cast_ofNat] at hi |
| 173 | rw [harg, one_div, ← Real.exp_neg] at hi |
| 174 | convert! hi using 1 |
| 175 | field_simp ; ring |
| 176 | |
| 177 | noncomputable def mainSecondBound : ℝ := 1 + Classical.choose |
| 178 | (LocalizedMomentRepair.smooth_compact_derivative_bound mainPulse |
| 179 | mainPulse_contDiff mainPulse_hasCompactSupport 2) |
| 180 | |
| 181 | theorem mainSecondBound_pos : 0 < mainSecondBound := by |
| 182 | have h := (Classical.choose_spec (LocalizedMomentRepair.smooth_compact_derivative_bound mainPulse |
| 183 | mainPulse_contDiff mainPulse_hasCompactSupport 2)).1 |
| 184 | dsimp [mainSecondBound] |
| 185 | linarith |
| 186 | |
| 187 | theorem main_second_le (z : ℝ) : |iteratedDeriv 2 mainPulse z| ≤ mainSecondBound := by |
| 188 | have h := (Classical.choose_spec (LocalizedMomentRepair.smooth_compact_derivative_bound mainPulse |
| 189 | mainPulse_contDiff mainPulse_hasCompactSupport 2)).2 z |
| 190 | dsimp [mainSecondBound] |
| 191 | linarith |
| 192 | |
| 193 | noncomputable def forcing (c : Parameters) (q A y : ℝ) : ℝ := |
| 194 | A * mainPulse (c.lam * y) + affineProfile c q A y |
| 195 | |
| 196 | theorem forcing_contDiff (c : Parameters) (q A : ℝ) : ContDiff ℝ ∞ (forcing c q A) := |
| 197 | (contDiff_const.mul (mainPulse_contDiff.comp (contDiff_const.mul contDiff_id))).add |
| 198 | (affineProfile_contDiff c q A) |
| 199 | |
| 200 | theorem forcing_eq_pulseRatio (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 201 | forcing c (parameterPolynomial eta) (amp eta) y = pulseRatio c amp (y, eta) := by |
| 202 | rw [pulseRatio, correction_log_eq_affineProfile] |
| 203 | rfl |
| 204 | |
| 205 | theorem affineProfile_zero_left (c : Parameters) (q A : ℝ) {y : ℝ} (hy : y ≤ 0) : |
| 206 | affineProfile c q A y = 0 := by |
| 207 | have hz (j : Fin 2) : logTemplate (y - center c j) = 0 := by |
| 208 | rw [← bump_log_translate] |
| 209 | by_contra hb |
| 210 | have hsupport := LocalizedMomentRepair.bump_tsupport_subset_open |
| 211 | (c.lower j) (c.upper j) (c.lower_lt_upper j) (subset_tsupport _ hb) |
| 212 | have hey : Real.exp y ≤ 1 := by simpa only [Real.exp_zero] using Real.exp_le_exp.mpr hy |
| 213 | linarith [c.one_lt_lower j, hsupport.1] |
| 214 | simp only [affineProfile, hz, mul_zero, Finset.sum_const_zero] |
| 215 | |
| 216 | theorem forcing_zero_left (c : Parameters) (q A : ℝ) {y : ℝ} (hy : y ≤ 0) : |
| 217 | forcing c q A y = 0 := by |
| 218 | rw [forcing, mainPulse_zero_left (mul_nonpos_of_nonneg_of_nonpos c.lam_pos.le hy), |
| 219 | affineProfile_zero_left c q A hy] |
| 220 | ring |
| 221 | |
| 222 | theorem deriv_zero_of_zero_left {f : ℝ → ℝ} (hf : ∀ y ≤ 0, f y = 0) : deriv f 0 = 0 := by |
| 223 | have hd : HasDerivWithinAt f 0 (Iic 0) 0 := |
| 224 | (hasDerivWithinAt_const 0 (Iic 0) 0).congr (fun y hy => hf y hy) (hf 0 le_rfl) |
| 225 | exact hd.deriv_eq_zero (uniqueDiffOn_Iic 0 0 self_mem_Iic) |
| 226 | |
| 227 | theorem forcing_jet_formula (c : Parameters) (q A : ℝ) (k : ℕ) (y : ℝ) : |
| 228 | iteratedDeriv k (forcing c q A) y = |
| 229 | A * c.lam ^ k * iteratedDeriv k mainPulse (c.lam * y) + |
| 230 | iteratedDeriv k (affineProfile c q A) y := by |
| 231 | have hm : ContDiff ℝ k (fun t => mainPulse (c.lam * t)) := |
| 232 | (mainPulse_contDiff.comp (contDiff_const.mul contDiff_id)).of_le |
| 233 | (ENat.natCast_le_of_coe_top_le_withTop le_rfl k) |
| 234 | have hc : ContDiff ℝ k (affineProfile c q A) := (affineProfile_contDiff c q A).of_le |
| 235 | (ENat.natCast_le_of_coe_top_le_withTop le_rfl k) |
| 236 | change iteratedDeriv k ((fun t => A * mainPulse (c.lam * t)) + affineProfile c q A) y = _ |
| 237 | rw [iteratedDeriv_add (contDiff_const.mul hm).contDiffAt hc.contDiffAt, |
| 238 | iteratedDeriv_const_mul A hm.contDiffAt, |
| 239 | iteratedDeriv_comp_const_mul (mainPulse_contDiff.of_le |
| 240 | (ENat.natCast_le_of_coe_top_le_withTop le_rfl k)) c.lam] |
| 241 | ring |
| 242 | |
| 243 | noncomputable def forcingBound (P m : ℝ) : ℝ := mainSecondBound + 64 * correctionJetBound P m 2 |
| 244 | |
| 245 | theorem forcingBound_pos {P : ℝ} (hP : 0 < P) (m : ℝ) : 0 < forcingBound P m := by |
| 246 | have hc := correctionJetBound_pos hP m 2 |
| 247 | dsimp [forcingBound] |
| 248 | linarith [mainSecondBound_pos] |
| 249 | |
| 250 | theorem forcing_second_bound (c : Parameters) (hsmall : c.lam ≤ 1 / 120) |
| 251 | (q A y : ℝ) : |iteratedDeriv 2 (forcing c q A) y| ≤ |
| 252 | forcingBound c.P c.m * (|q| + |A|) * c.lam ^ 2 := by |
| 253 | rw [forcing_jet_formula] |
| 254 | have hc := affineProfile_jet_bound c hsmall q A 2 y |
| 255 | have he := exponential_correction_quadratic c.lam_pos |
| 256 | have hm : |A * c.lam ^ 2 * iteratedDeriv 2 mainPulse (c.lam * y)| ≤ |
| 257 | |A| * c.lam ^ 2 * mainSecondBound := by |
| 258 | rw [abs_mul, abs_mul, abs_of_nonneg (sq_nonneg c.lam)] |
| 259 | exact mul_le_mul_of_nonneg_left (main_second_le _) (by positivity) |
| 260 | have hc' : |iteratedDeriv 2 (affineProfile c q A) y| ≤ |
| 261 | correctionJetBound c.P c.m 2 * (64 * c.lam ^ 2) * (|q| + |A|) := |
| 262 | hc.trans (mul_le_mul_of_nonneg_right |
| 263 | (mul_le_mul_of_nonneg_left he (correctionJetBound_pos c.P_pos c.m 2).le) (by positivity)) |
| 264 | have hab : |A| ≤ |q| + |A| := by linarith [abs_nonneg q] |
| 265 | have hmain := mul_le_mul_of_nonneg_right hab |
| 266 | (mul_nonneg (sq_nonneg c.lam) mainSecondBound_pos.le) |
| 267 | calc |
| 268 | _ ≤ |A * c.lam ^ 2 * iteratedDeriv 2 mainPulse (c.lam * y)| + |
| 269 | |iteratedDeriv 2 (affineProfile c q A) y| := abs_add_le _ _ |
| 270 | _ ≤ |A| * c.lam ^ 2 * mainSecondBound + |
| 271 | correctionJetBound c.P c.m 2 * (64 * c.lam ^ 2) * (|q| + |A|) := add_le_add hm hc' |
| 272 | _ ≤ _ := by dsimp [forcingBound]; nlinarith |
| 273 | |
| 274 | noncomputable def affineLag (c : Parameters) (q A y : ℝ) : ℝ := |
| 275 | lag (decay c) (prefixCoefficient c 0 * q) (forcing c q A) y |
| 276 | |
| 277 | noncomputable def lagBound (P m : ℝ) : ℝ := 16 * forcingBound P m |
| 278 | |
| 279 | theorem lagBound_pos {P : ℝ} (hP : 0 < P) (m : ℝ) : 0 < lagBound P m := |
| 280 | mul_pos (by norm_num) (forcingBound_pos hP m) |
| 281 | |
| 282 | theorem affineLag_error (c : Parameters) (hsmall : c.lam ≤ 1 / 120) |
| 283 | (q A : ℝ) {y : ℝ} (hy : 0 ≤ y) : |
| 284 | |affineLag c q A y - (forcing c q A y / decay c - |
| 285 | deriv (forcing c q A) y / decay c ^ 2 + |
| 286 | (prefixCoefficient c 0 * q) * Real.exp (-decay c * y))| ≤ |
| 287 | lagBound c.P c.m * (|q| + |A|) * c.lam ^ 2 := by |
| 288 | have hf := forcing_contDiff c q A |
| 289 | have hd : ∀ t, HasDerivAt (forcing c q A) (deriv (forcing c q A) t) t := |
| 290 | fun t => (hf.differentiable (by simp) t).hasDerivAt |
| 291 | have hd₁ : ∀ t, HasDerivAt (deriv (forcing c q A)) |
| 292 | (iteratedDeriv 2 (forcing c q A) t) t := by |
| 293 | intro t |
| 294 | simpa only [iteratedDeriv_one, iteratedDeriv_succ, iteratedDeriv_zero] using |
| 295 | (hf.differentiable_iteratedDeriv 1 (ENat.natCast_lt_of_coe_top_le_withTop le_rfl 1) t).hasDerivAt |
| 296 | have hc₂ := hf.continuous_iteratedDeriv 2 (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2) |
| 297 | have hM : 0 ≤ forcingBound c.P c.m * (|q| + |A|) * c.lam ^ 2 := by |
| 298 | have hp := forcingBound_pos c.P_pos c.m |
| 299 | positivity |
| 300 | have he := lag_second_order_error (decay_pos c) hM hy hd hd₁ hc₂ |
| 301 | (forcing_zero_left c q A le_rfl) |
| 302 | (deriv_zero_of_zero_left (fun t ht => forcing_zero_left c q A ht)) |
| 303 | (fun t _ => forcing_second_bound c hsmall q A t) (prefixCoefficient c 0 * q) |
| 304 | exact he.trans ((decay_inv_cube_le c hM).trans_eq (by dsimp [lagBound]; ring)) |
| 305 | |
| 306 | /-- The actual radial mass average divided by the actual angular profile, |
| 307 | at pulse-relative log time `y`. -/ |
| 308 | noncomputable def normalizedLag (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : ℝ := |
| 309 | massMoment c amp eta (c.pulseStart + y) / |
| 310 | (Real.exp (c.pulseStart + y) * |
| 311 | angular c.P c.dropLength c.lam (c.pulseStart + y, eta)) |
| 312 | |
| 313 | theorem pulse_denominator (c : Parameters) (eta : ℝ) {y : ℝ} (hy : 0 ≤ y) : |
| 314 | Real.exp (c.pulseStart + y) * angular c.P c.dropLength c.lam (c.pulseStart + y, eta) = |
| 315 | (momentScale c 0 * shape eta) * Real.exp (decay c * y) := by |
| 316 | rw [angular_pulse c eta (by linarith)] |
| 317 | have hsub : c.pulseStart + y - c.pulseStart = y := by ring |
| 318 | rw [hsub, Real.exp_add] |
| 319 | have he : Real.exp y * Real.exp (-(1 / 2 + c.lam) * y) = Real.exp (decay c * y) := by |
| 320 | rw [← Real.exp_add] |
| 321 | congr 1 |
| 322 | dsimp [decay] |
| 323 | ring |
| 324 | norm_num only [momentScale, ite_eq_left rfl] |
| 325 | simp only [ite_true] |
| 326 | calc |
| 327 | _ = (Real.exp c.pulseStart * pulseAmplitude c * shape eta) * |
| 328 | (Real.exp y * Real.exp (-(1 / 2 + c.lam) * y)) := by ring |
| 329 | _ = _ := by rw [he] |
| 330 | |
| 331 | theorem massMoment_pulse (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) |
| 332 | {y : ℝ} (hy : 0 ≤ y) : |
| 333 | massMoment c amp eta (c.pulseStart + y) = massMoment c amp eta c.pulseStart + |
| 334 | (momentScale c 0 * shape eta) * |
| 335 | ∫ t in (0 : ℝ)..y, Real.exp (decay c * t) * forcing c (parameterPolynomial eta) (amp eta) t := by |
| 336 | let g : ℝ → ℝ := fun t => Real.exp t * axial c amp (t, eta) |
| 337 | have hg : Continuous g := Real.continuous_exp.mul (axial_radial_contDiff c amp eta).continuous |
| 338 | have hadd := intervalIntegral.integral_add_adjacent_intervals |
| 339 | (hg.intervalIntegrable (μ := volume) 0 c.pulseStart) |
| 340 | (hg.intervalIntegrable (μ := volume) c.pulseStart (c.pulseStart + y)) |
| 341 | have hshift := intervalIntegral.integral_comp_add_left (a := 0) (b := y) g c.pulseStart |
| 342 | simp only [add_zero] at hshift |
| 343 | have hpart : (∫ t in c.pulseStart..c.pulseStart + y, g t) = |
| 344 | (momentScale c 0 * shape eta) * |
| 345 | ∫ t in (0 : ℝ)..y, Real.exp (decay c * t) * forcing c (parameterPolynomial eta) (amp eta) t := by |
| 346 | rw [← hshift, ← intervalIntegral.integral_const_mul] |
| 347 | apply intervalIntegral.integral_congr |
| 348 | intro t ht |
| 349 | have ht' : t ∈ Icc (0 : ℝ) y := by simpa only [uIcc_of_le hy] using ht |
| 350 | have h := mass_integrand_pulse c amp eta (y := c.pulseStart + t) (by linarith [ht'.1]) |
| 351 | have hsub : c.pulseStart + t - c.pulseStart = t := by ring |
| 352 | rw [hsub, radialPulse_exp, ← forcing_eq_pulseRatio] at h |
| 353 | have hdecay : c.exponents 0 + 1 = decay c := by norm_num [Parameters.exponents, decay]; ring |
| 354 | rw [hdecay] at h |
| 355 | exact h |
| 356 | change (4 * eta + ∫ t in (0 : ℝ)..c.pulseStart + y, g t) = |
| 357 | (4 * eta + ∫ t in (0 : ℝ)..c.pulseStart, g t) + _ |
| 358 | rw [← hadd, hpart] |
| 359 | ring |
| 360 | |
| 361 | /-- The exact exponential-convolution representation of the actual lag; |
| 362 | it is derived from the radial mass integral. -/ |
| 363 | theorem normalizedLag_eq_affineLag (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) |
| 364 | {y : ℝ} (hy : 0 ≤ y) : |
| 365 | normalizedLag c amp eta y = affineLag c (parameterPolynomial eta) (amp eta) y := by |
| 366 | have hs : momentScale c 0 * shape eta ≠ 0 := |
| 367 | ne_of_gt (mul_pos (momentScale_pos c 0) (shape_pos eta)) |
| 368 | have hpre := normalized_mass_prefix c amp eta |
| 369 | have hd0 := pulse_denominator c eta (y := 0) le_rfl |
| 370 | simp only [add_zero, mul_zero, Real.exp_zero, mul_one] at hd0 |
| 371 | rw [hd0] at hpre |
| 372 | have hpre' : massMoment c amp eta c.pulseStart = |
| 373 | (prefixCoefficient c 0 * parameterPolynomial eta) * (momentScale c 0 * shape eta) := by |
| 374 | apply (div_eq_iff hs).mp |
| 375 | simpa only [parameterPolynomial, mul_assoc] using hpre |
| 376 | rw [normalizedLag, massMoment_pulse c amp eta hy, pulse_denominator c eta hy, hpre', |
| 377 | affineLag, lag, convolution_eq_weighted] |
| 378 | have he : Real.exp (-decay c * y) = (Real.exp (decay c * y))⁻¹ := by |
| 379 | rw [show -decay c * y = -(decay c * y) by ring, Real.exp_neg] |
| 380 | rw [he] |
| 381 | field_simp [(momentScale_pos c 0).ne', (shape_pos eta).ne'] |
| 382 | |
| 383 | theorem normalizedLag_error (c : Parameters) (hsmall : c.lam ≤ 1 / 120) |
| 384 | (amp : ℝ → ℝ) {eta : ℝ} (heta : |eta| ≤ 1) {y : ℝ} (hy : 0 ≤ y) : |
| 385 | |normalizedLag c amp eta y - (pulseRatio c amp (y, eta) / decay c - |
| 386 | deriv (fun t => pulseRatio c amp (t, eta)) y / decay c ^ 2 + |
| 387 | (prefixCoefficient c 0 * parameterPolynomial eta) * Real.exp (-decay c * y))| ≤ |
| 388 | lagBound c.P c.m * (2 + |amp eta|) * c.lam ^ 2 := by |
| 389 | have hfun : (fun t => pulseRatio c amp (t, eta)) = |
| 390 | forcing c (parameterPolynomial eta) (amp eta) := by |
| 391 | funext t |
| 392 | exact (forcing_eq_pulseRatio c amp eta t).symm |
| 393 | rw [normalizedLag_eq_affineLag c amp eta hy, hfun, |
| 394 | ← forcing_eq_pulseRatio c amp eta y] |
| 395 | apply (affineLag_error c hsmall _ _ hy).trans |
| 396 | have hq := parameterPolynomial_bound heta |
| 397 | have hpos := lagBound_pos c.P_pos c.m |
| 398 | gcongr |
| 399 | |
| 400 | theorem forcing_jet_decomposition (c : Parameters) (q A : ℝ) (k : ℕ) (y : ℝ) : |
| 401 | iteratedDeriv k (forcing c q A) y = |
| 402 | q * iteratedDeriv k (forcing c 1 0) y + A * iteratedDeriv k (forcing c 0 1) y := by |
| 403 | rw [forcing_jet_formula, forcing_jet_formula, forcing_jet_formula, |
| 404 | affineProfile_jet_decomposition c q A k y] |
| 405 | ring |
| 406 | |
| 407 | theorem affineLag_decomposition (c : Parameters) (q A y : ℝ) : |
| 408 | affineLag c q A y = q * affineLag c 1 0 y + A * affineLag c 0 1 y := by |
| 409 | have hF : forcing c q A = fun t => q * forcing c 1 0 t + A * forcing c 0 1 t := by |
| 410 | funext t |
| 411 | simpa only [iteratedDeriv_zero] using forcing_jet_decomposition c q A 0 t |
| 412 | simp only [affineLag, lag] |
| 413 | rw [hF, convolution_linear (decay c) q A y |
| 414 | (forcing_contDiff c 1 0).continuous (forcing_contDiff c 0 1).continuous] |
| 415 | ring |
| 416 | |
| 417 | theorem affineLag_eta_hasDerivAt (c : Parameters) {amp : ℝ → ℝ} {eta amp' : ℝ} |
| 418 | (ha : HasDerivAt amp amp' eta) (y : ℝ) : |
| 419 | HasDerivAt (fun t => affineLag c (parameterPolynomial t) (amp t) y) |
| 420 | (affineLag c (1 + 3 * eta ^ 2) amp' y) eta := by |
| 421 | have hF : (fun t => affineLag c (parameterPolynomial t) (amp t) y) = |
| 422 | (fun t => parameterPolynomial t * affineLag c 1 0 y + amp t * affineLag c 0 1 y) := by |
| 423 | funext t |
| 424 | exact affineLag_decomposition c _ _ y |
| 425 | rw [hF, affineLag_decomposition c (1 + 3 * eta ^ 2) amp' y] |
| 426 | exact ((parameterPolynomial_hasDerivAt eta).mul_const _).add (ha.mul_const _) |
| 427 | |
| 428 | theorem normalizedLag_eta_hasDerivAt (c : Parameters) {amp : ℝ → ℝ} {eta amp' : ℝ} |
| 429 | (ha : HasDerivAt amp amp' eta) {y : ℝ} (hy : 0 ≤ y) : |
| 430 | HasDerivAt (fun t => normalizedLag c amp t y) |
| 431 | (affineLag c (1 + 3 * eta ^ 2) amp' y) eta := |
| 432 | (affineLag_eta_hasDerivAt c ha y).congr_of_eventuallyEq |
| 433 | (Filter.Eventually.of_forall (fun t => normalizedLag_eq_affineLag c amp t hy)) |
| 434 | |
| 435 | noncomputable def affineError (c : Parameters) (q A y : ℝ) : ℝ := |
| 436 | affineLag c q A y - (forcing c q A y / decay c - deriv (forcing c q A) y / decay c ^ 2 + |
| 437 | (prefixCoefficient c 0 * q) * Real.exp (-decay c * y)) |
| 438 | |
| 439 | theorem affineError_decomposition (c : Parameters) (q A y : ℝ) : |
| 440 | affineError c q A y = q * affineError c 1 0 y + A * affineError c 0 1 y := by |
| 441 | have h₀ := forcing_jet_decomposition c q A 0 y |
| 442 | have h₁ := forcing_jet_decomposition c q A 1 y |
| 443 | simp only [iteratedDeriv_zero] at h₀ |
| 444 | simp only [iteratedDeriv_one] at h₁ |
| 445 | simp only [affineError] |
| 446 | rw [affineLag_decomposition c q A y, h₀, h₁] |
| 447 | ring |
| 448 | |
| 449 | theorem affineError_eta_hasDerivAt (c : Parameters) {amp : ℝ → ℝ} {eta amp' : ℝ} |
| 450 | (ha : HasDerivAt amp amp' eta) (y : ℝ) : |
| 451 | HasDerivAt (fun t => affineError c (parameterPolynomial t) (amp t) y) |
| 452 | (affineError c (1 + 3 * eta ^ 2) amp' y) eta := by |
| 453 | have hF : (fun t => affineError c (parameterPolynomial t) (amp t) y) = |
| 454 | (fun t => parameterPolynomial t * affineError c 1 0 y + amp t * affineError c 0 1 y) := by |
| 455 | funext t |
| 456 | exact affineError_decomposition c _ _ y |
| 457 | rw [hF, affineError_decomposition c (1 + 3 * eta ^ 2) amp' y] |
| 458 | exact ((parameterPolynomial_hasDerivAt eta).mul_const _).add (ha.mul_const _) |
| 459 | |
| 460 | /-- Error in the two-term expansion of the actual normalized mass lag, |
| 461 | with its exact exponentially decaying initial value retained. -/ |
| 462 | noncomputable def pulseError (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : ℝ := |
| 463 | normalizedLag c amp eta y - (pulseRatio c amp (y, eta) / decay c - |
| 464 | deriv (fun t => pulseRatio c amp (t, eta)) y / decay c ^ 2 + |
| 465 | (prefixCoefficient c 0 * parameterPolynomial eta) * Real.exp (-decay c * y)) |
| 466 | |
| 467 | theorem pulseError_eq_affineError (c : Parameters) (amp : ℝ → ℝ) (eta : ℝ) |
| 468 | {y : ℝ} (hy : 0 ≤ y) : |
| 469 | pulseError c amp eta y = affineError c (parameterPolynomial eta) (amp eta) y := by |
| 470 | have hF : (fun t => pulseRatio c amp (t, eta)) = forcing c (parameterPolynomial eta) (amp eta) := by |
| 471 | funext t |
| 472 | exact (forcing_eq_pulseRatio c amp eta t).symm |
| 473 | rw [pulseError, affineError, normalizedLag_eq_affineLag c amp eta hy, hF, |
| 474 | ← forcing_eq_pulseRatio c amp eta y] |
| 475 | |
| 476 | theorem pulseError_eta_hasDerivAt (c : Parameters) {amp : ℝ → ℝ} {eta amp' : ℝ} |
| 477 | (ha : HasDerivAt amp amp' eta) {y : ℝ} (hy : 0 ≤ y) : |
| 478 | HasDerivAt (fun t => pulseError c amp t y) |
| 479 | (affineError c (1 + 3 * eta ^ 2) amp' y) eta := |
| 480 | (affineError_eta_hasDerivAt c ha y).congr_of_eventuallyEq |
| 481 | (Filter.Eventually.of_forall (fun t => pulseError_eq_affineError c amp t hy)) |
| 482 | |
| 483 | noncomputable def scaledPulse (c : Parameters) (amp : ℝ → ℝ) (eta z : ℝ) : ℝ := |
| 484 | pulseRatio c amp (z / c.lam, eta) |
| 485 | |
| 486 | theorem scaledPulse_deriv (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 487 | c.lam * deriv (scaledPulse c amp eta) (c.lam * y) = |
| 488 | deriv (fun t => pulseRatio c amp (t, eta)) y := by |
| 489 | have hF : (fun t => pulseRatio c amp (t, eta)) = forcing c (parameterPolynomial eta) (amp eta) := by |
| 490 | funext t |
| 491 | exact (forcing_eq_pulseRatio c amp eta t).symm |
| 492 | have hf := forcing_contDiff c (parameterPolynomial eta) (amp eta) |
| 493 | have hc : HasDerivAt (scaledPulse c amp eta) |
| 494 | (deriv (forcing c (parameterPolynomial eta) (amp eta)) y / c.lam) (c.lam * y) := by |
| 495 | have hscaled : scaledPulse c amp eta = |
| 496 | fun z => forcing c (parameterPolynomial eta) (amp eta) (z / c.lam) := by |
| 497 | funext z |
| 498 | exact (forcing_eq_pulseRatio c amp eta (z / c.lam)).symm |
| 499 | rw [hscaled] |
| 500 | have h := ((hf.differentiable (by simp) ((c.lam * y) / c.lam)).hasDerivAt).comp (c.lam * y) |
| 501 | ((hasDerivAt_id (c.lam * y)).div_const c.lam) |
| 502 | simpa only [Function.comp_def, id_eq, mul_div_cancel_left₀ y c.lam_pos.ne', one_div, |
| 503 | mul_inv_rev, mul_one, one_mul, div_eq_mul_inv] using h |
| 504 | rw [hc.deriv, hF] |
| 505 | field_simp [c.lam_pos.ne'] |
| 506 | |
| 507 | theorem pulseError_scaled (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 508 | pulseError c amp eta y = normalizedLag c amp eta y - |
| 509 | (pulseRatio c amp (y, eta) / decay c - |
| 510 | c.lam * deriv (scaledPulse c amp eta) (c.lam * y) / decay c ^ 2 + |
| 511 | (prefixCoefficient c 0 * parameterPolynomial eta) * Real.exp (-decay c * y)) := by |
| 512 | rw [scaledPulse_deriv] |
| 513 | rfl |
| 514 | |
| 515 | noncomputable def fullError (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : ℝ := |
| 516 | normalizedLag c amp eta y - (pulseRatio c amp (y, eta) / decay c - |
| 517 | c.lam * deriv (scaledPulse c amp eta) (c.lam * y) / decay c ^ 2) |
| 518 | |
| 519 | theorem fullError_eq (c : Parameters) (amp : ℝ → ℝ) (eta y : ℝ) : |
| 520 | fullError c amp eta y = pulseError c amp eta y + |
| 521 | (prefixCoefficient c 0 * parameterPolynomial eta) * Real.exp (-decay c * y) := by |
| 522 | rw [pulseError_scaled, fullError] |
| 523 | ring |
| 524 | |
| 525 | theorem fullError_eta_hasDerivAt (c : Parameters) {amp : ℝ → ℝ} {eta amp' : ℝ} |
| 526 | (ha : HasDerivAt amp amp' eta) {y : ℝ} (hy : 0 ≤ y) : |
| 527 | HasDerivAt (fun t => fullError c amp t y) |
| 528 | (affineError c (1 + 3 * eta ^ 2) amp' y + |
| 529 | (prefixCoefficient c 0 * (1 + 3 * eta ^ 2)) * Real.exp (-decay c * y)) eta := by |
| 530 | have hfun : (fun t => fullError c amp t y) = fun t => pulseError c amp t y + |
| 531 | (prefixCoefficient c 0 * parameterPolynomial t) * Real.exp (-decay c * y) := by |
| 532 | funext t |
| 533 | exact fullError_eq c amp t y |
| 534 | rw [hfun] |
| 535 | exact (pulseError_eta_hasDerivAt c ha hy).add |
| 536 | (((parameterPolynomial_hasDerivAt eta).const_mul _).mul_const _) |
| 537 | |
| 538 | theorem initial_memory_bound (c : Parameters) |
| 539 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) (hsmall : c.lam ≤ 1 / 120) |
| 540 | (q : ℝ) {y : ℝ} (hy : 0 ≤ y) : |
| 541 | |(prefixCoefficient c 0 * q) * Real.exp (-decay c * y)| ≤ |
| 542 | prefixBound c.P c.m 0 * |q| * c.lam ^ 2 := by |
| 543 | have hp := prefixCoefficient_small c hwait hsmall 0 |
| 544 | have he : Real.exp (-decay c * y) ≤ 1 := |
| 545 | Real.exp_le_one_iff.mpr (mul_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr (decay_pos c).le) hy) |
| 546 | have hpow : c.lam ^ 29 ≤ c.lam ^ 2 := |
| 547 | pow_le_pow_of_le_one c.lam_pos.le (by linarith [c.lam_lt]) (by norm_num) |
| 548 | have hP := prefixBound_pos c.P_pos c.m 0 |
| 549 | calc |
| 550 | _ = |prefixCoefficient c 0| * |q| * Real.exp (-decay c * y) := by |
| 551 | rw [abs_mul, abs_mul, abs_of_pos (Real.exp_pos _)] |
| 552 | _ ≤ (prefixBound c.P c.m 0 * c.lam ^ 29) * |q| * 1 := by |
| 553 | exact mul_le_mul (mul_le_mul_of_nonneg_right hp (abs_nonneg q)) he |
| 554 | (Real.exp_pos _).le |
| 555 | (mul_nonneg (mul_nonneg hP.le (pow_nonneg c.lam_pos.le _)) (abs_nonneg q)) |
| 556 | _ ≤ prefixBound c.P c.m 0 * |q| * c.lam ^ 2 := by |
| 557 | have h := mul_le_mul_of_nonneg_left hpow |
| 558 | (mul_nonneg (prefixBound_pos c.P_pos c.m 0).le (abs_nonneg q)) |
| 559 | nlinarith |
| 560 | |
| 561 | noncomputable def fullLagBound (P m : ℝ) : ℝ := 5 * lagBound P m + 4 * prefixBound P m 0 |
| 562 | |
| 563 | theorem fullLagBound_pos {P : ℝ} (hP : 0 < P) (m : ℝ) : 0 < fullLagBound P m := by |
| 564 | have h₁ := lagBound_pos hP m |
| 565 | have h₂ := prefixBound_pos hP m 0 |
| 566 | dsimp [fullLagBound] |
| 567 | linarith |
| 568 | |
| 569 | /-- A common explicit constant bounds the actual lag error and its first |
| 570 | parameter derivative on the full nonnegative pulse-time half-line. -/ |
| 571 | theorem fullError_bounds_of_amplitude_bounds (c : Parameters) |
| 572 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) (hsmall : c.lam ≤ 1 / 120) |
| 573 | {amp : ℝ → ℝ} {eta amp' : ℝ} (ha : HasDerivAt amp amp' eta) |
| 574 | (heta : |eta| ≤ 1) (hamp : |amp eta| ≤ 6 / 5) (hamp' : |amp'| ≤ 1) |
| 575 | {y : ℝ} (hy : 0 ≤ y) : |
| 576 | |fullError c amp eta y| ≤ fullLagBound c.P c.m * c.lam ^ 2 ∧ |
| 577 | |deriv (fun t => fullError c amp t y) eta| ≤ fullLagBound c.P c.m * c.lam ^ 2 := by |
| 578 | have hL := lagBound_pos c.P_pos c.m |
| 579 | have hP := prefixBound_pos c.P_pos c.m 0 |
| 580 | have hq := parameterPolynomial_bound heta |
| 581 | have hq' : |1 + 3 * eta ^ 2| ≤ 4 := by |
| 582 | simpa only [(parameterPolynomial_hasDerivAt eta).deriv] using parameterPolynomial_derivative_bound heta |
| 583 | constructor |
| 584 | · have hmain : |pulseError c amp eta y| ≤ 4 * lagBound c.P c.m * c.lam ^ 2 := by |
| 585 | apply (normalizedLag_error c hsmall amp heta hy).trans |
| 586 | have ht : 2 + |amp eta| ≤ 4 := by linarith |
| 587 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left ht hL.le) |
| 588 | (sq_nonneg c.lam) |
| 589 | nlinarith |
| 590 | have hmemory : |(prefixCoefficient c 0 * parameterPolynomial eta) * Real.exp (-decay c * y)| ≤ |
| 591 | 2 * prefixBound c.P c.m 0 * c.lam ^ 2 := by |
| 592 | apply (initial_memory_bound c hwait hsmall _ hy).trans |
| 593 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hq hP.le) |
| 594 | (sq_nonneg c.lam) |
| 595 | nlinarith |
| 596 | rw [fullError_eq] |
| 597 | refine (abs_add_le _ _).trans ((add_le_add hmain hmemory).trans ?_) |
| 598 | dsimp [fullLagBound] |
| 599 | nlinarith [sq_nonneg c.lam] |
| 600 | · rw [(fullError_eta_hasDerivAt c ha hy).deriv] |
| 601 | have hmain : |affineError c (1 + 3 * eta ^ 2) amp' y| ≤ |
| 602 | 5 * lagBound c.P c.m * c.lam ^ 2 := by |
| 603 | apply (affineLag_error c hsmall _ _ hy).trans |
| 604 | have hs : |1 + 3 * eta ^ 2| + |amp'| ≤ 5 := by linarith |
| 605 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hs hL.le) |
| 606 | (sq_nonneg c.lam) |
| 607 | nlinarith |
| 608 | have hmemory : |(prefixCoefficient c 0 * (1 + 3 * eta ^ 2)) * Real.exp (-decay c * y)| ≤ |
| 609 | 4 * prefixBound c.P c.m 0 * c.lam ^ 2 := by |
| 610 | apply (initial_memory_bound c hwait hsmall _ hy).trans |
| 611 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hq' hP.le) |
| 612 | (sq_nonneg c.lam) |
| 613 | nlinarith |
| 614 | refine (abs_add_le _ _).trans ((add_le_add hmain hmemory).trans_eq ?_) |
| 615 | dsimp [fullLagBound] |
| 616 | ring |
| 617 | |
| 618 | end ActualPulse |
| 619 | |
| 620 | end NavierStokes.PulseLag |
| 621 | |
| 622 | end |