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 | theorem cosineTilt_mean (m amplitude : ℝ) : angularMean (cosineTilt m amplitude) = m := by |
| 95 | unfold cosineTilt |
| 96 | rw [angularMean_add _ _ continuous_const (continuous_const.fun_mul Real.continuous_cos), |
| 97 | angularMean_const, angularMean_const_mul, angularMean_cos] |
| 98 | ring |
| 99 | |
| 100 | theorem cosineTilt_variance (m amplitude : ℝ) : |
| 101 | angularMean (fun θ => (cosineTilt m amplitude θ - m) ^ 2) = amplitude ^ 2 / 2 := by |
| 102 | have heq : (fun θ => (cosineTilt m amplitude θ - m) ^ 2) = |
| 103 | fun θ => amplitude ^ 2 * Real.cos θ ^ 2 := by |
| 104 | funext θ |
| 105 | dsimp [cosineTilt] |
| 106 | ring |
| 107 | rw [heq, angularMean_const_mul, angularMean_cos_sq] |
| 108 | ring |
| 109 | |
| 110 | /-- Variance expansion for actual angular integrals. -/ |
| 111 | theorem angular_variance_identity (t : ℝ → ℝ) (m : ℝ) |
| 112 | (ht : Continuous t) (hmean : angularMean t = m) : |
| 113 | angularMean (fun θ => (t θ - m) ^ 2) = angularMean (fun θ => t θ ^ 2) - m ^ 2 := by |
| 114 | have heq : (fun θ => (t θ - m) ^ 2) = |
| 115 | (fun θ => (t θ ^ 2 - (2 * m) * t θ) + m ^ 2) := by |
| 116 | funext θ |
| 117 | ring |
| 118 | rw [heq, angularMean_add _ _ ((ht.fun_pow 2).fun_sub (continuous_const.fun_mul ht)) continuous_const, |
| 119 | angularMean_sub _ _ (ht.fun_pow 2) (continuous_const.fun_mul ht), angularMean_const_mul, |
| 120 | angularMean_const, hmean] |
| 121 | ring |
| 122 | |
| 123 | theorem angular_energy_moment (t : ℝ → ℝ) (a m ρ : ℝ) (ha : a ≠ 0) |
| 124 | (ht : Continuous t) (hmean : angularMean t = m) |
| 125 | (hvar : angularMean (fun θ => (t θ - m) ^ 2) = ρ / a) : |
| 126 | a * angularMean (fun θ => 1 + t θ ^ 2) = a * (1 + m ^ 2) + ρ := by |
| 127 | have hv := angular_variance_identity t m ht hmean |
| 128 | have hsecond : angularMean (fun θ => t θ ^ 2) = m ^ 2 + ρ / a := by linarith |
| 129 | rw [angularMean_add _ _ continuous_const (ht.fun_pow 2), angularMean_const, hsecond] |
| 130 | field_simp; ring |
| 131 | |
| 132 | open LoopMoments in |
| 133 | theorem angular_rephasing_moments (t : ℝ → ℝ) (a m ρ v : ℝ) |
| 134 | (ha : a ≠ 0) (hv : v ≠ 0) (ht : Continuous t) (hmean : angularMean t = m) |
| 135 | (hvar : angularMean (fun θ => (t θ - m) ^ 2) = ρ / a) |
| 136 | (hspeed : v = a * (1 + m ^ 2) + ρ) : |
| 137 | angularMean (fun θ => phaseDensity a v (t θ)) = 1 ∧ |
| 138 | angularMean (fun θ => phaseDensity a v (t θ) * loopA v (t θ)) = a ∧ |
| 139 | angularMean (fun θ => phaseDensity a v (t θ) * loopC v (t θ)) = a * m := by |
| 140 | constructor |
| 141 | · have he := angular_energy_moment t a m ρ ha ht hmean hvar |
| 142 | rw [← hspeed] at he |
| 143 | simp only [phaseDensity, angularMean_div_const, angularMean_const_mul, he, div_self hv] |
| 144 | constructor |
| 145 | · simp_rw [density_times_loopA a v _ hv] |
| 146 | exact angularMean_const a |
| 147 | · simp_rw [density_times_loopC a v _ hv] |
| 148 | rw [angularMean_const_mul, hmean] |
| 149 | |
| 150 | open LoopMoments in |
| 151 | theorem smooth_loop_shears (t : ℝ → ℝ) (v : ℝ) |
| 152 | (ht : ContDiff ℝ (∞ : WithTop ℕ∞) t) : |
| 153 | ContDiff ℝ (∞ : WithTop ℕ∞) (fun θ => loopA v (t θ)) ∧ |
| 154 | ContDiff ℝ (∞ : WithTop ℕ∞) (fun θ => loopC v (t θ)) := by |
| 155 | have hden : ContDiff ℝ (∞ : WithTop ℕ∞) (fun θ => 1 + t θ ^ 2) := |
| 156 | contDiff_const.add (ht.pow 2) |
| 157 | have hnz : ∀ θ, 1 + t θ ^ 2 ≠ 0 := fun θ => ne_of_gt (one_add_sq_pos (t θ)) |
| 158 | exact ⟨contDiff_const.div hden hnz, (contDiff_const.mul ht).div hden hnz⟩ |
| 159 | |
| 160 | open LoopMoments in |
| 161 | theorem periodic_loop_shears (t : ℝ → ℝ) (v : ℝ) |
| 162 | (ht : Function.Periodic t (2 * Real.pi)) : |
| 163 | Function.Periodic (fun θ => loopA v (t θ)) (2 * Real.pi) ∧ |
| 164 | Function.Periodic (fun θ => loopC v (t θ)) (2 * Real.pi) := by |
| 165 | constructor <;> intro θ <;> dsimp only <;> rw [ht θ] |
| 166 | |
| 167 | /-- The normalizing angular mean in the manuscript's exponential family, |
| 168 | using cosine instead of sine (a translation of the angular origin). -/ |
| 169 | def expNormalizer (s : ℝ) : ℝ := angularMean (fun θ => Real.exp (s * Real.cos θ)) |
| 170 | |
| 171 | theorem expNormalizer_pos (s : ℝ) : 0 < expNormalizer s := by |
| 172 | apply angularMean_pos |
| 173 | · exact Real.continuous_exp.comp (continuous_const.fun_mul Real.continuous_cos) |
| 174 | · intro θ |
| 175 | exact Real.exp_pos _ |
| 176 | |
| 177 | theorem expNormalizer_zero : expNormalizer 0 = 1 := by |
| 178 | simp only [expNormalizer, zero_mul, Real.exp_zero, angularMean_const] |
| 179 | |
| 180 | def normalizedExp (s θ : ℝ) : ℝ := Real.exp (s * Real.cos θ) / expNormalizer s |
| 181 | |
| 182 | theorem normalizedExp_pos (s θ : ℝ) : 0 < normalizedExp s θ := |
| 183 | div_pos (Real.exp_pos _) (expNormalizer_pos s) |
| 184 | |
| 185 | theorem normalizedExp_contDiff (s : ℝ) : |
| 186 | ContDiff ℝ (∞ : WithTop ℕ∞) (normalizedExp s) := by |
| 187 | exact (Real.contDiff_exp.comp (contDiff_const.mul Real.contDiff_cos)).div_const _ |
| 188 | |
| 189 | theorem normalizedExp_periodic (s : ℝ) : |
| 190 | Function.Periodic (normalizedExp s) (2 * Real.pi) := by |
| 191 | intro θ |
| 192 | simp only [normalizedExp, Real.cos_periodic θ] |
| 193 | |
| 194 | theorem normalizedExp_mean (s : ℝ) : angularMean (normalizedExp s) = 1 := by |
| 195 | unfold normalizedExp |
| 196 | rw [angularMean_div_const] |
| 197 | exact div_self (ne_of_gt (expNormalizer_pos s)) |
| 198 | |
| 199 | theorem normalizedExp_second_moment (s : ℝ) : |
| 200 | angularMean (fun θ => normalizedExp s θ ^ 2) = |
| 201 | expNormalizer (2 * s) / expNormalizer s ^ 2 := by |
| 202 | have heq : (fun θ => normalizedExp s θ ^ 2) = |
| 203 | (fun θ => Real.exp ((2 * s) * Real.cos θ) / expNormalizer s ^ 2) := by |
| 204 | funext θ |
| 205 | dsimp [normalizedExp] |
| 206 | rw [div_pow, show (2 * s) * Real.cos θ = s * Real.cos θ + s * Real.cos θ by ring, |
| 207 | Real.exp_add, pow_two] |
| 208 | rw [heq, angularMean_div_const] |
| 209 | rfl |
| 210 | |
| 211 | theorem normalizedExp_variance (s : ℝ) : |
| 212 | angularMean (fun θ => (normalizedExp s θ - 1) ^ 2) = |
| 213 | expNormalizer (2 * s) / expNormalizer s ^ 2 - 1 := by |
| 214 | rw [angular_variance_identity _ 1 (normalizedExp_contDiff s).continuous (normalizedExp_mean s), |
| 215 | normalizedExp_second_moment] |
| 216 | norm_num |
| 217 | |
| 218 | /-- The divided exponential tilt. Its smooth extension at `p=0` is handled |
| 219 | separately below; this expression by itself is not that extension. -/ |
| 220 | def expTilt (m d μ p θ : ℝ) : ℝ := m + (d / p) * (normalizedExp (μ * p) θ - 1) |
| 221 | |
| 222 | theorem expTilt_contDiff (m d μ p : ℝ) : |
| 223 | ContDiff ℝ (∞ : WithTop ℕ∞) (expTilt m d μ p) := by |
| 224 | exact contDiff_const.add (contDiff_const.mul ((normalizedExp_contDiff _).sub contDiff_const)) |
| 225 | |
| 226 | theorem expTilt_periodic (m d μ p : ℝ) : |
| 227 | Function.Periodic (expTilt m d μ p) (2 * Real.pi) := by |
| 228 | intro θ |
| 229 | simp only [expTilt, normalizedExp_periodic (μ * p) θ] |
| 230 | |
| 231 | theorem expTilt_mean (m d μ p : ℝ) : angularMean (expTilt m d μ p) = m := by |
| 232 | unfold expTilt |
| 233 | rw [angularMean_add _ _ continuous_const |
| 234 | (continuous_const.fun_mul ((normalizedExp_contDiff _).continuous.fun_sub continuous_const)), |
| 235 | angularMean_const, angularMean_const_mul, |
| 236 | angularMean_sub _ _ (normalizedExp_contDiff _).continuous continuous_const, |
| 237 | normalizedExp_mean, angularMean_const] |
| 238 | ring |
| 239 | |
| 240 | theorem expTilt_variance (m d μ p : ℝ) : |
| 241 | angularMean (fun θ => (expTilt m d μ p θ - m) ^ 2) = |
| 242 | (d / p) ^ 2 * (expNormalizer (2 * (μ * p)) / expNormalizer (μ * p) ^ 2 - 1) := by |
| 243 | have heq : (fun θ => (expTilt m d μ p θ - m) ^ 2) = |
| 244 | fun θ => (d / p) ^ 2 * (normalizedExp (μ * p) θ - 1) ^ 2 := by |
| 245 | funext θ |
| 246 | dsimp [expTilt] |
| 247 | ring |
| 248 | rw [heq, angularMean_const_mul, normalizedExp_variance] |
| 249 | |
| 250 | theorem expTilt_projection (p₁ p₂ m d μ θ : ℝ) (hp : p₂ ≠ 0) : |
| 251 | p₁ + p₂ * expTilt m d μ p₂ θ = |
| 252 | (p₁ + p₂ * m - d) + d * normalizedExp (μ * p₂) θ := by |
| 253 | unfold expTilt |
| 254 | field_simp; ring |
| 255 | |
| 256 | theorem expTilt_projection_lower (p₁ p₂ m d μ : ℝ) (hp : p₂ ≠ 0) (hd : 0 < d) : |
| 257 | ∀ θ, p₁ + p₂ * m - d < p₁ + p₂ * expTilt m d μ p₂ θ := by |
| 258 | intro θ |
| 259 | rw [expTilt_projection p₁ p₂ m d μ θ hp] |
| 260 | exact lt_add_of_pos_right _ (mul_pos hd (normalizedExp_pos _ _)) |
| 261 | |
| 262 | /-- Correct value at vanishing transverse stress. Smooth dependence across |
| 263 | `p=0` is a separate analytic obligation; only angular smoothness is proved. -/ |
| 264 | def extendedExpTilt (m d μ p : ℝ) : ℝ → ℝ := |
| 265 | if p = 0 then cosineTilt m (d * μ) else expTilt m d μ p |
| 266 | |
| 267 | theorem extendedExpTilt_contDiff (m d μ p : ℝ) : |
| 268 | ContDiff ℝ (∞ : WithTop ℕ∞) (extendedExpTilt m d μ p) := by |
| 269 | by_cases hp : p = 0 |
| 270 | · simpa only [extendedExpTilt, ite_eq_left hp] using cosineTilt_contDiff m (d * μ) |
| 271 | · simpa only [extendedExpTilt, ite_eq_right hp] using expTilt_contDiff m d μ p |
| 272 | |
| 273 | theorem extendedExpTilt_periodic (m d μ p : ℝ) : |
| 274 | Function.Periodic (extendedExpTilt m d μ p) (2 * Real.pi) := by |
| 275 | by_cases hp : p = 0 |
| 276 | · simpa only [extendedExpTilt, ite_eq_left hp] using cosineTilt_periodic m (d * μ) |
| 277 | · simpa only [extendedExpTilt, ite_eq_right hp] using expTilt_periodic m d μ p |
| 278 | |
| 279 | theorem extendedExpTilt_mean (m d μ p : ℝ) : |
| 280 | angularMean (extendedExpTilt m d μ p) = m := by |
| 281 | by_cases hp : p = 0 |
| 282 | · simpa only [extendedExpTilt, ite_eq_left hp] using cosineTilt_mean m (d * μ) |
| 283 | · simpa only [extendedExpTilt, ite_eq_right hp] using expTilt_mean m d μ p |
| 284 | |
| 285 | theorem extendedExpTilt_variance_zero (m d μ : ℝ) : |
| 286 | angularMean (fun θ => (extendedExpTilt m d μ 0 θ - m) ^ 2) = d ^ 2 * μ ^ 2 / 2 := by |
| 287 | simp [extendedExpTilt, cosineTilt_variance, mul_pow] |
| 288 | |
| 289 | theorem extendedExpTilt_projection_positive (p₁ p₂ m d μ : ℝ) |
| 290 | (hd : 0 < d) (hmargin : 2 ≤ p₁ + p₂ * m - d) : |
| 291 | ∀ θ, 2 < p₁ + p₂ * extendedExpTilt m d μ p₂ θ := by |
| 292 | intro θ |
| 293 | by_cases hp : p₂ = 0 |
| 294 | · simp only [hp, zero_mul, add_zero] at hmargin ⊢ |
| 295 | linarith |
| 296 | · simp only [extendedExpTilt, ite_eq_right hp] |
| 297 | exact lt_of_le_of_lt hmargin (expTilt_projection_lower p₁ p₂ m d μ hp hd θ) |
| 298 | |
| 299 | /-- A positive normalized density on a circle, given as a smooth periodic |
| 300 | function on its universal covering line. The construction `densityOfTilt` |
| 301 | below supplies these data from the already proved moment identity. -/ |
| 302 | structure CircleDensity where |
| 303 | rate : ℝ → ℝ |
| 304 | smooth : ContDiff ℝ (∞ : WithTop ℕ∞) rate |
| 305 | positive : ∀ θ, 0 < rate θ |
| 306 | periodic : Function.Periodic rate (2 * Real.pi) |
| 307 | integral_one : (∫ θ in (0 : ℝ)..(2 * Real.pi), rate θ) = 1 |
| 308 | |
| 309 | def phaseMap (d : CircleDensity) (θ : ℝ) : ℝ := ∫ x in (0 : ℝ)..θ, d.rate x |
| 310 | |
| 311 | theorem phaseMap_hasDerivAt (d : CircleDensity) (θ : ℝ) : |
| 312 | HasDerivAt (phaseMap d) (d.rate θ) θ := by |
| 313 | apply intervalIntegral.integral_hasDerivAt_right |
| 314 | · exact d.smooth.continuous.intervalIntegrable _ _ |
| 315 | · exact d.smooth.continuous.aestronglyMeasurable.stronglyMeasurableAtFilter |
| 316 | · exact d.smooth.continuous.continuousAt |
| 317 | |
| 318 | theorem phaseMap_contDiff (d : CircleDensity) : ContDiff ℝ (∞ : WithTop ℕ∞) (phaseMap d) := by |
| 319 | rw [contDiff_infty_iff_deriv] |
| 320 | refine ⟨fun θ => (phaseMap_hasDerivAt d θ).differentiableAt, ?_⟩ |
| 321 | have heq : deriv (phaseMap d) = d.rate := funext (fun θ => (phaseMap_hasDerivAt d θ).deriv) |
| 322 | rw [heq] |
| 323 | exact d.smooth |
| 324 | |
| 325 | theorem phaseMap_strictMono (d : CircleDensity) : StrictMono (phaseMap d) := |
| 326 | strictMono_of_hasDerivAt_pos (phaseMap_hasDerivAt d) d.positive |
| 327 | |
| 328 | theorem phaseMap_zero (d : CircleDensity) : phaseMap d 0 = 0 := by simp [phaseMap] |
| 329 | |
| 330 | theorem phaseMap_fullTurn (d : CircleDensity) : phaseMap d (2 * Real.pi) = 1 := d.integral_one |
| 331 | |
| 332 | theorem phaseMap_add_fullTurn (d : CircleDensity) (θ : ℝ) : |
| 333 | phaseMap d (θ + 2 * Real.pi) = phaseMap d θ + 1 := by |
| 334 | have h := d.periodic.intervalIntegral_add_eq_add 0 θ |
| 335 | (fun a b => d.smooth.continuous.intervalIntegrable a b) |
| 336 | simpa only [phaseMap, zero_add, d.integral_one] using h |
| 337 | |
| 338 | theorem phaseMap_int_fullTurn (d : CircleDensity) (n : ℤ) : |
| 339 | phaseMap d ((n : ℝ) * (2 * Real.pi)) = (n : ℝ) := by |
| 340 | have h := d.periodic.intervalIntegral_add_zsmul_eq n 0 |
| 341 | (fun a b => d.smooth.continuous.intervalIntegrable a b) |
| 342 | simpa only [phaseMap, zero_add, d.integral_one, zsmul_eq_mul, mul_one] using h |
| 343 | |
| 344 | theorem phaseMap_surjective (d : CircleDensity) : Function.Surjective (phaseMap d) := by |
| 345 | intro y |
| 346 | obtain ⟨n, hn⟩ := exists_nat_gt |y| |
| 347 | have hn₀ : (0 : ℝ) ≤ n := Nat.cast_nonneg n |
| 348 | have hy : -(n : ℝ) ≤ y ∧ y ≤ (n : ℝ) := by |
| 349 | have h₁ := neg_abs_le y |
| 350 | have h₂ := le_abs_self y |
| 351 | constructor <;> linarith |
| 352 | have hlo : phaseMap d (-(n : ℝ) * (2 * Real.pi)) = -(n : ℝ) := by |
| 353 | simpa only [Int.cast_neg, Int.cast_natCast] using phaseMap_int_fullTurn d (-(n : ℤ)) |
| 354 | have hhi : phaseMap d ((n : ℝ) * (2 * Real.pi)) = (n : ℝ) := by |
| 355 | simpa only [Int.cast_natCast] using phaseMap_int_fullTurn d (n : ℤ) |
| 356 | have hab : -(n : ℝ) * (2 * Real.pi) ≤ (n : ℝ) * (2 * Real.pi) := |
| 357 | mul_le_mul_of_nonneg_right (by linarith) (le_of_lt period_pos) |
| 358 | have hmem : y ∈ Set.Icc (phaseMap d (-(n : ℝ) * (2 * Real.pi))) |
| 359 | (phaseMap d ((n : ℝ) * (2 * Real.pi))) := by |
| 360 | simpa only [hlo, hhi, Set.mem_Icc] using hy |
| 361 | obtain ⟨θ, _, heq⟩ := |
| 362 | intermediate_value_Icc hab (phaseMap_contDiff d).continuous.continuousOn hmem |
| 363 | exact ⟨θ, heq⟩ |
| 364 | |
| 365 | /-- The phase map is an actual global homeomorphism, not an assumed inverse. -/ |
| 366 | def phaseHomeomorph (d : CircleDensity) : ℝ ≃ₜ ℝ := |
| 367 | (StrictMono.orderIsoOfSurjective (phaseMap d) (phaseMap_strictMono d) |
| 368 | (phaseMap_surjective d)).toHomeomorph |
| 369 | |
| 370 | theorem phaseHomeomorph_apply (d : CircleDensity) (θ : ℝ) : |
| 371 | phaseHomeomorph d θ = phaseMap d θ := rfl |
| 372 | |
| 373 | theorem phaseInverse_contDiff (d : CircleDensity) : |
| 374 | ContDiff ℝ (∞ : WithTop ℕ∞) (phaseHomeomorph d).symm := by |
| 375 | apply (phaseHomeomorph d).contDiff_symm_deriv |
| 376 | (fun θ => ne_of_gt (d.positive θ)) |
| 377 | · exact phaseMap_hasDerivAt d |
| 378 | · exact phaseMap_contDiff d |
| 379 | |
| 380 | theorem phaseInverse_add_one (d : CircleDensity) (φ : ℝ) : |
| 381 | (phaseHomeomorph d).symm (φ + 1) = (phaseHomeomorph d).symm φ + 2 * Real.pi := by |
| 382 | apply (phaseHomeomorph d).injective |
| 383 | rw [(phaseHomeomorph d).apply_symm_apply, phaseHomeomorph_apply, phaseMap_add_fullTurn] |
| 384 | change φ + 1 = phaseHomeomorph d ((phaseHomeomorph d).symm φ) + 1 |
| 385 | rw [(phaseHomeomorph d).apply_symm_apply] |
| 386 | |
| 387 | def rephase (d : CircleDensity) (f : ℝ → ℝ) (φ : ℝ) : ℝ := |
| 388 | f ((phaseHomeomorph d).symm φ) |
| 389 | |
| 390 | theorem rephase_contDiff (d : CircleDensity) (f : ℝ → ℝ) |
| 391 | (hf : ContDiff ℝ (∞ : WithTop ℕ∞) f) : |
| 392 | ContDiff ℝ (∞ : WithTop ℕ∞) (rephase d f) := hf.comp (phaseInverse_contDiff d) |
| 393 | |
| 394 | theorem rephase_periodic (d : CircleDensity) (f : ℝ → ℝ) |
| 395 | (hf : Function.Periodic f (2 * Real.pi)) : Function.Periodic (rephase d f) 1 := by |
| 396 | intro φ |
| 397 | dsimp [rephase] |
| 398 | rw [phaseInverse_add_one] |
| 399 | exact hf _ |
| 400 | |
| 401 | theorem rephase_phaseMap (d : CircleDensity) (f : ℝ → ℝ) (θ : ℝ) : |
| 402 | rephase d f (phaseMap d θ) = f θ := by |
| 403 | change f ((phaseHomeomorph d).symm (phaseHomeomorph d θ)) = f θ |
| 404 | rw [(phaseHomeomorph d).symm_apply_apply] |
| 405 | |
| 406 | /-- The actual change of variables for the constructed smooth inverse. -/ |
| 407 | theorem integral_rephase (d : CircleDensity) (f : ℝ → ℝ) (hf : Continuous f) : |
| 408 | (∫ φ in (0 : ℝ)..1, rephase d f φ) = |
| 409 | ∫ θ in (0 : ℝ)..(2 * Real.pi), f θ * d.rate θ := by |
| 410 | have hsub := intervalIntegral.integral_comp_mul_deriv |
| 411 | (a := (0 : ℝ)) (b := 2 * Real.pi) (f := phaseMap d) (f' := d.rate) |
| 412 | (g := rephase d f) (fun θ _ => phaseMap_hasDerivAt d θ) |
| 413 | d.smooth.continuous.continuousOn (hf.comp (phaseHomeomorph d).symm.continuous) |
| 414 | simpa only [Function.comp_apply, rephase_phaseMap, phaseMap_zero, phaseMap_fullTurn] using hsub.symm |
| 415 | |
| 416 | open LoopMoments in |
| 417 | def densityOfTilt (t : ℝ → ℝ) (a m ρ v : ℝ) |
| 418 | (ha : 0 < a) (hv : 0 < v) (ht : ContDiff ℝ (∞ : WithTop ℕ∞) t) |
| 419 | (hperiodic : Function.Periodic t (2 * Real.pi)) |
| 420 | (hmean : angularMean t = m) |
| 421 | (hvar : angularMean (fun θ => (t θ - m) ^ 2) = ρ / a) |
| 422 | (hspeed : v = a * (1 + m ^ 2) + ρ) : CircleDensity where |
| 423 | rate θ := phaseDensity a v (t θ) / (2 * Real.pi) |
| 424 | smooth := ((contDiff_const.mul (contDiff_const.add (ht.pow 2))).div_const v).div_const _ |
| 425 | positive θ := div_pos (phaseDensity_pos a v (t θ) ha hv) period_pos |
| 426 | periodic := by intro θ; dsimp only; rw [hperiodic θ] |
| 427 | integral_one := by |
| 428 | rw [intervalIntegral.integral_div] |
| 429 | exact (angular_rephasing_moments t a m ρ v (ne_of_gt ha) (ne_of_gt hv) |
| 430 | ht.continuous hmean hvar hspeed).1 |
| 431 | |
| 432 | end |
| 433 | |
| 434 | end NavierStokes.SmoothLoop |