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 Euler.InitialTimePrimitive |
| 2 | import Mathlib.Analysis.SpecialFunctions.Integrals.Basic |
| 3 | |
| 4 | /-! |
| 5 | An explicit smooth terminal-layer trial profile. Its endpoint values are |
| 6 | zero and one, and its squared value/derivative integrals are at most `2/L` |
| 7 | and `2*L` when `L*T ≥ 1`. These are the same energy bounds needed for the |
| 8 | piecewise linear terminal ramp in the activation argument. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | |
| 13 | namespace EulerTerminalLayerRamp |
| 14 | |
| 15 | open Set MeasureTheory |
| 16 | |
| 17 | def ramp (T L t : ℝ) : ℝ := |
| 18 | (Real.exp (L * (t - T)) - Real.exp (-L * T)) / (1 - Real.exp (-L * T)) |
| 19 | |
| 20 | def rampDerivative (T L t : ℝ) : ℝ := |
| 21 | L * Real.exp (L * (t - T)) / (1 - Real.exp (-L * T)) |
| 22 | |
| 23 | theorem denominator_lower {T L : ℝ} (hLT : 1 ≤ L * T) : |
| 24 | (1 / 2 : ℝ) ≤ 1 - Real.exp (-L * T) := by |
| 25 | have he : 2 ≤ Real.exp (L * T) := by |
| 26 | linarith only [Real.add_one_le_exp (L * T), hLT] |
| 27 | have hp : Real.exp (L * T) * Real.exp (-L * T) = 1 := by |
| 28 | rw [← Real.exp_add] |
| 29 | rw [show L * T + -L * T = 0 by ring, Real.exp_zero] |
| 30 | have hm := mul_le_mul_of_nonneg_right he (Real.exp_nonneg (-L * T)) |
| 31 | nlinarith only [hp, hm] |
| 32 | |
| 33 | theorem denominator_pos {T L : ℝ} (hLT : 1 ≤ L * T) : |
| 34 | 0 < 1 - Real.exp (-L * T) := lt_of_lt_of_le (by norm_num) (denominator_lower hLT) |
| 35 | |
| 36 | @[simp] theorem ramp_initial (T L : ℝ) : ramp T L 0 = 0 := by |
| 37 | simp [ramp, mul_neg] |
| 38 | |
| 39 | theorem ramp_terminal {T L : ℝ} (hLT : 1 ≤ L * T) : ramp T L T = 1 := by |
| 40 | simp only [ramp, sub_self, mul_zero, Real.exp_zero] |
| 41 | exact div_self (denominator_pos hLT).ne' |
| 42 | |
| 43 | theorem ramp_hasDerivAt (T L t : ℝ) : HasDerivAt (ramp T L) (rampDerivative T L t) t := by |
| 44 | change HasDerivAt |
| 45 | (fun s => (Real.exp (L * (s - T)) - Real.exp (-L * T)) / (1 - Real.exp (-L * T))) |
| 46 | (L * Real.exp (L * (t - T)) / (1 - Real.exp (-L * T))) t |
| 47 | simpa only [id_eq, mul_one, mul_comm] using |
| 48 | (((((hasDerivAt_id t).sub_const T).const_mul L).exp).sub_const |
| 49 | (Real.exp (-L * T))).div_const (1 - Real.exp (-L * T)) |
| 50 | |
| 51 | theorem ramp_continuous (T L : ℝ) : Continuous (ramp T L) := |
| 52 | continuous_iff_continuousAt.2 fun t => (ramp_hasDerivAt T L t).continuousAt |
| 53 | |
| 54 | theorem rampDerivative_continuous (T L : ℝ) : Continuous (rampDerivative T L) := by |
| 55 | unfold rampDerivative |
| 56 | fun_prop |
| 57 | |
| 58 | theorem ramp_nonneg {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) |
| 59 | (ht : 0 ≤ t) : 0 ≤ ramp T L t := by |
| 60 | apply div_nonneg _ (denominator_pos hLT).le |
| 61 | apply sub_nonneg.mpr (Real.exp_le_exp.mpr _) |
| 62 | nlinarith only [mul_nonneg hL ht] |
| 63 | |
| 64 | theorem ramp_le_exp {T L t : ℝ} (hLT : 1 ≤ L * T) : |
| 65 | ramp T L t ≤ 2 * Real.exp (L * (t - T)) := by |
| 66 | apply (div_le_iff₀ (denominator_pos hLT)).2 |
| 67 | have hm := mul_le_mul_of_nonneg_right (denominator_lower hLT) |
| 68 | (Real.exp_nonneg (L * (t - T))) |
| 69 | nlinarith only [hm, Real.exp_nonneg (-L * T)] |
| 70 | |
| 71 | theorem rampDerivative_nonneg {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) : |
| 72 | 0 ≤ rampDerivative T L t := |
| 73 | div_nonneg (mul_nonneg hL (Real.exp_nonneg _)) (denominator_pos hLT).le |
| 74 | |
| 75 | theorem rampDerivative_le_exp {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) : |
| 76 | rampDerivative T L t ≤ 2 * L * Real.exp (L * (t - T)) := by |
| 77 | apply (div_le_iff₀ (denominator_pos hLT)).2 |
| 78 | have hm := mul_le_mul_of_nonneg_right (denominator_lower hLT) |
| 79 | (mul_nonneg hL (Real.exp_nonneg (L * (t - T)))) |
| 80 | nlinarith only [hm] |
| 81 | |
| 82 | theorem ramp_sq_le {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) (ht : 0 ≤ t) : |
| 83 | ramp T L t ^ 2 ≤ 4 * Real.exp (2 * L * (t - T)) := by |
| 84 | have hp := pow_le_pow_left₀ (ramp_nonneg hL hLT ht) (ramp_le_exp (t := t) hLT) 2 |
| 85 | have he : Real.exp (L * (t - T)) ^ 2 = Real.exp (2 * L * (t - T)) := by |
| 86 | rw [pow_two, ← Real.exp_add] |
| 87 | congr 1 |
| 88 | ring |
| 89 | simpa only [mul_pow, he, show (2 : ℝ) ^ 2 = 4 by norm_num] using hp |
| 90 | |
| 91 | theorem rampDerivative_sq_le {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) : |
| 92 | rampDerivative T L t ^ 2 ≤ (4 * L ^ 2) * Real.exp (2 * L * (t - T)) := by |
| 93 | have hp := pow_le_pow_left₀ (rampDerivative_nonneg (t := t) hL hLT) |
| 94 | (rampDerivative_le_exp (t := t) hL hLT) 2 |
| 95 | have he : Real.exp (L * (t - T)) ^ 2 = Real.exp (2 * L * (t - T)) := by |
| 96 | rw [pow_two, ← Real.exp_add] |
| 97 | congr 1 |
| 98 | ring |
| 99 | simpa only [mul_pow, he, show (2 : ℝ) ^ 2 = 4 by norm_num] using hp |
| 100 | |
| 101 | theorem exp_kernel_integral_le {T L : ℝ} (hL : 0 < L) : |
| 102 | (∫ t in 0..T, Real.exp (2 * L * (t - T))) ≤ 1 / (2 * L) := by |
| 103 | have hd (t : ℝ) : HasDerivAt |
| 104 | (fun s => Real.exp (2 * L * (s - T)) / (2 * L)) |
| 105 | (Real.exp (2 * L * (t - T))) t := by |
| 106 | simpa only [id_eq, mul_one, |
| 107 | mul_div_cancel_right₀ _ (show 2 * L ≠ 0 by positivity)] using |
| 108 | (((((hasDerivAt_id t).sub_const T).const_mul (2 * L)).exp).div_const (2 * L)) |
| 109 | have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _ => hd t) |
| 110 | ((Real.continuous_exp.comp (continuous_const.mul (continuous_id.sub continuous_const))).intervalIntegrable 0 T) |
| 111 | calc |
| 112 | (∫ t in 0..T, Real.exp (2 * L * (t - T))) = |
| 113 | (1 - Real.exp (2 * L * (0 - T))) / (2 * L) := by |
| 114 | rw [hi, sub_self, mul_zero, Real.exp_zero, sub_div] |
| 115 | _ ≤ 1 / (2 * L) := div_le_div_of_nonneg_right |
| 116 | (sub_le_self _ (Real.exp_nonneg _)) (by positivity) |
| 117 | |
| 118 | theorem ramp_energy {T L : ℝ} (hT : 0 ≤ T) (hL : 0 < L) (hLT : 1 ≤ L * T) : |
| 119 | (∫ t in 0..T, ramp T L t ^ 2) ≤ 2 / L := by |
| 120 | have hc : Continuous (fun t : ℝ => Real.exp (2 * L * (t - T))) := by fun_prop |
| 121 | have hi := intervalIntegral.integral_mono_on (μ := volume) hT |
| 122 | (((ramp_continuous T L).pow 2).intervalIntegrable 0 T) |
| 123 | ((continuous_const.mul hc).intervalIntegrable (a := 0) (b := T)) |
| 124 | (fun t ht => ramp_sq_le hL.le hLT ht.1) |
| 125 | change (∫ t in 0..T, ramp T L t ^ 2) ≤ |
| 126 | ∫ t in 0..T, 4 * Real.exp (2 * L * (t - T)) at hi |
| 127 | rw [intervalIntegral.integral_const_mul] at hi |
| 128 | calc |
| 129 | (∫ t in 0..T, ramp T L t ^ 2) ≤ 4 * (∫ t in 0..T, Real.exp (2 * L * (t - T))) := hi |
| 130 | _ ≤ 4 * (1 / (2 * L)) := mul_le_mul_of_nonneg_left (exp_kernel_integral_le hL) (by norm_num) |
| 131 | _ = 2 / L := by ring |
| 132 | |
| 133 | theorem rampDerivative_energy {T L : ℝ} (hT : 0 ≤ T) (hL : 0 < L) |
| 134 | (hLT : 1 ≤ L * T) : |
| 135 | (∫ t in 0..T, rampDerivative T L t ^ 2) ≤ 2 * L := by |
| 136 | have hc : Continuous (fun t : ℝ => Real.exp (2 * L * (t - T))) := by fun_prop |
| 137 | have hi := intervalIntegral.integral_mono_on (μ := volume) hT |
| 138 | (((rampDerivative_continuous T L).pow 2).intervalIntegrable 0 T) |
| 139 | ((continuous_const.mul hc).intervalIntegrable (a := 0) (b := T)) |
| 140 | (fun t _ => rampDerivative_sq_le (t := t) hL.le hLT) |
| 141 | change (∫ t in 0..T, rampDerivative T L t ^ 2) ≤ |
| 142 | ∫ t in 0..T, (4 * L ^ 2) * Real.exp (2 * L * (t - T)) at hi |
| 143 | rw [intervalIntegral.integral_const_mul] at hi |
| 144 | calc |
| 145 | (∫ t in 0..T, rampDerivative T L t ^ 2) ≤ |
| 146 | (4 * L ^ 2) * (∫ t in 0..T, Real.exp (2 * L * (t - T))) := hi |
| 147 | _ ≤ (4 * L ^ 2) * (1 / (2 * L)) := |
| 148 | mul_le_mul_of_nonneg_left (exp_kernel_integral_le hL) (by positivity) |
| 149 | _ = 2 * L := by field_simp; ring |
| 150 | |
| 151 | end EulerTerminalLayerRamp |