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

Comparing changes
Choose two branches to see what changed, then open a pull request to bring the work across.
Able to merge. These branches can be merged automatically.
A pull request is already open: #588 perf(NavierStokes/Pulse): 5 files cheaper to elaborate (−29.2%, measured)
1 commit
+21 −21 NavierStokes/PulseAmplitude.lean View file
| @@ -208,7 +208,7 @@ theorem mainPulse_mul_prefixRepair (c : Parameters) (y : ℝ) : | ||
| 208 | 208 | mainPulse (c.lam * y) * prefixRepair c y = 0 := by |
| 209 | 209 | have he := mainPulse_mul_correction c (fun _ => 0) 1 y |
| 210 | 210 | rw [← prefixRepair_eq_correction] at he |
| 211 | - nlinarith | |
| 211 | + linarith | |
| 212 | 212 | |
| 213 | 213 | def pulseWeight (c : Parameters) (y : ℝ) : ℝ := Real.exp (-2 * c.lam * y) |
| 214 | 214 | |
| @@ -266,7 +266,7 @@ theorem quadraticCoefficient_eq (c : Parameters) : | ||
| 266 | 266 | funext y |
| 267 | 267 | unfold amplitudeShape |
| 268 | 268 | have hz := mainPulse_mul_amplitudeRepair c y |
| 269 | - nlinarith [congrArg (fun x : ℝ => pulseWeight c y * x) hz] | |
| 269 | + linarith [congrArg (fun x : ℝ => pulseWeight c y * x) hz] | |
| 270 | 270 | unfold quadraticCoefficient |
| 271 | 271 | rw [he, intervalIntegral.integral_add (hp.intervalIntegrable _ _) (hr.intervalIntegrable _ _), |
| 272 | 272 | mul_add, normalized_main_energy] |
| @@ -312,7 +312,7 @@ theorem scaledPulseEnergy_eq (c : Parameters) (A eta : ℝ) : | ||
| 312 | 312 | have hn' := normalized_negative_energy c |
| 313 | 313 | simp only [intervalIntegral.integral_const_mul] at hn' |
| 314 | 314 | unfold quadraticCoefficient linearCoefficient constantCorrection |
| 315 | - nlinarith | |
| 315 | + linarith | |
| 316 | 316 | |
| 317 | 317 | /-! ## Exact prefix coefficients and uniform bounds -/ |
| 318 | 318 | |
| @@ -390,7 +390,7 @@ theorem prefixAngularEnergy_bound (c : Parameters) : | ||
| 390 | 390 | (fun y hy => div_le_div_of_nonneg_right (prefix_weight_bound c hy.1 hy.2) (by norm_num)) |
| 391 | 391 | simp only [intervalIntegral.integral_const, sub_zero, smul_eq_mul] at hm |
| 392 | 392 | unfold prefixAngularEnergy |
| 393 | - nlinarith [initial_weight_bound c] | |
| 393 | + linarith [initial_weight_bound c] | |
| 394 | 394 | |
| 395 | 395 | theorem prefixAxialEnergy_bound (c : Parameters) : |
| 396 | 396 | prefixAxialEnergy c ≤ 16 * Real.exp (Real.exp c.m) := by |
| @@ -696,7 +696,7 @@ theorem negativeClamp_le (x : ℝ) : negativeClamp x ≤ -(1 / 10) := by | ||
| 696 | 696 | · have h0 := sigma_nonneg (10 * (x + 1 / 5)) |
| 697 | 697 | have h1 := sigma_le_one (10 * (x + 1 / 5)) |
| 698 | 698 | unfold negativeClamp |
| 699 | - nlinarith [mul_nonneg (sub_nonneg.mpr h1) (show 0 ≤ -(1 / 10) - x by linarith)] | |
| 699 | + linarith [mul_nonneg (sub_nonneg.mpr h1) (show 0 ≤ -(1 / 10) - x by linarith)] | |
| 700 | 700 | · simp only [negativeClamp, sigma_one (by linarith : 1 ≤ 10 * (x + 1 / 5))] |
| 701 | 701 | norm_num |
| 702 | 702 | |
| @@ -780,7 +780,7 @@ theorem logarithmicRate_pos (c : Parameters) : 0 < logarithmicRate c.lam := | ||
| 780 | 780 | |
| 781 | 781 | theorem lambda_le_logarithmicRate (c : Parameters) : c.lam ≤ logarithmicRate c.lam := by |
| 782 | 782 | unfold logarithmicRate |
| 783 | - nlinarith [mul_nonneg c.lam_pos.le (log_inverse_nonneg c)] | |
| 783 | + linarith [mul_nonneg c.lam_pos.le (log_inverse_nonneg c)] | |
| 784 | 784 | |
| 785 | 785 | theorem prefixAxialEnergy_nonneg (c : Parameters) : 0 ≤ prefixAxialEnergy c := by |
| 786 | 786 | have hi := intervalIntegral.integral_nonneg_of_forall (μ := volume) c.pulseStart_pos.le |
| @@ -792,7 +792,7 @@ theorem prefixAngularEnergy_nonneg (c : Parameters) : 0 ≤ prefixAngularEnergy | ||
| 792 | 792 | have hi := intervalIntegral.integral_nonneg_of_forall (μ := volume) c.pulseStart_pos.le |
| 793 | 793 | (fun y => div_nonneg (coreEnergyWeight_nonneg c y) (by norm_num : (0 : ℝ) ≤ 2)) |
| 794 | 794 | unfold prefixAngularEnergy |
| 795 | - nlinarith [sq_nonneg c.P] | |
| 795 | + linarith [sq_nonneg c.P] | |
| 796 | 796 | |
| 797 | 797 | theorem normalizedPrefix_nonneg (c : Parameters) : |
| 798 | 798 | 0 ≤ normalizedPrefixAxial c ∧ 0 ≤ normalizedPrefixAngular c := |
| @@ -897,7 +897,7 @@ theorem normalizedTail_bound (d : OutgoingTail.TailData) (eta : ℝ) (heta : eta | ||
| 897 | 897 | |
| 898 | 898 | theorem pulseWeight_le_one (c : Parameters) {y : ℝ} (hy : 0 ≤ y) : pulseWeight c y ≤ 1 := by |
| 899 | 899 | apply Real.exp_le_one_iff.mpr |
| 900 | - nlinarith [mul_nonneg c.lam_pos.le hy] | |
| 900 | + linarith [mul_nonneg c.lam_pos.le hy] | |
| 901 | 901 | |
| 902 | 902 | theorem weighted_square_bound (c : Parameters) (f : ℝ → ℝ) (hf : Continuous f) |
| 903 | 903 | (M : ℝ) (hM : 0 ≤ M) (hbound : ∀ y, |f y| ≤ M) : |
| @@ -955,7 +955,7 @@ theorem etaPolynomial_bounds {eta : ℝ} (heta : eta ^ 2 ≤ 1) : | ||
| 955 | 955 | have he : |eta| ≤ 1 := abs_le.mpr ⟨by nlinarith, by nlinarith⟩ |
| 956 | 956 | constructor |
| 957 | 957 | · rw [etaPolynomial, abs_mul, abs_of_nonneg (by positivity : 0 ≤ 1 + eta ^ 2)] |
| 958 | - nlinarith [mul_nonneg (show 0 ≤ 1 - |eta| by linarith) (show 0 ≤ 1 + eta ^ 2 by positivity)] | |
| 958 | + linarith [mul_nonneg (show 0 ≤ 1 - |eta| by linarith) (show 0 ≤ 1 + eta ^ 2 by positivity)] | |
| 959 | 959 | · rw [(etaPolynomial_hasDerivAt eta).deriv, abs_of_nonneg (by positivity : 0 ≤ 1 + 3 * eta ^ 2)] |
| 960 | 960 | linarith |
| 961 | 961 | |
| @@ -969,16 +969,16 @@ theorem quadratic_root_bracket {a b c r : ℝ} | ||
| 969 | 969 | · by_contra h |
| 970 | 970 | have hrl : r ≤ 9 / 10 := le_of_not_gt h |
| 971 | 971 | have hs : r ^ 2 ≤ (9 / 10 : ℝ) ^ 2 := by |
| 972 | - nlinarith [mul_nonneg (show 0 ≤ 9 / 10 - r by linarith) (show 0 ≤ 9 / 10 + r by linarith)] | |
| 972 | + linarith [mul_nonneg (show 0 ≤ 9 / 10 - r by linarith) (show 0 ≤ 9 / 10 + r by linarith)] | |
| 973 | 973 | have haR := mul_le_mul_of_nonneg_right ha' (sq_nonneg r) |
| 974 | 974 | have hbR := mul_le_mul_of_nonneg_right hbu hr.le |
| 975 | - nlinarith | |
| 975 | + linarith | |
| 976 | 976 | · by_contra h |
| 977 | 977 | have hru : 6 / 5 ≤ r := le_of_not_gt h |
| 978 | 978 | have hs := mul_nonneg (show 0 ≤ r - 6 / 5 by linarith) hr.le |
| 979 | 979 | have haR := mul_le_mul_of_nonneg_right ha (sq_nonneg r) |
| 980 | 980 | have hbR := mul_le_mul_of_nonneg_right hbl hr.le |
| 981 | - nlinarith | |
| 981 | + linarith | |
| 982 | 982 | |
| 983 | 983 | theorem amplitude_derivative_identity (d : OutgoingTail.TailData) (eta : ℝ) |
| 984 | 984 | (hc : constantTerm d eta < -(1 / 5)) : |
| @@ -1039,7 +1039,7 @@ theorem exp_inverse_bound {lam : ℝ} (hlam : 0 < lam) : | ||
| 1039 | 1039 | simpa only [one_div, inv_inv] using hinv |
| 1040 | 1040 | have hu : Real.exp (-(1 / (4 * lam))) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith) |
| 1041 | 1041 | have hm := mul_le_mul hlin hu (Real.exp_pos _).le (by positivity : 0 ≤ 4 * lam) |
| 1042 | - nlinarith | |
| 1042 | + linarith | |
| 1043 | 1043 | |
| 1044 | 1044 | def correctionEnergyConstant (P m : ℝ) : ℝ := |
| 1045 | 1045 | 104 * OutgoingPulseBounds.correctionJetBound P m 0 ^ 2 |
| @@ -1083,13 +1083,13 @@ theorem correctionEnergy_bounds (c : Parameters) (hsmall : c.lam ≤ 1 / 120) : | ||
| 1083 | 1083 | have hlarge : 26 * M ^ 2 ≤ correctionEnergyConstant c.P c.m * c.lam := by |
| 1084 | 1084 | have he := mul_le_mul_of_nonneg_left (exp_inverse_bound c.lam_pos) |
| 1085 | 1085 | (sq_nonneg (OutgoingPulseBounds.correctionJetBound c.P c.m 0)) |
| 1086 | - dsimp [M, correctionEnergyConstant] | |
| 1087 | - nlinarith | |
| 1088 | - have hq : 13 * M ^ 2 ≤ 26 * M ^ 2 := by nlinarith [sq_nonneg M] | |
| 1086 | + dsimp [correctionEnergyConstant] | |
| 1087 | + linarith | |
| 1088 | + have hq : 13 * M ^ 2 ≤ 26 * M ^ 2 := by linarith [sq_nonneg M] | |
| 1089 | 1089 | refine ⟨hb1.1, hb1.2.trans (hq.trans hlarge), ?_, hb0.1, hb0.2.trans (hq.trans hlarge)⟩ |
| 1090 | 1090 | rw [hlin, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] |
| 1091 | 1091 | exact (mul_le_mul_of_nonneg_left hcross (by norm_num : (0 : ℝ) ≤ 2)).trans |
| 1092 | - (by nlinarith [hlarge]) | |
| 1092 | + (by linarith [hlarge]) | |
| 1093 | 1093 | |
| 1094 | 1094 | def errorConstant (P m : ℝ) : ℝ := |
| 1095 | 1095 | 1 + prefixBoundConstant P m + correctionEnergyConstant P m + |
| @@ -1167,7 +1167,7 @@ theorem numerical_coefficient_bounds (d : OutgoingTail.TailData) (eta e : ℝ) | ||
| 1167 | 1167 | have hprod : (constantCorrection d.core + normalizedPrefixAxial d.core) * etaPolynomial eta ^ 2 ≤ 8 * e := by |
| 1168 | 1168 | have hm := mul_le_mul (add_le_add h.correction_error h.prefix_axial_error) hq2 |
| 1169 | 1169 | (sq_nonneg (etaPolynomial eta)) (by linarith [h.scale_nonneg]) |
| 1170 | - nlinarith | |
| 1170 | + linarith | |
| 1171 | 1171 | have hb : |linearTerm d.core eta| ≤ e * 2 := by |
| 1172 | 1172 | unfold linearTerm |
| 1173 | 1173 | rw [abs_mul] |
| @@ -1207,7 +1207,7 @@ theorem normalizedTail_derivative_bound (d : OutgoingTail.TailData) (eta : ℝ) | ||
| 1207 | 1207 | _ ≤ (OutgoingTail.flattenLength + 2 * TailEnergyBounds.tailConstant) * |
| 1208 | 1208 | logarithmicRate d.core.lam := by |
| 1209 | 1209 | unfold logarithmicRate |
| 1210 | - nlinarith | |
| 1210 | + linarith | |
| 1211 | 1211 | _ ≤ errorScale d.core := mul_le_mul_of_nonneg_right hC (logarithmicRate_pos d.core).le |
| 1212 | 1212 | |
| 1213 | 1213 | theorem linearTerm_hasDerivAt (c : Parameters) (eta : ℝ) : |
| @@ -1239,7 +1239,7 @@ theorem coefficient_derivative_bounds (d : OutgoingTail.TailData) (eta e : ℝ) | ||
| 1239 | 1239 | constructor |
| 1240 | 1240 | · rw [(linearTerm_hasDerivAt d.core eta).deriv, abs_mul, abs_of_nonneg hq'] |
| 1241 | 1241 | have hm := mul_le_mul h.linear_error hq4 hq' h.scale_nonneg |
| 1242 | - nlinarith | |
| 1242 | + linarith | |
| 1243 | 1243 | · rw [(constantTerm_hasDerivAt d eta).deriv] |
| 1244 | 1244 | calc |
| 1245 | 1245 | _ ≤ |2 * (constantCorrection d.core + normalizedPrefixAxial d.core) * |
| @@ -1252,7 +1252,7 @@ theorem coefficient_derivative_bounds (d : OutgoingTail.TailData) (eta e : ℝ) | ||
| 1252 | 1252 | (mul_le_mul (mul_le_mul_of_nonneg_left hsum' (by norm_num : (0 : ℝ) ≤ 2)) hq.1 |
| 1253 | 1253 | (abs_nonneg _) (by linarith [h.scale_nonneg])) hq4 hq' |
| 1254 | 1254 | (by linarith [h.scale_nonneg]) |
| 1255 | - nlinarith | |
| 1255 | + linarith | |
| 1256 | 1256 | _ = 33 * e := by ring |
| 1257 | 1257 | |
| 1258 | 1258 | theorem amplitude_derivative_bound_of_error (d : OutgoingTail.TailData) (eta e : ℝ) |
+59 −60 NavierStokes/PulseCone.lean View file
| @@ -38,11 +38,11 @@ theorem forcing_abs_le (c : Parameters) (hsmall : c.lam ≤ 1 / 120) (q A y : | ||
| 38 | 38 | simpa only [mul_one] using h |
| 39 | 39 | have hm : |A * mainPulse (c.lam * y)| ≤ mainBound * |A| := by |
| 40 | 40 | rw [abs_mul] |
| 41 | - nlinarith [mul_le_mul_of_nonneg_left (mainPulse_abs_le (c.lam * y)) (abs_nonneg A)] | |
| 41 | + linarith [mul_le_mul_of_nonneg_left (mainPulse_abs_le (c.lam * y)) (abs_nonneg A)] | |
| 42 | 42 | calc |
| 43 | 43 | _ ≤ |A * mainPulse (c.lam * y)| + |affineProfile c q A y| := abs_add_le _ _ |
| 44 | 44 | _ ≤ mainBound * |A| + correctionJetBound c.P c.m 0 * (|q| + |A|) := add_le_add hm hc' |
| 45 | - _ ≤ _ := by dsimp [forceConstant]; nlinarith [mul_nonneg mainBound_pos.le (abs_nonneg q)] | |
| 45 | + _ ≤ _ := by dsimp [forceConstant]; linarith [mul_nonneg mainBound_pos.le (abs_nonneg q)] | |
| 46 | 46 | |
| 47 | 47 | theorem initial_coefficient_le (c : Parameters) |
| 48 | 48 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) (hsmall : c.lam ≤ 1 / 120) : |
| @@ -55,7 +55,7 @@ theorem decay_div_le_three (c : Parameters) {M : ℝ} (hM : 0 ≤ M) : | ||
| 55 | 55 | M / decay c ≤ 3 * M := by |
| 56 | 56 | have hd : (2 / 5 : ℝ) ≤ decay c := by dsimp [decay]; linarith [c.lam_lt] |
| 57 | 57 | apply (div_le_iff₀ (decay_pos c)).mpr |
| 58 | - nlinarith [mul_nonneg hM (show 0 ≤ 3 * decay c - 1 by linarith)] | |
| 58 | + linarith [mul_nonneg hM (show 0 ≤ 3 * decay c - 1 by linarith)] | |
| 59 | 59 | |
| 60 | 60 | theorem affineLag_abs_le (c : Parameters) |
| 61 | 61 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) (hsmall : c.lam ≤ 1 / 120) |
| @@ -108,18 +108,18 @@ theorem pulse_data_bounds (c : Parameters) | ||
| 108 | 108 | constructor |
| 109 | 109 | · rw [← forcing_eq_pulseRatio c amp eta y] |
| 110 | 110 | apply (forcing_abs_le c hsmall _ _ y).trans |
| 111 | - nlinarith [mul_le_mul_of_nonneg_left (show |parameterPolynomial eta| + |amp eta| ≤ 6 by linarith) hf.le] | |
| 111 | + linarith [mul_le_mul_of_nonneg_left (show |parameterPolynomial eta| + |amp eta| ≤ 6 by linarith) hf.le] | |
| 112 | 112 | constructor |
| 113 | 113 | · rw [normalizedLag_eq_affineLag c amp eta hy] |
| 114 | 114 | apply (affineLag_abs_le c hwait hsmall _ _ hy).trans |
| 115 | 115 | dsimp [averageConstant] |
| 116 | 116 | have hs : |parameterPolynomial eta| + |amp eta| ≤ 6 := by linarith |
| 117 | - nlinarith [mul_le_mul_of_nonneg_left hq hp.le, mul_le_mul_of_nonneg_left hs hf.le] | |
| 117 | + linarith [mul_le_mul_of_nonneg_left hq hp.le, mul_le_mul_of_nonneg_left hs hf.le] | |
| 118 | 118 | · rw [(normalizedLag_eta_hasDerivAt c ha hy).deriv] |
| 119 | 119 | apply (affineLag_abs_le c hwait hsmall _ _ hy).trans |
| 120 | 120 | dsimp [averageConstant] |
| 121 | 121 | have hs : |1 + 3 * eta ^ 2| + |amp'| ≤ 6 := by linarith |
| 122 | - nlinarith [mul_le_mul_of_nonneg_left hq' hp.le, mul_le_mul_of_nonneg_left hs hf.le] | |
| 122 | + linarith [mul_le_mul_of_nonneg_left hq' hp.le, mul_le_mul_of_nonneg_left hs hf.le] | |
| 123 | 123 | |
| 124 | 124 | noncomputable def energyConstant (P m : ℝ) : ℝ := P * Real.exp (Real.exp m + 12) |
| 125 | 125 | |
| @@ -130,7 +130,7 @@ theorem shape_le_one (eta : ℝ) : shape eta ≤ 1 := by | ||
| 130 | 130 | unfold shape |
| 131 | 131 | rw [← one_div] |
| 132 | 132 | apply (div_le_one (by positivity : 0 < 1 + eta ^ 2)).mpr |
| 133 | - nlinarith [sq_nonneg eta] | |
| 133 | + linarith [sq_nonneg eta] | |
| 134 | 134 | |
| 135 | 135 | theorem pulse_angular_small (c : Parameters) |
| 136 | 136 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) (eta : ℝ) {y : ℝ} (hy : 0 ≤ y) : |
| @@ -182,8 +182,8 @@ theorem geometric_coefficient_bounds {h eta : ℝ} (hh : 0 ≤ h) (hh' : h ≤ 1 | ||
| 182 | 182 | (heta : |eta| ≤ 1) : |
| 183 | 183 | |2 * (1 / 2 - h) * eta - (1 - eta ^ 2) * shapeGradient eta| ≤ 3 ∧ |
| 184 | 184 | |1 - eta ^ 2| ≤ 1 ∧ |2 * h * eta + (1 - eta ^ 2) * shapeGradient eta| ≤ 3 := by |
| 185 | - have hs : eta ^ 2 ≤ 1 := by nlinarith [sq_abs eta, sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1) |>.mpr heta] | |
| 186 | - have hd : |1 - eta ^ 2| ≤ 1 := by rw [abs_of_nonneg (by linarith)]; nlinarith [sq_nonneg eta] | |
| 185 | + have hs : eta ^ 2 ≤ 1 := by linarith [sq_abs eta, sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1) |>.mpr heta] | |
| 186 | + have hd : |1 - eta ^ 2| ≤ 1 := by rw [abs_of_nonneg (by linarith)]; linarith [sq_nonneg eta] | |
| 187 | 187 | have hD : |1 / 2 - h| ≤ 1 / 2 := by rw [abs_of_nonneg (by linarith)]; linarith |
| 188 | 188 | have hg : |(1 - eta ^ 2) * shapeGradient eta| ≤ 2 := by |
| 189 | 189 | rw [abs_mul] |
| @@ -192,10 +192,10 @@ theorem geometric_coefficient_bounds {h eta : ℝ} (hh : 0 ≤ h) (hh' : h ≤ 1 | ||
| 192 | 192 | exact hm |
| 193 | 193 | have hDeta : |2 * (1 / 2 - h) * eta| ≤ 1 := by |
| 194 | 194 | rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] |
| 195 | - nlinarith [mul_le_mul hD heta (abs_nonneg eta) (by norm_num)] | |
| 195 | + linarith [mul_le_mul hD heta (abs_nonneg eta) (by norm_num)] | |
| 196 | 196 | have heta' : |2 * h * eta| ≤ 1 := by |
| 197 | 197 | rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2), abs_of_nonneg hh] |
| 198 | - nlinarith [mul_le_mul hh' heta (abs_nonneg eta) (by norm_num)] | |
| 198 | + linarith [mul_le_mul hh' heta (abs_nonneg eta) (by norm_num)] | |
| 199 | 199 | exact ⟨(abs_sub _ _).trans (by linarith), hd, (abs_add_le _ _).trans (by linarith)⟩ |
| 200 | 200 | |
| 201 | 201 | noncomputable def pulseAngularSource (c : Parameters) (h : ℝ) (amp : ℝ → ℝ) (eta y : ℝ) : ℝ := |
| @@ -249,7 +249,7 @@ theorem pulseAngularSource_error_bound (c : Parameters) | ||
| 249 | 249 | positivity |
| 250 | 250 | have he := mul_le_mul_of_nonneg_right (pulse_angular_small c hwait eta hy) hp |
| 251 | 251 | dsimp [sourceConstant] |
| 252 | - nlinarith | |
| 252 | + linarith | |
| 253 | 253 | |
| 254 | 254 | theorem pulseAngularSource_lower (d : OutgoingTail.TailData) |
| 255 | 255 | (hwait : d.core.wait = 60 * Real.log (1 / d.core.lam)) (hsmall : d.core.lam ≤ 1 / 120) |
| @@ -271,7 +271,7 @@ theorem pulseAngularSource_lower (d : OutgoingTail.TailData) | ||
| 271 | 271 | positivity |
| 272 | 272 | have hc := mul_nonneg (show 0 ≤ 1 / 2 - d.h by linarith [d.h_lt_half]) hg |
| 273 | 273 | have hlo := (abs_le.mp he).1 |
| 274 | - nlinarith [d.h_small] | |
| 274 | + linarith [d.h_small] | |
| 275 | 275 | |
| 276 | 276 | /-- A lower barrier for the exact scalar lag equation on a finite interval. |
| 277 | 277 | Only the differential equation and a lower source bound are used. -/ |
| @@ -339,7 +339,7 @@ theorem pulse_endpoint_lower (c : Parameters) {Q S : ℝ → ℝ} (hQ₀ : 0 ≤ | ||
| 339 | 339 | have hmain := mul_le_mul hdiv (show (2 / 3 : ℝ) ≤ 1 - Real.exp (-(1 - c.lam) * c.pulseLength) by linarith) |
| 340 | 340 | (by norm_num : (0 : ℝ) ≤ 2 / 3) hpos |
| 341 | 341 | have hini := mul_nonneg hQ₀ he.le |
| 342 | - nlinarith | |
| 342 | + linarith | |
| 343 | 343 | |
| 344 | 344 | /-! ## Binding the pulse formulas to the actual corrected histories -/ |
| 345 | 345 | |
| @@ -512,9 +512,9 @@ theorem ode_equilibrium_error {r s δ L : ℝ} (hr : 0 < r) (hδ : 0 ≤ δ) (hL | ||
| 512 | 512 | rw [abs_le] |
| 513 | 513 | constructor |
| 514 | 514 | · rw [sub_div] at hlo |
| 515 | - nlinarith | |
| 515 | + linarith | |
| 516 | 516 | · rw [neg_div, add_div] at hhi |
| 517 | - nlinarith | |
| 517 | + linarith | |
| 518 | 518 | |
| 519 | 519 | /-- Uniform angular-lag error throughout the actual pulse; the incoming |
| 520 | 520 | error is retained explicitly for the shaped-wait theorem to supply. -/ |
| @@ -567,7 +567,7 @@ theorem corrected_Qs_endpoint_lower (w : ResetWitness d K) (hK : 0 < K) | ||
| 567 | 567 | have hs := CorrectedPulseAmplitude.amplitude_spec w hK hsmall hwait hscale |
| 568 | 568 | have heta₂ : eta ^ 2 ≤ 1 := by |
| 569 | 569 | have h := (sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1)).mpr heta |
| 570 | - nlinarith [sq_abs eta] | |
| 570 | + linarith [sq_abs eta] | |
| 571 | 571 | have hb := hs.2 eta heta₂ |
| 572 | 572 | apply Qs_endpoint_lower w hwait hsmall hpulse hh₁ hhT hs.1 heta |
| 573 | 573 | · rw [abs_of_pos (CorrectedPulseAmplitude.amplitude_pos d w.coefficients eta)] |
| @@ -743,7 +743,7 @@ theorem mainPulse_deriv_le_one {z : ℝ} (hz : 0 ≤ z) : deriv mainPulse z ≤ | ||
| 743 | 743 | (sub_nonneg.mpr (sigma_le_one (z - 10))) zero_le_one |
| 744 | 744 | have hcut := mul_nonneg (PulseAmplitude.pulseRamp_nonneg hz) |
| 745 | 745 | (OutgoingTail.sigma_derivative_nonneg (z - 10)) |
| 746 | - nlinarith | |
| 746 | + linarith | |
| 747 | 747 | |
| 748 | 748 | noncomputable def mainFirstBound : ℝ := 1 + Classical.choose |
| 749 | 749 | (LocalizedMomentRepair.smooth_compact_derivative_bound mainPulse |
| @@ -832,14 +832,14 @@ theorem scaledPulse_deriv_abs_le (c : Parameters) (hsmall : c.lam ≤ 1 / 120) | ||
| 832 | 832 | have hm : |amp eta * deriv mainPulse (c.lam * y)| ≤ 2 * mainFirstBound := by |
| 833 | 833 | rw [abs_mul] |
| 834 | 834 | exact (mul_le_mul hamp (main_first_le _) (abs_nonneg _) (by norm_num)).trans |
| 835 | - (by nlinarith [mainFirstBound_pos]) | |
| 835 | + (by linarith [mainFirstBound_pos]) | |
| 836 | 836 | have hc := mul_le_mul_of_nonneg_left (show c.lam ≤ 1 by linarith [c.lam_lt]) |
| 837 | 837 | (derivativeRepairConstant_pos c.P_pos c.m).le |
| 838 | 838 | have htriangle := abs_add_le (deriv (scaledPulse c amp eta) (c.lam * y) - |
| 839 | 839 | amp eta * deriv mainPulse (c.lam * y)) (amp eta * deriv mainPulse (c.lam * y)) |
| 840 | 840 | rw [sub_add_cancel] at htriangle |
| 841 | 841 | dsimp [derivativeConstant] |
| 842 | - nlinarith | |
| 842 | + linarith | |
| 843 | 843 | |
| 844 | 844 | theorem forcing_fine_abs_le (c : Parameters) (hsmall : c.lam ≤ 1 / 120) (q A y : ℝ) : |
| 845 | 845 | |forcing c q A y| ≤ mainBound * |A| + |
| @@ -851,10 +851,10 @@ theorem forcing_fine_abs_le (c : Parameters) (hsmall : c.lam ≤ 1 / 120) (q A y | ||
| 851 | 851 | (correctionJetBound_pos c.P_pos c.m 0).le) (by positivity : 0 ≤ |q| + |A|) |
| 852 | 852 | have hm : |A * mainPulse (c.lam * y)| ≤ mainBound * |A| := by |
| 853 | 853 | rw [abs_mul] |
| 854 | - nlinarith [mul_le_mul_of_nonneg_left (mainPulse_abs_le (c.lam * y)) (abs_nonneg A)] | |
| 854 | + linarith [mul_le_mul_of_nonneg_left (mainPulse_abs_le (c.lam * y)) (abs_nonneg A)] | |
| 855 | 855 | apply (abs_add_le _ _).trans |
| 856 | 856 | change |A * mainPulse (c.lam * y)| + |affineProfile c q A y| ≤ _ |
| 857 | - nlinarith | |
| 857 | + linarith | |
| 858 | 858 | |
| 859 | 859 | theorem affineLag_fine_abs_le (c : Parameters) |
| 860 | 860 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) (hsmall : c.lam ≤ 1 / 120) |
| @@ -871,7 +871,7 @@ theorem affineLag_fine_abs_le (c : Parameters) | ||
| 871 | 871 | have ht := abs_add_le ((prefixCoefficient c 0 * q) * Real.exp (-decay c * y)) |
| 872 | 872 | (convolution (decay c) (forcing c q A) y) |
| 873 | 873 | change |affineLag c q A y| ≤ _ at ht |
| 874 | - nlinarith | |
| 874 | + linarith | |
| 875 | 875 | |
| 876 | 876 | noncomputable def parameterLagConstant (P m : ℝ) : ℝ := |
| 877 | 877 | 4 * prefixBound P m 0 + 960 * correctionJetBound P m 0 |
| @@ -901,7 +901,7 @@ theorem normalizedLag_parameter_fine_bound (c : Parameters) | ||
| 901 | 901 | have hcoeff : prefixBound c.P c.m 0 * |1 + 3 * eta ^ 2| + |
| 902 | 902 | 192 * correctionJetBound c.P c.m 0 * (|1 + 3 * eta ^ 2| + |amp'|) ≤ parameterLagConstant c.P c.m := by |
| 903 | 903 | dsimp [parameterLagConstant] |
| 904 | - nlinarith | |
| 904 | + linarith | |
| 905 | 905 | exact add_le_add_right (mul_le_mul_of_nonneg_right hcoeff (sq_nonneg c.lam)) _ |
| 906 | 906 | |
| 907 | 907 | /-! ## The coefficient in the pulse-direction expansion -/ |
| @@ -933,11 +933,11 @@ theorem eta_shapeGradient_bounds {eta : ℝ} (heta : |eta| ≤ 1) : | ||
| 933 | 933 | ring |
| 934 | 934 | have hs : eta ^ 2 ≤ 1 := by |
| 935 | 935 | have h := (sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1)).mpr heta |
| 936 | - nlinarith [sq_abs eta] | |
| 936 | + linarith [sq_abs eta] | |
| 937 | 937 | rw [he] |
| 938 | 938 | constructor |
| 939 | 939 | · apply (le_div_iff₀ (by positivity : 0 < 1 + eta ^ 2)).mpr |
| 940 | - nlinarith [mul_nonneg (sq_nonneg eta) (sub_nonneg.mpr hs)] | |
| 940 | + linarith [mul_nonneg (sq_nonneg eta) (sub_nonneg.mpr hs)] | |
| 941 | 941 | · apply (div_le_iff₀ (by positivity : 0 < 1 + eta ^ 2)).mpr |
| 942 | 942 | linarith |
| 943 | 943 | |
| @@ -960,7 +960,7 @@ theorem pulse_geometric_bounds (d : TailData) {eta : ℝ} (heta : |eta| ≤ 1) : | ||
| 960 | 960 | have hc₂ := mul_le_mul_of_nonneg_left hg₂ (show 0 ≤ 1 / 2 - d.h by linarith) |
| 961 | 961 | have hc₃ := mul_le_mul_of_nonneg_right hD (sq_nonneg eta) |
| 962 | 962 | dsimp [geometricSource, equilibriumNumerator] at * |
| 963 | - constructor <;> nlinarith [d.h_pos, d.h_small] | |
| 963 | + constructor <;> linarith [d.h_pos, d.h_small] | |
| 964 | 964 | |
| 965 | 965 | theorem derivativeCoefficient_nonneg (d : TailData) (eta : ℝ) : |
| 966 | 966 | 0 ≤ derivativeCoefficient d eta := by |
| @@ -979,7 +979,7 @@ theorem derivativeCoefficient_le (d : TailData) | ||
| 979 | 979 | have hb : (49999 / 100000 : ℝ) ≤ decay d.core := by dsimp [decay]; linarith |
| 980 | 980 | have hb₂ := pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 49999 / 100000) hb 2 |
| 981 | 981 | have hbase : (1 / 2 : ℝ) ≤ (2001 / 1000) * decay d.core ^ 2 * (99999 / 100000) := by |
| 982 | - nlinarith | |
| 982 | + linarith | |
| 983 | 983 | have hg := geometricSource_nonneg d eta |
| 984 | 984 | have hD : 0 ≤ 1 / 2 - d.h := by linarith [d.h_lt_half] |
| 985 | 985 | have hA : (99999 / 100000) * d.core.lam + geometricSource d eta ≤ equilibriumNumerator d eta := by |
| @@ -990,15 +990,15 @@ theorem derivativeCoefficient_le (d : TailData) | ||
| 990 | 990 | have hm := mul_le_mul_of_nonneg_left (show 1 - d.core.lam ≤ 1 by linarith [d.core.lam_pos]) |
| 991 | 991 | (mul_nonneg d.core.lam_pos.le (add_nonneg hD hg)) |
| 992 | 992 | have hh' := mul_le_mul_of_nonneg_left d.h_pos.le d.core.lam_pos.le |
| 993 | - nlinarith | |
| 993 | + linarith | |
| 994 | 994 | have hbase' := mul_le_mul_of_nonneg_right hbase d.core.lam_pos.le |
| 995 | - have hc : d.core.lam ≤ (2001 / 1000) * decay d.core ^ 2 := by nlinarith [d.core.lam_pos] | |
| 995 | + have hc : d.core.lam ≤ (2001 / 1000) * decay d.core ^ 2 := by linarith [d.core.lam_pos] | |
| 996 | 996 | have hc' := mul_le_mul_of_nonneg_right hc hg |
| 997 | 997 | have hA' := mul_le_mul_of_nonneg_left hA |
| 998 | 998 | (show 0 ≤ (2001 / 1000) * decay d.core ^ 2 by positivity) |
| 999 | 999 | unfold derivativeCoefficient |
| 1000 | 1000 | apply (div_le_iff₀ (mul_pos (sq_pos_of_pos (decay_pos d.core)) (equilibriumNumerator_pos d eta))).mpr |
| 1001 | - nlinarith | |
| 1001 | + linarith | |
| 1002 | 1002 | |
| 1003 | 1003 | noncomputable def mainDirection (d : TailData) (amp : ℝ → ℝ) (eta y : ℝ) : ℝ := |
| 1004 | 1004 | ((1 - d.core.lam) / decay d.core) * pulseRatio d.core amp (y, eta) - |
| @@ -1041,19 +1041,19 @@ theorem Ns_pulse_expansion (w : ResetWitness d K) {amp : ℝ → ℝ} | ||
| 1041 | 1041 | |
| 1042 | 1042 | theorem first_quadratic_margin (R : ℝ) : |
| 1043 | 1043 | -2 * R ^ 2 + (241 / 100) * R ≤ 73 / 100 := by |
| 1044 | - nlinarith [sq_nonneg (R - 241 / 400)] | |
| 1044 | + linarith [sq_nonneg (R - 241 / 400)] | |
| 1045 | 1045 | |
| 1046 | 1046 | theorem second_quadratic_margin (R : ℝ) : |
| 1047 | 1047 | -(7 / 2) * R ^ 2 + (241 / 50) * R ≤ 167 / 100 := by |
| 1048 | - nlinarith [sq_nonneg (R - 241 / 350)] | |
| 1048 | + linarith [sq_nonneg (R - 241 / 350)] | |
| 1049 | 1049 | |
| 1050 | 1050 | theorem ideal_cross_bound {R C Z : ℝ} (hR : 0 ≤ R) (hC : 0 ≤ C) |
| 1051 | 1051 | (hC' : C ≤ 2001 / 1000) (hZ : Z ≤ 6 / 5) : |
| 1052 | 1052 | -R * (2 * R - C * Z) ≤ -2 * R ^ 2 + (241 / 100) * R := by |
| 1053 | 1053 | have hc := mul_le_mul_of_nonneg_left hZ hC |
| 1054 | - have hcz : C * Z ≤ 241 / 100 := by nlinarith | |
| 1054 | + have hcz : C * Z ≤ 241 / 100 := by linarith | |
| 1055 | 1055 | have hm := mul_le_mul_of_nonneg_left hcz hR |
| 1056 | - nlinarith | |
| 1056 | + linarith | |
| 1057 | 1057 | |
| 1058 | 1058 | noncomputable def coneErrorBudget (F M eps lam : ℝ) : ℝ := |
| 1059 | 1059 | 2 * eps * (M + F + 1) + eps * (2 * F + 1) / 2 + 2 * lam * (M + 1) ^ 2 |
| @@ -1086,7 +1086,7 @@ theorem perturbed_cone_margins {lam R C Z b v eps F M : ℝ} | ||
| 1086 | 1086 | rw [abs_mul, abs_mul, abs_of_nonneg hR] |
| 1087 | 1087 | have h₁ := mul_le_mul hb hvabs (abs_nonneg v) heps |
| 1088 | 1088 | have h₂ := mul_le_mul hR' hv (abs_nonneg _) hF |
| 1089 | - nlinarith | |
| 1089 | + linarith | |
| 1090 | 1090 | have hdiff : |b - R| ≤ 2 * F + 1 := by |
| 1091 | 1091 | have h := abs_sub b R |
| 1092 | 1092 | rw [abs_of_nonneg hR] at h |
| @@ -1117,7 +1117,7 @@ theorem perturbed_cone_margins {lam R C Z b v eps F M : ℝ} | ||
| 1117 | 1117 | _ = _ := by ring |
| 1118 | 1118 | constructor |
| 1119 | 1119 | · have herr : eps * (M + F + 1) ≤ 1 / 200 := by |
| 1120 | - nlinarith only [hbudget, hnonneg₁, hnonneg₂] | |
| 1120 | + linarith only [hbudget, hnonneg₁, hnonneg₂] | |
| 1121 | 1121 | calc |
| 1122 | 1122 | _ ≤ -2 * R ^ 2 + (241 / 100) * R + eps * (M + F + 1) := hcrossBound |
| 1123 | 1123 | _ ≤ 73 / 100 + 1 / 200 := add_le_add (first_quadratic_margin R) herr |
| @@ -1219,12 +1219,12 @@ theorem axialHistoryError_bound (w : ResetWitness d K) | ||
| 1219 | 1219 | have ha' : |4 * d.h * eta| ≤ 2 := by |
| 1220 | 1220 | rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 4), abs_of_pos d.h_pos] |
| 1221 | 1221 | have h := mul_le_mul d.h_lt_half.le heta (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1 / 2) |
| 1222 | - nlinarith | |
| 1222 | + linarith | |
| 1223 | 1223 | have hc' : |4 * (1 / 2 + d.h) * eta| ≤ 4 := by |
| 1224 | 1224 | rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 4), |
| 1225 | 1225 | abs_of_pos (by linarith [d.h_pos] : 0 < 1 / 2 + d.h)] |
| 1226 | 1226 | have h := mul_le_mul (show 1 / 2 + d.h ≤ 1 by linarith [d.h_lt_half]) heta (abs_nonneg eta) zero_le_one |
| 1227 | - nlinarith | |
| 1227 | + linarith | |
| 1228 | 1228 | have hw' : |(1 - W d amp p) / E w p| ≤ 4 * averageConstant d.core.P d.core.m := by |
| 1229 | 1229 | rw [abs_div, abs_of_pos hE] |
| 1230 | 1230 | exact (div_le_iff₀ hE).mpr hW |
| @@ -1287,8 +1287,7 @@ theorem axialHistoryError_bound (w : ResetWitness d K) | ||
| 1287 | 1287 | calc |
| 1288 | 1288 | _ ≤ E w p * (A + B) / d.core.lam := by |
| 1289 | 1289 | simpa only [mul_div_assoc] using hb'.trans (mul_le_mul_of_nonneg_left hAB hE.le) |
| 1290 | - _ ≤ (energyConstant d.core.P d.core.m * d.core.lam ^ 30) * (A + B) / d.core.lam := by | |
| 1291 | - exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right he (add_nonneg hA hB)) d.core.lam_pos.le | |
| 1290 | + _ ≤ (energyConstant d.core.P d.core.m * d.core.lam ^ 30) * (A + B) / d.core.lam := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right he (add_nonneg hA hB)) d.core.lam_pos.le | |
| 1292 | 1291 | _ = axialErrorConstant d.core.P d.core.m * d.core.lam ^ 29 := by |
| 1293 | 1292 | have hc : axialErrorConstant d.core.P d.core.m = energyConstant d.core.P d.core.m * (A + B) := by |
| 1294 | 1293 | dsimp [axialErrorConstant, A, B] |
| @@ -1303,12 +1302,12 @@ theorem denominator_bounds (d : TailData) {eta Q : ℝ} (heta : |eta| ≤ 1) | ||
| 1303 | 1302 | 0 < Q ∧ 1 / Q ≤ 4 / d.core.lam ∧ |eta| / Q ≤ 4 / Real.sqrt d.core.lam := by |
| 1304 | 1303 | have hA := (pulse_geometric_bounds d heta).2 |
| 1305 | 1304 | have hq : d.core.lam / 4 + eta ^ 2 / 5 ≤ Q := by linarith |
| 1306 | - have hQpos : 0 < Q := by nlinarith [d.core.lam_pos, sq_nonneg eta] | |
| 1305 | + have hQpos : 0 < Q := by linarith [d.core.lam_pos, sq_nonneg eta] | |
| 1307 | 1306 | have hs := Real.sqrt_pos.mpr d.core.lam_pos |
| 1308 | 1307 | have hs₂ := Real.sq_sqrt d.core.lam_pos.le |
| 1309 | 1308 | refine ⟨hQpos, ?_, ?_⟩ |
| 1310 | 1309 | · apply (div_le_div_iff₀ hQpos d.core.lam_pos).mpr |
| 1311 | - nlinarith [sq_nonneg eta] | |
| 1310 | + linarith [sq_nonneg eta] | |
| 1312 | 1311 | · apply (div_le_div_iff₀ hQpos hs).mpr |
| 1313 | 1312 | nlinarith [sq_nonneg (Real.sqrt d.core.lam - |eta| / 2), sq_abs eta] |
| 1314 | 1313 | |
| @@ -1348,7 +1347,7 @@ theorem mainDirection_abs_le (d : TailData) | ||
| 1348 | 1347 | apply (abs_sub _ _).trans |
| 1349 | 1348 | rw [abs_mul, abs_mul, abs_of_nonneg hr₀, abs_of_nonneg hc₀] |
| 1350 | 1349 | dsimp [mainDirectionBound] |
| 1351 | - nlinarith | |
| 1350 | + linarith | |
| 1352 | 1351 | |
| 1353 | 1352 | private theorem quotient_remainder_bound |
| 1354 | 1353 | {N Q q B C D eta e m H eQ eE eM eH BM I J : ℝ} |
| @@ -1449,11 +1448,11 @@ theorem main_profile_bounds (d : TailData) | ||
| 1449 | 1448 | rw [mainRatio, abs_mul] |
| 1450 | 1449 | have h := mul_le_mul hamp (mainPulse_abs_le (d.core.lam * y)) (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 6 / 5) |
| 1451 | 1450 | dsimp [mainRatioBound] |
| 1452 | - nlinarith [mainBound_pos] | |
| 1451 | + linarith [mainBound_pos] | |
| 1453 | 1452 | have hZ : |mainSlope d.core amp eta y| ≤ 2 * mainFirstBound := by |
| 1454 | 1453 | rw [mainSlope, abs_mul] |
| 1455 | 1454 | have h := mul_le_mul hamp (main_first_le (d.core.lam * y)) (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 6 / 5) |
| 1456 | - nlinarith [mainFirstBound_pos] | |
| 1455 | + linarith [mainFirstBound_pos] | |
| 1457 | 1456 | have hZup := mul_le_mul_of_nonneg_left |
| 1458 | 1457 | (mainPulse_deriv_le_one (mul_nonneg d.core.lam_pos.le hy)) hamp₀ |
| 1459 | 1458 | have hCd : |derivativeCoefficient d eta| ≤ 3 := by |
| @@ -1468,7 +1467,7 @@ theorem main_profile_bounds (d : TailData) | ||
| 1468 | 1467 | apply (abs_sub _ _).trans |
| 1469 | 1468 | rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2), abs_mul] |
| 1470 | 1469 | dsimp [idealDirectionBound, mainRatioBound] at * |
| 1471 | - nlinarith | |
| 1470 | + linarith | |
| 1472 | 1471 | |
| 1473 | 1472 | theorem pulseRatio_abs_le (c : Parameters) (hsmall : c.lam ≤ 1 / 120) |
| 1474 | 1473 | (amp : ℝ → ℝ) {eta : ℝ} (heta : |eta| ≤ 1) (hamp : |amp eta| ≤ 6 / 5) (y : ℝ) : |
| @@ -1523,7 +1522,7 @@ theorem shearB_main_error (w : ResetWitness d K) (hsmall : d.core.lam ≤ 1 / 12 | ||
| 1523 | 1522 | have hm := mul_le_mul_of_nonneg_left hdiff (show 0 ≤ 2 * d.core.lam by linarith [d.core.lam_pos]) |
| 1524 | 1523 | dsimp only [mainRatio] at * |
| 1525 | 1524 | dsimp [shearErrorConstant] |
| 1526 | - nlinarith | |
| 1525 | + linarith | |
| 1527 | 1526 | |
| 1528 | 1527 | theorem mainDirection_ideal_error (d : TailData) |
| 1529 | 1528 | (hsmall : d.core.lam ≤ 1 / 100000) (hh : d.h ≤ d.core.lam / 100000) |
| @@ -1556,7 +1555,7 @@ theorem mainDirection_ideal_error (d : TailData) | ||
| 1556 | 1555 | apply (add_le_add_left (abs_add_le _ _) _).trans |
| 1557 | 1556 | rw [abs_mul, abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] |
| 1558 | 1557 | dsimp [directionMainErrorConstant, mainRatio, mainSlope] at * |
| 1559 | - nlinarith | |
| 1558 | + linarith | |
| 1560 | 1559 | |
| 1561 | 1560 | /-! ## The shaped wait supplies the actual angular equilibrium error -/ |
| 1562 | 1561 | |
| @@ -1572,7 +1571,7 @@ theorem canonical_wait_for_power28 (c : Parameters) | ||
| 1572 | 1571 | have h := PulseAmplitude.log_inverse_nonneg c |
| 1573 | 1572 | simpa only [one_div, Real.log_inv] using h |
| 1574 | 1573 | have hm := mul_nonneg hl (show 0 ≤ (1 : ℝ) / 10 - c.lam by linarith [c.lam_lt]) |
| 1575 | - nlinarith | |
| 1574 | + linarith | |
| 1576 | 1575 | |
| 1577 | 1576 | noncomputable def angularErrorConstant (P m : ℝ) : ℝ := 19 + 2 * sourceConstant P m |
| 1578 | 1577 | |
| @@ -1613,7 +1612,7 @@ theorem actual_Qs_pulse_error (w : ResetWitness d K) | ||
| 1613 | 1612 | apply (div_le_iff₀ hr).mpr |
| 1614 | 1613 | nlinarith only [hs, hfac'] |
| 1615 | 1614 | dsimp [angularErrorConstant] |
| 1616 | - nlinarith only [hb, hiprod, hc] | |
| 1615 | + linarith only [hb, hiprod, hc] | |
| 1617 | 1616 | |
| 1618 | 1617 | theorem actual_Qs_pulse_lower (w : ResetWitness d K) |
| 1619 | 1618 | (hwait : d.core.wait = 60 * Real.log (1 / d.core.lam)) (hsmall : d.core.lam ≤ 1 / 120) |
| @@ -1630,9 +1629,9 @@ theorem actual_Qs_pulse_lower (w : ResetWitness d K) | ||
| 1630 | 1629 | have hA := (pulse_geometric_bounds d heta).2 |
| 1631 | 1630 | have heq : equilibriumNumerator d eta ≤ angularEquilibrium d eta := by |
| 1632 | 1631 | apply (le_div_iff₀ (show 0 < 1 - d.core.lam by linarith [d.core.lam_lt])).mpr |
| 1633 | - nlinarith [mul_nonneg (equilibriumNumerator_pos d eta).le d.core.lam_pos.le] | |
| 1632 | + linarith [mul_nonneg (equilibriumNumerator_pos d eta).le d.core.lam_pos.le] | |
| 1634 | 1633 | have hlo := (abs_le.mp he).1 |
| 1635 | - nlinarith [sq_nonneg eta] | |
| 1634 | + linarith [sq_nonneg eta] | |
| 1636 | 1635 | |
| 1637 | 1636 | /-! ## A single explicit vanishing rate for the cone errors -/ |
| 1638 | 1637 | |
| @@ -1682,7 +1681,7 @@ private theorem raw_error_le_rate {lam Q B M H P A F v : ℝ} | ||
| 1682 | 1681 | (Q * B + M + H) * lam ^ 2 := by |
| 1683 | 1682 | have h₁ := mul_le_mul_of_nonneg_left hp28 (mul_nonneg hQ hB) |
| 1684 | 1683 | have h₂ := mul_le_mul_of_nonneg_left hp29 hH |
| 1685 | - nlinarith only [h₁, h₂] | |
| 1684 | + linarith only [h₁, h₂] | |
| 1686 | 1685 | have hfirst : (4 / lam) * (Q * lam ^ 28 * B + M * lam ^ 2 + H * lam ^ 29) ≤ |
| 1687 | 1686 | 4 * (Q * B + M + H) * lam := by |
| 1688 | 1687 | have h := mul_le_mul_of_nonneg_left hfirstInside (by positivity : 0 ≤ 4 / lam) |
| @@ -1699,7 +1698,7 @@ private theorem raw_error_le_rate {lam Q B M H P A F v : ℝ} | ||
| 1699 | 1698 | have hp2 : lam ^ 2 / Real.sqrt lam ≤ lam := by |
| 1700 | 1699 | apply (div_le_iff₀ hs).mpr |
| 1701 | 1700 | have hl : lam ≤ Real.sqrt lam := Real.le_sqrt_of_sq_le (by nlinarith only [hlam, hsmall]) |
| 1702 | - nlinarith only [mul_le_mul_of_nonneg_left hl hlam.le] | |
| 1701 | + linarith only [mul_le_mul_of_nonneg_left hl hlam.le] | |
| 1703 | 1702 | have hsecond : (4 / Real.sqrt lam) * (3 * F * v + P * lam ^ 2) ≤ |
| 1704 | 1703 | 12 * F * A * (Real.sqrt lam * (1 + Real.log (1 / lam))) + 4 * P * lam := by |
| 1705 | 1704 | have h₁ := mul_le_mul_of_nonneg_left hv' (mul_nonneg (by norm_num : (0 : ℝ) ≤ 12) hF) |
| @@ -1714,7 +1713,7 @@ private theorem raw_error_le_rate {lam Q B M H P A F v : ℝ} | ||
| 1714 | 1713 | (show 0 ≤ 4 * (Q * B + M + H + P) by positivity) |
| 1715 | 1714 | have hparameter := mul_le_mul_of_nonneg_left hr.2.2 |
| 1716 | 1715 | (show 0 ≤ 12 * F * A by positivity) |
| 1717 | - nlinarith only [hfirst, hsecond, hlinear, hparameter] | |
| 1716 | + linarith only [hfirst, hsecond, hlinear, hparameter] | |
| 1718 | 1717 | |
| 1719 | 1718 | noncomputable def directionErrorConstant (P m A : ℝ) : ℝ := |
| 1720 | 1719 | 4 * (angularErrorConstant P m * mainDirectionBound P m + fullLagBound P m + |
| @@ -1801,7 +1800,7 @@ private theorem cone_budget_eps_le_one {F M eps lam : ℝ} | ||
| 1801 | 1800 | have h₂ : 0 ≤ eps * (2 * F + 1) / 2 := by positivity |
| 1802 | 1801 | have h₃ : 0 ≤ 2 * lam * (M + 1) ^ 2 := by positivity |
| 1803 | 1802 | dsimp [coneErrorBudget] at hb |
| 1804 | - nlinarith only [h₁, h₂, h₃, hb] | |
| 1803 | + linarith only [h₁, h₂, h₃, hb] | |
| 1805 | 1804 | |
| 1806 | 1805 | /-- The numerical margins refer only to the actual global stress histories |
| 1807 | 1806 | and the actual first radial derivatives of the corrected fields. -/ |
| @@ -1824,7 +1823,7 @@ theorem PulseConeAt.true_criterion {w : ResetWitness d K} {amp : ℝ → ℝ} {p | ||
| 1824 | 1823 | refine ⟨?_, ?_, ?_⟩ |
| 1825 | 1824 | · linarith [h.first_margin] |
| 1826 | 1825 | · linarith [h.second_margin] |
| 1827 | - · nlinarith only [ha, hmul] | |
| 1826 | + · linarith only [ha, hmul] | |
| 1828 | 1827 | |
| 1829 | 1828 | /-- The full pulse cone for any smooth amplitude with the proved size and |
| 1830 | 1829 | first-derivative rate. Every further hypothesis is a scalar parameter bound. -/ |
| @@ -1881,7 +1880,7 @@ theorem corrected_pulse_cone (w : ResetWitness d K) (hK : 0 < K) | ||
| 1881 | 1880 | have hs := CorrectedPulseAmplitude.amplitude_spec w hK (by linarith) hwait hscale |
| 1882 | 1881 | have heta₂ : eta ^ 2 ≤ 1 := by |
| 1883 | 1882 | have h := (sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1)).mpr heta |
| 1884 | - nlinarith [sq_abs eta] | |
| 1883 | + linarith [sq_abs eta] | |
| 1885 | 1884 | have hb := hs.2 eta heta₂ |
| 1886 | 1885 | have hamp : |CorrectedPulseAmplitude.amplitude d w.coefficients eta| ≤ 6 / 5 := by |
| 1887 | 1886 | rw [abs_of_pos (CorrectedPulseAmplitude.amplitude_pos d w.coefficients eta)] |
| @@ -1951,7 +1950,7 @@ theorem exists_corrected_pulse_threshold (P m K : ℝ) (hP : 0 < P) (hK : 0 < K) | ||
| 1951 | 1950 | (show d.core.lam ≤ 1 by linarith) (show 1 ≤ 27 by norm_num) |
| 1952 | 1951 | have hm := mul_le_mul_of_nonneg_left hp hC.le |
| 1953 | 1952 | have hd := (le_div_iff₀ (show 0 < 4 * angularErrorConstant P m by positivity)).mp hCsmall |
| 1954 | - nlinarith only [hm, hd] | |
| 1953 | + linarith only [hm, hd] | |
| 1955 | 1954 | have hscale' : CorrectedPulseAmplitude.combinedScale d K ≤ 1 / 1000 := by |
| 1956 | 1955 | dsimp [CorrectedPulseAmplitude.combinedScale] |
| 1957 | 1956 | rw [hdP, hdm] |
+13 −13 NavierStokes/PulseCovariance.lean View file
| @@ -169,7 +169,7 @@ theorem weight_gaussian_upper (v : ℝ) : | ||
| 169 | 169 | weight ψ x v ≤ A ^ 2 * gaussian (2 * b) (r ^ 2 / 2) r v := by |
| 170 | 170 | by_cases hv : v ∈ Icc (r ^ 2 / 6) (5 * r ^ 2 / 6) |
| 171 | 171 | · have hslot : v ∈ Icc 0 (r ^ 2) := by |
| 172 | - constructor <;> nlinarith [hv.1, hv.2, sq_nonneg r] | |
| 172 | + constructor <;> linarith [hv.1, hv.2, sq_nonneg r] | |
| 173 | 173 | have hx := h.component_upper v hslot |
| 174 | 174 | have hx0 := (h.component_pos hslot).le |
| 175 | 175 | have hg := (gaussian_pos b (r ^ 2 / 2) r v).le |
| @@ -185,7 +185,7 @@ theorem weight_gaussian_upper (v : ℝ) : | ||
| 185 | 185 | calc |
| 186 | 186 | weight ψ x v ≤ x v ^ 2 := by |
| 187 | 187 | unfold weight |
| 188 | - nlinarith [mul_le_mul_of_nonneg_right hψ (sq_nonneg (x v))] | |
| 188 | + linarith [mul_le_mul_of_nonneg_right hψ (sq_nonneg (x v))] | |
| 189 | 189 | _ ≤ (A * gaussian b (r ^ 2 / 2) r v) ^ 2 := |
| 190 | 190 | pow_le_pow_left₀ hx0 hx 2 |
| 191 | 191 | _ = A ^ 2 * gaussian (2 * b) (r ^ 2 / 2) r v := by rw [mul_pow, he] |
| @@ -208,7 +208,7 @@ theorem moment_integrable : | ||
| 208 | 208 | rw [Real.norm_eq_abs, abs_of_nonneg |
| 209 | 209 | (mul_nonneg (abs_nonneg _) (weight_nonneg v))] |
| 210 | 210 | simp only [id_eq] |
| 211 | - nlinarith [mul_le_mul_of_nonneg_left (h.weight_gaussian_upper v) (abs_nonneg (v - r ^ 2 / 2))] | |
| 211 | + linarith [mul_le_mul_of_nonneg_left (h.weight_gaussian_upper v) (abs_nonneg (v - r ^ 2 / 2))] | |
| 212 | 212 | |
| 213 | 213 | theorem mass_upper : mass ψ x ≤ A ^ 2 * Real.sqrt (Real.pi / (2 * b)) * r := by |
| 214 | 214 | have hi := integral_mono h.weight_integrable |
| @@ -231,8 +231,8 @@ theorem core_mem_middle {v : ℝ} | ||
| 231 | 231 | (hv : v ∈ Icc (r ^ 2 / 2 - r / 6) (r ^ 2 / 2 + r / 6)) : |
| 232 | 232 | v ∈ Icc (r ^ 2 / 3) (2 * r ^ 2 / 3) := by |
| 233 | 233 | have hr := h.radius_one_le |
| 234 | - have hrr : r ≤ r ^ 2 := by nlinarith [mul_nonneg (sub_nonneg.mpr hr) h.radius_pos.le] | |
| 235 | - constructor <;> nlinarith [hv.1, hv.2] | |
| 234 | + have hrr : r ≤ r ^ 2 := by linarith [mul_nonneg (sub_nonneg.mpr hr) h.radius_pos.le] | |
| 235 | + constructor <;> linarith [hv.1, hv.2] | |
| 236 | 236 | |
| 237 | 237 | theorem core_scaled_sq {v : ℝ} |
| 238 | 238 | (hv : v ∈ Icc (r ^ 2 / 2 - r / 6) (r ^ 2 / 2 + r / 6)) : |
| @@ -250,13 +250,13 @@ theorem core_weight_lower {v : ℝ} | ||
| 250 | 250 | a ^ 2 * Real.exp (-B / 18) ≤ weight ψ x v := by |
| 251 | 251 | have hmid := h.core_mem_middle hv |
| 252 | 252 | have hslot : v ∈ Icc 0 (r ^ 2) := by |
| 253 | - constructor <;> nlinarith [hmid.1, hmid.2, sq_nonneg r] | |
| 253 | + constructor <;> linarith [hmid.1, hmid.2, sq_nonneg r] | |
| 254 | 254 | have hx := h.component_lower v hslot |
| 255 | 255 | have he : Real.exp (-B / 18) ≤ gaussian B (r ^ 2 / 2) r v ^ 2 := by |
| 256 | 256 | unfold gaussian |
| 257 | 257 | rw [pow_two, ← Real.exp_add] |
| 258 | 258 | apply Real.exp_le_exp.mpr |
| 259 | - nlinarith [mul_le_mul_of_nonneg_left (h.core_scaled_sq hv) h.lower_decay_pos.le] | |
| 259 | + linarith [mul_le_mul_of_nonneg_left (h.core_scaled_sq hv) h.lower_decay_pos.le] | |
| 260 | 260 | rw [weight, h.cutoff_one v hmid] |
| 261 | 261 | simp only [one_pow, one_mul] |
| 262 | 262 | calc |
| @@ -303,7 +303,7 @@ theorem weight_direction_integrable {q : ℝ → ℝ} | ||
| 303 | 303 | have hout : v ∉ Icc (r ^ 2 / 6) (5 * r ^ 2 / 6) := by |
| 304 | 304 | intro hin |
| 305 | 305 | apply hv' |
| 306 | - constructor <;> nlinarith [hin.1, hin.2, sq_nonneg r] | |
| 306 | + constructor <;> linarith [hin.1, hin.2, sq_nonneg r] | |
| 307 | 307 | exact hv (by simp [weight, h.cutoff_zero v hout]) |
| 308 | 308 | apply (integrableOn_iff_integrable_of_support_subset hs).mp |
| 309 | 309 | exact (h.weight_continuous.continuousOn.mul hq).integrableOn_Icc |
| @@ -366,7 +366,7 @@ theorem averagedDirection_error {q : ℝ → ℝ} (hq : ContinuousOn q (Icc 0 (r | ||
| 366 | 366 | ε * weight ψ x v + (K / r ^ 2) * (|v - r ^ 2 / 2| * weight ψ x v) := by |
| 367 | 367 | by_cases hv : v ∈ Icc (r ^ 2 / 6) (5 * r ^ 2 / 6) |
| 368 | 368 | · have hslot : v ∈ Icc 0 (r ^ 2) := by |
| 369 | - constructor <;> nlinarith [hv.1, hv.2, sq_nonneg r] | |
| 369 | + constructor <;> linarith [hv.1, hv.2, sq_nonneg r] | |
| 370 | 370 | rw [abs_mul, abs_of_nonneg (weight_nonneg v)] |
| 371 | 371 | convert! mul_le_mul_of_nonneg_left (hqbound v hslot) (weight_nonneg v) using 1 |
| 372 | 372 | ring |
| @@ -403,7 +403,7 @@ theorem averagedDirection_error_order {q : ℝ → ℝ} | ||
| 403 | 403 | have hi := h.averagedDirection_error hq hK hqbound |
| 404 | 404 | have hEr : E / r ^ 2 ≤ E / r := by |
| 405 | 405 | apply div_le_div_of_nonneg_left hE h.radius_pos |
| 406 | - nlinarith [mul_nonneg (sub_nonneg.mpr h.radius_one_le) h.radius_pos.le] | |
| 406 | + linarith [mul_nonneg (sub_nonneg.mpr h.radius_one_le) h.radius_pos.le] | |
| 407 | 407 | apply hi.trans |
| 408 | 408 | rw [add_div] |
| 409 | 409 | exact add_le_add_left hEr _ |
| @@ -435,13 +435,13 @@ theorem radiusProfile_lipschitz (s t : ℝ) : | ||
| 435 | 435 | add_pos (radiusProfile_pos s) (radiusProfile_pos t) |
| 436 | 436 | have he : (radiusProfile s - radiusProfile t) * (radiusProfile s + radiusProfile t) = |
| 437 | 437 | (s - t) * (s + t) := by |
| 438 | - nlinarith [radiusProfile_sq s, radiusProfile_sq t] | |
| 438 | + linarith [radiusProfile_sq s, radiusProfile_sq t] | |
| 439 | 439 | have ha := congrArg abs he |
| 440 | 440 | rw [abs_mul, abs_mul, abs_of_pos hp] at ha |
| 441 | 441 | have hst : |s + t| ≤ radiusProfile s + radiusProfile t := |
| 442 | 442 | (abs_add_le s t).trans (add_le_add (abs_le_radiusProfile s) (abs_le_radiusProfile t)) |
| 443 | 443 | exact (mul_le_mul_iff_left₀ hp).mp (by |
| 444 | - nlinarith [mul_le_mul_of_nonneg_left hst (abs_nonneg (s - t))]) | |
| 444 | + linarith [mul_le_mul_of_nonneg_left hst (abs_nonneg (s - t))]) | |
| 445 | 445 | |
| 446 | 446 | /-- Coordinates in the fixed tangent frame `(N,K)` of `h N - s K`, where |
| 447 | 447 | `h = c₀ sqrt(1+s²)`. -/ |
| @@ -471,7 +471,7 @@ theorem raw_integrand_eq {t : ℝ → Vec2} (v : ℝ) (i : Fin 2) : | ||
| 471 | 471 | · have hout : v ∉ Icc (r ^ 2 / 6) (5 * r ^ 2 / 6) := by |
| 472 | 472 | intro hin |
| 473 | 473 | apply hv |
| 474 | - constructor <;> nlinarith [hin.1, hin.2, sq_nonneg r] | |
| 474 | + constructor <;> linarith [hin.1, hin.2, sq_nonneg r] | |
| 475 | 475 | simp [weight, h.cutoff_zero v hout] |
| 476 | 476 | |
| 477 | 477 | /-- Exact factorization of the actual covariance integral into its positive |
+13 −13 NavierStokes/PulseEnergyHistory.lean View file
| @@ -142,7 +142,7 @@ theorem logarithmicRate_le_one (c : Parameters) : PulseAmplitude.logarithmicRate | ||
| 142 | 142 | have he : c.lam * (1 / c.lam - 1) = 1 - c.lam := by field_simp [c.lam_pos.ne'] |
| 143 | 143 | rw [he] at hm |
| 144 | 144 | unfold PulseAmplitude.logarithmicRate |
| 145 | - nlinarith | |
| 145 | + linarith | |
| 146 | 146 | |
| 147 | 147 | theorem prefix_sum_bound (c : Parameters) |
| 148 | 148 | (hwait : c.wait = 60 * Real.log (1 / c.lam)) : |
| @@ -159,12 +159,12 @@ theorem prefix_sum_bound (c : Parameters) | ||
| 159 | 159 | rw [he] at hb |
| 160 | 160 | have h := (div_le_iff₀ (PulseAmplitude.normalization_pos c)).mp hb |
| 161 | 161 | apply (le_div_iff₀ c.lam_pos).mpr |
| 162 | - nlinarith | |
| 162 | + linarith | |
| 163 | 163 | |
| 164 | 164 | theorem shape_bounds {eta : ℝ} (heta : |eta| ≤ 1) : |
| 165 | 165 | (1 / 4 : ℝ) ≤ shape eta ^ 2 ∧ shape eta ^ 2 ≤ 1 ∧ |shapeRate eta| ≤ 2 := by |
| 166 | 166 | have hs : eta ^ 2 ≤ 1 := by |
| 167 | - nlinarith [sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1) |>.mpr heta, sq_abs eta] | |
| 167 | + linarith [sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1) |>.mpr heta, sq_abs eta] | |
| 168 | 168 | have hlo : (1 / 2 : ℝ) ≤ shape eta := by |
| 169 | 169 | change 1 / 2 ≤ (1 + eta ^ 2)⁻¹ |
| 170 | 170 | rw [← one_div] |
| @@ -174,7 +174,7 @@ theorem shape_bounds {eta : ℝ} (heta : |eta| ≤ 1) : | ||
| 174 | 174 | rw [shapeRate, abs_div, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2), |
| 175 | 175 | abs_of_pos (by positivity : 0 < 1 + eta ^ 2)] |
| 176 | 176 | apply (div_le_iff₀ (by positivity : 0 < 1 + eta ^ 2)).mpr |
| 177 | - nlinarith [sq_nonneg eta] | |
| 177 | + linarith [sq_nonneg eta] | |
| 178 | 178 | |
| 179 | 179 | /-- One bound covers both normalized source factors. -/ |
| 180 | 180 | theorem source_factor_bounds {R Reta rate B : ℝ} (hB : 0 ≤ B) |
| @@ -182,7 +182,7 @@ theorem source_factor_bounds {R Reta rate B : ℝ} (hB : 0 ≤ B) | ||
| 182 | 182 | |R ^ 2 - 1 / 2| ≤ 6 * B ^ 2 + 2 ∧ |
| 183 | 183 | |2 * R * Reta - 2 * rate * (R ^ 2 - 1 / 2)| ≤ 6 * B ^ 2 + 2 := by |
| 184 | 184 | have hRsq : R ^ 2 ≤ B ^ 2 := by |
| 185 | - nlinarith [sq_le_sq₀ (abs_nonneg R) hB |>.mpr hR, sq_abs R] | |
| 185 | + linarith [sq_le_sq₀ (abs_nonneg R) hB |>.mpr hR, sq_abs R] | |
| 186 | 186 | have hbase : |R ^ 2 - 1 / 2| ≤ B ^ 2 + 1 / 2 := by |
| 187 | 187 | apply (abs_sub _ _).trans |
| 188 | 188 | rw [abs_of_nonneg (sq_nonneg R), abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2)] |
| @@ -196,8 +196,8 @@ theorem source_factor_bounds {R Reta rate B : ℝ} (hB : 0 ≤ B) | ||
| 196 | 196 | linarith |
| 197 | 197 | have hsecond : |2 * rate * (R ^ 2 - 1 / 2)| ≤ 4 * (B ^ 2 + 1 / 2) := by |
| 198 | 198 | rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] |
| 199 | - nlinarith [mul_le_mul hrate hbase (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 2)] | |
| 200 | - exact ⟨hbase.trans (by nlinarith [sq_nonneg B]), | |
| 199 | + linarith [mul_le_mul hrate hbase (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 2)] | |
| 200 | + exact ⟨hbase.trans (by linarith [sq_nonneg B]), | |
| 201 | 201 | (abs_sub _ _).trans (by linarith)⟩ |
| 202 | 202 | |
| 203 | 203 | /-- The actual energy source and its actual parameter derivative have a common bound. -/ |
| @@ -239,25 +239,25 @@ theorem initial_history_bounds (w : ResetWitness d K) {amp : ℝ → ℝ} | ||
| 239 | 239 | have hG : 0 ≤ G := PulseAmplitude.prefixAngularEnergy_nonneg d.core |
| 240 | 240 | have hs := shape_bounds heta |
| 241 | 241 | have heta2 : eta ^ 2 ≤ 1 := by |
| 242 | - nlinarith [sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1) |>.mpr heta, sq_abs eta] | |
| 242 | + linarith [sq_le_sq₀ (abs_nonneg eta) (by norm_num : (0 : ℝ) ≤ 1) |>.mpr heta, sq_abs eta] | |
| 243 | 243 | have hval : |S w amp (d.core.pulseStart, eta)| ≤ 4 * (A + G) := by |
| 244 | 244 | rw [S_at_pulseStart w ha] |
| 245 | 245 | change |A * eta ^ 2 - G * shape eta ^ 2| ≤ _ |
| 246 | 246 | apply (abs_sub _ _).trans |
| 247 | 247 | rw [abs_of_nonneg (mul_nonneg hA (sq_nonneg _)), |
| 248 | 248 | abs_of_nonneg (mul_nonneg hG (sq_nonneg _))] |
| 249 | - nlinarith [mul_le_of_le_one_right hA heta2, mul_le_of_le_one_right hG hs.2.1] | |
| 249 | + linarith [mul_le_of_le_one_right hA heta2, mul_le_of_le_one_right hG hs.2.1] | |
| 250 | 250 | have hder : |dEta (S w amp) (d.core.pulseStart, eta)| ≤ 4 * (A + G) := by |
| 251 | 251 | rw [dEta_S_at_pulseStart w ha] |
| 252 | 252 | change |2 * A * eta + 2 * G * shape eta ^ 2 * shapeRate eta| ≤ _ |
| 253 | 253 | apply (abs_add_le _ _).trans |
| 254 | 254 | have hfirst : |2 * A * eta| ≤ 2 * A := by |
| 255 | 255 | rw [abs_mul, abs_of_nonneg (mul_nonneg (by norm_num) hA)] |
| 256 | - nlinarith [mul_le_of_le_one_right (show 0 ≤ 2 * A by positivity) heta] | |
| 256 | + linarith [mul_le_of_le_one_right (show 0 ≤ 2 * A by positivity) heta] | |
| 257 | 257 | have hsecond : |2 * G * shape eta ^ 2 * shapeRate eta| ≤ 4 * G := by |
| 258 | 258 | rw [abs_mul, abs_of_nonneg (by positivity : 0 ≤ 2 * G * shape eta ^ 2)] |
| 259 | 259 | have hh := mul_le_mul hs.2.1 hs.2.2 (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) |
| 260 | - nlinarith [mul_le_mul_of_nonneg_left hh (show 0 ≤ 2 * G by positivity)] | |
| 260 | + linarith [mul_le_mul_of_nonneg_left hh (show 0 ≤ 2 * G by positivity)] | |
| 261 | 261 | linarith |
| 262 | 262 | have hscale : 4 * (A + G) ≤ |
| 263 | 263 | pulseNormalization d.core eta * (16 * PulseAmplitude.prefixBoundConstant d.core.P d.core.m) / |
| @@ -306,7 +306,7 @@ theorem normalized_history_bound {H g : ℝ → ℝ} {lam N C M y : ℝ} | ||
| 306 | 306 | have hfactor : 1 ≤ Real.exp 26 * Real.exp (-2 * lam * y) := by |
| 307 | 307 | rw [← Real.exp_add] |
| 308 | 308 | apply Real.one_le_exp |
| 309 | - nlinarith [(le_div_iff₀ hlam).mp hy'] | |
| 309 | + linarith [(le_div_iff₀ hlam).mp hy'] | |
| 310 | 310 | apply (div_le_iff₀ (mul_pos hN (Real.exp_pos _))).mpr |
| 311 | 311 | calc |
| 312 | 312 | _ ≤ N * (C + 13 * M) / lam := hvalue |
| @@ -396,7 +396,7 @@ theorem forcing_abs_bound (c : Parameters) (hsmall : c.lam ≤ 1 / 120) (q A y : | ||
| 396 | 396 | OutgoingPulseBounds.correctionJetBound c.P c.m 0 * (|q| + |A|) := add_le_add hm hc' |
| 397 | 397 | _ ≤ _ := by |
| 398 | 398 | unfold forceConstant |
| 399 | - nlinarith [mul_nonneg OutgoingPulseBounds.mainBound_pos.le (abs_nonneg q)] | |
| 399 | + linarith [mul_nonneg OutgoingPulseBounds.mainBound_pos.le (abs_nonneg q)] | |
| 400 | 400 | |
| 401 | 401 | /-- The parameter derivative includes the derivative of the actual moment repair. -/ |
| 402 | 402 | theorem pulseRatio_eta_hasDerivAt (c : Parameters) {amp : ℝ → ℝ} {eta amp' : ℝ} |
+8 −8 NavierStokes/PulseLag.lean View file
| @@ -156,7 +156,7 @@ theorem decay_inv_cube_le (c : Parameters) {M : ℝ} (hM : 0 ≤ M) : | ||
| 156 | 156 | have hp := pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 2 / 5) hd 3 |
| 157 | 157 | have hb : 1 ≤ 16 * decay c ^ 3 := by norm_num at hp; linarith |
| 158 | 158 | apply (div_le_iff₀ (pow_pos (decay_pos c) 3)).mpr |
| 159 | - nlinarith [mul_le_mul_of_nonneg_right hb hM] | |
| 159 | + linarith [mul_le_mul_of_nonneg_right hb hM] | |
| 160 | 160 | |
| 161 | 161 | /-- The exponential correction is smaller than a fixed quadratic rate, |
| 162 | 162 | uniformly for every positive lambda. -/ |
| @@ -269,7 +269,7 @@ theorem forcing_second_bound (c : Parameters) (hsmall : c.lam ≤ 1 / 120) | ||
| 269 | 269 | |iteratedDeriv 2 (affineProfile c q A) y| := abs_add_le _ _ |
| 270 | 270 | _ ≤ |A| * c.lam ^ 2 * mainSecondBound + |
| 271 | 271 | correctionJetBound c.P c.m 2 * (64 * c.lam ^ 2) * (|q| + |A|) := add_le_add hm hc' |
| 272 | - _ ≤ _ := by dsimp [forcingBound]; nlinarith | |
| 272 | + _ ≤ _ := by dsimp [forcingBound]; linarith | |
| 273 | 273 | |
| 274 | 274 | noncomputable def affineLag (c : Parameters) (q A y : ℝ) : ℝ := |
| 275 | 275 | lag (decay c) (prefixCoefficient c 0 * q) (forcing c q A) y |
| @@ -372,7 +372,7 @@ theorem normalizedLag_eq_affineLag (c : Parameters) (amp : ℝ → ℝ) (eta : | ||
| 372 | 372 | have hpre' : massMoment c amp eta c.pulseStart = |
| 373 | 373 | (prefixCoefficient c 0 * parameterPolynomial eta) * (momentScale c 0 * shape eta) := by |
| 374 | 374 | apply (div_eq_iff hs).mp |
| 375 | - simpa only [parameterPolynomial, mul_assoc] using hpre | |
| 375 | + simpa only [mul_assoc] using hpre | |
| 376 | 376 | rw [normalizedLag, massMoment_pulse c amp eta hy, pulse_denominator c eta hy, hpre', |
| 377 | 377 | affineLag, lag, convolution_eq_weighted] |
| 378 | 378 | have he : Real.exp (-decay c * y) = (Real.exp (decay c * y))⁻¹ := by |
| @@ -556,7 +556,7 @@ theorem initial_memory_bound (c : Parameters) | ||
| 556 | 556 | _ ≤ prefixBound c.P c.m 0 * |q| * c.lam ^ 2 := by |
| 557 | 557 | have h := mul_le_mul_of_nonneg_left hpow |
| 558 | 558 | (mul_nonneg (prefixBound_pos c.P_pos c.m 0).le (abs_nonneg q)) |
| 559 | - nlinarith | |
| 559 | + linarith | |
| 560 | 560 | |
| 561 | 561 | noncomputable def fullLagBound (P m : ℝ) : ℝ := 5 * lagBound P m + 4 * prefixBound P m 0 |
| 562 | 562 | |
| @@ -586,13 +586,13 @@ theorem fullError_bounds_of_amplitude_bounds (c : Parameters) | ||
| 586 | 586 | have ht : 2 + |amp eta| ≤ 4 := by linarith |
| 587 | 587 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left ht hL.le) |
| 588 | 588 | (sq_nonneg c.lam) |
| 589 | - nlinarith | |
| 589 | + linarith | |
| 590 | 590 | have hmemory : |(prefixCoefficient c 0 * parameterPolynomial eta) * Real.exp (-decay c * y)| ≤ |
| 591 | 591 | 2 * prefixBound c.P c.m 0 * c.lam ^ 2 := by |
| 592 | 592 | apply (initial_memory_bound c hwait hsmall _ hy).trans |
| 593 | 593 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hq hP.le) |
| 594 | 594 | (sq_nonneg c.lam) |
| 595 | - nlinarith | |
| 595 | + linarith | |
| 596 | 596 | rw [fullError_eq] |
| 597 | 597 | refine (abs_add_le _ _).trans ((add_le_add hmain hmemory).trans ?_) |
| 598 | 598 | dsimp [fullLagBound] |
| @@ -604,13 +604,13 @@ theorem fullError_bounds_of_amplitude_bounds (c : Parameters) | ||
| 604 | 604 | have hs : |1 + 3 * eta ^ 2| + |amp'| ≤ 5 := by linarith |
| 605 | 605 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hs hL.le) |
| 606 | 606 | (sq_nonneg c.lam) |
| 607 | - nlinarith | |
| 607 | + linarith | |
| 608 | 608 | have hmemory : |(prefixCoefficient c 0 * (1 + 3 * eta ^ 2)) * Real.exp (-decay c * y)| ≤ |
| 609 | 609 | 4 * prefixBound c.P c.m 0 * c.lam ^ 2 := by |
| 610 | 610 | apply (initial_memory_bound c hwait hsmall _ hy).trans |
| 611 | 611 | have h := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hq' hP.le) |
| 612 | 612 | (sq_nonneg c.lam) |
| 613 | - nlinarith | |
| 613 | + linarith | |
| 614 | 614 | refine (abs_add_le _ _).trans ((add_le_add hmain hmemory).trans_eq ?_) |
| 615 | 615 | dsimp [fullLagBound] |
| 616 | 616 | ring |
+22 −0 routes/s2-ns-pulse-1/README.md added View file
| @@ -0,0 +1,22 @@ | ||
| 1 | +--- | |
| 2 | +issue: 11 | |
| 3 | +status: working | |
| 4 | +--- | |
| 5 | +# s2-ns-pulse-1 | |
| 6 | + | |
| 7 | +S-2 (find the slowest files and make one faster), one unit: the family | |
| 8 | +`NavierStokes/Pulse*`, five files. Each is made cheaper to elaborate by edits | |
| 9 | +inside proofs only, carried onto main at `d956c7c` from Treant's | |
| 10 | +`speedup_trials` stage (TitiSkywalker/NavierStokesAndEuler, the run of | |
| 11 | +2026-12-03) and counted again there; every file here is at least 0.5% cheaper: | |
| 12 | +`PulseAmplitude`, `PulseCone`, `PulseCovariance`, `PulseEnergyHistory`, | |
| 13 | +`PulseLag`. The edits drop `simp` entries that do not change the goal, replace | |
| 14 | +`nlinarith` with `linarith` where no nonlinear step is used, and shorten two | |
| 15 | +tactic steps. No statement, import or docstring line changes, and no | |
| 16 | +`maxHeartbeats` is added. How the counts were taken is in the pull request; | |
| 17 | +this unit adds no file beyond the note. | |
| 18 | + | |
| 19 | +## Next | |
| 20 | + | |
| 21 | +Wait for `build` on `s2-ns-pulse-1`; then the maintainer's review. Nothing is | |
| 22 | +left to edit in these five files for this unit. | |