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.AngularMomentReset |
| 2 | import NavierStokes.OutgoingTail |
| 3 | import NavierStokes.ParametricFlatFactor |
| 4 | import Mathlib.Analysis.Calculus.ParametricIntegral |
| 5 | import Mathlib.Analysis.Calculus.ParametricIntervalIntegral |
| 6 | import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics |
| 7 | import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals |
| 8 | |
| 9 | /-! |
| 10 | # Uniform applicability of the angular reset |
| 11 | |
| 12 | The actual two-bump moment system is uniformly invertible down to `lam = 0`. |
| 13 | The outgoing uniform wait damps the angular-history discrepancy and its |
| 14 | parameter derivatives before this nonlinear repair is applied. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | |
| 19 | open Set Function Filter MeasureTheory |
| 20 | open scoped BigOperators ContDiff Topology |
| 21 | open NavierStokes.AngularMomentReset |
| 22 | |
| 23 | namespace NavierStokes.UniformAngularReset |
| 24 | |
| 25 | def lambdaRange : Set ℝ := Icc 0 (1 / 10) |
| 26 | |
| 27 | theorem linearMatrix_det_ne_zero_nonneg (lam : ℝ) (hlam : 0 ≤ lam) : |
| 28 | (linearMatrix lam).det ≠ 0 := by |
| 29 | rw [AngularMomentReset.linearMatrix_det] |
| 30 | apply mul_ne_zero |
| 31 | · exact mul_ne_zero (mul_ne_zero (by norm_num) (moment_pos _).ne') (moment_pos _).ne' |
| 32 | · apply ne_of_lt |
| 33 | apply sub_neg.mpr |
| 34 | apply Real.exp_lt_exp.mpr |
| 35 | unfold angularSlope pressureSlope |
| 36 | linarith |
| 37 | |
| 38 | theorem continuous_moment : Continuous moment := by |
| 39 | apply continuousOn_univ.mp |
| 40 | apply continuousOn_integral_of_compact_support |
| 41 | (k := Icc (-3 / 20 : ℝ) (3 / 20)) isCompact_Icc |
| 42 | · exact ((Real.continuous_exp.comp (continuous_fst.mul continuous_snd)).mul |
| 43 | (template_contDiff.continuous.comp continuous_snd)).continuousOn |
| 44 | · intro s y _ hy |
| 45 | have hz : template y = 0 := Classical.byContradiction (fun hn => hy (template_support hn)) |
| 46 | simp [hz] |
| 47 | |
| 48 | theorem continuous_quadraticMoment (j : Fin 2) : Continuous (fun lam => quadraticMoment lam j) := by |
| 49 | apply continuousOn_univ.mp |
| 50 | apply continuousOn_integral_of_compact_support |
| 51 | (k := Icc (2 * (j.val : ℝ) - 3 / 20) (2 * (j.val : ℝ) + 3 / 20)) isCompact_Icc |
| 52 | · exact ((Real.continuous_exp.comp ((continuous_const.sub (continuous_const.mul continuous_fst)).mul |
| 53 | continuous_snd)).mul (((bump_contDiff j).continuous.comp continuous_snd).pow 2)).continuousOn |
| 54 | · intro lam y _ hy |
| 55 | have hz : bump j y = 0 := Classical.byContradiction (fun hn => hy (bump_support j hn)) |
| 56 | simp [hz] |
| 57 | |
| 58 | def linearCLM (lam : ℝ) : Coeff →L[ℝ] Coeff := |
| 59 | LinearMap.toContinuousLinearMap |
| 60 | { toFun := (linearMatrix lam).mulVec |
| 61 | map_add' := Matrix.mulVec_add _ |
| 62 | map_smul' := fun r c => Matrix.mulVec_smul _ r c } |
| 63 | |
| 64 | def linearEquivNonneg (lam : ℝ) (hlam : 0 ≤ lam) : Coeff ≃L[ℝ] Coeff := |
| 65 | LinearEquiv.toContinuousLinearEquiv |
| 66 | { toFun := (linearMatrix lam).mulVec |
| 67 | invFun := (linearMatrix lam)⁻¹.mulVec |
| 68 | map_add' := Matrix.mulVec_add _ |
| 69 | map_smul' := fun r c => Matrix.mulVec_smul _ r c |
| 70 | left_inv := fun c => by |
| 71 | rw [Matrix.mulVec_mulVec, Matrix.nonsing_inv_mul _ |
| 72 | (isUnit_iff_ne_zero.mpr (linearMatrix_det_ne_zero_nonneg lam hlam)), Matrix.one_mulVec] |
| 73 | right_inv := fun c => by |
| 74 | rw [Matrix.mulVec_mulVec, Matrix.mul_nonsing_inv _ |
| 75 | (isUnit_iff_ne_zero.mpr (linearMatrix_det_ne_zero_nonneg lam hlam)), Matrix.one_mulVec] } |
| 76 | |
| 77 | theorem linearEquivNonneg_coe (lam : ℝ) (hlam : 0 ≤ lam) : |
| 78 | (linearEquivNonneg lam hlam).toContinuousLinearMap = linearCLM lam := rfl |
| 79 | |
| 80 | theorem continuous_linearCLM : Continuous linearCLM := by |
| 81 | let L : (Matrix (Fin 2) (Fin 2) ℝ) →ₗ[ℝ] (Coeff →L[ℝ] Coeff) := |
| 82 | (LinearMap.toContinuousLinearMap (𝕜 := ℝ) (E := Coeff) (F' := Coeff)).toLinearMap.comp |
| 83 | Matrix.toLin'.toLinearMap |
| 84 | have hM : Continuous linearMatrix := by |
| 85 | apply continuous_pi |
| 86 | intro i |
| 87 | apply continuous_pi |
| 88 | intro j |
| 89 | fin_cases i <;> fin_cases j <;> |
| 90 | dsimp [linearMatrix, angularSlope, pressureSlope] |
| 91 | · exact continuous_moment.comp (continuous_const.sub continuous_id) |
| 92 | · exact (Real.continuous_exp.comp (continuous_const.mul (continuous_const.sub continuous_id))).mul |
| 93 | (continuous_moment.comp (continuous_const.sub continuous_id)) |
| 94 | · exact continuous_const.mul |
| 95 | (continuous_moment.comp (continuous_const.sub (continuous_const.mul continuous_id))) |
| 96 | · exact continuous_const.mul |
| 97 | ((Real.continuous_exp.comp (continuous_const.mul (continuous_const.sub (continuous_const.mul continuous_id)))).mul |
| 98 | (continuous_moment.comp (continuous_const.sub (continuous_const.mul continuous_id)))) |
| 99 | exact L.continuous_of_finiteDimensional.comp hM |
| 100 | |
| 101 | def quadraticCoefficientsBilin (q : Coeff) : Coeff →ₗ[ℝ] Coeff →ₗ[ℝ] Coeff where |
| 102 | toFun c := |
| 103 | { toFun := fun d => ![0, q 0 * c 0 * d 0 + q 1 * c 1 * d 1] |
| 104 | map_add' := fun d e => by |
| 105 | ext i |
| 106 | fin_cases i <;> simp [Pi.add_apply] |
| 107 | ring |
| 108 | map_smul' := fun r d => by |
| 109 | ext i |
| 110 | fin_cases i <;> simp [Pi.smul_apply, smul_eq_mul] |
| 111 | ring } |
| 112 | map_add' c d := by |
| 113 | ext e i |
| 114 | fin_cases i <;> simp [Pi.add_apply] |
| 115 | ring |
| 116 | map_smul' r c := by |
| 117 | ext e i |
| 118 | fin_cases i <;> simp [Pi.smul_apply, smul_eq_mul] |
| 119 | ring |
| 120 | |
| 121 | def quadraticCoefficientMap : Coeff →ₗ[ℝ] (Coeff →L[ℝ] Coeff →L[ℝ] Coeff) where |
| 122 | toFun q := LinearMap.toContinuousLinearMap |
| 123 | ((LinearMap.toContinuousLinearMap (𝕜 := ℝ) (E := Coeff) (F' := Coeff)).toLinearMap.comp |
| 124 | (quadraticCoefficientsBilin q)) |
| 125 | map_add' q p := by |
| 126 | apply ContinuousLinearMap.ext |
| 127 | intro c |
| 128 | apply ContinuousLinearMap.ext |
| 129 | intro d |
| 130 | ext i |
| 131 | fin_cases i <;> simp [quadraticCoefficientsBilin, Pi.add_apply] |
| 132 | ring |
| 133 | map_smul' r q := by |
| 134 | apply ContinuousLinearMap.ext |
| 135 | intro c |
| 136 | apply ContinuousLinearMap.ext |
| 137 | intro d |
| 138 | ext i |
| 139 | fin_cases i <;> simp [quadraticCoefficientsBilin, Pi.smul_apply, smul_eq_mul] |
| 140 | ring |
| 141 | |
| 142 | theorem continuous_quadraticCLM : Continuous quadraticCLM := by |
| 143 | have hL : Continuous (quadraticCoefficientMap : Coeff → (Coeff →L[ℝ] Coeff →L[ℝ] Coeff)) := |
| 144 | LinearMap.continuous_of_finiteDimensional (𝕜 := ℝ) (E := Coeff) |
| 145 | (F' := Coeff →L[ℝ] Coeff →L[ℝ] Coeff) quadraticCoefficientMap |
| 146 | have heq : quadraticCLM = fun lam => quadraticCoefficientMap (fun j => quadraticMoment lam j) := rfl |
| 147 | rw [heq] |
| 148 | exact hL.comp (continuous_pi continuous_quadraticMoment) |
| 149 | |
| 150 | /-- Both operator bounds follow from the compact parameter interval and the |
| 151 | proved determinant, including its nonzero value at zero. -/ |
| 152 | theorem uniform_operator_bounds : |
| 153 | ∃ β K : ℝ, 0 < β ∧ 0 < K ∧ ∀ lam ∈ lambdaRange, |
| 154 | ‖(linearCLM lam).inverse‖ ≤ β ∧ ‖quadraticCLM lam‖ ≤ K := by |
| 155 | apply SmoothMomentRepair.compact_inverse_quadratic_bounds lambdaRange isCompact_Icc |
| 156 | linearCLM quadraticCLM continuous_linearCLM.continuousOn continuous_quadraticCLM.continuousOn |
| 157 | intro lam hlam |
| 158 | exact ⟨linearEquivNonneg lam hlam.1, linearEquivNonneg_coe lam hlam.1⟩ |
| 159 | |
| 160 | section SmoothUniformInverse |
| 161 | |
| 162 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 163 | |
| 164 | def quadraticMap (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) (c : E) : E := |
| 165 | B c + A c c |
| 166 | |
| 167 | def tangent (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) (c : E) : E →L[ℝ] E := |
| 168 | B.toContinuousLinearMap + A c + A.flip c |
| 169 | |
| 170 | theorem quadraticMap_contDiff (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) : |
| 171 | ContDiff ℝ ∞ (quadraticMap B A) := |
| 172 | B.contDiff.add (A.contDiff.clm_apply contDiff_id) |
| 173 | |
| 174 | theorem quadraticMap_hasFDerivAt (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) (c : E) : |
| 175 | HasFDerivAt (quadraticMap B A) (tangent B A c) c := by |
| 176 | convert! B.hasFDerivAt.add (A.hasFDerivAt.clm_apply (hasFDerivAt_id c)) using 1 |
| 177 | apply ContinuousLinearMap.ext |
| 178 | intro x |
| 179 | change B x + A c x + A x c = B x + (A c x + A x c) |
| 180 | abel |
| 181 | |
| 182 | theorem tangent_lower_bound (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) |
| 183 | (β K r : ℝ) (hβ : 0 ≤ β) (hK : 0 ≤ K) |
| 184 | (hinv : ∀ x, ‖B.symm x‖ ≤ β * ‖x‖) (hA : ‖A‖ ≤ K) |
| 185 | (hsmall : 4 * β * K * r ≤ 1) (c : E) (hc : ‖c‖ ≤ r) (x : E) : |
| 186 | ‖x‖ ≤ 2 * β * ‖tangent B A c x‖ := by |
| 187 | have hrem : ‖A c x + A x c‖ ≤ (2 * K * r) * ‖x‖ := by |
| 188 | calc |
| 189 | _ ≤ ‖A c x‖ + ‖A x c‖ := norm_add_le _ _ |
| 190 | _ ≤ (K * r) * ‖x‖ + (K * ‖x‖) * r := by |
| 191 | apply add_le_add |
| 192 | · exact (A.le_opNorm₂ c x).trans |
| 193 | (mul_le_mul_of_nonneg_right (mul_le_mul hA hc (norm_nonneg c) hK) (norm_nonneg x)) |
| 194 | · exact (A.le_opNorm₂ x c).trans |
| 195 | (mul_le_mul (mul_le_mul_of_nonneg_right hA (norm_nonneg x)) hc |
| 196 | (norm_nonneg c) (mul_nonneg hK (norm_nonneg x))) |
| 197 | _ = _ := by ring |
| 198 | have hid : B x = tangent B A c x - (A c x + A x c) := by |
| 199 | change B x = B x + A c x + A x c - (A c x + A x c) |
| 200 | abel |
| 201 | have hn : ‖x‖ ≤ β * ‖tangent B A c x‖ + (1 / 2 : ℝ) * ‖x‖ := by |
| 202 | calc |
| 203 | ‖x‖ = ‖B.symm (B x)‖ := by rw [B.symm_apply_apply] |
| 204 | _ ≤ β * ‖B x‖ := hinv _ |
| 205 | _ = β * ‖tangent B A c x - (A c x + A x c)‖ := by rw [hid] |
| 206 | _ ≤ β * (‖tangent B A c x‖ + ‖A c x + A x c‖) := |
| 207 | mul_le_mul_of_nonneg_left (norm_sub_le _ _) hβ |
| 208 | _ ≤ β * (‖tangent B A c x‖ + (2 * K * r) * ‖x‖) := |
| 209 | mul_le_mul_of_nonneg_left (add_le_add_right hrem _) hβ |
| 210 | _ ≤ β * ‖tangent B A c x‖ + (1 / 2 : ℝ) * ‖x‖ := by |
| 211 | nlinarith [mul_le_mul_of_nonneg_right hsmall (norm_nonneg x)] |
| 212 | linarith |
| 213 | |
| 214 | theorem tangent_invertible [FiniteDimensional ℝ E] |
| 215 | (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) |
| 216 | (β K r : ℝ) (hβ : 0 ≤ β) (hK : 0 ≤ K) |
| 217 | (hinv : ∀ x, ‖B.symm x‖ ≤ β * ‖x‖) (hA : ‖A‖ ≤ K) |
| 218 | (hsmall : 4 * β * K * r ≤ 1) (c : E) (hc : ‖c‖ ≤ r) : |
| 219 | (tangent B A c).IsInvertible := by |
| 220 | have hi : Injective (tangent B A c) := by |
| 221 | intro x y hxy |
| 222 | have hz : tangent B A c (x - y) = 0 := by rw [map_sub, hxy, sub_self] |
| 223 | have hnorm := tangent_lower_bound B A β K r hβ hK hinv hA hsmall c hc (x - y) |
| 224 | rw [hz, norm_zero, mul_zero] at hnorm |
| 225 | exact sub_eq_zero.mp (norm_eq_zero.mp (le_antisymm hnorm (norm_nonneg _))) |
| 226 | let e : E ≃ₗ[ℝ] E := LinearEquiv.ofBijective (tangent B A c).toLinearMap |
| 227 | ⟨hi, LinearMap.injective_iff_surjective.mp hi⟩ |
| 228 | exact ⟨e.toContinuousLinearEquiv, rfl⟩ |
| 229 | |
| 230 | theorem quadratic_solution_distance (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) |
| 231 | (β K r : ℝ) (hβ : 0 ≤ β) (hK : 0 ≤ K) |
| 232 | (hinv : ∀ x, ‖B.symm x‖ ≤ β * ‖x‖) (hA : ‖A‖ ≤ K) |
| 233 | (hsmall : 4 * β * K * r ≤ 1) (c e d f : E) |
| 234 | (hc : ‖c‖ ≤ r) (he : ‖e‖ ≤ r) |
| 235 | (hceq : quadraticMap B A c = d) (heeq : quadraticMap B A e = f) : |
| 236 | ‖c - e‖ ≤ 2 * β * ‖d - f‖ := by |
| 237 | have hr : 0 ≤ r := (norm_nonneg c).trans hc |
| 238 | have hrem : ‖A c c - A e e‖ ≤ (2 * K * r) * ‖c - e‖ := by |
| 239 | apply (SmoothMomentRepair.quadratic_sub_le A c e).trans |
| 240 | apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) |
| 241 | calc |
| 242 | ‖A‖ * (‖c‖ + ‖e‖) ≤ K * (2 * r) := |
| 243 | mul_le_mul hA (by linarith) (by positivity) hK |
| 244 | _ = _ := by ring |
| 245 | have hid : B (c - e) = (d - f) - (A c c - A e e) := by |
| 246 | rw [map_sub, ← hceq, ← heeq] |
| 247 | unfold quadraticMap |
| 248 | abel |
| 249 | have hn : ‖c - e‖ ≤ β * ‖d - f‖ + (1 / 2 : ℝ) * ‖c - e‖ := by |
| 250 | calc |
| 251 | ‖c - e‖ = ‖B.symm (B (c - e))‖ := by rw [B.symm_apply_apply] |
| 252 | _ ≤ β * ‖B (c - e)‖ := hinv _ |
| 253 | _ = β * ‖(d - f) - (A c c - A e e)‖ := by rw [hid] |
| 254 | _ ≤ β * (‖d - f‖ + ‖A c c - A e e‖) := |
| 255 | mul_le_mul_of_nonneg_left (norm_sub_le _ _) hβ |
| 256 | _ ≤ β * (‖d - f‖ + (2 * K * r) * ‖c - e‖) := |
| 257 | mul_le_mul_of_nonneg_left (add_le_add_right hrem _) hβ |
| 258 | _ ≤ β * ‖d - f‖ + (1 / 2 : ℝ) * ‖c - e‖ := by |
| 259 | nlinarith [mul_le_mul_of_nonneg_right hsmall (norm_nonneg (c - e))] |
| 260 | linarith |
| 261 | |
| 262 | /-- Contraction uniqueness patches the local smooth inverses throughout one |
| 263 | uniform debt ball. The resulting smoothness radius is quantitative. -/ |
| 264 | theorem exists_smooth_solver_on_ball [FiniteDimensional ℝ E] [CompleteSpace E] |
| 265 | (B : E ≃L[ℝ] E) (A : E →L[ℝ] E →L[ℝ] E) |
| 266 | (β K r : ℝ) (hβ : 0 < β) (hK : 0 ≤ K) (hr : 0 < r) |
| 267 | (hinv : ∀ x, ‖B.symm x‖ ≤ β * ‖x‖) (hA : ‖A‖ ≤ K) |
| 268 | (hsmall : 4 * β * K * r ≤ 1) : |
| 269 | ∃ g : E → E, ContDiffOn ℝ ∞ g (Metric.ball 0 (r / (4 * β))) ∧ |
| 270 | (∀ d ∈ Metric.ball 0 (r / (4 * β)), quadraticMap B A (g d) = d ∧ ‖g d‖ ≤ 2 * β * ‖d‖) ∧ |
| 271 | ∀ d ∈ Metric.ball 0 (r / (4 * β)), ∀ e ∈ Metric.ball 0 (r / (4 * β)), |
| 272 | ‖g d - g e‖ ≤ 2 * β * ‖d - e‖ := by |
| 273 | classical |
| 274 | let ε : ℝ := r / (4 * β) |
| 275 | have hε : 0 < ε := div_pos hr (by positivity) |
| 276 | have hεeq : 2 * β * ε = r / 2 := by dsimp [ε]; field_simp ; ring |
| 277 | have hex : ∀ d : Metric.ball (0 : E) ε, ∃! c : E, |
| 278 | ‖c‖ ≤ r ∧ quadraticMap B A c = d := by |
| 279 | intro d |
| 280 | apply MomentRepair.exists_unique_small_correction B (fun c => A c c) d β K r hβ.le hK hr.le hinv |
| 281 | · intro c _ |
| 282 | exact (SmoothMomentRepair.quadratic_norm_le A c).trans |
| 283 | (mul_le_mul_of_nonneg_right hA (sq_nonneg _)) |
| 284 | · intro c _ e _ |
| 285 | exact (SmoothMomentRepair.quadratic_sub_le A c e).trans |
| 286 | (mul_le_mul_of_nonneg_right |
| 287 | (mul_le_mul_of_nonneg_right hA (add_nonneg (norm_nonneg _) (norm_nonneg _))) |
| 288 | (norm_nonneg _)) |
| 289 | · exact hsmall |
| 290 | · have hd : ‖(d : E)‖ < ε := by simpa only [Metric.mem_ball, dist_zero_right] using d.property |
| 291 | have hb := mul_lt_mul_of_pos_left hd (show 0 < 2 * β by positivity) |
| 292 | linarith |
| 293 | choose f hf using hex |
| 294 | let g : E → E := fun d => if hd : d ∈ Metric.ball (0 : E) ε then f ⟨d, hd⟩ else 0 |
| 295 | have hspec : ∀ d (hd : d ∈ Metric.ball (0 : E) ε), |
| 296 | (‖g d‖ ≤ r ∧ quadraticMap B A (g d) = d) ∧ |
| 297 | ∀ c, (‖c‖ ≤ r ∧ quadraticMap B A c = d) → c = g d := by |
| 298 | intro d hd |
| 299 | simpa only [g, dite_eq_left hd] using hf ⟨d, hd⟩ |
| 300 | have hbound : ∀ d ∈ Metric.ball (0 : E) ε, ‖g d‖ ≤ 2 * β * ‖d‖ := by |
| 301 | intro d hd |
| 302 | have hz : quadraticMap B A 0 = 0 := by simp [quadraticMap] |
| 303 | simpa only [sub_zero] using quadratic_solution_distance B A β K r hβ.le hK hinv hA hsmall |
| 304 | (g d) 0 d 0 (hspec d hd).1.1 (by simpa using hr.le) (hspec d hd).1.2 hz |
| 305 | have hinterior : ∀ d ∈ Metric.ball (0 : E) ε, ‖g d‖ < r := by |
| 306 | intro d hd |
| 307 | have hd' : ‖d‖ < ε := by simpa only [Metric.mem_ball, dist_zero_right] using hd |
| 308 | have ht := mul_lt_mul_of_pos_left hd' (show 0 < 2 * β by positivity) |
| 309 | linarith [hbound d hd] |
| 310 | refine ⟨g, ?_, fun d hd => ⟨(hspec d hd).1.2, hbound d hd⟩, ?_⟩ |
| 311 | · intro d hd |
| 312 | obtain ⟨D, hD⟩ := tangent_invertible B A β K r hβ.le hK hinv hA hsmall |
| 313 | (g d) (hspec d hd).1.1 |
| 314 | have hderiv : HasFDerivAt (quadraticMap B A) D.toContinuousLinearMap (g d) := by |
| 315 | rw [hD] |
| 316 | exact quadraticMap_hasFDerivAt B A (g d) |
| 317 | have hq : ContDiffAt ℝ ∞ (quadraticMap B A) (g d) := |
| 318 | (quadraticMap_contDiff B A).contDiffAt |
| 319 | let inv : E → E := hq.localInverse hderiv (by simp) |
| 320 | have hqd : quadraticMap B A (g d) = d := (hspec d hd).1.2 |
| 321 | have hinvsm : ContDiffAt ℝ ∞ inv d := by |
| 322 | simpa only [hqd] using hq.to_localInverse hderiv (by simp) |
| 323 | have hinv0 : inv d = g d := by |
| 324 | simpa only [hqd] using hq.localInverse_apply_image hderiv (by simp) |
| 325 | have hinvr : ∀ᶠ x in 𝓝 d, ‖inv x‖ < r := |
| 326 | hinvsm.continuousAt.norm.eventually |
| 327 | (eventually_lt_nhds (by simpa only [hinv0] using hinterior d hd)) |
| 328 | have hinveq : ∀ᶠ x in 𝓝 d, quadraticMap B A (inv x) = x := by |
| 329 | have h := HasStrictFDerivAt.eventually_right_inverse (f' := D) |
| 330 | (hq.hasStrictFDerivAt' hderiv (by simp)) |
| 331 | change ∀ᶠ x in 𝓝 (quadraticMap B A (g d)), quadraticMap B A (inv x) = x at h |
| 332 | simpa only [hqd] using h |
| 333 | have hgeq : g =ᶠ[𝓝 d] inv := by |
| 334 | filter_upwards [Metric.isOpen_ball.mem_nhds hd, hinvr, hinveq] with x hx hxr hxe |
| 335 | exact ((hspec x hx).2 (inv x) ⟨hxr.le, hxe⟩).symm |
| 336 | exact (hinvsm.congr_of_eventuallyEq hgeq).contDiffWithinAt |
| 337 | · intro d hd e he |
| 338 | exact quadratic_solution_distance B A β K r hβ.le hK hinv hA hsmall |
| 339 | (g d) (g e) d e (hspec d hd).1.1 (hspec e he).1.1 (hspec d hd).1.2 (hspec e he).1.2 |
| 340 | |
| 341 | end SmoothUniformInverse |
| 342 | |
| 343 | theorem actual_moment_map (lam : ℝ) (c : Coeff) : |
| 344 | linearCLM lam c + quadraticCLM lam c c = |
| 345 | ![∫ y, Real.exp (angularSlope lam * y) * relative c y, |
| 346 | ∫ y, Real.exp (pressureSlope lam * y) * ((1 + relative c y) ^ 2 - 1)] := by |
| 347 | rw [quadraticCLM_apply, relative_moment, pressure_change_moment] |
| 348 | ext i |
| 349 | fin_cases i <;> simp [linearCLM, linearMatrix, dotProduct, Fin.sum_univ_two] |
| 350 | ring |
| 351 | |
| 352 | /-- A single radius and a single bound work for the actual two-bump system for |
| 353 | every `lam ∈ [0,1/10]`. Smoothness and the derivative bound concern the debt |
| 354 | variable; no smoothness of an arbitrary choice in `lam` is asserted. -/ |
| 355 | theorem uniform_reset_branch : |
| 356 | ∃ ε L : ℝ, 0 < ε ∧ 0 < L ∧ ∀ lam ∈ lambdaRange, |
| 357 | ∃ c : ℝ → Coeff, ContDiffOn ℝ ∞ c (Ioo (-ε) ε) ∧ c 0 = 0 ∧ |
| 358 | ∀ δ ∈ Ioo (-ε) ε, |
| 359 | (∫ y, Real.exp (angularSlope lam * y) * relative (c δ) y) = δ ∧ |
| 360 | (∫ y, Real.exp (pressureSlope lam * y) * ((1 + relative (c δ) y) ^ 2 - 1)) = 0 ∧ |
| 361 | ‖c δ‖ ≤ L * |δ| ∧ ‖deriv c δ‖ ≤ L ∧ ∀ y, |
| 362 | |relative (c δ) y| ≤ L * |δ| ∧ |deriv (relative (c δ)) y| ≤ L * |δ| := by |
| 363 | obtain ⟨β, K, hβ, hK, hcoeff⟩ := uniform_operator_bounds |
| 364 | obtain ⟨D, hD, hjet⟩ := relative_first_jet_bound |
| 365 | let r : ℝ := 1 / (4 * β * K) |
| 366 | let ε : ℝ := r / (4 * β) |
| 367 | let L : ℝ := (1 + D) * (2 * β) |
| 368 | have hr : 0 < r := by dsimp [r]; positivity |
| 369 | have hε : 0 < ε := div_pos hr (by positivity) |
| 370 | have hL : 0 < L := mul_pos (by linarith) (by positivity) |
| 371 | have hLbase : 2 * β ≤ L := by dsimp [L]; nlinarith |
| 372 | have hLD : D * (2 * β) ≤ L := by dsimp [L]; nlinarith |
| 373 | have hsmall : 4 * β * K * r ≤ 1 := by dsimp [r]; field_simp ; rfl |
| 374 | refine ⟨ε, L, hε, hL, ?_⟩ |
| 375 | intro lam hlam |
| 376 | let B := linearEquivNonneg lam hlam.1 |
| 377 | have hBinv : ‖B.symm.toContinuousLinearMap‖ ≤ β := by |
| 378 | have h := (hcoeff lam hlam).1 |
| 379 | rw [← linearEquivNonneg_coe lam hlam.1, ContinuousLinearMap.inverse_equiv] at h |
| 380 | exact h |
| 381 | have hinv : ∀ x, ‖B.symm x‖ ≤ β * ‖x‖ := fun x => |
| 382 | (B.symm.toContinuousLinearMap.le_opNorm x).trans |
| 383 | (mul_le_mul_of_nonneg_right hBinv (norm_nonneg x)) |
| 384 | obtain ⟨g, hg, hgeq, hglip⟩ := exists_smooth_solver_on_ball B (quadraticCLM lam) |
| 385 | β K r hβ hK.le hr hinv (hcoeff lam hlam).2 hsmall |
| 386 | let c : ℝ → Coeff := fun δ => g (debt δ) |
| 387 | have hd : ∀ δ ∈ Ioo (-ε) ε, debt δ ∈ Metric.ball (0 : Coeff) ε := by |
| 388 | intro δ hδ |
| 389 | simpa only [Metric.mem_ball, dist_zero_right] using (debt_norm_le δ).trans_lt (abs_lt.mpr hδ) |
| 390 | have hc : ContDiffOn ℝ ∞ c (Ioo (-ε) ε) := |
| 391 | hg.comp debt_contDiff.contDiffOn hd |
| 392 | have hc_norm : ∀ δ ∈ Ioo (-ε) ε, ‖c δ‖ ≤ (2 * β) * |δ| := by |
| 393 | intro δ hδ |
| 394 | exact ((hgeq (debt δ) (hd δ hδ)).2).trans |
| 395 | (mul_le_mul_of_nonneg_left (debt_norm_le δ) (by positivity)) |
| 396 | have hc_zero : c 0 = 0 := by |
| 397 | have h := hc_norm 0 (by constructor <;> linarith) |
| 398 | simp only [abs_zero, mul_zero, norm_le_zero_iff] at h |
| 399 | exact h |
| 400 | have hclip : ∀ δ ∈ Ioo (-ε) ε, ∀ η ∈ Ioo (-ε) ε, |
| 401 | ‖c δ - c η‖ ≤ (2 * β) * |δ - η| := by |
| 402 | intro δ hδ η hη |
| 403 | have hs : debt δ - debt η = debt (δ - η) := by ext i; fin_cases i <;> simp [debt] |
| 404 | apply (hglip (debt δ) (hd δ hδ) (debt η) (hd η hη)).trans |
| 405 | rw [hs] |
| 406 | exact mul_le_mul_of_nonneg_left (debt_norm_le _) (by positivity) |
| 407 | refine ⟨c, hc, hc_zero, ?_⟩ |
| 408 | intro δ hδ |
| 409 | have heq := (hgeq (debt δ) (hd δ hδ)).1 |
| 410 | change linearCLM lam (c δ) + quadraticCLM lam (c δ) (c δ) = debt δ at heq |
| 411 | rw [actual_moment_map] at heq |
| 412 | refine ⟨congrFun heq 0, congrFun heq 1, |
| 413 | (hc_norm δ hδ).trans (mul_le_mul_of_nonneg_right hLbase (abs_nonneg δ)), ?_, ?_⟩ |
| 414 | · apply le_trans _ hLbase |
| 415 | apply norm_deriv_le_of_lip' (show 0 ≤ 2 * β by positivity) |
| 416 | filter_upwards [isOpen_Ioo.mem_nhds hδ] with η hη |
| 417 | simpa only [Real.norm_eq_abs] using hclip η hη δ hδ |
| 418 | · intro y |
| 419 | have hb : D * ‖c δ‖ ≤ L * |δ| := |
| 420 | (mul_le_mul_of_nonneg_left (hc_norm δ hδ) hD.le).trans |
| 421 | (by simpa only [mul_assoc] using mul_le_mul_of_nonneg_right hLD (abs_nonneg δ)) |
| 422 | exact ⟨(hjet (c δ) y).1.trans hb, (hjet (c δ) y).2.trans hb⟩ |
| 423 | |
| 424 | section ActualHistory |
| 425 | |
| 426 | open NavierStokes.OutgoingSchedule NavierStokes.OutgoingTail |
| 427 | |
| 428 | /-- The factor `sqrt 2` cancels in every angular-history ratio. -/ |
| 429 | def baseWeight (d : TailData) (y : ℝ) : ℝ := |
| 430 | Real.exp (3 * y / 2) * radialAmplitude d.core.P d.core.dropLength d.core.lam y |
| 431 | |
| 432 | def baseHistory (d : TailData) (y : ℝ) : ℝ := |
| 433 | (5 / 8) * d.core.P + OutgoingSchedule.primitive (baseWeight d) y |
| 434 | |
| 435 | theorem baseWeight_contDiff (d : TailData) : ContDiff ℝ ∞ (baseWeight d) := |
| 436 | ((contDiff_const.mul contDiff_id).div_const 2).exp.mul (radialAmplitude_contDiff _ _ _) |
| 437 | |
| 438 | theorem baseWeight_pos (d : TailData) (y : ℝ) : 0 < baseWeight d y := |
| 439 | mul_pos (Real.exp_pos _) (mul_pos d.core.P_pos (Real.exp_pos _)) |
| 440 | |
| 441 | theorem baseWeight_zero (d : TailData) : baseWeight d 0 = d.core.P := by |
| 442 | simp [baseWeight, radialAmplitude, logAmplitude, OutgoingSchedule.primitive] |
| 443 | |
| 444 | theorem core_slope_lower (d : TailData) (y : ℝ) : |
| 445 | -d.core.lam ≤ slope d.core.dropLength d.core.lam y := by |
| 446 | unfold OutgoingSchedule.slope |
| 447 | have h0 := mul_nonneg (show (0 : ℝ) ≤ 3 / 5 by norm_num) |
| 448 | (sub_nonneg.mpr (sigma_le_one y)) |
| 449 | have h1 := mul_nonneg d.core.lam_pos.le |
| 450 | (sub_nonneg.mpr (sigma_le_one (y - (d.core.dropLength + 1)))) |
| 451 | linarith |
| 452 | |
| 453 | theorem baseWeight_hasDerivAt (d : TailData) (y : ℝ) : |
| 454 | HasDerivAt (baseWeight d) |
| 455 | (baseWeight d y * (1 + slope d.core.dropLength d.core.lam y)) y := by |
| 456 | have he := (((hasDerivAt_id y).const_mul (3 : ℝ)).div_const 2).exp |
| 457 | convert! he.mul (radialAmplitude_hasDerivAt d.core.P d.core.dropLength d.core.lam y) using 1 |
| 458 | dsimp [baseWeight] |
| 459 | ring |
| 460 | |
| 461 | theorem baseHistory_hasDerivAt (d : TailData) (y : ℝ) : |
| 462 | HasDerivAt (baseHistory d) (baseWeight d y) y := |
| 463 | (OutgoingSchedule.primitive_hasDerivAt (baseWeight_contDiff d).continuous y).const_add _ |
| 464 | |
| 465 | /-- The actual unflattened angular-history ratio is uniformly bounded; |
| 466 | the ideal incoming prefix is included explicitly. -/ |
| 467 | theorem baseHistory_le (d : TailData) {y : ℝ} (hy : 0 ≤ y) : |
| 468 | baseHistory d y ≤ baseWeight d y / (1 - d.core.lam) := by |
| 469 | have hk : 0 < 1 - d.core.lam := by linarith [d.core.lam_lt] |
| 470 | let f : ℝ → ℝ := fun y => baseWeight d y / (1 - d.core.lam) - baseHistory d y |
| 471 | have hf : ∀ y, HasDerivAt f |
| 472 | (baseWeight d y * (1 + slope d.core.dropLength d.core.lam y) / (1 - d.core.lam) - |
| 473 | baseWeight d y) y := fun y => |
| 474 | ((baseWeight_hasDerivAt d y).div_const _).sub (baseHistory_hasDerivAt d y) |
| 475 | have hmono : Monotone f := by |
| 476 | apply monotone_of_deriv_nonneg (fun y => (hf y).differentiableAt) |
| 477 | intro y |
| 478 | rw [(hf y).deriv] |
| 479 | apply sub_nonneg.mpr |
| 480 | apply (le_div_iff₀ hk).mpr |
| 481 | exact mul_le_mul_of_nonneg_left (by linarith [core_slope_lower d y]) (baseWeight_pos d y).le |
| 482 | have hzero : 0 ≤ f 0 := by |
| 483 | change 0 ≤ baseWeight d 0 / (1 - d.core.lam) - baseHistory d 0 |
| 484 | rw [baseWeight_zero] |
| 485 | simp only [baseHistory, OutgoingSchedule.primitive, intervalIntegral.integral_same, add_zero] |
| 486 | apply sub_nonneg.mpr |
| 487 | apply (le_div_iff₀ hk).mpr |
| 488 | nlinarith [d.core.P_pos, d.core.lam_pos] |
| 489 | have h := hmono hy |
| 490 | dsimp [f] at h hzero |
| 491 | linarith |
| 492 | |
| 493 | def flattenShape (d : TailData) (y eta : ℝ) : ℝ := |
| 494 | Real.exp ((sigma ((y - d.core.endpoint) / flattenLength) - 1) * logShape eta - |
| 495 | sigma ((y - d.core.endpoint) / flattenLength) * Real.log 2) |
| 496 | |
| 497 | theorem shape_eq_exp (eta : ℝ) : shape eta = Real.exp (-logShape eta) := by |
| 498 | rw [Real.exp_neg, logShape, Real.exp_log (by positivity)] |
| 499 | rfl |
| 500 | |
| 501 | theorem flattened_eq (d : TailData) (y eta : ℝ) : |
| 502 | flattened d (y, eta) = |
| 503 | radialAmplitude d.core.P d.core.dropLength d.core.lam y * flattenShape d y eta := by |
| 504 | unfold flattened angular flattenFactor flattenShape |
| 505 | rw [shape_eq_exp] |
| 506 | rw [mul_assoc, ← Real.exp_add] |
| 507 | congr 2 |
| 508 | ring |
| 509 | |
| 510 | theorem flattenShape_le_one (d : TailData) (y eta : ℝ) : flattenShape d y eta ≤ 1 := by |
| 511 | apply Real.exp_le_one_iff.mpr |
| 512 | have hl : 0 ≤ logShape eta := Real.log_nonneg (by nlinarith [sq_nonneg eta]) |
| 513 | have ha := mul_nonpos_of_nonpos_of_nonneg |
| 514 | (sub_nonpos.mpr (sigma_le_one ((y - d.core.endpoint) / flattenLength))) hl |
| 515 | have hb := mul_nonneg (sigma_nonneg ((y - d.core.endpoint) / flattenLength)) |
| 516 | (Real.log_nonneg (by norm_num : (1 : ℝ) ≤ 2)) |
| 517 | linarith |
| 518 | |
| 519 | def flatWeight (d : TailData) (eta y : ℝ) : ℝ := |
| 520 | Real.exp (3 * y / 2) * flattened d (y, eta) |
| 521 | |
| 522 | def flatHistory (d : TailData) (eta y : ℝ) : ℝ := |
| 523 | (5 / 8) * d.core.P * shape eta + OutgoingSchedule.primitive (flatWeight d eta) y |
| 524 | |
| 525 | theorem flatWeight_contDiff (d : TailData) (eta : ℝ) : ContDiff ℝ ∞ (flatWeight d eta) := |
| 526 | ((contDiff_const.mul contDiff_id).div_const 2).exp.mul |
| 527 | ((flattened_contDiff d).comp (contDiff_id.prodMk contDiff_const)) |
| 528 | |
| 529 | theorem flatWeight_pos (d : TailData) (eta y : ℝ) : 0 < flatWeight d eta y := |
| 530 | mul_pos (Real.exp_pos _) (flattened_pos d _) |
| 531 | |
| 532 | theorem flatWeight_le_base (d : TailData) (eta y : ℝ) : flatWeight d eta y ≤ baseWeight d y := by |
| 533 | have hf : flatWeight d eta y = baseWeight d y * flattenShape d y eta := by |
| 534 | unfold flatWeight baseWeight |
| 535 | rw [flattened_eq] |
| 536 | ring |
| 537 | rw [hf] |
| 538 | exact mul_le_of_le_one_right (baseWeight_pos d y).le (flattenShape_le_one d y eta) |
| 539 | |
| 540 | theorem flatHistory_bounds (d : TailData) (eta : ℝ) {y : ℝ} (hy : 0 ≤ y) : |
| 541 | 0 ≤ flatHistory d eta y ∧ flatHistory d eta y ≤ baseHistory d y := by |
| 542 | constructor |
| 543 | · apply add_nonneg |
| 544 | · exact mul_nonneg (mul_nonneg (by norm_num) d.core.P_pos.le) (shape_pos eta).le |
| 545 | · exact intervalIntegral.integral_nonneg hy (fun t _ => (flatWeight_pos d eta t).le) |
| 546 | · apply add_le_add |
| 547 | · have hs : shape eta ≤ 1 := by |
| 548 | unfold shape |
| 549 | apply inv_le_one_of_one_le₀ |
| 550 | nlinarith [sq_nonneg eta] |
| 551 | exact mul_le_of_le_one_right (mul_nonneg (by norm_num) d.core.P_pos.le) hs |
| 552 | · exact intervalIntegral.integral_mono hy ((flatWeight_contDiff d eta).continuous.intervalIntegrable 0 y) |
| 553 | ((baseWeight_contDiff d).continuous.intervalIntegrable 0 y) (flatWeight_le_base d eta) |
| 554 | |
| 555 | theorem compact_integral_contDiff (F : ℝ → ℝ → ℝ) (a b : ℝ) (hab : a ≤ b) |
| 556 | (hF : ContDiff ℝ ∞ (Function.uncurry F)) : |
| 557 | ContDiff ℝ ∞ (fun p => ∫ t in a..b, F p t) := by |
| 558 | apply contDiffOn_univ.mp |
| 559 | apply SmoothParameterIntegral.contDiffOn_intervalIntegral_of_continuous_jet isOpen_univ hab |
| 560 | · intro t _ |
| 561 | exact (hF.comp (contDiff_id.prodMk contDiff_const)).contDiffOn |
| 562 | · intro k |
| 563 | rintro ⟨p, t⟩ _ |
| 564 | have hf : ContDiffAt ℝ ∞ (Function.uncurry (fun t p => F p t)) (t, p) := |
| 565 | (hF.comp (contDiff_snd.prodMk contDiff_fst)).contDiffAt |
| 566 | have hj := ParametricFlatFactor.contDiffAt_partial_iteratedFDeriv (fun t p => F p t) k t p hf |
| 567 | exact (hj.comp (p, t) (contDiffAt_snd.prodMk contDiffAt_fst)).continuousAt.continuousWithinAt |
| 568 | |
| 569 | theorem flatWeight_joint_contDiff (d : TailData) : |
| 570 | ContDiff ℝ ∞ (Function.uncurry (flatWeight d)) := |
| 571 | ((contDiff_const.mul contDiff_snd).div_const 2).exp.mul |
| 572 | ((flattened_contDiff d).comp (contDiff_snd.prodMk contDiff_fst)) |
| 573 | |
| 574 | theorem flatHistory_contDiff (d : TailData) {y : ℝ} (hy : 0 ≤ y) : |
| 575 | ContDiff ℝ ∞ (fun eta => flatHistory d eta y) := |
| 576 | (contDiff_const.mul shape_contDiff).add |
| 577 | (compact_integral_contDiff (flatWeight d) 0 y hy (flatWeight_joint_contDiff d)) |
| 578 | |
| 579 | def etaRate (d : TailData) (eta y : ℝ) : ℝ := |
| 580 | (sigma ((y - d.core.endpoint) / flattenLength) - 1) * (2 * eta / (1 + eta ^ 2)) |
| 581 | |
| 582 | theorem logShape_hasDerivAt (eta : ℝ) : |
| 583 | HasDerivAt logShape (2 * eta / (1 + eta ^ 2)) eta := by |
| 584 | convert! (((hasDerivAt_id eta).pow 2).const_add 1).log (by positivity : 1 + eta ^ 2 ≠ 0) using 1 |
| 585 | simp [] |
| 586 | |
| 587 | theorem logShape_deriv_bound (eta : ℝ) : |2 * eta / (1 + eta ^ 2)| ≤ 1 := by |
| 588 | rw [abs_div, abs_mul, abs_of_pos (by positivity : 0 < (2 : ℝ)), abs_of_pos (by positivity : 0 < 1 + eta ^ 2)] |
| 589 | apply (div_le_one (by positivity : 0 < 1 + eta ^ 2)).mpr |
| 590 | nlinarith [sq_nonneg (|eta| - 1), sq_abs eta] |
| 591 | |
| 592 | theorem etaRate_bound (d : TailData) (eta y : ℝ) : |etaRate d eta y| ≤ 1 := by |
| 593 | unfold etaRate |
| 594 | rw [abs_mul] |
| 595 | have hs : |sigma ((y - d.core.endpoint) / flattenLength) - 1| ≤ 1 := by |
| 596 | rw [abs_of_nonpos (sub_nonpos.mpr (sigma_le_one _))] |
| 597 | linarith [sigma_nonneg ((y - d.core.endpoint) / flattenLength)] |
| 598 | exact (mul_le_mul hs (logShape_deriv_bound eta) (abs_nonneg _) zero_le_one).trans_eq (one_mul _) |
| 599 | |
| 600 | theorem flatWeight_eq (d : TailData) (eta y : ℝ) : |
| 601 | flatWeight d eta y = baseWeight d y * flattenShape d y eta := by |
| 602 | unfold flatWeight baseWeight |
| 603 | rw [flattened_eq] |
| 604 | ring |
| 605 | |
| 606 | theorem flatWeight_eta_hasDerivAt (d : TailData) (eta y : ℝ) : |
| 607 | HasDerivAt (fun eta => flatWeight d eta y) (flatWeight d eta y * etaRate d eta y) eta := by |
| 608 | have h := (((logShape_hasDerivAt eta).const_mul |
| 609 | (sigma ((y - d.core.endpoint) / flattenLength) - 1)).sub_const |
| 610 | (sigma ((y - d.core.endpoint) / flattenLength) * Real.log 2)).exp |
| 611 | convert! h.const_mul (baseWeight d y) using 1 |
| 612 | · funext p |
| 613 | exact flatWeight_eq d p y |
| 614 | · rw [flatWeight_eq] |
| 615 | dsimp [flattenShape, etaRate] |
| 616 | ring |
| 617 | |
| 618 | theorem flatWeight_eta_bound (d : TailData) (eta y : ℝ) : |
| 619 | |flatWeight d eta y * etaRate d eta y| ≤ baseWeight d y := by |
| 620 | rw [abs_mul, abs_of_pos (flatWeight_pos d eta y)] |
| 621 | exact (mul_le_of_le_one_right (flatWeight_pos d eta y).le (etaRate_bound d eta y)).trans |
| 622 | (flatWeight_le_base d eta y) |
| 623 | |
| 624 | theorem etaRate_continuous (d : TailData) (eta : ℝ) : Continuous (etaRate d eta) := |
| 625 | (sigma_contDiff.continuous.comp ((continuous_id.sub continuous_const).div_const _) |
| 626 | |>.sub continuous_const).mul continuous_const |
| 627 | |
| 628 | theorem shape_hasDerivAt (eta : ℝ) : |
| 629 | HasDerivAt shape (shape eta * (-(2 * eta / (1 + eta ^ 2)))) eta := by |
| 630 | have h := (logShape_hasDerivAt eta).fun_neg.exp |
| 631 | convert! h using 1 |
| 632 | · funext p |
| 633 | exact shape_eq_exp p |
| 634 | · rw [← shape_eq_exp] |
| 635 | |
| 636 | theorem shape_le_one (eta : ℝ) : shape eta ≤ 1 := by |
| 637 | unfold shape |
| 638 | apply inv_le_one_of_one_le₀ |
| 639 | nlinarith [sq_nonneg eta] |
| 640 | |
| 641 | theorem flatHistory_hasDerivAt (d : TailData) (eta y : ℝ) : |
| 642 | HasDerivAt (fun eta => flatHistory d eta y) |
| 643 | ((5 / 8) * d.core.P * (shape eta * (-(2 * eta / (1 + eta ^ 2)))) + |
| 644 | ∫ t in (0 : ℝ)..y, flatWeight d eta t * etaRate d eta t) eta := by |
| 645 | have hint := intervalIntegral.hasDerivAt_integral_of_dominated_loc_of_deriv_le |
| 646 | (μ := volume) (F := flatWeight d) (F' := fun eta t => flatWeight d eta t * etaRate d eta t) |
| 647 | (bound := baseWeight d) (s := Metric.ball eta 1) (x₀ := eta) (a := 0) (b := y) |
| 648 | (Metric.ball_mem_nhds eta (by norm_num)) |
| 649 | (Filter.Eventually.of_forall fun p => (flatWeight_contDiff d p).continuous.aestronglyMeasurable) |
| 650 | ((flatWeight_contDiff d eta).continuous.intervalIntegrable 0 y) |
| 651 | (((flatWeight_contDiff d eta).continuous.mul (etaRate_continuous d eta)).aestronglyMeasurable) |
| 652 | (Filter.Eventually.of_forall fun t _ p _ => by |
| 653 | simpa only [Real.norm_eq_abs] using flatWeight_eta_bound d p t) |
| 654 | ((baseWeight_contDiff d).continuous.intervalIntegrable 0 y) |
| 655 | (Filter.Eventually.of_forall fun t _ p _ => flatWeight_eta_hasDerivAt d p t) |
| 656 | exact ((shape_hasDerivAt eta).const_mul ((5 / 8) * d.core.P)).fun_add hint.2 |
| 657 | |
| 658 | theorem flatHistory_deriv_bound (d : TailData) (eta : ℝ) {y : ℝ} (hy : 0 ≤ y) : |
| 659 | |deriv (fun eta => flatHistory d eta y) eta| ≤ baseHistory d y := by |
| 660 | rw [(flatHistory_hasDerivAt d eta y).deriv] |
| 661 | have hpre : |(5 / 8 : ℝ) * d.core.P * (shape eta * (-(2 * eta / (1 + eta ^ 2))))| ≤ |
| 662 | (5 / 8 : ℝ) * d.core.P := by |
| 663 | rw [abs_mul, abs_of_nonneg (mul_nonneg (by norm_num) d.core.P_pos.le), abs_mul, |
| 664 | abs_of_pos (shape_pos eta), abs_neg] |
| 665 | have hprod := mul_le_mul (shape_le_one eta) (logShape_deriv_bound eta) (abs_nonneg _) zero_le_one |
| 666 | simpa using mul_le_mul_of_nonneg_left hprod (mul_nonneg (by norm_num) d.core.P_pos.le) |
| 667 | have hint : |∫ t in (0 : ℝ)..y, flatWeight d eta t * etaRate d eta t| ≤ |
| 668 | ∫ t in (0 : ℝ)..y, baseWeight d t := by |
| 669 | apply (intervalIntegral.abs_integral_le_integral_abs hy).trans |
| 670 | apply intervalIntegral.integral_mono hy |
| 671 | ((((flatWeight_contDiff d eta).continuous.mul (etaRate_continuous d eta)).abs).intervalIntegrable 0 y) |
| 672 | ((baseWeight_contDiff d).continuous.intervalIntegrable 0 y) |
| 673 | exact flatWeight_eta_bound d eta |
| 674 | exact (abs_add_le _ _).trans (add_le_add hpre hint) |
| 675 | |
| 676 | theorem flattenEnd_pos (d : TailData) : 0 < d.flattenEnd := by |
| 677 | exact (d.core.holdStart_pos.trans_le (coreEndpoint_ge_hold d)).trans (flattenEnd_gt_core d) |
| 678 | |
| 679 | theorem flatWeight_uniform (d : TailData) (eta : ℝ) {y : ℝ} (hy : d.flattenEnd ≤ y) : |
| 680 | flatWeight d eta y = baseWeight d y / 2 := by |
| 681 | unfold flatWeight baseWeight |
| 682 | rw [flattened_uniform d eta hy] |
| 683 | ring |
| 684 | |
| 685 | theorem baseWeight_hold (d : TailData) {a y : ℝ} |
| 686 | (ha : d.core.holdStart ≤ a) (hay : a ≤ y) : |
| 687 | baseWeight d y = baseWeight d a * Real.exp ((1 - d.core.lam) * (y - a)) := by |
| 688 | have h := radialAmplitude_hold (P := d.core.P) (lam := d.core.lam) |
| 689 | d.core.dropLength_pos.le ha hay |
| 690 | unfold baseWeight |
| 691 | rw [h] |
| 692 | calc |
| 693 | _ = radialAmplitude d.core.P d.core.dropLength d.core.lam a * |
| 694 | (Real.exp (3 * y / 2) * Real.exp (-(1 / 2 + d.core.lam) * (y - a))) := by ring |
| 695 | _ = radialAmplitude d.core.P d.core.dropLength d.core.lam a * |
| 696 | (Real.exp (3 * a / 2) * Real.exp ((1 - d.core.lam) * (y - a))) := by |
| 697 | rw [← Real.exp_add, ← Real.exp_add] |
| 698 | congr 2 |
| 699 | ring |
| 700 | _ = _ := by ring |
| 701 | |
| 702 | theorem flatHistory_increment (d : TailData) (eta : ℝ) {y : ℝ} (hy : d.flattenEnd ≤ y) : |
| 703 | flatHistory d eta y = flatHistory d eta d.flattenEnd + |
| 704 | (baseWeight d y - baseWeight d d.flattenEnd) / (2 * (1 - d.core.lam)) := by |
| 705 | have hk : 1 - d.core.lam ≠ 0 := by linarith [d.core.lam_lt] |
| 706 | have hderiv : ∀ t ∈ uIcc d.flattenEnd y, |
| 707 | HasDerivAt (fun t => baseWeight d t / (2 * (1 - d.core.lam))) (flatWeight d eta t) t := by |
| 708 | intro t ht |
| 709 | have htF : d.flattenEnd ≤ t := (uIcc_of_le hy ▸ ht).1 |
| 710 | have htH : d.core.holdStart ≤ t := |
| 711 | (coreEndpoint_ge_hold d).trans ((flattenEnd_gt_core d).le.trans htF) |
| 712 | rw [flatWeight_uniform d eta htF] |
| 713 | convert! (baseWeight_hasDerivAt d t).div_const (2 * (1 - d.core.lam)) using 1 |
| 714 | rw [slope_hold d.core.dropLength_pos.le htH] |
| 715 | field_simp ; ring |
| 716 | have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt hderiv |
| 717 | ((flatWeight_contDiff d eta).continuous.intervalIntegrable d.flattenEnd y) |
| 718 | have hadd := intervalIntegral.integral_add_adjacent_intervals (μ := volume) |
| 719 | ((flatWeight_contDiff d eta).continuous.intervalIntegrable 0 d.flattenEnd) |
| 720 | ((flatWeight_contDiff d eta).continuous.intervalIntegrable d.flattenEnd y) |
| 721 | unfold flatHistory OutgoingSchedule.primitive |
| 722 | rw [← hadd, hi] |
| 723 | ring |
| 724 | |
| 725 | def flatRatio (d : TailData) (eta : ℝ) : ℝ := |
| 726 | flatHistory d eta d.flattenEnd / (baseWeight d d.flattenEnd / 2) |
| 727 | |
| 728 | theorem flatRatio_contDiff (d : TailData) : ContDiff ℝ ∞ (flatRatio d) := |
| 729 | (flatHistory_contDiff d (flattenEnd_pos d).le).div_const _ |
| 730 | |
| 731 | theorem flatRatio_bounds (d : TailData) (eta : ℝ) : |
| 732 | 0 ≤ flatRatio d eta ∧ flatRatio d eta ≤ 2 / (1 - d.core.lam) := by |
| 733 | have hW : 0 < baseWeight d d.flattenEnd := baseWeight_pos d _ |
| 734 | have hI := flatHistory_bounds d eta (flattenEnd_pos d).le |
| 735 | have hB := baseHistory_le d (flattenEnd_pos d).le |
| 736 | constructor |
| 737 | · exact div_nonneg hI.1 (by positivity) |
| 738 | · calc |
| 739 | flatRatio d eta ≤ (baseWeight d d.flattenEnd / (1 - d.core.lam)) / |
| 740 | (baseWeight d d.flattenEnd / 2) := |
| 741 | div_le_div_of_nonneg_right (hI.2.trans hB) (by positivity) |
| 742 | _ = _ := by field_simp [hW.ne', show 1 - d.core.lam ≠ 0 by linarith [d.core.lam_lt]] |
| 743 | |
| 744 | theorem flatRatio_deriv_bound (d : TailData) (eta : ℝ) : |
| 745 | |deriv (flatRatio d) eta| ≤ 2 / (1 - d.core.lam) := by |
| 746 | have hW : 0 < baseWeight d d.flattenEnd := baseWeight_pos d _ |
| 747 | change |deriv (fun eta => flatHistory d eta d.flattenEnd / (baseWeight d d.flattenEnd / 2)) eta| ≤ _ |
| 748 | rw [deriv_div_const, abs_div, abs_of_pos (by positivity : 0 < baseWeight d d.flattenEnd / 2)] |
| 749 | calc |
| 750 | _ ≤ baseHistory d d.flattenEnd / (baseWeight d d.flattenEnd / 2) := |
| 751 | div_le_div_of_nonneg_right (flatHistory_deriv_bound d eta (flattenEnd_pos d).le) (by positivity) |
| 752 | _ ≤ (baseWeight d d.flattenEnd / (1 - d.core.lam)) / (baseWeight d d.flattenEnd / 2) := |
| 753 | div_le_div_of_nonneg_right (baseHistory_le d (flattenEnd_pos d).le) (by positivity) |
| 754 | _ = _ := by field_simp [hW.ne', show 1 - d.core.lam ≠ 0 by linarith [d.core.lam_lt]] |
| 755 | |
| 756 | def decayFactor (d : TailData) : ℝ := |
| 757 | Real.exp (-(1 - d.core.lam) * (d.uniformWait - 3)) |
| 758 | |
| 759 | /-- The actual normalized discrepancy at the first correction center. -/ |
| 760 | def normalizedDebt (d : TailData) (eta : ℝ) : ℝ := |
| 761 | decayFactor d * (1 / (1 - d.core.lam) - flatRatio d eta) |
| 762 | |
| 763 | theorem normalizedDebt_contDiff (d : TailData) : ContDiff ℝ ∞ (normalizedDebt d) := |
| 764 | contDiff_const.mul (contDiff_const.sub (flatRatio_contDiff d)) |
| 765 | |
| 766 | theorem normalizedDebt_bounds (d : TailData) (eta : ℝ) : |
| 767 | |normalizedDebt d eta| ≤ 3 * decayFactor d ∧ |
| 768 | |deriv (normalizedDebt d) eta| ≤ 3 * decayFactor d := by |
| 769 | have hk : 0 < 1 - d.core.lam := by linarith [d.core.lam_lt] |
| 770 | have hinv : 2 / (1 - d.core.lam) ≤ 3 := by |
| 771 | apply (div_le_iff₀ hk).mpr |
| 772 | linarith [d.core.lam_lt] |
| 773 | have hR := flatRatio_bounds d eta |
| 774 | have he : 0 ≤ decayFactor d := (Real.exp_pos _).le |
| 775 | constructor |
| 776 | · unfold normalizedDebt |
| 777 | rw [abs_mul, abs_of_nonneg he] |
| 778 | have hsmall : |1 / (1 - d.core.lam) - flatRatio d eta| ≤ 3 := by |
| 779 | apply abs_le.mpr |
| 780 | have hpos : 0 ≤ 1 / (1 - d.core.lam) := by positivity |
| 781 | have htwo : 2 / (1 - d.core.lam) = 2 * (1 / (1 - d.core.lam)) := by ring |
| 782 | constructor <;> linarith |
| 783 | nlinarith |
| 784 | · have hd : deriv (normalizedDebt d) eta = -decayFactor d * deriv (flatRatio d) eta := by |
| 785 | unfold normalizedDebt |
| 786 | rw [deriv_const_mul_field, deriv_const_sub] |
| 787 | ring |
| 788 | rw [hd, abs_mul, abs_neg, abs_of_nonneg he] |
| 789 | have hbound := (flatRatio_deriv_bound d eta).trans hinv |
| 790 | nlinarith |
| 791 | |
| 792 | theorem decayFactor_le (d : TailData) (hlam : d.core.lam ≤ 1 / 15) : |
| 793 | decayFactor d ≤ Real.exp 3 * d.core.lam ^ (28 : ℕ) := by |
| 794 | have hl1 : d.core.lam ≤ 1 := by linarith [d.core.lam_lt] |
| 795 | have hlog : Real.log (1 / d.core.lam) = -Real.log d.core.lam := by |
| 796 | rw [one_div, Real.log_inv] |
| 797 | have he : decayFactor d = Real.exp (3 * (1 - d.core.lam)) * |
| 798 | d.core.lam ^ (30 * (1 - d.core.lam)) := by |
| 799 | rw [decayFactor, TailData.uniformWait, hlog, Real.rpow_def_of_pos d.core.lam_pos, ← Real.exp_add] |
| 800 | congr 1 |
| 801 | ring |
| 802 | rw [he] |
| 803 | apply mul_le_mul |
| 804 | · apply Real.exp_le_exp.mpr |
| 805 | linarith [d.core.lam_pos] |
| 806 | · have hp : d.core.lam ^ (30 * (1 - d.core.lam)) ≤ d.core.lam ^ ((28 : ℕ) : ℝ) := |
| 807 | Real.rpow_le_rpow_of_exponent_ge d.core.lam_pos hl1 (by norm_num; linarith) |
| 808 | simpa only [Real.rpow_natCast] using hp |
| 809 | · exact Real.rpow_nonneg d.core.lam_pos.le _ |
| 810 | · exact (Real.exp_pos _).le |
| 811 | |
| 812 | /-- The normalized debt and its first angular derivative obey the requested |
| 813 | power bound for the actual waiting duration. The constant is universal. -/ |
| 814 | theorem actual_debt_first_jet_bound (d : TailData) (hlam : d.core.lam ≤ 1 / 15) (eta : ℝ) : |
| 815 | |normalizedDebt d eta| ≤ (3 * Real.exp 3) * d.core.lam ^ (28 : ℕ) ∧ |
| 816 | |deriv (normalizedDebt d) eta| ≤ (3 * Real.exp 3) * d.core.lam ^ (28 : ℕ) := by |
| 817 | have hb := normalizedDebt_bounds d eta |
| 818 | have he := decayFactor_le d hlam |
| 819 | constructor <;> nlinarith [hb.1, hb.2] |
| 820 | |
| 821 | theorem finalAngular_before_release (d : TailData) (eta : ℝ) {y : ℝ} |
| 822 | (hy : y ≤ d.releaseStart) : finalAngular d (y, eta) = flattened d (y, eta) := by |
| 823 | have hrel : y - d.releaseStart ≤ 0 := by linarith |
| 824 | have htail : y - tailStart d ≤ 1 := by linarith [tailStart_gt_release d] |
| 825 | have hden : 1 - d.rho ≠ 0 := by linarith [d.rho_lt_half] |
| 826 | simp [finalAngular, releaseAdjustment_early d hrel, tailShape_early d htail, hden] |
| 827 | |
| 828 | /-- The angular history of the actual unedited full outgoing profile, divided |
| 829 | by its common harmless factor `sqrt 2`. -/ |
| 830 | def fullHistory (d : TailData) (eta y : ℝ) : ℝ := |
| 831 | (5 / 8) * d.core.P * shape eta + |
| 832 | ∫ t in (0 : ℝ)..y, Real.exp (3 * t / 2) * finalAngular d (t, eta) |
| 833 | |
| 834 | theorem fullHistory_eq_flat (d : TailData) (eta : ℝ) {y : ℝ} |
| 835 | (hy0 : 0 ≤ y) (hyR : y ≤ d.releaseStart) : fullHistory d eta y = flatHistory d eta y := by |
| 836 | unfold fullHistory flatHistory OutgoingSchedule.primitive |
| 837 | congr 1 |
| 838 | apply intervalIntegral.integral_congr |
| 839 | intro t ht |
| 840 | have ht' : t ≤ y := (uIcc_of_le hy0 ▸ ht).2 |
| 841 | change Real.exp (3 * t / 2) * finalAngular d (t, eta) = flatWeight d eta t |
| 842 | rw [finalAngular_before_release d eta (ht'.trans hyR)] |
| 843 | rfl |
| 844 | |
| 845 | theorem first_center_after_flatten (d : TailData) : d.flattenEnd ≤ d.releaseStart - 3 := by |
| 846 | have h := uniformWait_gt_twentyseven d |
| 847 | dsimp [TailData.releaseStart] |
| 848 | linarith |
| 849 | |
| 850 | /-- Identification with the literal endpoint discrepancy and first-center |
| 851 | normalization of the actual full profile. -/ |
| 852 | theorem normalizedDebt_eq_actual (d : TailData) (eta : ℝ) : |
| 853 | normalizedDebt d eta = |
| 854 | (baseWeight d d.releaseStart / (2 * (1 - d.core.lam)) - fullHistory d eta d.releaseStart) / |
| 855 | (baseWeight d (d.releaseStart - 3) / 2) := by |
| 856 | have hR : 0 ≤ d.releaseStart := (flattenEnd_pos d).le.trans (releaseStart_gt_flattenEnd d).le |
| 857 | rw [fullHistory_eq_flat d eta hR le_rfl] |
| 858 | have hI := flatHistory_increment d eta (releaseStart_gt_flattenEnd d).le |
| 859 | have hconst : baseWeight d d.releaseStart / (2 * (1 - d.core.lam)) - |
| 860 | flatHistory d eta d.releaseStart = |
| 861 | baseWeight d d.flattenEnd / (2 * (1 - d.core.lam)) - flatHistory d eta d.flattenEnd := by |
| 862 | rw [hI] |
| 863 | ring |
| 864 | have hcenter : baseWeight d (d.releaseStart - 3) = |
| 865 | baseWeight d d.flattenEnd * Real.exp ((1 - d.core.lam) * (d.uniformWait - 3)) := by |
| 866 | rw [baseWeight_hold d ((coreEndpoint_ge_hold d).trans (flattenEnd_gt_core d).le) |
| 867 | (first_center_after_flatten d)] |
| 868 | congr 2 |
| 869 | dsimp [TailData.releaseStart] |
| 870 | ring |
| 871 | rw [hconst, hcenter] |
| 872 | unfold normalizedDebt flatRatio decayFactor |
| 873 | rw [show -(1 - d.core.lam) * (d.uniformWait - 3) = -((1 - d.core.lam) * (d.uniformWait - 3)) by ring, |
| 874 | Real.exp_neg] |
| 875 | field_simp [(baseWeight_pos d d.flattenEnd).ne', Real.exp_ne_zero, |
| 876 | show 1 - d.core.lam ≠ 0 by linarith [d.core.lam_lt]] |
| 877 | |
| 878 | theorem power28_le_self (d : TailData) : d.core.lam ^ (28 : ℕ) ≤ d.core.lam := by |
| 879 | have h : d.core.lam ^ ((28 : ℕ) : ℝ) ≤ d.core.lam ^ (1 : ℝ) := |
| 880 | Real.rpow_le_rpow_of_exponent_ge d.core.lam_pos (by linarith [d.core.lam_lt]) (by norm_num) |
| 881 | simpa only [Real.rpow_natCast, Real.rpow_one] using h |
| 882 | |
| 883 | theorem power28_le_square (d : TailData) : d.core.lam ^ (28 : ℕ) ≤ d.core.lam ^ (2 : ℕ) := by |
| 884 | have h : d.core.lam ^ ((28 : ℕ) : ℝ) ≤ d.core.lam ^ ((2 : ℕ) : ℝ) := |
| 885 | Real.rpow_le_rpow_of_exponent_ge d.core.lam_pos (by linarith [d.core.lam_lt]) (by norm_num) |
| 886 | simpa only [Real.rpow_natCast] using h |
| 887 | |
| 888 | /-- A reset for the actual scheduled debt, including the uniform first angular |
| 889 | jet estimate needed for later profile estimates. -/ |
| 890 | structure ResetWitness (d : TailData) (K : ℝ) where |
| 891 | coefficients : ℝ → Coeff |
| 892 | smooth : ContDiff ℝ ∞ coefficients |
| 893 | angular : ∀ eta, |
| 894 | (∫ u, Real.exp (angularSlope d.core.lam * u) * relative (coefficients eta) u) = normalizedDebt d eta |
| 895 | pressure : ∀ eta, |
| 896 | (∫ u, Real.exp (pressureSlope d.core.lam * u) * ((1 + relative (coefficients eta) u) ^ 2 - 1)) = 0 |
| 897 | coefficient_bound : ∀ eta, ‖coefficients eta‖ ≤ K * d.core.lam ^ (28 : ℕ) |
| 898 | eta_derivative_bound : ∀ eta, ‖deriv coefficients eta‖ ≤ K * d.core.lam ^ (28 : ℕ) |
| 899 | small_jets : ∀ eta u, |
| 900 | |relative (coefficients eta) u| ≤ 1 / 2 ∧ |
| 901 | |deriv (relative (coefficients eta)) u| ≤ d.core.lam / 4 |
| 902 | |
| 903 | /-- The complete outgoing data themselves supply a sufficiently small debt. |
| 904 | No small-debt assumption or parameter-derivative assumption remains. -/ |
| 905 | theorem exists_scheduled_reset : |
| 906 | ∃ lam0 K : ℝ, 0 < lam0 ∧ 0 < K ∧ ∀ d : TailData, d.core.lam < lam0 → |
| 907 | Nonempty (ResetWitness d K) := by |
| 908 | obtain ⟨ε, L, hε, hL, hsolve⟩ := uniform_reset_branch |
| 909 | let C : ℝ := 3 * Real.exp 3 |
| 910 | have hC : 0 < C := by dsimp [C]; positivity |
| 911 | let lam0 : ℝ := min (1 / 15) (min (ε / C) (1 / (4 * L * C))) |
| 912 | have hlam0 : 0 < lam0 := lt_min (by norm_num) (lt_min (div_pos hε hC) (by positivity)) |
| 913 | refine ⟨lam0, L * C, hlam0, mul_pos hL hC, ?_⟩ |
| 914 | intro d hd |
| 915 | have hsmall : d.core.lam ≤ 1 / 15 := (lt_of_lt_of_le hd (min_le_left _ _)).le |
| 916 | have hδε : C * d.core.lam ^ (28 : ℕ) < ε := by |
| 917 | apply lt_of_le_of_lt (mul_le_mul_of_nonneg_left (power28_le_self d) hC.le) |
| 918 | have hlam := lt_of_lt_of_le hd ((min_le_right _ _).trans (min_le_left _ _)) |
| 919 | nlinarith [(lt_div_iff₀ hC).mp hlam] |
| 920 | have hδsmall : L * (C * d.core.lam ^ (28 : ℕ)) ≤ d.core.lam / 4 := by |
| 921 | have hlam := lt_of_lt_of_le hd ((min_le_right _ _).trans (min_le_right _ _)) |
| 922 | have hmul := (lt_div_iff₀ (show 0 < 4 * L * C by positivity)).mp hlam |
| 923 | have hp := mul_le_mul_of_nonneg_left (power28_le_square d) (show 0 ≤ L * C by positivity) |
| 924 | nlinarith [mul_lt_mul_of_pos_right hmul d.core.lam_pos] |
| 925 | have hδ : ∀ eta, normalizedDebt d eta ∈ Ioo (-ε) ε := by |
| 926 | intro eta |
| 927 | exact abs_lt.mp ((actual_debt_first_jet_bound d hsmall eta).1.trans_lt hδε) |
| 928 | obtain ⟨c, hc, _, hceq⟩ := hsolve d.core.lam ⟨d.core.lam_pos.le, d.core.lam_lt.le⟩ |
| 929 | let a : ℝ → Coeff := fun eta => c (normalizedDebt d eta) |
| 930 | have ha : ContDiff ℝ ∞ a := by |
| 931 | apply contDiffOn_univ.mp |
| 932 | exact hc.comp (normalizedDebt_contDiff d).contDiffOn (fun eta _ => hδ eta) |
| 933 | refine ⟨{ |
| 934 | coefficients := a |
| 935 | smooth := ha |
| 936 | angular := fun eta => (hceq _ (hδ eta)).1 |
| 937 | pressure := fun eta => (hceq _ (hδ eta)).2.1 |
| 938 | coefficient_bound := ?_ |
| 939 | eta_derivative_bound := ?_ |
| 940 | small_jets := ?_ }⟩ |
| 941 | · intro eta |
| 942 | have hb := (hceq _ (hδ eta)).2.2.1 |
| 943 | have hd : |normalizedDebt d eta| ≤ C * d.core.lam ^ (28 : ℕ) := |
| 944 | (actual_debt_first_jet_bound d hsmall eta).1 |
| 945 | apply hb.trans |
| 946 | calc |
| 947 | _ ≤ L * (C * d.core.lam ^ (28 : ℕ)) := mul_le_mul_of_nonneg_left hd hL.le |
| 948 | _ = _ := by ring |
| 949 | · intro eta |
| 950 | have hcD : HasDerivAt c (deriv c (normalizedDebt d eta)) (normalizedDebt d eta) := |
| 951 | ((hc.contDiffAt (isOpen_Ioo.mem_nhds (hδ eta))).differentiableAt (by simp)).hasDerivAt |
| 952 | have hdD := ((normalizedDebt_contDiff d).differentiable (by simp) eta).hasDerivAt |
| 953 | have hchain := hcD.scomp eta hdD |
| 954 | change HasDerivAt a _ eta at hchain |
| 955 | rw [hchain.deriv, norm_smul, Real.norm_eq_abs] |
| 956 | have hb := (hceq _ (hδ eta)).2.2.2.1 |
| 957 | have hd := (actual_debt_first_jet_bound d hsmall eta).2 |
| 958 | calc |
| 959 | _ ≤ (C * d.core.lam ^ (28 : ℕ)) * L := |
| 960 | mul_le_mul hd hb (norm_nonneg _) (by positivity) |
| 961 | _ = _ := by ring |
| 962 | · intro eta u |
| 963 | have hv := (hceq _ (hδ eta)).2.2.2.2 u |
| 964 | have hb := mul_le_mul_of_nonneg_left (actual_debt_first_jet_bound d hsmall eta).1 hL.le |
| 965 | constructor |
| 966 | · exact (hv.1.trans (hb.trans hδsmall)).trans (by linarith [d.core.lam_lt]) |
| 967 | · exact hv.2.trans (hb.trans hδsmall) |
| 968 | |
| 969 | def correctionCenter (d : TailData) : ℝ := d.releaseStart - 3 |
| 970 | |
| 971 | def referenceAmplitude (d : TailData) : ℝ := |
| 972 | (radialAmplitude d.core.P d.core.dropLength d.core.lam d.flattenEnd / 2) * |
| 973 | Real.exp ((1 / 2 + d.core.lam) * d.flattenEnd) |
| 974 | |
| 975 | theorem reference_matches (d : TailData) {y : ℝ} (hy : d.flattenEnd ≤ y) : |
| 976 | baseE d.core.lam (referenceAmplitude d) y = |
| 977 | radialAmplitude d.core.P d.core.dropLength d.core.lam y / 2 := by |
| 978 | have hh : d.core.holdStart ≤ d.flattenEnd := (coreEndpoint_ge_hold d).trans (flattenEnd_gt_core d).le |
| 979 | have h := radialAmplitude_hold (P := d.core.P) (lam := d.core.lam) |
| 980 | d.core.dropLength_pos.le hh hy |
| 981 | rw [h] |
| 982 | unfold baseE referenceAmplitude |
| 983 | rw [mul_assoc, ← Real.exp_add] |
| 984 | have he : (1 / 2 + d.core.lam) * d.flattenEnd + (-1 / 2 - d.core.lam) * y = |
| 985 | -(1 / 2 + d.core.lam) * (y - d.flattenEnd) := by ring |
| 986 | rw [he] |
| 987 | ring |
| 988 | |
| 989 | theorem last_four_after_flatten (d : TailData) : d.flattenEnd < d.releaseStart - 4 := by |
| 990 | have h := uniformWait_gt_twentyseven d |
| 991 | dsimp [TailData.releaseStart] |
| 992 | linarith |
| 993 | |
| 994 | theorem original_matches_reference (d : TailData) (eta : ℝ) {y : ℝ} |
| 995 | (hy : y ∈ Icc (d.releaseStart - 4) d.releaseStart) : |
| 996 | finalAngular d (y, eta) = baseE d.core.lam (referenceAmplitude d) y := by |
| 997 | have hf : d.flattenEnd ≤ y := (last_four_after_flatten d).le.trans hy.1 |
| 998 | rw [finalAngular_uniform_wait d eta hf hy.2, reference_matches d hf] |
| 999 | |
| 1000 | theorem weighted_baseE (lam e0 y : ℝ) : |
| 1001 | Real.exp (3 * y / 2) * baseE lam e0 y = e0 * Real.exp ((1 - lam) * y) := by |
| 1002 | unfold baseE |
| 1003 | rw [mul_left_comm, ← Real.exp_add] |
| 1004 | congr 2 |
| 1005 | ring |
| 1006 | |
| 1007 | theorem reference_scale (d : TailData) : |
| 1008 | referenceAmplitude d * Real.exp ((1 - d.core.lam) * correctionCenter d) = |
| 1009 | baseWeight d (correctionCenter d) / 2 := by |
| 1010 | rw [← weighted_baseE, reference_matches d (y := correctionCenter d) |
| 1011 | (first_center_after_flatten d)] |
| 1012 | unfold baseWeight |
| 1013 | ring |
| 1014 | |
| 1015 | theorem relative_zero_outside (d : TailData) (c : Coeff) {y : ℝ} |
| 1016 | (hy : y ∉ Ioo (d.releaseStart - 4) d.releaseStart) : |
| 1017 | relative c (y - correctionCenter d) = 0 := by |
| 1018 | apply Classical.byContradiction |
| 1019 | intro hn |
| 1020 | have hs := relative_support c hn |
| 1021 | apply hy |
| 1022 | dsimp [correctionCenter] at hs |
| 1023 | constructor <;> linarith [hs.1, hs.2] |
| 1024 | |
| 1025 | /-- The actual complete outgoing angular field after the two relative bumps. -/ |
| 1026 | def correctedAngular (d : TailData) (c : ℝ → Coeff) (p : ℝ × ℝ) : ℝ := |
| 1027 | finalAngular d p * (1 + relative (c p.2) (p.1 - correctionCenter d)) |
| 1028 | |
| 1029 | theorem correctedAngular_contDiff (d : TailData) (c : ℝ → Coeff) (hc : ContDiff ℝ ∞ c) : |
| 1030 | ContDiff ℝ ∞ (correctedAngular d c) := |
| 1031 | (finalAngular_contDiff d).mul |
| 1032 | (contDiff_const.add (relative_joint_contDiff.comp |
| 1033 | ((hc.comp contDiff_snd).prodMk (contDiff_fst.sub contDiff_const)))) |
| 1034 | |
| 1035 | theorem correctedAngular_unchanged (d : TailData) (c : ℝ → Coeff) (eta : ℝ) {y : ℝ} |
| 1036 | (hy : y ∉ Ioo (d.releaseStart - 4) d.releaseStart) : |
| 1037 | correctedAngular d c (y, eta) = finalAngular d (y, eta) := by |
| 1038 | simp [correctedAngular, relative_zero_outside d (c eta) hy] |
| 1039 | |
| 1040 | theorem corrected_matches_reference (d : TailData) (c : ℝ → Coeff) (eta : ℝ) {y : ℝ} |
| 1041 | (hy : y ∈ Ioo (d.releaseStart - 4) d.releaseStart) : |
| 1042 | correctedAngular d c (y, eta) = |
| 1043 | modifiedE d.core.lam (referenceAmplitude d) (correctionCenter d) (c eta) y := by |
| 1044 | unfold correctedAngular modifiedE |
| 1045 | rw [original_matches_reference d eta ⟨hy.1.le, hy.2.le⟩] |
| 1046 | |
| 1047 | theorem corrected_difference_reference (d : TailData) (c : ℝ → Coeff) (eta y : ℝ) : |
| 1048 | correctedAngular d c (y, eta) - finalAngular d (y, eta) = |
| 1049 | modifiedE d.core.lam (referenceAmplitude d) (correctionCenter d) (c eta) y - |
| 1050 | baseE d.core.lam (referenceAmplitude d) y := by |
| 1051 | by_cases hy : y ∈ Ioo (d.releaseStart - 4) d.releaseStart |
| 1052 | · rw [corrected_matches_reference d c eta hy, original_matches_reference d eta ⟨hy.1.le, hy.2.le⟩] |
| 1053 | · rw [correctedAngular_unchanged d c eta hy] |
| 1054 | simp [modifiedE, relative_zero_outside d (c eta) hy] |
| 1055 | |
| 1056 | theorem corrected_pressure_reference (d : TailData) (c : ℝ → Coeff) (eta y : ℝ) : |
| 1057 | (correctedAngular d c (y, eta)) ^ 2 - (finalAngular d (y, eta)) ^ 2 = |
| 1058 | (modifiedE d.core.lam (referenceAmplitude d) (correctionCenter d) (c eta) y) ^ 2 - |
| 1059 | (baseE d.core.lam (referenceAmplitude d) y) ^ 2 := by |
| 1060 | by_cases hy : y ∈ Ioo (d.releaseStart - 4) d.releaseStart |
| 1061 | · rw [corrected_matches_reference d c eta hy, original_matches_reference d eta ⟨hy.1.le, hy.2.le⟩] |
| 1062 | · rw [correctedAngular_unchanged d c eta hy] |
| 1063 | simp [modifiedE, relative_zero_outside d (c eta) hy] |
| 1064 | |
| 1065 | namespace ResetWitness |
| 1066 | |
| 1067 | variable {d : TailData} {K : ℝ} (w : ResetWitness d K) |
| 1068 | |
| 1069 | theorem positive (p : ℝ × ℝ) : 0 < correctedAngular d w.coefficients p := by |
| 1070 | apply mul_pos (finalAngular_pos d p) |
| 1071 | have h := (abs_le.mp (w.small_jets p.2 (p.1 - correctionCenter d)).1).1 |
| 1072 | linarith |
| 1073 | |
| 1074 | theorem pressure_neutral (eta : ℝ) : |
| 1075 | (∫ y, (correctedAngular d w.coefficients (y, eta)) ^ 2 - (finalAngular d (y, eta)) ^ 2) = 0 := by |
| 1076 | simp_rw [corrected_pressure_reference] |
| 1077 | rw [pressure_integral_formula, w.pressure eta, mul_zero] |
| 1078 | |
| 1079 | theorem angular_change (eta : ℝ) : |
| 1080 | (∫ y, Real.exp (3 * y / 2) * |
| 1081 | (correctedAngular d w.coefficients (y, eta) - finalAngular d (y, eta))) = |
| 1082 | (baseWeight d (correctionCenter d) / 2) * normalizedDebt d eta := by |
| 1083 | simp_rw [corrected_difference_reference] |
| 1084 | have hf : (fun y => Real.exp (3 * y / 2) * |
| 1085 | (modifiedE d.core.lam (referenceAmplitude d) (correctionCenter d) (w.coefficients eta) y - |
| 1086 | baseE d.core.lam (referenceAmplitude d) y)) = |
| 1087 | (fun y => referenceAmplitude d * (Real.exp ((1 - d.core.lam) * y) * |
| 1088 | relative (w.coefficients eta) (y - correctionCenter d))) := by |
| 1089 | funext y |
| 1090 | calc |
| 1091 | _ = (Real.exp (3 * y / 2) * baseE d.core.lam (referenceAmplitude d) y) * |
| 1092 | relative (w.coefficients eta) (y - correctionCenter d) := by unfold modifiedE; ring |
| 1093 | _ = _ := by rw [weighted_baseE]; ring |
| 1094 | have hm : (∫ y, Real.exp ((1 - d.core.lam) * y) * relative (w.coefficients eta) y) = |
| 1095 | normalizedDebt d eta := w.angular eta |
| 1096 | rw [hf, integral_const_mul, weighted_translate_integral, hm, ← mul_assoc, reference_scale] |
| 1097 | |
| 1098 | end ResetWitness |
| 1099 | |
| 1100 | theorem integral_edit_window (d : TailData) (f : ℝ → ℝ) |
| 1101 | (hf : ∀ y, y ∉ Ioo (d.releaseStart - 4) d.releaseStart → f y = 0) : |
| 1102 | (∫ y in (0 : ℝ)..d.releaseStart, f y) = ∫ y, f y := by |
| 1103 | have hR : 0 ≤ d.releaseStart := (flattenEnd_pos d).le.trans (releaseStart_gt_flattenEnd d).le |
| 1104 | rw [intervalIntegral.integral_of_le hR] |
| 1105 | apply setIntegral_eq_integral_of_forall_compl_eq_zero |
| 1106 | intro y hy |
| 1107 | apply hf y |
| 1108 | intro hw |
| 1109 | apply hy |
| 1110 | exact ⟨(flattenEnd_pos d).trans ((last_four_after_flatten d).trans hw.1), hw.2.le⟩ |
| 1111 | |
| 1112 | def correctedHistory (d : TailData) (c : ℝ → Coeff) (eta : ℝ) : ℝ := |
| 1113 | (5 / 8) * d.core.P * shape eta + |
| 1114 | ∫ t in (0 : ℝ)..d.releaseStart, Real.exp (3 * t / 2) * correctedAngular d c (t, eta) |
| 1115 | |
| 1116 | namespace ResetWitness |
| 1117 | |
| 1118 | variable {d : TailData} {K : ℝ} (w : ResetWitness d K) |
| 1119 | |
| 1120 | theorem exact_endpoint (eta : ℝ) : correctedHistory d w.coefficients eta = |
| 1121 | baseWeight d d.releaseStart / (2 * (1 - d.core.lam)) := by |
| 1122 | have hm : IntervalIntegrable (fun y => Real.exp (3 * y / 2) * |
| 1123 | correctedAngular d w.coefficients (y, eta)) volume 0 d.releaseStart := |
| 1124 | (((Real.continuous_exp.comp ((continuous_const.mul continuous_id).div_const 2))).mul |
| 1125 | ((correctedAngular_contDiff d w.coefficients w.smooth).continuous.comp |
| 1126 | (continuous_id.prodMk continuous_const))).intervalIntegrable _ _ |
| 1127 | have ho : IntervalIntegrable (fun y => Real.exp (3 * y / 2) * finalAngular d (y, eta)) |
| 1128 | volume 0 d.releaseStart := |
| 1129 | (((Real.continuous_exp.comp ((continuous_const.mul continuous_id).div_const 2))).mul |
| 1130 | ((finalAngular_contDiff d).continuous.comp (continuous_id.prodMk continuous_const))).intervalIntegrable _ _ |
| 1131 | have hchange : |
| 1132 | (∫ y in (0 : ℝ)..d.releaseStart, Real.exp (3 * y / 2) * correctedAngular d w.coefficients (y, eta)) - |
| 1133 | (∫ y in (0 : ℝ)..d.releaseStart, Real.exp (3 * y / 2) * finalAngular d (y, eta)) = |
| 1134 | (baseWeight d (correctionCenter d) / 2) * normalizedDebt d eta := by |
| 1135 | rw [← intervalIntegral.integral_sub hm ho] |
| 1136 | have hf : (fun y => Real.exp (3 * y / 2) * correctedAngular d w.coefficients (y, eta) - |
| 1137 | Real.exp (3 * y / 2) * finalAngular d (y, eta)) = |
| 1138 | (fun y => Real.exp (3 * y / 2) * |
| 1139 | (correctedAngular d w.coefficients (y, eta) - finalAngular d (y, eta))) := by funext y; ring |
| 1140 | rw [hf, integral_edit_window d _ (fun y hy => by |
| 1141 | rw [correctedAngular_unchanged d w.coefficients eta hy, sub_self, mul_zero])] |
| 1142 | exact w.angular_change eta |
| 1143 | have hnorm : (baseWeight d (correctionCenter d) / 2) * normalizedDebt d eta = |
| 1144 | baseWeight d d.releaseStart / (2 * (1 - d.core.lam)) - fullHistory d eta d.releaseStart := by |
| 1145 | rw [normalizedDebt_eq_actual] |
| 1146 | have hz : baseWeight d (correctionCenter d) / 2 ≠ 0 := by |
| 1147 | exact ne_of_gt (div_pos (baseWeight_pos d _) (by norm_num)) |
| 1148 | change (baseWeight d (correctionCenter d) / 2) * |
| 1149 | ((baseWeight d d.releaseStart / (2 * (1 - d.core.lam)) - fullHistory d eta d.releaseStart) / |
| 1150 | (baseWeight d (correctionCenter d) / 2)) = _ |
| 1151 | field_simp [(baseWeight_pos d (correctionCenter d)).ne'] |
| 1152 | rw [hnorm] at hchange |
| 1153 | unfold correctedHistory fullHistory at * |
| 1154 | linarith |
| 1155 | |
| 1156 | end ResetWitness |
| 1157 | |
| 1158 | theorem full_weight_ideal (d : TailData) (eta : ℝ) {y : ℝ} (hy : y ≤ 0) : |
| 1159 | Real.exp (3 * y / 2) * finalAngular d (y, eta) = |
| 1160 | (d.core.P * shape eta) * Real.exp ((8 / 5 : ℝ) * y) := by |
| 1161 | rw [finalAngular_before d eta |
| 1162 | (hy.trans (d.core.holdStart_pos.le.trans (coreEndpoint_ge_hold d))), |
| 1163 | angular_ideal d.core.dropLength_pos.le hy] |
| 1164 | calc |
| 1165 | _ = (d.core.P * shape eta) * (Real.exp (3 * y / 2) * Real.exp (y / 10)) := by ring |
| 1166 | _ = _ := by rw [← Real.exp_add]; congr 2; ring |
| 1167 | |
| 1168 | /-- The ideal incoming segment fixes the prefix as an actual improper integral. -/ |
| 1169 | theorem history_from_ideal_prefix (d : TailData) (eta : ℝ) (f : ℝ → ℝ) |
| 1170 | (hf : Continuous f) |
| 1171 | (hprefix : ∀ y ≤ 0, f y = (d.core.P * shape eta) * Real.exp ((8 / 5 : ℝ) * y)) |
| 1172 | {y : ℝ} (hy : 0 ≤ y) : |
| 1173 | IntegrableOn f (Iic y) ∧ |
| 1174 | (∫ t in Iic y, f t) = (5 / 8) * d.core.P * shape eta + ∫ t in (0 : ℝ)..y, f t := by |
| 1175 | have hexp : IntegrableOn (fun t => (d.core.P * shape eta) * Real.exp ((8 / 5 : ℝ) * t)) |
| 1176 | (Iic (0 : ℝ)) := |
| 1177 | (integrableOn_exp_mul_Iic (by norm_num : (0 : ℝ) < 8 / 5) 0).const_mul (d.core.P * shape eta) |
| 1178 | have h0 : IntegrableOn f (Iic (0 : ℝ)) := |
| 1179 | IntegrableOn.congr_fun hexp (fun t ht => (hprefix t ht).symm) measurableSet_Iic |
| 1180 | have hi : IntegrableOn f (Iic y) := by |
| 1181 | rw [← Iic_union_Ioc_eq_Iic hy] |
| 1182 | exact h0.union hf.integrableOn_Ioc |
| 1183 | have he : (∫ t in Iic (0 : ℝ), f t) = (5 / 8) * d.core.P * shape eta := by |
| 1184 | calc |
| 1185 | _ = ∫ t in Iic (0 : ℝ), (d.core.P * shape eta) * Real.exp ((8 / 5 : ℝ) * t) := |
| 1186 | setIntegral_congr_fun measurableSet_Iic (fun t ht => hprefix t ht) |
| 1187 | _ = _ := by |
| 1188 | rw [integral_const_mul, integral_exp_mul_Iic (by norm_num : (0 : ℝ) < 8 / 5) 0] |
| 1189 | norm_num |
| 1190 | ring |
| 1191 | refine ⟨hi, ?_⟩ |
| 1192 | have hdiff := intervalIntegral.integral_Iic_sub_Iic h0 hi |
| 1193 | rw [he] at hdiff |
| 1194 | linarith |
| 1195 | |
| 1196 | namespace ResetWitness |
| 1197 | |
| 1198 | variable {d : TailData} {K : ℝ} (w : ResetWitness d K) |
| 1199 | |
| 1200 | end ResetWitness |
| 1201 | |
| 1202 | end ActualHistory |
| 1203 | |
| 1204 | end NavierStokes.UniformAngularReset |