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

Merge pull request #709 from s5-euler-terminal-1
Browse filesrefactor(Euler/Terminal): 1 small module folded into the file that imports it (−15.3%, measured)
Checks
build Program · lake build and Comparator
Details
challenge Program · challenge files and build config
Details
+0 −151 Euler/TerminalLayerRamp.lean deleted
| @@ -1,151 +0,0 @@ | ||
| 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 | - linarith 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 | - linarith 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 | - linarith 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 | - linarith 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 | |
+160 −1 Euler/TerminalProjectionTrial.lean View file
| @@ -1,4 +1,5 @@ | ||
| 1 | -import Euler.TerminalLayerRamp | |
| 1 | +import Euler.InitialTimePrimitive | |
| 2 | +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic | |
| 2 | 3 | import Euler.TimeH1PointwiseBounds |
| 3 | 4 | import Euler.TimeH1OperatorProduct |
| 4 | 5 | |
| @@ -8,6 +9,164 @@ projection path by the smooth exponential ramp. Both energy estimates concern | ||
| 8 | 9 | the actual Bochner L² derivative and primitive. |
| 9 | 10 | -/ |
| 10 | 11 | |
| 12 | +/-! ## From `Euler/TerminalLayerRamp.lean` | |
| 13 | + | |
| 14 | +The text of `Euler/TerminalLayerRamp.lean`, folded into this file, which was its only importer. -/ | |
| 15 | + | |
| 16 | +section | |
| 17 | + | |
| 18 | +/-! | |
| 19 | +An explicit smooth terminal-layer trial profile. Its endpoint values are | |
| 20 | +zero and one, and its squared value/derivative integrals are at most `2/L` | |
| 21 | +and `2*L` when `L*T ≥ 1`. These are the same energy bounds needed for the | |
| 22 | +piecewise linear terminal ramp in the activation argument. | |
| 23 | +-/ | |
| 24 | + | |
| 25 | +noncomputable section | |
| 26 | + | |
| 27 | +namespace EulerTerminalLayerRamp | |
| 28 | + | |
| 29 | +open Set MeasureTheory | |
| 30 | + | |
| 31 | +def ramp (T L t : ℝ) : ℝ := | |
| 32 | + (Real.exp (L * (t - T)) - Real.exp (-L * T)) / (1 - Real.exp (-L * T)) | |
| 33 | + | |
| 34 | +def rampDerivative (T L t : ℝ) : ℝ := | |
| 35 | + L * Real.exp (L * (t - T)) / (1 - Real.exp (-L * T)) | |
| 36 | + | |
| 37 | +theorem denominator_lower {T L : ℝ} (hLT : 1 ≤ L * T) : | |
| 38 | + (1 / 2 : ℝ) ≤ 1 - Real.exp (-L * T) := by | |
| 39 | + have he : 2 ≤ Real.exp (L * T) := by | |
| 40 | + linarith only [Real.add_one_le_exp (L * T), hLT] | |
| 41 | + have hp : Real.exp (L * T) * Real.exp (-L * T) = 1 := by | |
| 42 | + rw [← Real.exp_add] | |
| 43 | + rw [show L * T + -L * T = 0 by ring, Real.exp_zero] | |
| 44 | + have hm := mul_le_mul_of_nonneg_right he (Real.exp_nonneg (-L * T)) | |
| 45 | + linarith only [hp, hm] | |
| 46 | + | |
| 47 | +theorem denominator_pos {T L : ℝ} (hLT : 1 ≤ L * T) : | |
| 48 | + 0 < 1 - Real.exp (-L * T) := lt_of_lt_of_le (by norm_num) (denominator_lower hLT) | |
| 49 | + | |
| 50 | +@[simp] theorem ramp_initial (T L : ℝ) : ramp T L 0 = 0 := by | |
| 51 | + simp [ramp, mul_neg] | |
| 52 | + | |
| 53 | +theorem ramp_terminal {T L : ℝ} (hLT : 1 ≤ L * T) : ramp T L T = 1 := by | |
| 54 | + simp only [ramp, sub_self, mul_zero, Real.exp_zero] | |
| 55 | + exact div_self (denominator_pos hLT).ne' | |
| 56 | + | |
| 57 | +theorem ramp_hasDerivAt (T L t : ℝ) : HasDerivAt (ramp T L) (rampDerivative T L t) t := by | |
| 58 | + change HasDerivAt | |
| 59 | + (fun s => (Real.exp (L * (s - T)) - Real.exp (-L * T)) / (1 - Real.exp (-L * T))) | |
| 60 | + (L * Real.exp (L * (t - T)) / (1 - Real.exp (-L * T))) t | |
| 61 | + simpa only [id_eq, mul_one, mul_comm] using | |
| 62 | + (((((hasDerivAt_id t).sub_const T).const_mul L).exp).sub_const | |
| 63 | + (Real.exp (-L * T))).div_const (1 - Real.exp (-L * T)) | |
| 64 | + | |
| 65 | +theorem ramp_continuous (T L : ℝ) : Continuous (ramp T L) := | |
| 66 | + continuous_iff_continuousAt.2 fun t => (ramp_hasDerivAt T L t).continuousAt | |
| 67 | + | |
| 68 | +theorem rampDerivative_continuous (T L : ℝ) : Continuous (rampDerivative T L) := by | |
| 69 | + unfold rampDerivative | |
| 70 | + fun_prop | |
| 71 | + | |
| 72 | +theorem ramp_nonneg {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) | |
| 73 | + (ht : 0 ≤ t) : 0 ≤ ramp T L t := by | |
| 74 | + apply div_nonneg _ (denominator_pos hLT).le | |
| 75 | + apply sub_nonneg.mpr (Real.exp_le_exp.mpr _) | |
| 76 | + linarith only [mul_nonneg hL ht] | |
| 77 | + | |
| 78 | +theorem ramp_le_exp {T L t : ℝ} (hLT : 1 ≤ L * T) : | |
| 79 | + ramp T L t ≤ 2 * Real.exp (L * (t - T)) := by | |
| 80 | + apply (div_le_iff₀ (denominator_pos hLT)).2 | |
| 81 | + have hm := mul_le_mul_of_nonneg_right (denominator_lower hLT) | |
| 82 | + (Real.exp_nonneg (L * (t - T))) | |
| 83 | + linarith only [hm, Real.exp_nonneg (-L * T)] | |
| 84 | + | |
| 85 | +theorem rampDerivative_nonneg {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) : | |
| 86 | + 0 ≤ rampDerivative T L t := | |
| 87 | + div_nonneg (mul_nonneg hL (Real.exp_nonneg _)) (denominator_pos hLT).le | |
| 88 | + | |
| 89 | +theorem rampDerivative_le_exp {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) : | |
| 90 | + rampDerivative T L t ≤ 2 * L * Real.exp (L * (t - T)) := by | |
| 91 | + apply (div_le_iff₀ (denominator_pos hLT)).2 | |
| 92 | + have hm := mul_le_mul_of_nonneg_right (denominator_lower hLT) | |
| 93 | + (mul_nonneg hL (Real.exp_nonneg (L * (t - T)))) | |
| 94 | + linarith only [hm] | |
| 95 | + | |
| 96 | +theorem ramp_sq_le {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) (ht : 0 ≤ t) : | |
| 97 | + ramp T L t ^ 2 ≤ 4 * Real.exp (2 * L * (t - T)) := by | |
| 98 | + have hp := pow_le_pow_left₀ (ramp_nonneg hL hLT ht) (ramp_le_exp (t := t) hLT) 2 | |
| 99 | + have he : Real.exp (L * (t - T)) ^ 2 = Real.exp (2 * L * (t - T)) := by | |
| 100 | + rw [pow_two, ← Real.exp_add] | |
| 101 | + congr 1 | |
| 102 | + ring | |
| 103 | + simpa only [mul_pow, he, show (2 : ℝ) ^ 2 = 4 by norm_num] using hp | |
| 104 | + | |
| 105 | +theorem rampDerivative_sq_le {T L t : ℝ} (hL : 0 ≤ L) (hLT : 1 ≤ L * T) : | |
| 106 | + rampDerivative T L t ^ 2 ≤ (4 * L ^ 2) * Real.exp (2 * L * (t - T)) := by | |
| 107 | + have hp := pow_le_pow_left₀ (rampDerivative_nonneg (t := t) hL hLT) | |
| 108 | + (rampDerivative_le_exp (t := t) hL hLT) 2 | |
| 109 | + have he : Real.exp (L * (t - T)) ^ 2 = Real.exp (2 * L * (t - T)) := by | |
| 110 | + rw [pow_two, ← Real.exp_add] | |
| 111 | + congr 1 | |
| 112 | + ring | |
| 113 | + simpa only [mul_pow, he, show (2 : ℝ) ^ 2 = 4 by norm_num] using hp | |
| 114 | + | |
| 115 | +theorem exp_kernel_integral_le {T L : ℝ} (hL : 0 < L) : | |
| 116 | + (∫ t in 0..T, Real.exp (2 * L * (t - T))) ≤ 1 / (2 * L) := by | |
| 117 | + have hd (t : ℝ) : HasDerivAt | |
| 118 | + (fun s => Real.exp (2 * L * (s - T)) / (2 * L)) | |
| 119 | + (Real.exp (2 * L * (t - T))) t := by | |
| 120 | + simpa only [id_eq, mul_one, | |
| 121 | + mul_div_cancel_right₀ _ (show 2 * L ≠ 0 by positivity)] using | |
| 122 | + (((((hasDerivAt_id t).sub_const T).const_mul (2 * L)).exp).div_const (2 * L)) | |
| 123 | + have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _ => hd t) | |
| 124 | + ((Real.continuous_exp.comp (continuous_const.mul (continuous_id.sub continuous_const))).intervalIntegrable 0 T) | |
| 125 | + calc | |
| 126 | + (∫ t in 0..T, Real.exp (2 * L * (t - T))) = | |
| 127 | + (1 - Real.exp (2 * L * (0 - T))) / (2 * L) := by | |
| 128 | + rw [hi, sub_self, mul_zero, Real.exp_zero, sub_div] | |
| 129 | + _ ≤ 1 / (2 * L) := div_le_div_of_nonneg_right | |
| 130 | + (sub_le_self _ (Real.exp_nonneg _)) (by positivity) | |
| 131 | + | |
| 132 | +theorem ramp_energy {T L : ℝ} (hT : 0 ≤ T) (hL : 0 < L) (hLT : 1 ≤ L * T) : | |
| 133 | + (∫ t in 0..T, ramp T L t ^ 2) ≤ 2 / L := by | |
| 134 | + have hc : Continuous (fun t : ℝ => Real.exp (2 * L * (t - T))) := by fun_prop | |
| 135 | + have hi := intervalIntegral.integral_mono_on (μ := volume) hT | |
| 136 | + (((ramp_continuous T L).pow 2).intervalIntegrable 0 T) | |
| 137 | + ((continuous_const.mul hc).intervalIntegrable (a := 0) (b := T)) | |
| 138 | + (fun t ht => ramp_sq_le hL.le hLT ht.1) | |
| 139 | + change (∫ t in 0..T, ramp T L t ^ 2) ≤ | |
| 140 | + ∫ t in 0..T, 4 * Real.exp (2 * L * (t - T)) at hi | |
| 141 | + rw [intervalIntegral.integral_const_mul] at hi | |
| 142 | + calc | |
| 143 | + (∫ t in 0..T, ramp T L t ^ 2) ≤ 4 * (∫ t in 0..T, Real.exp (2 * L * (t - T))) := hi | |
| 144 | + _ ≤ 4 * (1 / (2 * L)) := mul_le_mul_of_nonneg_left (exp_kernel_integral_le hL) (by norm_num) | |
| 145 | + _ = 2 / L := by ring | |
| 146 | + | |
| 147 | +theorem rampDerivative_energy {T L : ℝ} (hT : 0 ≤ T) (hL : 0 < L) | |
| 148 | + (hLT : 1 ≤ L * T) : | |
| 149 | + (∫ t in 0..T, rampDerivative T L t ^ 2) ≤ 2 * L := by | |
| 150 | + have hc : Continuous (fun t : ℝ => Real.exp (2 * L * (t - T))) := by fun_prop | |
| 151 | + have hi := intervalIntegral.integral_mono_on (μ := volume) hT | |
| 152 | + (((rampDerivative_continuous T L).pow 2).intervalIntegrable 0 T) | |
| 153 | + ((continuous_const.mul hc).intervalIntegrable (a := 0) (b := T)) | |
| 154 | + (fun t _ => rampDerivative_sq_le (t := t) hL.le hLT) | |
| 155 | + change (∫ t in 0..T, rampDerivative T L t ^ 2) ≤ | |
| 156 | + ∫ t in 0..T, (4 * L ^ 2) * Real.exp (2 * L * (t - T)) at hi | |
| 157 | + rw [intervalIntegral.integral_const_mul] at hi | |
| 158 | + calc | |
| 159 | + (∫ t in 0..T, rampDerivative T L t ^ 2) ≤ | |
| 160 | + (4 * L ^ 2) * (∫ t in 0..T, Real.exp (2 * L * (t - T))) := hi | |
| 161 | + _ ≤ (4 * L ^ 2) * (1 / (2 * L)) := | |
| 162 | + mul_le_mul_of_nonneg_left (exp_kernel_integral_le hL) (by positivity) | |
| 163 | + _ = 2 * L := by field_simp; ring | |
| 164 | + | |
| 165 | +end EulerTerminalLayerRamp | |
| 166 | +end | |
| 167 | + | |
| 168 | +end | |
| 169 | + | |
| 11 | 170 | noncomputable section |
| 12 | 171 | |
| 13 | 172 | |
+25 −0 routes/s5-euler-terminal-1/README.md added View file
| @@ -0,0 +1,25 @@ | ||
| 1 | +--- | |
| 2 | +issue: 14 | |
| 3 | +status: working | |
| 4 | +--- | |
| 5 | +# s5-euler-terminal-1 | |
| 6 | + | |
| 7 | +Unit `s5-euler-terminal-1` of S-5: the family `Euler/Terminal*`. One module that exactly one file imports is folded | |
| 8 | +into that file, text unchanged: | |
| 9 | + | |
| 10 | +- `Euler/TerminalLayerRamp.lean` (151 lines, its only importer `Euler/TerminalProjectionTrial.lean`) goes into | |
| 11 | + `Euler/TerminalProjectionTrial.lean`, under the heading `## From `Euler/TerminalLayerRamp.lean`` and in a `section` | |
| 12 | + of its own, before that file's own text; the importer takes over its imports, in place. | |
| 13 | +- The result is 393 lines. Measured at `ba4a037`, the file and the module it takes in cost 41.43 G instructions | |
| 14 | + before and 35.10 G after (−15.3%); `fold.py` and the page say how the count was taken. | |
| 15 | + | |
| 16 | +The plan is `plan.json` beside this note. `python3 -I docs/s5-folding/fold.py check . routes/s5-euler-terminal-1/plan.json` | |
| 17 | +makes the changed file again from main's text and compares byte for byte; no statement, proof or docstring changes. | |
| 18 | +Both files were read top to bottom after the fold: `EulerTerminalProjectionTrial` already `open`s | |
| 19 | +`EulerTerminalLayerRamp`, so the names carry over unchanged and the merged file reads as one file, not two. | |
| 20 | + | |
| 21 | +## Next | |
| 22 | + | |
| 23 | +Wait for the maintainer's verdict on pull request: `challenge` passed on the head; `build` is the check that says | |
| 24 | +whether the merged module compiles. Nothing here is measured by hand, and a whole unit is all of its folds, so no | |
| 25 | +file is changed by hand after the tool ran. | |
+9 −0 routes/s5-euler-terminal-1/plan.json added View file
| @@ -0,0 +1,9 @@ | ||
| 1 | +{ | |
| 2 | +"imports": "in place", | |
| 3 | +"folds": { | |
| 4 | +"Euler/TerminalProjectionTrial.lean": [ | |
| 5 | +"Euler/TerminalLayerRamp.lean", | |
| 6 | +"Euler/TerminalProjectionTrial.lean" | |
| 7 | +] | |
| 8 | +} | |
| 9 | +} | |