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.LoopMoments |
| 2 | import Mathlib.Analysis.SpecialFunctions.Integrals.Basic |
| 3 | import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv |
| 4 | import Mathlib.Analysis.Calculus.Deriv.MeanValue |
| 5 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Periodic |
| 6 | import Mathlib.Topology.Order.MonotoneContinuity |
| 7 | |
| 8 | /-! |
| 9 | # Smooth periodic tilt functions and their actual integral moments |
| 10 | |
| 11 | This file advances the finite moment calculations in `LoopMoments` to genuine |
| 12 | smooth functions on the real line, with period `2π` and actual interval |
| 13 | integrals. The cosine construction realizes all nonnegative variances. A |
| 14 | separate, explicit amplitude bound is required to preserve the stress |
| 15 | projection. Smoothness in parameters is stated using the amplitude, avoiding |
| 16 | an incorrect claim of smoothness of the square root at zero variance. |
| 17 | |
| 18 | The positive exponential tilt used by the manuscript is also treated below. |
| 19 | Neither a smooth variance-inversion theorem nor a full true-cone result is |
| 20 | assumed or asserted. |
| 21 | -/ |
| 22 | |
| 23 | namespace NavierStokes.SmoothLoop |
| 24 | |
| 25 | noncomputable section |
| 26 | |
| 27 | open MeasureTheory |
| 28 | open scoped Interval ContDiff |
| 29 | |
| 30 | /-- Angular average over one full turn. -/ |
| 31 | def angularMean (f : ℝ → ℝ) : ℝ := (∫ θ in (0 : ℝ)..(2 * Real.pi), f θ) / (2 * Real.pi) |
| 32 | |
| 33 | theorem period_pos : (0 : ℝ) < 2 * Real.pi := mul_pos (by norm_num) Real.pi_pos |
| 34 | |
| 35 | theorem period_ne_zero : (2 : ℝ) * Real.pi ≠ 0 := ne_of_gt period_pos |
| 36 | |
| 37 | theorem angularMean_const (c : ℝ) : angularMean (fun _ => c) = c := by |
| 38 | simp only [angularMean, intervalIntegral.integral_const, sub_zero, smul_eq_mul] |
| 39 | field_simp [period_ne_zero] |
| 40 | |
| 41 | theorem angularMean_add (f g : ℝ → ℝ) (hf : Continuous f) (hg : Continuous g) : |
| 42 | angularMean (fun θ => f θ + g θ) = angularMean f + angularMean g := by |
| 43 | unfold angularMean |
| 44 | rw [intervalIntegral.integral_add (hf.intervalIntegrable _ _) (hg.intervalIntegrable _ _)] |
| 45 | ring |
| 46 | |
| 47 | theorem angularMean_sub (f g : ℝ → ℝ) (hf : Continuous f) (hg : Continuous g) : |
| 48 | angularMean (fun θ => f θ - g θ) = angularMean f - angularMean g := by |
| 49 | unfold angularMean |
| 50 | rw [intervalIntegral.integral_sub (hf.intervalIntegrable _ _) (hg.intervalIntegrable _ _)] |
| 51 | ring |
| 52 | |
| 53 | theorem angularMean_const_mul (c : ℝ) (f : ℝ → ℝ) : |
| 54 | angularMean (fun θ => c * f θ) = c * angularMean f := by |
| 55 | unfold angularMean |
| 56 | rw [intervalIntegral.integral_const_mul] |
| 57 | ring |
| 58 | |
| 59 | theorem angularMean_div_const (f : ℝ → ℝ) (c : ℝ) : |
| 60 | angularMean (fun θ => f θ / c) = angularMean f / c := by |
| 61 | simp only [div_eq_mul_inv, mul_comm _ c⁻¹, angularMean_const_mul] |
| 62 | |
| 63 | theorem angularMean_nonneg (f : ℝ → ℝ) (hf : ∀ θ, 0 ≤ f θ) : |
| 64 | 0 ≤ angularMean f := by |
| 65 | exact div_nonneg |
| 66 | (intervalIntegral.integral_nonneg_of_forall (le_of_lt period_pos) hf) |
| 67 | (le_of_lt period_pos) |
| 68 | |
| 69 | theorem angularMean_pos (f : ℝ → ℝ) (hf : Continuous f) (hpos : ∀ θ, 0 < f θ) : |
| 70 | 0 < angularMean f := by |
| 71 | exact div_pos (intervalIntegral.intervalIntegral_pos_of_pos |
| 72 | (hf.intervalIntegrable _ _) hpos period_pos) period_pos |
| 73 | |
| 74 | theorem angularMean_cos : angularMean Real.cos = 0 := by |
| 75 | simp [angularMean, Real.sin_two_pi] |
| 76 | |
| 77 | theorem angularMean_cos_sq : angularMean (fun θ => Real.cos θ ^ 2) = 1 / 2 := by |
| 78 | simp only [angularMean, integral_cos_sq, Real.sin_two_pi, Real.sin_zero, |
| 79 | mul_zero, sub_zero, zero_add] |
| 80 | field_simp [Real.pi_ne_zero] |
| 81 | |
| 82 | /-- A smooth tilt parametrized by its mean and its (signed) amplitude. -/ |
| 83 | def cosineTilt (m amplitude θ : ℝ) : ℝ := m + amplitude * Real.cos θ |
| 84 | |
| 85 | theorem cosineTilt_periodic (m amplitude : ℝ) : |
| 86 | Function.Periodic (cosineTilt m amplitude) (2 * Real.pi) := by |
| 87 | intro θ |
| 88 | simp only [cosineTilt, Real.cos_periodic θ] |
| 89 | |
| 90 | theorem cosineTilt_contDiff (m amplitude : ℝ) : |
| 91 | ContDiff ℝ (∞ : WithTop ℕ∞) (cosineTilt m amplitude) := by |
| 92 | exact contDiff_const.add (contDiff_const.mul Real.contDiff_cos) |
| 93 | |
| 94 | /-- Joint smoothness in mean, amplitude, and angle. -/ |
| 95 | theorem cosineTilt_joint_contDiff : |
| 96 | ContDiff ℝ (∞ : WithTop ℕ∞) (fun x : (ℝ × ℝ) × ℝ => |
| 97 | cosineTilt x.1.1 x.1.2 x.2) := by |
| 98 | exact (contDiff_fst.fst).add ((contDiff_fst.snd).mul (Real.contDiff_cos.comp contDiff_snd)) |
| 99 | |
| 100 | theorem cosineTilt_mean (m amplitude : ℝ) : angularMean (cosineTilt m amplitude) = m := by |
| 101 | unfold cosineTilt |
| 102 | rw [angularMean_add _ _ continuous_const (continuous_const.fun_mul Real.continuous_cos), |
| 103 | angularMean_const, angularMean_const_mul, angularMean_cos] |
| 104 | ring |
| 105 | |
| 106 | theorem cosineTilt_variance (m amplitude : ℝ) : |
| 107 | angularMean (fun θ => (cosineTilt m amplitude θ - m) ^ 2) = amplitude ^ 2 / 2 := by |
| 108 | have heq : (fun θ => (cosineTilt m amplitude θ - m) ^ 2) = |
| 109 | fun θ => amplitude ^ 2 * Real.cos θ ^ 2 := by |
| 110 | funext θ |
| 111 | dsimp [cosineTilt] |
| 112 | ring |
| 113 | rw [heq, angularMean_const_mul, angularMean_cos_sq] |
| 114 | ring |
| 115 | |
| 116 | /-- Actual smooth periodic functions realize every nonnegative variance. -/ |
| 117 | theorem exists_cosine_moments (m V : ℝ) (hV : 0 ≤ V) : |
| 118 | ∃ t : ℝ → ℝ, ContDiff ℝ (∞ : WithTop ℕ∞) t ∧ |
| 119 | Function.Periodic t (2 * Real.pi) ∧ angularMean t = m ∧ |
| 120 | angularMean (fun θ => (t θ - m) ^ 2) = V := by |
| 121 | refine ⟨cosineTilt m (Real.sqrt (2 * V)), cosineTilt_contDiff _ _, |
| 122 | cosineTilt_periodic _ _, cosineTilt_mean _ _, ?_⟩ |
| 123 | rw [cosineTilt_variance, Real.sq_sqrt (mul_nonneg (by norm_num) hV)] |
| 124 | ring |
| 125 | |
| 126 | /-- The full range is controlled by the amplitude, uniformly in the angle. -/ |
| 127 | theorem cosineTilt_projection_bound (p₁ p₂ m amplitude θ : ℝ) : |
| 128 | p₁ + p₂ * m - |p₂ * amplitude| ≤ p₁ + p₂ * cosineTilt m amplitude θ := by |
| 129 | have habs : |(p₂ * amplitude) * Real.cos θ| ≤ |p₂ * amplitude| := by |
| 130 | calc |
| 131 | |(p₂ * amplitude) * Real.cos θ| = |p₂ * amplitude| * |Real.cos θ| := abs_mul _ _ |
| 132 | _ ≤ |p₂ * amplitude| * 1 := |
| 133 | mul_le_mul_of_nonneg_left (Real.abs_cos_le_one θ) (abs_nonneg _) |
| 134 | _ = |p₂ * amplitude| := mul_one _ |
| 135 | have hlow := (abs_le.mp habs).1 |
| 136 | dsimp [cosineTilt] |
| 137 | nlinarith |
| 138 | |
| 139 | theorem cosineTilt_stress_positive (p₁ p₂ m amplitude : ℝ) |
| 140 | (hmargin : 2 + |p₂ * amplitude| < p₁ + p₂ * m) : |
| 141 | ∀ θ, 2 < p₁ + p₂ * cosineTilt m amplitude θ := by |
| 142 | intro θ |
| 143 | have hbound := cosineTilt_projection_bound p₁ p₂ m amplitude θ |
| 144 | linarith |
| 145 | |
| 146 | /-- Sufficient projection margin for the explicit prescribed-variance loop. |
| 147 | The margin is an additional hypothesis, not a consequence of `P>2`. -/ |
| 148 | theorem exists_cosine_moments_with_projection (p₁ p₂ m V : ℝ) (hV : 0 ≤ V) |
| 149 | (hmargin : 2 + |p₂ * Real.sqrt (2 * V)| < p₁ + p₂ * m) : |
| 150 | ∃ t : ℝ → ℝ, ContDiff ℝ (∞ : WithTop ℕ∞) t ∧ |
| 151 | Function.Periodic t (2 * Real.pi) ∧ angularMean t = m ∧ |
| 152 | angularMean (fun θ => (t θ - m) ^ 2) = V ∧ |
| 153 | ∀ θ, 2 < p₁ + p₂ * t θ := by |
| 154 | refine ⟨cosineTilt m (Real.sqrt (2 * V)), cosineTilt_contDiff _ _, |
| 155 | cosineTilt_periodic _ _, cosineTilt_mean _ _, ?_, |
| 156 | cosineTilt_stress_positive p₁ p₂ m _ hmargin⟩ |
| 157 | rw [cosineTilt_variance, Real.sq_sqrt (mul_nonneg (by norm_num) hV)] |
| 158 | ring |
| 159 | |
| 160 | /-- Smooth parameter data remain smooth when the chosen signed amplitude is |
| 161 | smooth. In particular, a smooth square root of a variance correction can be |
| 162 | used without asserting that square root is smooth on all of `[0,∞)`. -/ |
| 163 | theorem cosineTilt_smooth_family {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 164 | (m amplitude : E → ℝ) |
| 165 | (hm : ContDiff ℝ (∞ : WithTop ℕ∞) m) |
| 166 | (hamp : ContDiff ℝ (∞ : WithTop ℕ∞) amplitude) : |
| 167 | ContDiff ℝ (∞ : WithTop ℕ∞) (fun x : E × ℝ => cosineTilt (m x.1) (amplitude x.1) x.2) := by |
| 168 | exact (hm.comp contDiff_fst).add |
| 169 | ((hamp.comp contDiff_fst).mul (Real.contDiff_cos.comp contDiff_snd)) |
| 170 | |
| 171 | /-- Variance expansion for actual angular integrals. -/ |
| 172 | theorem angular_variance_identity (t : ℝ → ℝ) (m : ℝ) |
| 173 | (ht : Continuous t) (hmean : angularMean t = m) : |
| 174 | angularMean (fun θ => (t θ - m) ^ 2) = angularMean (fun θ => t θ ^ 2) - m ^ 2 := by |
| 175 | have heq : (fun θ => (t θ - m) ^ 2) = |
| 176 | (fun θ => (t θ ^ 2 - (2 * m) * t θ) + m ^ 2) := by |
| 177 | funext θ |
| 178 | ring |
| 179 | rw [heq, angularMean_add _ _ ((ht.fun_pow 2).fun_sub (continuous_const.fun_mul ht)) continuous_const, |
| 180 | angularMean_sub _ _ (ht.fun_pow 2) (continuous_const.fun_mul ht), angularMean_const_mul, |
| 181 | angularMean_const, hmean] |
| 182 | ring |
| 183 | |
| 184 | theorem angular_energy_moment (t : ℝ → ℝ) (a m ρ : ℝ) (ha : a ≠ 0) |
| 185 | (ht : Continuous t) (hmean : angularMean t = m) |
| 186 | (hvar : angularMean (fun θ => (t θ - m) ^ 2) = ρ / a) : |
| 187 | a * angularMean (fun θ => 1 + t θ ^ 2) = a * (1 + m ^ 2) + ρ := by |
| 188 | have hv := angular_variance_identity t m ht hmean |
| 189 | have hsecond : angularMean (fun θ => t θ ^ 2) = m ^ 2 + ρ / a := by linarith |
| 190 | rw [angularMean_add _ _ continuous_const (ht.fun_pow 2), angularMean_const, hsecond] |
| 191 | field_simp; ring |
| 192 | |
| 193 | open LoopMoments in |
| 194 | theorem angular_rephasing_moments (t : ℝ → ℝ) (a m ρ v : ℝ) |
| 195 | (ha : a ≠ 0) (hv : v ≠ 0) (ht : Continuous t) (hmean : angularMean t = m) |
| 196 | (hvar : angularMean (fun θ => (t θ - m) ^ 2) = ρ / a) |
| 197 | (hspeed : v = a * (1 + m ^ 2) + ρ) : |
| 198 | angularMean (fun θ => phaseDensity a v (t θ)) = 1 ∧ |
| 199 | angularMean (fun θ => phaseDensity a v (t θ) * loopA v (t θ)) = a ∧ |
| 200 | angularMean (fun θ => phaseDensity a v (t θ) * loopC v (t θ)) = a * m := by |
| 201 | constructor |
| 202 | · have he := angular_energy_moment t a m ρ ha ht hmean hvar |
| 203 | rw [← hspeed] at he |
| 204 | simp only [phaseDensity, angularMean_div_const, angularMean_const_mul, he, div_self hv] |
| 205 | constructor |
| 206 | · simp_rw [density_times_loopA a v _ hv] |
| 207 | exact angularMean_const a |
| 208 | · simp_rw [density_times_loopC a v _ hv] |
| 209 | rw [angularMean_const_mul, hmean] |
| 210 | |
| 211 | open LoopMoments in |
| 212 | theorem smooth_loop_shears (t : ℝ → ℝ) (v : ℝ) |
| 213 | (ht : ContDiff ℝ (∞ : WithTop ℕ∞) t) : |
| 214 | ContDiff ℝ (∞ : WithTop ℕ∞) (fun θ => loopA v (t θ)) ∧ |
| 215 | ContDiff ℝ (∞ : WithTop ℕ∞) (fun θ => loopC v (t θ)) := by |
| 216 | have hden : ContDiff ℝ (∞ : WithTop ℕ∞) (fun θ => 1 + t θ ^ 2) := |
| 217 | contDiff_const.add (ht.pow 2) |
| 218 | have hnz : ∀ θ, 1 + t θ ^ 2 ≠ 0 := fun θ => ne_of_gt (one_add_sq_pos (t θ)) |
| 219 | exact ⟨contDiff_const.div hden hnz, (contDiff_const.mul ht).div hden hnz⟩ |
| 220 | |
| 221 | open LoopMoments in |
| 222 | theorem periodic_loop_shears (t : ℝ → ℝ) (v : ℝ) |
| 223 | (ht : Function.Periodic t (2 * Real.pi)) : |
| 224 | Function.Periodic (fun θ => loopA v (t θ)) (2 * Real.pi) ∧ |
| 225 | Function.Periodic (fun θ => loopC v (t θ)) (2 * Real.pi) := by |
| 226 | constructor <;> intro θ <;> dsimp only <;> rw [ht θ] |
| 227 | |
| 228 | /-- The normalizing angular mean in the manuscript's exponential family, |
| 229 | using cosine instead of sine (a translation of the angular origin). -/ |
| 230 | def expNormalizer (s : ℝ) : ℝ := angularMean (fun θ => Real.exp (s * Real.cos θ)) |
| 231 | |
| 232 | theorem expNormalizer_pos (s : ℝ) : 0 < expNormalizer s := by |
| 233 | apply angularMean_pos |
| 234 | · exact Real.continuous_exp.comp (continuous_const.fun_mul Real.continuous_cos) |
| 235 | · intro θ |
| 236 | exact Real.exp_pos _ |
| 237 | |
| 238 | theorem expNormalizer_zero : expNormalizer 0 = 1 := by |
| 239 | simp only [expNormalizer, zero_mul, Real.exp_zero, angularMean_const] |
| 240 | |
| 241 | def normalizedExp (s θ : ℝ) : ℝ := Real.exp (s * Real.cos θ) / expNormalizer s |
| 242 | |
| 243 | theorem normalizedExp_pos (s θ : ℝ) : 0 < normalizedExp s θ := |
| 244 | div_pos (Real.exp_pos _) (expNormalizer_pos s) |
| 245 | |
| 246 | theorem normalizedExp_contDiff (s : ℝ) : |
| 247 | ContDiff ℝ (∞ : WithTop ℕ∞) (normalizedExp s) := by |
| 248 | exact (Real.contDiff_exp.comp (contDiff_const.mul Real.contDiff_cos)).div_const _ |
| 249 | |
| 250 | theorem normalizedExp_periodic (s : ℝ) : |
| 251 | Function.Periodic (normalizedExp s) (2 * Real.pi) := by |
| 252 | intro θ |
| 253 | simp only [normalizedExp, Real.cos_periodic θ] |
| 254 | |
| 255 | theorem normalizedExp_mean (s : ℝ) : angularMean (normalizedExp s) = 1 := by |
| 256 | unfold normalizedExp |
| 257 | rw [angularMean_div_const] |
| 258 | exact div_self (ne_of_gt (expNormalizer_pos s)) |
| 259 | |
| 260 | theorem normalizedExp_second_moment (s : ℝ) : |
| 261 | angularMean (fun θ => normalizedExp s θ ^ 2) = |
| 262 | expNormalizer (2 * s) / expNormalizer s ^ 2 := by |
| 263 | have heq : (fun θ => normalizedExp s θ ^ 2) = |
| 264 | (fun θ => Real.exp ((2 * s) * Real.cos θ) / expNormalizer s ^ 2) := by |
| 265 | funext θ |
| 266 | dsimp [normalizedExp] |
| 267 | rw [div_pow, show (2 * s) * Real.cos θ = s * Real.cos θ + s * Real.cos θ by ring, |
| 268 | Real.exp_add, pow_two] |
| 269 | rw [heq, angularMean_div_const] |
| 270 | rfl |
| 271 | |
| 272 | theorem normalizedExp_variance (s : ℝ) : |
| 273 | angularMean (fun θ => (normalizedExp s θ - 1) ^ 2) = |
| 274 | expNormalizer (2 * s) / expNormalizer s ^ 2 - 1 := by |
| 275 | rw [angular_variance_identity _ 1 (normalizedExp_contDiff s).continuous (normalizedExp_mean s), |
| 276 | normalizedExp_second_moment] |
| 277 | norm_num |
| 278 | |
| 279 | /-- The divided exponential tilt. Its smooth extension at `p=0` is handled |
| 280 | separately below; this expression by itself is not that extension. -/ |
| 281 | def expTilt (m d μ p θ : ℝ) : ℝ := m + (d / p) * (normalizedExp (μ * p) θ - 1) |
| 282 | |
| 283 | theorem expTilt_contDiff (m d μ p : ℝ) : |
| 284 | ContDiff ℝ (∞ : WithTop ℕ∞) (expTilt m d μ p) := by |
| 285 | exact contDiff_const.add (contDiff_const.mul ((normalizedExp_contDiff _).sub contDiff_const)) |
| 286 | |
| 287 | theorem expTilt_periodic (m d μ p : ℝ) : |
| 288 | Function.Periodic (expTilt m d μ p) (2 * Real.pi) := by |
| 289 | intro θ |
| 290 | simp only [expTilt, normalizedExp_periodic (μ * p) θ] |
| 291 | |
| 292 | theorem expTilt_mean (m d μ p : ℝ) : angularMean (expTilt m d μ p) = m := by |
| 293 | unfold expTilt |
| 294 | rw [angularMean_add _ _ continuous_const |
| 295 | (continuous_const.fun_mul ((normalizedExp_contDiff _).continuous.fun_sub continuous_const)), |
| 296 | angularMean_const, angularMean_const_mul, |
| 297 | angularMean_sub _ _ (normalizedExp_contDiff _).continuous continuous_const, |
| 298 | normalizedExp_mean, angularMean_const] |
| 299 | ring |
| 300 | |
| 301 | theorem expTilt_variance (m d μ p : ℝ) : |
| 302 | angularMean (fun θ => (expTilt m d μ p θ - m) ^ 2) = |
| 303 | (d / p) ^ 2 * (expNormalizer (2 * (μ * p)) / expNormalizer (μ * p) ^ 2 - 1) := by |
| 304 | have heq : (fun θ => (expTilt m d μ p θ - m) ^ 2) = |
| 305 | fun θ => (d / p) ^ 2 * (normalizedExp (μ * p) θ - 1) ^ 2 := by |
| 306 | funext θ |
| 307 | dsimp [expTilt] |
| 308 | ring |
| 309 | rw [heq, angularMean_const_mul, normalizedExp_variance] |
| 310 | |
| 311 | theorem expTilt_projection (p₁ p₂ m d μ θ : ℝ) (hp : p₂ ≠ 0) : |
| 312 | p₁ + p₂ * expTilt m d μ p₂ θ = |
| 313 | (p₁ + p₂ * m - d) + d * normalizedExp (μ * p₂) θ := by |
| 314 | unfold expTilt |
| 315 | field_simp; ring |
| 316 | |
| 317 | theorem expTilt_projection_lower (p₁ p₂ m d μ : ℝ) (hp : p₂ ≠ 0) (hd : 0 < d) : |
| 318 | ∀ θ, p₁ + p₂ * m - d < p₁ + p₂ * expTilt m d μ p₂ θ := by |
| 319 | intro θ |
| 320 | rw [expTilt_projection p₁ p₂ m d μ θ hp] |
| 321 | exact lt_add_of_pos_right _ (mul_pos hd (normalizedExp_pos _ _)) |
| 322 | |
| 323 | /-- Correct value at vanishing transverse stress. Smooth dependence across |
| 324 | `p=0` is a separate analytic obligation; only angular smoothness is proved. -/ |
| 325 | def extendedExpTilt (m d μ p : ℝ) : ℝ → ℝ := |
| 326 | if p = 0 then cosineTilt m (d * μ) else expTilt m d μ p |
| 327 | |
| 328 | theorem extendedExpTilt_contDiff (m d μ p : ℝ) : |
| 329 | ContDiff ℝ (∞ : WithTop ℕ∞) (extendedExpTilt m d μ p) := by |
| 330 | by_cases hp : p = 0 |
| 331 | · simpa only [extendedExpTilt, ite_eq_left hp] using cosineTilt_contDiff m (d * μ) |
| 332 | · simpa only [extendedExpTilt, ite_eq_right hp] using expTilt_contDiff m d μ p |
| 333 | |
| 334 | theorem extendedExpTilt_periodic (m d μ p : ℝ) : |
| 335 | Function.Periodic (extendedExpTilt m d μ p) (2 * Real.pi) := by |
| 336 | by_cases hp : p = 0 |
| 337 | · simpa only [extendedExpTilt, ite_eq_left hp] using cosineTilt_periodic m (d * μ) |
| 338 | · simpa only [extendedExpTilt, ite_eq_right hp] using expTilt_periodic m d μ p |
| 339 | |
| 340 | theorem extendedExpTilt_mean (m d μ p : ℝ) : |
| 341 | angularMean (extendedExpTilt m d μ p) = m := by |
| 342 | by_cases hp : p = 0 |
| 343 | · simpa only [extendedExpTilt, ite_eq_left hp] using cosineTilt_mean m (d * μ) |
| 344 | · simpa only [extendedExpTilt, ite_eq_right hp] using expTilt_mean m d μ p |
| 345 | |
| 346 | theorem extendedExpTilt_variance_zero (m d μ : ℝ) : |
| 347 | angularMean (fun θ => (extendedExpTilt m d μ 0 θ - m) ^ 2) = d ^ 2 * μ ^ 2 / 2 := by |
| 348 | simp [extendedExpTilt, cosineTilt_variance, mul_pow] |
| 349 | |
| 350 | theorem extendedExpTilt_projection_positive (p₁ p₂ m d μ : ℝ) |
| 351 | (hd : 0 < d) (hmargin : 2 ≤ p₁ + p₂ * m - d) : |
| 352 | ∀ θ, 2 < p₁ + p₂ * extendedExpTilt m d μ p₂ θ := by |
| 353 | intro θ |
| 354 | by_cases hp : p₂ = 0 |
| 355 | · simp only [hp, zero_mul, add_zero] at hmargin ⊢ |
| 356 | linarith |
| 357 | · simp only [extendedExpTilt, ite_eq_right hp] |
| 358 | exact lt_of_le_of_lt hmargin (expTilt_projection_lower p₁ p₂ m d μ hp hd θ) |
| 359 | |
| 360 | /-- A positive normalized density on a circle, given as a smooth periodic |
| 361 | function on its universal covering line. The construction `densityOfTilt` |
| 362 | below supplies these data from the already proved moment identity. -/ |
| 363 | structure CircleDensity where |
| 364 | rate : ℝ → ℝ |
| 365 | smooth : ContDiff ℝ (∞ : WithTop ℕ∞) rate |
| 366 | positive : ∀ θ, 0 < rate θ |
| 367 | periodic : Function.Periodic rate (2 * Real.pi) |
| 368 | integral_one : (∫ θ in (0 : ℝ)..(2 * Real.pi), rate θ) = 1 |
| 369 | |
| 370 | def phaseMap (d : CircleDensity) (θ : ℝ) : ℝ := ∫ x in (0 : ℝ)..θ, d.rate x |
| 371 | |
| 372 | theorem phaseMap_hasDerivAt (d : CircleDensity) (θ : ℝ) : |
| 373 | HasDerivAt (phaseMap d) (d.rate θ) θ := by |
| 374 | apply intervalIntegral.integral_hasDerivAt_right |
| 375 | · exact d.smooth.continuous.intervalIntegrable _ _ |
| 376 | · exact d.smooth.continuous.aestronglyMeasurable.stronglyMeasurableAtFilter |
| 377 | · exact d.smooth.continuous.continuousAt |
| 378 | |
| 379 | theorem phaseMap_contDiff (d : CircleDensity) : ContDiff ℝ (∞ : WithTop ℕ∞) (phaseMap d) := by |
| 380 | rw [contDiff_infty_iff_deriv] |
| 381 | refine ⟨fun θ => (phaseMap_hasDerivAt d θ).differentiableAt, ?_⟩ |
| 382 | have heq : deriv (phaseMap d) = d.rate := funext (fun θ => (phaseMap_hasDerivAt d θ).deriv) |
| 383 | rw [heq] |
| 384 | exact d.smooth |
| 385 | |
| 386 | theorem phaseMap_strictMono (d : CircleDensity) : StrictMono (phaseMap d) := |
| 387 | strictMono_of_hasDerivAt_pos (phaseMap_hasDerivAt d) d.positive |
| 388 | |
| 389 | theorem phaseMap_zero (d : CircleDensity) : phaseMap d 0 = 0 := by simp [phaseMap] |
| 390 | |
| 391 | theorem phaseMap_fullTurn (d : CircleDensity) : phaseMap d (2 * Real.pi) = 1 := d.integral_one |
| 392 | |
| 393 | theorem phaseMap_add_fullTurn (d : CircleDensity) (θ : ℝ) : |
| 394 | phaseMap d (θ + 2 * Real.pi) = phaseMap d θ + 1 := by |
| 395 | have h := d.periodic.intervalIntegral_add_eq_add 0 θ |
| 396 | (fun a b => d.smooth.continuous.intervalIntegrable a b) |
| 397 | simpa only [phaseMap, zero_add, d.integral_one] using h |
| 398 | |
| 399 | theorem phaseMap_int_fullTurn (d : CircleDensity) (n : ℤ) : |
| 400 | phaseMap d ((n : ℝ) * (2 * Real.pi)) = (n : ℝ) := by |
| 401 | have h := d.periodic.intervalIntegral_add_zsmul_eq n 0 |
| 402 | (fun a b => d.smooth.continuous.intervalIntegrable a b) |
| 403 | simpa only [phaseMap, zero_add, d.integral_one, zsmul_eq_mul, mul_one] using h |
| 404 | |
| 405 | theorem phaseMap_surjective (d : CircleDensity) : Function.Surjective (phaseMap d) := by |
| 406 | intro y |
| 407 | obtain ⟨n, hn⟩ := exists_nat_gt |y| |
| 408 | have hn₀ : (0 : ℝ) ≤ n := Nat.cast_nonneg n |
| 409 | have hy : -(n : ℝ) ≤ y ∧ y ≤ (n : ℝ) := by |
| 410 | have h₁ := neg_abs_le y |
| 411 | have h₂ := le_abs_self y |
| 412 | constructor <;> linarith |
| 413 | have hlo : phaseMap d (-(n : ℝ) * (2 * Real.pi)) = -(n : ℝ) := by |
| 414 | simpa only [Int.cast_neg, Int.cast_natCast] using phaseMap_int_fullTurn d (-(n : ℤ)) |
| 415 | have hhi : phaseMap d ((n : ℝ) * (2 * Real.pi)) = (n : ℝ) := by |
| 416 | simpa only [Int.cast_natCast] using phaseMap_int_fullTurn d (n : ℤ) |
| 417 | have hab : -(n : ℝ) * (2 * Real.pi) ≤ (n : ℝ) * (2 * Real.pi) := |
| 418 | mul_le_mul_of_nonneg_right (by linarith) (le_of_lt period_pos) |
| 419 | have hmem : y ∈ Set.Icc (phaseMap d (-(n : ℝ) * (2 * Real.pi))) |
| 420 | (phaseMap d ((n : ℝ) * (2 * Real.pi))) := by |
| 421 | simpa only [hlo, hhi, Set.mem_Icc] using hy |
| 422 | obtain ⟨θ, _, heq⟩ := |
| 423 | intermediate_value_Icc hab (phaseMap_contDiff d).continuous.continuousOn hmem |
| 424 | exact ⟨θ, heq⟩ |
| 425 | |
| 426 | /-- The phase map is an actual global homeomorphism, not an assumed inverse. -/ |
| 427 | def phaseHomeomorph (d : CircleDensity) : ℝ ≃ₜ ℝ := |
| 428 | (StrictMono.orderIsoOfSurjective (phaseMap d) (phaseMap_strictMono d) |
| 429 | (phaseMap_surjective d)).toHomeomorph |
| 430 | |
| 431 | theorem phaseHomeomorph_apply (d : CircleDensity) (θ : ℝ) : |
| 432 | phaseHomeomorph d θ = phaseMap d θ := rfl |
| 433 | |
| 434 | theorem phaseInverse_contDiff (d : CircleDensity) : |
| 435 | ContDiff ℝ (∞ : WithTop ℕ∞) (phaseHomeomorph d).symm := by |
| 436 | apply (phaseHomeomorph d).contDiff_symm_deriv |
| 437 | (fun θ => ne_of_gt (d.positive θ)) |
| 438 | · exact phaseMap_hasDerivAt d |
| 439 | · exact phaseMap_contDiff d |
| 440 | |
| 441 | theorem phaseInverse_add_one (d : CircleDensity) (φ : ℝ) : |
| 442 | (phaseHomeomorph d).symm (φ + 1) = (phaseHomeomorph d).symm φ + 2 * Real.pi := by |
| 443 | apply (phaseHomeomorph d).injective |
| 444 | rw [(phaseHomeomorph d).apply_symm_apply, phaseHomeomorph_apply, phaseMap_add_fullTurn] |
| 445 | change φ + 1 = phaseHomeomorph d ((phaseHomeomorph d).symm φ) + 1 |
| 446 | rw [(phaseHomeomorph d).apply_symm_apply] |
| 447 | |
| 448 | def rephase (d : CircleDensity) (f : ℝ → ℝ) (φ : ℝ) : ℝ := |
| 449 | f ((phaseHomeomorph d).symm φ) |
| 450 | |
| 451 | theorem rephase_contDiff (d : CircleDensity) (f : ℝ → ℝ) |
| 452 | (hf : ContDiff ℝ (∞ : WithTop ℕ∞) f) : |
| 453 | ContDiff ℝ (∞ : WithTop ℕ∞) (rephase d f) := hf.comp (phaseInverse_contDiff d) |
| 454 | |
| 455 | theorem rephase_periodic (d : CircleDensity) (f : ℝ → ℝ) |
| 456 | (hf : Function.Periodic f (2 * Real.pi)) : Function.Periodic (rephase d f) 1 := by |
| 457 | intro φ |
| 458 | dsimp [rephase] |
| 459 | rw [phaseInverse_add_one] |
| 460 | exact hf _ |
| 461 | |
| 462 | theorem rephase_phaseMap (d : CircleDensity) (f : ℝ → ℝ) (θ : ℝ) : |
| 463 | rephase d f (phaseMap d θ) = f θ := by |
| 464 | change f ((phaseHomeomorph d).symm (phaseHomeomorph d θ)) = f θ |
| 465 | rw [(phaseHomeomorph d).symm_apply_apply] |
| 466 | |
| 467 | /-- The actual change of variables for the constructed smooth inverse. -/ |
| 468 | theorem integral_rephase (d : CircleDensity) (f : ℝ → ℝ) (hf : Continuous f) : |
| 469 | (∫ φ in (0 : ℝ)..1, rephase d f φ) = |
| 470 | ∫ θ in (0 : ℝ)..(2 * Real.pi), f θ * d.rate θ := by |
| 471 | have hsub := intervalIntegral.integral_comp_mul_deriv |
| 472 | (a := (0 : ℝ)) (b := 2 * Real.pi) (f := phaseMap d) (f' := d.rate) |
| 473 | (g := rephase d f) (fun θ _ => phaseMap_hasDerivAt d θ) |
| 474 | d.smooth.continuous.continuousOn (hf.comp (phaseHomeomorph d).symm.continuous) |
| 475 | simpa only [Function.comp_apply, rephase_phaseMap, phaseMap_zero, phaseMap_fullTurn] using hsub.symm |
| 476 | |
| 477 | open LoopMoments in |
| 478 | def densityOfTilt (t : ℝ → ℝ) (a m ρ v : ℝ) |
| 479 | (ha : 0 < a) (hv : 0 < v) (ht : ContDiff ℝ (∞ : WithTop ℕ∞) t) |
| 480 | (hperiodic : Function.Periodic t (2 * Real.pi)) |
| 481 | (hmean : angularMean t = m) |
| 482 | (hvar : angularMean (fun θ => (t θ - m) ^ 2) = ρ / a) |
| 483 | (hspeed : v = a * (1 + m ^ 2) + ρ) : CircleDensity where |
| 484 | rate θ := phaseDensity a v (t θ) / (2 * Real.pi) |
| 485 | smooth := ((contDiff_const.mul (contDiff_const.add (ht.pow 2))).div_const v).div_const _ |
| 486 | positive θ := div_pos (phaseDensity_pos a v (t θ) ha hv) period_pos |
| 487 | periodic := by intro θ; dsimp only; rw [hperiodic θ] |
| 488 | integral_one := by |
| 489 | rw [intervalIntegral.integral_div] |
| 490 | exact (angular_rephasing_moments t a m ρ v (ne_of_gt ha) (ne_of_gt hv) |
| 491 | ht.continuous hmean hvar hspeed).1 |
| 492 | |
| 493 | open LoopMoments in |
| 494 | /-- A complete reparametrization theorem: ordinary mean/variance data produce |
| 495 | actual smooth period-one shear functions with the prescribed unweighted |
| 496 | integrals. The radial-speed identity is pointwise. No cone condition is |
| 497 | included, since that requires further inequalities on the chosen tilts. -/ |
| 498 | theorem exists_rephased_shear_loop (t : ℝ → ℝ) (a m ρ v : ℝ) |
| 499 | (ha : 0 < a) (hv : 0 < v) (ht : ContDiff ℝ (∞ : WithTop ℕ∞) t) |
| 500 | (hperiodic : Function.Periodic t (2 * Real.pi)) |
| 501 | (hmean : angularMean t = m) |
| 502 | (hvar : angularMean (fun θ => (t θ - m) ^ 2) = ρ / a) |
| 503 | (hspeed : v = a * (1 + m ^ 2) + ρ) : |
| 504 | ∃ A C : ℝ → ℝ, |
| 505 | ContDiff ℝ (∞ : WithTop ℕ∞) A ∧ ContDiff ℝ (∞ : WithTop ℕ∞) C ∧ |
| 506 | Function.Periodic A 1 ∧ Function.Periodic C 1 ∧ |
| 507 | (∫ φ in (0 : ℝ)..1, A φ) = a ∧ (∫ φ in (0 : ℝ)..1, C φ) = a * m ∧ |
| 508 | ∀ φ, 0 < A φ ∧ A φ * (1 + (C φ / A φ) ^ 2) = v := by |
| 509 | let d := densityOfTilt t a m ρ v ha hv ht hperiodic hmean hvar hspeed |
| 510 | let fA := fun θ => loopA v (t θ) |
| 511 | let fC := fun θ => loopC v (t θ) |
| 512 | have hsm := smooth_loop_shears t v ht |
| 513 | have hper := periodic_loop_shears t v hperiodic |
| 514 | have hmom := angular_rephasing_moments t a m ρ v (ne_of_gt ha) (ne_of_gt hv) |
| 515 | ht.continuous hmean hvar hspeed |
| 516 | refine ⟨rephase d fA, rephase d fC, rephase_contDiff d fA hsm.1, |
| 517 | rephase_contDiff d fC hsm.2, rephase_periodic d fA hper.1, |
| 518 | rephase_periodic d fC hper.2, ?_, ?_, ?_⟩ |
| 519 | · rw [integral_rephase d fA hsm.1.continuous] |
| 520 | change (∫ θ in (0 : ℝ)..(2 * Real.pi), |
| 521 | loopA v (t θ) * (phaseDensity a v (t θ) / (2 * Real.pi))) = a |
| 522 | simp_rw [← mul_div_assoc, mul_comm (loopA v (t _)) (phaseDensity a v (t _))] |
| 523 | rw [intervalIntegral.integral_div] |
| 524 | exact hmom.2.1 |
| 525 | · rw [integral_rephase d fC hsm.2.continuous] |
| 526 | change (∫ θ in (0 : ℝ)..(2 * Real.pi), |
| 527 | loopC v (t θ) * (phaseDensity a v (t θ) / (2 * Real.pi))) = a * m |
| 528 | simp_rw [← mul_div_assoc, mul_comm (loopC v (t _)) (phaseDensity a v (t _))] |
| 529 | rw [intervalIntegral.integral_div] |
| 530 | exact hmom.2.2 |
| 531 | · intro φ |
| 532 | dsimp [rephase, fA, fC] |
| 533 | refine ⟨loopA_pos _ _ hv, ?_⟩ |
| 534 | rw [loop_slope _ _ (ne_of_gt hv), loop_speed] |
| 535 | |
| 536 | open LoopMoments in |
| 537 | theorem rephase_slope (d : CircleDensity) (t : ℝ → ℝ) (v φ : ℝ) (hv : v ≠ 0) : |
| 538 | rephase d (fun θ => loopC v (t θ)) φ / |
| 539 | rephase d (fun θ => loopA v (t θ)) φ = t ((phaseHomeomorph d).symm φ) := by |
| 540 | exact loop_slope v (t ((phaseHomeomorph d).symm φ)) hv |
| 541 | |
| 542 | open LoopMoments in |
| 543 | /-- Any verified slope condition survives the constructed phase change. -/ |
| 544 | theorem rephase_preserves_slope_condition (d : CircleDensity) (t : ℝ → ℝ) (v : ℝ) |
| 545 | (hv : v ≠ 0) (R : ℝ → Prop) (hR : ∀ θ, R (t θ)) : |
| 546 | ∀ φ, R (rephase d (fun θ => loopC v (t θ)) φ / |
| 547 | rephase d (fun θ => loopA v (t θ)) φ) := by |
| 548 | intro φ |
| 549 | rw [rephase_slope d t v φ hv] |
| 550 | exact hR _ |
| 551 | |
| 552 | open LoopMoments in |
| 553 | theorem rephase_projection_positive (d : CircleDensity) (t : ℝ → ℝ) (p₁ p₂ v : ℝ) |
| 554 | (hv : v ≠ 0) (hprojection : ∀ θ, 2 < p₁ + p₂ * t θ) : |
| 555 | ∀ φ, 2 < p₁ + p₂ * (rephase d (fun θ => loopC v (t θ)) φ / |
| 556 | rephase d (fun θ => loopA v (t θ)) φ) := by |
| 557 | exact rephase_preserves_slope_condition d t v hv (fun z => 2 < p₁ + p₂ * z) hprojection |
| 558 | |
| 559 | /-- A fully constructed period-one shear loop for arbitrary positive first |
| 560 | mean and nonnegative variance increment. No seed function or inverse is |
| 561 | assumed. The speed increase is exactly the specified `ρ`. -/ |
| 562 | theorem exists_prescribed_mean_shear_loop (a b ρ : ℝ) (ha : 0 < a) (hρ : 0 ≤ ρ) : |
| 563 | ∃ A C : ℝ → ℝ, |
| 564 | ContDiff ℝ (∞ : WithTop ℕ∞) A ∧ ContDiff ℝ (∞ : WithTop ℕ∞) C ∧ |
| 565 | Function.Periodic A 1 ∧ Function.Periodic C 1 ∧ |
| 566 | (∫ φ in (0 : ℝ)..1, A φ) = a ∧ (∫ φ in (0 : ℝ)..1, C φ) = -b ∧ |
| 567 | ∀ φ, 0 < A φ ∧ |
| 568 | A φ * (1 + (C φ / A φ) ^ 2) = a * (1 + (-b / a) ^ 2) + ρ := by |
| 569 | let m := -b / a |
| 570 | let v := a * (1 + m ^ 2) + ρ |
| 571 | have hV : 0 ≤ ρ / a := div_nonneg hρ (le_of_lt ha) |
| 572 | obtain ⟨t, hts, htp, htm, htv⟩ := exists_cosine_moments m (ρ / a) hV |
| 573 | have hv : 0 < v := by |
| 574 | dsimp [v] |
| 575 | exact add_pos_of_pos_of_nonneg |
| 576 | (mul_pos ha (LoopMoments.one_add_sq_pos m)) hρ |
| 577 | obtain ⟨A, C, hA, hC, hpA, hpC, hmA, hmC, hs⟩ := |
| 578 | exists_rephased_shear_loop t a m ρ v ha hv hts htp htm htv rfl |
| 579 | refine ⟨A, C, hA, hC, hpA, hpC, hmA, ?_, hs⟩ |
| 580 | rw [hmC] |
| 581 | dsimp [m] |
| 582 | field_simp |
| 583 | |
| 584 | theorem rephase_const (d : CircleDensity) (c : ℝ) : |
| 585 | rephase d (fun _ => c) = fun _ => c := rfl |
| 586 | |
| 587 | open LoopMoments in |
| 588 | /-- At zero amplitude the loop shears are exactly the nominal constants, |
| 589 | independently of the phase parametrization. -/ |
| 590 | theorem zero_amplitude_is_nominal (d : CircleDensity) (a m : ℝ) : |
| 591 | rephase d (fun θ => loopA (a * (1 + m ^ 2)) (cosineTilt m 0 θ)) = (fun _ => a) ∧ |
| 592 | rephase d (fun θ => loopC (a * (1 + m ^ 2)) (cosineTilt m 0 θ)) = (fun _ => a * m) := by |
| 593 | constructor <;> funext φ <;> dsimp [rephase, loopA, loopC, cosineTilt] |
| 594 | · have hnz := ne_of_gt (LoopMoments.one_add_sq_pos m) |
| 595 | simp only [zero_mul, add_zero] |
| 596 | exact mul_div_cancel_right₀ a hnz |
| 597 | · have hnz := ne_of_gt (LoopMoments.one_add_sq_pos m) |
| 598 | simp only [zero_mul, add_zero] |
| 599 | field_simp |
| 600 | |
| 601 | end |
| 602 | |
| 603 | end NavierStokes.SmoothLoop |