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.TangentProjection |
| 2 | import NavierStokes.PhaseCalculus |
| 3 | import NavierStokes.GrowingMode |
| 4 | import NavierStokes.ViscousPropagator |
| 5 | import Mathlib.Analysis.InnerProductSpace.PiL2 |
| 6 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 7 | import Mathlib.Analysis.Calculus.Deriv.Inv |
| 8 | import Mathlib.Tactic.FinCases |
| 9 | import Mathlib.Tactic.Positivity |
| 10 | |
| 11 | /-! |
| 12 | # The actual moving tangent frame |
| 13 | |
| 14 | The ambient coordinates are radial, angular, axial. The two tangent coordinates |
| 15 | are taken in `e_r - ρ K, N`, where `K,N` is an orthonormal frame of the last two |
| 16 | coordinates. Normal motion, rotation, viscosity and projected forcing are all |
| 17 | retained in the exact equation. |
| 18 | -/ |
| 19 | |
| 20 | namespace NavierStokes.MovingFrameODE |
| 21 | |
| 22 | open scoped InnerProductSpace ContDiff |
| 23 | |
| 24 | abbrev Plane := EuclideanSpace ℝ (Fin 2) |
| 25 | abbrev Space := EuclideanSpace ℝ (Fin 3) |
| 26 | abbrev Frame := OrthonormalBasis (Fin 2) ℝ Plane |
| 27 | |
| 28 | noncomputable def pack (r : ℝ) (w : Plane) : Space := !₂[r, w 0, w 1] |
| 29 | noncomputable def tail (w : Space) : Plane := !₂[w 1, w 2] |
| 30 | noncomputable def unitTheta : Plane := !₂[1, 0] |
| 31 | |
| 32 | @[simp] theorem pack_zero (r : ℝ) (w : Plane) : pack r w 0 = r := rfl |
| 33 | @[simp] theorem pack_one (r : ℝ) (w : Plane) : pack r w 1 = w 0 := rfl |
| 34 | @[simp] theorem pack_two (r : ℝ) (w : Plane) : pack r w 2 = w 1 := rfl |
| 35 | @[simp] theorem tail_pack (r : ℝ) (w : Plane) : tail (pack r w) = w := by |
| 36 | ext i |
| 37 | fin_cases i <;> rfl |
| 38 | @[simp] theorem tail_add (u v : Space) : tail (u + v) = tail u + tail v := by |
| 39 | ext i |
| 40 | fin_cases i <;> rfl |
| 41 | @[simp] theorem tail_sub (u v : Space) : tail (u - v) = tail u - tail v := by |
| 42 | ext i |
| 43 | fin_cases i <;> rfl |
| 44 | @[simp] theorem tail_neg (u : Space) : tail (-u) = -tail u := by |
| 45 | ext i |
| 46 | fin_cases i <;> rfl |
| 47 | @[simp] theorem tail_smul (c : ℝ) (u : Space) : tail (c • u) = c • tail u := by |
| 48 | ext i |
| 49 | fin_cases i <;> rfl |
| 50 | |
| 51 | theorem inner_pack (a b : ℝ) (u v : Plane) : |
| 52 | ⟪pack a u, pack b v⟫_ℝ = a * b + ⟪u, v⟫_ℝ := by |
| 53 | simp [pack, PiLp.inner_apply, Fin.sum_univ_three, Fin.sum_univ_two] |
| 54 | ring |
| 55 | |
| 56 | theorem inner_pack_left (a : ℝ) (u : Plane) (v : Space) : |
| 57 | ⟪pack a u, v⟫_ℝ = a * v 0 + ⟪u, tail v⟫_ℝ := by |
| 58 | simp [pack, tail, PiLp.inner_apply, Fin.sum_univ_three, Fin.sum_univ_two] |
| 59 | ring |
| 60 | |
| 61 | @[simp] theorem inner_unitTheta (w : Plane) : ⟪w, unitTheta⟫_ℝ = w 0 := by |
| 62 | simp [unitTheta, PiLp.inner_apply, Fin.sum_univ_two] |
| 63 | |
| 64 | @[simp] theorem frame_inner (B : Frame) (i j : Fin 2) : |
| 65 | ⟪B i, B j⟫_ℝ = if i = j then 1 else 0 := (orthonormal_iff_ite.mp B.orthonormal) i j |
| 66 | |
| 67 | @[simp] theorem frame_inner00 (B : Frame) : ⟪B 0, B 0⟫_ℝ = 1 := by |
| 68 | simp only [frame_inner, ite_true] |
| 69 | @[simp] theorem frame_inner11 (B : Frame) : ⟪B 1, B 1⟫_ℝ = 1 := by |
| 70 | simp only [frame_inner, ite_true] |
| 71 | @[simp] theorem frame_inner01 (B : Frame) : ⟪B 0, B 1⟫_ℝ = 0 := by |
| 72 | exact B.inner_eq_zero (by decide) |
| 73 | @[simp] theorem frame_inner10 (B : Frame) : ⟪B 1, B 0⟫_ℝ = 0 := by |
| 74 | exact B.inner_eq_zero (by decide) |
| 75 | |
| 76 | theorem frame_expand (B : Frame) (w : Plane) : |
| 77 | ⟪B 0, w⟫_ℝ • B 0 + ⟪B 1, w⟫_ℝ • B 1 = w := by |
| 78 | simpa only [Fin.sum_univ_two] using B.sum_repr' w |
| 79 | |
| 80 | theorem frame_ext (B : Frame) {u v : Space} (hr : u 0 = v 0) |
| 81 | (hK : ⟪B 0, tail u⟫_ℝ = ⟪B 0, tail v⟫_ℝ) |
| 82 | (hN : ⟪B 1, tail u⟫_ℝ = ⟪B 1, tail v⟫_ℝ) : u = v := by |
| 83 | have ht : tail u = tail v := by |
| 84 | rw [← frame_expand B (tail u), ← frame_expand B (tail v), hK, hN] |
| 85 | ext i |
| 86 | fin_cases i |
| 87 | · exact hr |
| 88 | · exact congrArg (fun w : Plane => w 0) ht |
| 89 | · exact congrArg (fun w : Plane => w 1) ht |
| 90 | |
| 91 | noncomputable def normal (β ρ : ℝ) (B : Frame) : Space := |
| 92 | pack (β * ρ) (β • B 0) |
| 93 | |
| 94 | noncomputable def tangent (ρ : ℝ) (B : Frame) (x y : ℝ) : Space := |
| 95 | pack x ((-ρ * x) • B 0 + y • B 1) |
| 96 | |
| 97 | noncomputable def normalMotion (β β' ρ ρ' rot : ℝ) (B : Frame) : Space := |
| 98 | pack (β' * ρ + β * ρ') (β' • B 0 + (β * rot) • B 1) |
| 99 | |
| 100 | noncomputable def tangentMotion (ρ ρ' rot : ℝ) (B : Frame) |
| 101 | (x y x' y' : ℝ) : Space := |
| 102 | pack x' (-(ρ' * x + ρ * x' + rot * y) • B 0 + |
| 103 | (y' - ρ * rot * x) • B 1) |
| 104 | |
| 105 | /-- The exact zeroth-order ambient matrix from the pulse equation. -/ |
| 106 | noncomputable def baseAction (F : ℝ) (g : Plane) (t : Space) : Space := |
| 107 | pack (-2 * F * (tail t) 0) ((t 0) • ((2 * F) • unitTheta + g)) |
| 108 | |
| 109 | theorem normal_ne_zero {β ρ : ℝ} (B : Frame) (hβ : β ≠ 0) : normal β ρ B ≠ 0 := by |
| 110 | intro hz |
| 111 | have ht := congrArg tail hz |
| 112 | have hi := congrArg (fun w : Plane => ⟪B 0, w⟫_ℝ) ht |
| 113 | simp only [normal, tail_pack, show tail (0 : Space) = 0 by ext i; fin_cases i <;> rfl, |
| 114 | inner_smul_right, frame_inner, ite_true, mul_one, inner_zero_right] at hi |
| 115 | exact hβ hi |
| 116 | |
| 117 | @[simp] theorem normal_tangent (β ρ : ℝ) (B : Frame) (x y : ℝ) : |
| 118 | ⟪normal β ρ B, tangent ρ B x y⟫_ℝ = 0 := by |
| 119 | simp only [normal, tangent, inner_pack, real_inner_smul_left, inner_smul_right, inner_add_right, |
| 120 | frame_inner00, frame_inner01, mul_one, mul_zero, add_zero] |
| 121 | ring |
| 122 | |
| 123 | theorem normal_self (β ρ : ℝ) (B : Frame) : |
| 124 | ⟪normal β ρ B, normal β ρ B⟫_ℝ = β ^ 2 * (1 + ρ ^ 2) := by |
| 125 | simp only [normal, inner_pack, real_inner_smul_left, inner_smul_right, |
| 126 | frame_inner00, mul_one] |
| 127 | ring |
| 128 | |
| 129 | theorem normalMotion_tangent (β β' ρ ρ' rot : ℝ) (B : Frame) (x y : ℝ) : |
| 130 | ⟪normalMotion β β' ρ ρ' rot B, tangent ρ B x y⟫_ℝ = |
| 131 | β * (ρ' * x + rot * y) := by |
| 132 | simp only [normalMotion, tangent, inner_pack, inner_add_left, inner_add_right, |
| 133 | real_inner_smul_left, inner_smul_right, frame_inner00, frame_inner01, frame_inner10, |
| 134 | frame_inner11, mul_one, mul_zero, add_zero, zero_add] |
| 135 | ring |
| 136 | |
| 137 | theorem normal_tangentMotion (β ρ ρ' rot : ℝ) (B : Frame) (x y x' y' : ℝ) : |
| 138 | ⟪normal β ρ B, tangentMotion ρ ρ' rot B x y x' y'⟫_ℝ = |
| 139 | -β * (ρ' * x + rot * y) := by |
| 140 | simp only [normal, tangentMotion, inner_pack, inner_add_right, |
| 141 | real_inner_smul_left, inner_smul_right, frame_inner00, frame_inner01, mul_one, mul_zero, add_zero] |
| 142 | ring |
| 143 | |
| 144 | theorem normal_inner (β ρ : ℝ) (B : Frame) (v : Space) : |
| 145 | ⟪normal β ρ B, v⟫_ℝ = β * ρ * v 0 + β * ⟪B 0, tail v⟫_ℝ := by |
| 146 | rw [normal, inner_pack_left, real_inner_smul_left] |
| 147 | |
| 148 | theorem normal_baseAction (β ρ F : ℝ) (B : Frame) (g : Plane) (x y : ℝ) : |
| 149 | ⟪normal β ρ B, baseAction F g (tangent ρ B x y)⟫_ℝ = |
| 150 | β * ((2 * F * (1 + ρ ^ 2) * (B 0) 0 + ⟪B 0, g⟫_ℝ) * x - |
| 151 | 2 * F * ρ * (B 1) 0 * y) := by |
| 152 | simp only [normal, baseAction, tangent, inner_pack, inner_add_right, |
| 153 | real_inner_smul_left, inner_smul_right, inner_unitTheta, tail_pack, pack_zero, PiLp.add_apply, |
| 154 | PiLp.smul_apply, smul_eq_mul] |
| 155 | ring |
| 156 | |
| 157 | /-- Coefficients before subtracting the scalar viscous damping. -/ |
| 158 | noncomputable def coeff11 (ρ ρ' gK : ℝ) : ℝ := ρ * (gK - ρ') / (1 + ρ ^ 2) |
| 159 | noncomputable def coeff12 (F Nθ ρ rot : ℝ) : ℝ := (2 * F * Nθ - ρ * rot) / (1 + ρ ^ 2) |
| 160 | noncomputable def coeff21 (F Nθ gN ρ rot : ℝ) : ℝ := -(2 * F * Nθ + gN) + ρ * rot |
| 161 | |
| 162 | noncomputable def rhsX (F d ρ ρ' rot : ℝ) (B : Frame) (g : Plane) |
| 163 | (f : Space) (x y : ℝ) : ℝ := |
| 164 | (coeff11 ρ ρ' ⟪B 0, g⟫_ℝ - d) * x + coeff12 F ((B 1) 0) ρ rot * y - |
| 165 | (f 0 - ρ * ⟪B 0, tail f⟫_ℝ) / (1 + ρ ^ 2) |
| 166 | |
| 167 | noncomputable def rhsY (F d ρ rot : ℝ) (B : Frame) (g : Plane) |
| 168 | (f : Space) (x y : ℝ) : ℝ := |
| 169 | coeff21 F ((B 1) 0) ⟪B 1, g⟫_ℝ ρ rot * x - d * y - ⟪B 1, tail f⟫_ℝ |
| 170 | |
| 171 | theorem projectedRhs_radial {β : ℝ} (hβ : β ≠ 0) |
| 172 | (β' ρ ρ' rot F d : ℝ) (B : Frame) (g : Plane) (f : Space) (x y : ℝ) : |
| 173 | TangentProjection.projectedRhs (normal β ρ B) (normalMotion β β' ρ ρ' rot B) |
| 174 | (tangent ρ B x y) (baseAction F g (tangent ρ B x y)) f d 0 = |
| 175 | rhsX F d ρ ρ' rot B g f x y := by |
| 176 | have hden : 1 + ρ ^ 2 ≠ 0 := by positivity |
| 177 | rw [TangentProjection.projectedRhs, TangentProjection.tangentProj, |
| 178 | normal_self, normalMotion_tangent, normal_baseAction, normal_inner] |
| 179 | simp only [normal, tangent, baseAction, rhsX, coeff11, coeff12, pack_zero, tail_pack, |
| 180 | PiLp.add_apply, PiLp.sub_apply, PiLp.neg_apply, PiLp.smul_apply, smul_eq_mul] |
| 181 | field_simp ; ring |
| 182 | |
| 183 | theorem projectedRhs_N (β β' ρ ρ' rot F d : ℝ) (B : Frame) (g : Plane) |
| 184 | (f : Space) (x y : ℝ) : |
| 185 | ⟪B 1, tail (TangentProjection.projectedRhs (normal β ρ B) |
| 186 | (normalMotion β β' ρ ρ' rot B) (tangent ρ B x y) |
| 187 | (baseAction F g (tangent ρ B x y)) f d)⟫_ℝ = |
| 188 | rhsY F d ρ rot B g f x y - ρ * rot * x := by |
| 189 | simp only [TangentProjection.projectedRhs, TangentProjection.tangentProj, |
| 190 | tail_sub, tail_add, tail_neg, tail_smul, normal, tangent, baseAction, tail_pack, |
| 191 | pack_zero, rhsY, coeff21, inner_sub_right, inner_add_right, inner_neg_right, |
| 192 | inner_smul_right, inner_unitTheta, frame_inner10, |
| 193 | frame_inner11, mul_one, mul_zero, add_zero, zero_add, sub_zero] |
| 194 | ring |
| 195 | |
| 196 | /-- Exact moving-frame reduction of the ambient projected equation. -/ |
| 197 | theorem projectedRhs_eq_tangentMotion {β : ℝ} (hβ : β ≠ 0) |
| 198 | (β' ρ ρ' rot F d : ℝ) (B : Frame) (g : Plane) (f : Space) (x y : ℝ) : |
| 199 | TangentProjection.projectedRhs (normal β ρ B) (normalMotion β β' ρ ρ' rot B) |
| 200 | (tangent ρ B x y) (baseAction F g (tangent ρ B x y)) f d = |
| 201 | tangentMotion ρ ρ' rot B x y |
| 202 | (rhsX F d ρ ρ' rot B g f x y) (rhsY F d ρ rot B g f x y) := by |
| 203 | apply frame_ext B |
| 204 | · exact projectedRhs_radial hβ β' ρ ρ' rot F d B g f x y |
| 205 | · have hn := TangentProjection.normal_projectedRhs_of_tangent |
| 206 | (normal_ne_zero B hβ) (normalMotion β β' ρ ρ' rot B) (tangent ρ B x y) |
| 207 | (baseAction F g (tangent ρ B x y)) f d (normal_tangent β ρ B x y) |
| 208 | rw [normalMotion_tangent] at hn |
| 209 | have hm := normal_tangentMotion β ρ ρ' rot B x y |
| 210 | (rhsX F d ρ ρ' rot B g f x y) (rhsY F d ρ rot B g f x y) |
| 211 | have heq : ⟪normal β ρ B, |
| 212 | TangentProjection.projectedRhs (normal β ρ B) (normalMotion β β' ρ ρ' rot B) |
| 213 | (tangent ρ B x y) (baseAction F g (tangent ρ B x y)) f d⟫_ℝ = |
| 214 | ⟪normal β ρ B, tangentMotion ρ ρ' rot B x y |
| 215 | (rhsX F d ρ ρ' rot B g f x y) (rhsY F d ρ rot B g f x y)⟫_ℝ := by |
| 216 | rw [hn, hm] |
| 217 | ring |
| 218 | rw [normal_inner, normal_inner] at heq |
| 219 | rw [projectedRhs_radial hβ] at heq |
| 220 | change β * ρ * _ + β * _ = β * ρ * rhsX F d ρ ρ' rot B g f x y + β * _ at heq |
| 221 | exact (mul_left_cancel₀ hβ) (by linarith [heq]) |
| 222 | · rw [projectedRhs_N] |
| 223 | simp only [tangentMotion, tail_pack, inner_add_right, inner_smul_right, |
| 224 | frame_inner10, frame_inner11, mul_zero, mul_one, zero_add] |
| 225 | |
| 226 | /-- The moving-coordinate equation has exactly two scalar equations. -/ |
| 227 | theorem tangentMotion_eq_projectedRhs_iff {β : ℝ} (hβ : β ≠ 0) |
| 228 | (β' ρ ρ' rot F d : ℝ) (B : Frame) (g : Plane) (f : Space) (x y x' y' : ℝ) : |
| 229 | tangentMotion ρ ρ' rot B x y x' y' = |
| 230 | TangentProjection.projectedRhs (normal β ρ B) (normalMotion β β' ρ ρ' rot B) |
| 231 | (tangent ρ B x y) (baseAction F g (tangent ρ B x y)) f d ↔ |
| 232 | x' = rhsX F d ρ ρ' rot B g f x y ∧ y' = rhsY F d ρ rot B g f x y := by |
| 233 | rw [projectedRhs_eq_tangentMotion hβ] |
| 234 | constructor |
| 235 | · intro h |
| 236 | constructor |
| 237 | · exact congrArg (fun v : Space => v 0) h |
| 238 | · have hn := congrArg (fun v : Space => ⟪B 1, tail v⟫_ℝ) h |
| 239 | simp only [tangentMotion, tail_pack, inner_add_right, inner_smul_right, |
| 240 | frame_inner10, frame_inner11, mul_zero, mul_one, zero_add] at hn |
| 241 | linarith |
| 242 | · rintro ⟨rfl, rfl⟩ |
| 243 | rfl |
| 244 | |
| 245 | noncomputable def packCLM : (ℝ × Plane) →L[ℝ] Space := |
| 246 | LinearMap.toContinuousLinearMap { |
| 247 | toFun := fun p => pack p.1 p.2 |
| 248 | map_add' := by |
| 249 | intro u v |
| 250 | ext i |
| 251 | fin_cases i <;> simp [pack] |
| 252 | map_smul' := by |
| 253 | intro c u |
| 254 | ext i |
| 255 | fin_cases i <;> simp [pack] } |
| 256 | |
| 257 | noncomputable def tailCLM : Space →L[ℝ] Plane := |
| 258 | LinearMap.toContinuousLinearMap { |
| 259 | toFun := tail |
| 260 | map_add' := tail_add |
| 261 | map_smul' := tail_smul } |
| 262 | |
| 263 | theorem hasDerivAt_pack {r : ℝ → ℝ} {w : ℝ → Plane} {r' v : ℝ} {w' : Plane} |
| 264 | (hr : HasDerivAt r r' v) (hw : HasDerivAt w w' v) : |
| 265 | HasDerivAt (fun s => pack (r s) (w s)) (pack r' w') v := |
| 266 | packCLM.hasFDerivAt.comp_hasDerivAt v (hr.prodMk hw) |
| 267 | |
| 268 | /-- Differentiation of the actual normal. The frame derivative is measured in |
| 269 | the same moving orthonormal basis. -/ |
| 270 | theorem hasDerivAt_normal {β ρ : ℝ → ℝ} {B : ℝ → Frame} |
| 271 | {v β' ρ' rot : ℝ} (hβ : HasDerivAt β β' v) (hρ : HasDerivAt ρ ρ' v) |
| 272 | (hK : HasDerivAt (fun s => B s 0) (rot • B v 1) v) : |
| 273 | HasDerivAt (fun s => normal (β s) (ρ s) (B s)) |
| 274 | (normalMotion (β v) β' (ρ v) ρ' rot (B v)) v := by |
| 275 | convert! hasDerivAt_pack (hβ.mul hρ) (hβ.smul hK) using 1 |
| 276 | ext i |
| 277 | fin_cases i <;> simp [normalMotion, pack] <;> ring |
| 278 | |
| 279 | /-- Differentiation of the actual tangent parametrization. -/ |
| 280 | theorem hasDerivAt_tangent {ρ x y : ℝ → ℝ} {B : ℝ → Frame} |
| 281 | {v ρ' rot x' y' : ℝ} (hρ : HasDerivAt ρ ρ' v) |
| 282 | (hx : HasDerivAt x x' v) (hy : HasDerivAt y y' v) |
| 283 | (hK : HasDerivAt (fun s => B s 0) (rot • B v 1) v) |
| 284 | (hN : HasDerivAt (fun s => B s 1) (-rot • B v 0) v) : |
| 285 | HasDerivAt (fun s => tangent (ρ s) (B s) (x s) (y s)) |
| 286 | (tangentMotion (ρ v) ρ' rot (B v) (x v) (y v) x' y') v := by |
| 287 | convert! hasDerivAt_pack hx (((hρ.neg.mul hx).smul hK).add (hy.smul hN)) using 1 |
| 288 | ext i |
| 289 | fin_cases i <;> simp [tangentMotion, pack] <;> ring |
| 290 | |
| 291 | /-- The ambient ODE is equivalent to the two explicit coordinate ODEs, using |
| 292 | actual derivatives of the curve and the moving frame. -/ |
| 293 | theorem hasDerivAt_projected_iff {β ρ x y : ℝ → ℝ} {B : ℝ → Frame} |
| 294 | {v β' ρ' rot x' y' F d : ℝ} {g : Plane} {f : Space} |
| 295 | (hβ0 : β v ≠ 0) (hρ : HasDerivAt ρ ρ' v) |
| 296 | (hx : HasDerivAt x x' v) (hy : HasDerivAt y y' v) |
| 297 | (hK : HasDerivAt (fun s => B s 0) (rot • B v 1) v) |
| 298 | (hN : HasDerivAt (fun s => B s 1) (-rot • B v 0) v) : |
| 299 | HasDerivAt (fun s => tangent (ρ s) (B s) (x s) (y s)) |
| 300 | (TangentProjection.projectedRhs (normal (β v) (ρ v) (B v)) |
| 301 | (normalMotion (β v) β' (ρ v) ρ' rot (B v)) |
| 302 | (tangent (ρ v) (B v) (x v) (y v)) |
| 303 | (baseAction F g (tangent (ρ v) (B v) (x v) (y v))) f d) v ↔ |
| 304 | x' = rhsX F d (ρ v) ρ' rot (B v) g f (x v) (y v) ∧ |
| 305 | y' = rhsY F d (ρ v) rot (B v) g f (x v) (y v) := by |
| 306 | have ht := hasDerivAt_tangent hρ hx hy hK hN |
| 307 | rw [← tangentMotion_eq_projectedRhs_iff hβ0] |
| 308 | constructor |
| 309 | · intro h |
| 310 | exact ht.unique h |
| 311 | · intro h |
| 312 | exact h ▸ ht |
| 313 | |
| 314 | /-- Counterclockwise quarter-turn in the angular-axial plane. -/ |
| 315 | noncomputable def quarterTurn : Plane →L[ℝ] Plane := |
| 316 | LinearMap.toContinuousLinearMap { |
| 317 | toFun := fun w => !₂[-w 1, w 0] |
| 318 | map_add' := by |
| 319 | intro u v |
| 320 | ext i |
| 321 | fin_cases i <;> simp |
| 322 | ring |
| 323 | map_smul' := by |
| 324 | intro c u |
| 325 | ext i |
| 326 | fin_cases i <;> simp } |
| 327 | |
| 328 | theorem quarterTurn_square (w : Plane) : quarterTurn (quarterTurn w) = -w := by |
| 329 | ext i |
| 330 | fin_cases i <;> simp [quarterTurn] |
| 331 | |
| 332 | theorem inner_quarterTurn_self (w : Plane) : ⟪w, quarterTurn w⟫_ℝ = 0 := by |
| 333 | simp [quarterTurn, PiLp.inner_apply, Fin.sum_univ_two] |
| 334 | ring |
| 335 | |
| 336 | theorem quarterTurn_inner (u v : Plane) : |
| 337 | ⟪quarterTurn u, quarterTurn v⟫_ℝ = ⟪u, v⟫_ℝ := by |
| 338 | simp [quarterTurn, PiLp.inner_apply, Fin.sum_univ_two] |
| 339 | ring |
| 340 | |
| 341 | theorem unit_pair_orthonormal (K : Plane) (hK : ‖K‖ = 1) : |
| 342 | Orthonormal ℝ ![K, quarterTurn K] := by |
| 343 | apply orthonormal_iff_ite.mpr |
| 344 | intro i j |
| 345 | fin_cases i <;> fin_cases j |
| 346 | · change ⟪K, K⟫_ℝ = 1 |
| 347 | rw [real_inner_self_eq_norm_sq, hK] |
| 348 | norm_num |
| 349 | · change ⟪K, quarterTurn K⟫_ℝ = 0 |
| 350 | exact inner_quarterTurn_self K |
| 351 | · change ⟪quarterTurn K, K⟫_ℝ = 0 |
| 352 | rw [real_inner_comm, inner_quarterTurn_self] |
| 353 | · change ⟪quarterTurn K, quarterTurn K⟫_ℝ = 1 |
| 354 | rw [quarterTurn_inner, real_inner_self_eq_norm_sq, hK] |
| 355 | norm_num |
| 356 | |
| 357 | noncomputable def frameOfUnit (K : Plane) (hK : ‖K‖ = 1) : Frame := |
| 358 | (basisOfOrthonormalOfCardEqFinrank (unit_pair_orthonormal K hK) (by simp [Plane])).toOrthonormalBasis |
| 359 | (by simpa using unit_pair_orthonormal K hK) |
| 360 | |
| 361 | @[simp] theorem frameOfUnit_zero (K : Plane) (hK : ‖K‖ = 1) : frameOfUnit K hK 0 = K := by |
| 362 | simp [frameOfUnit] |
| 363 | |
| 364 | @[simp] theorem frameOfUnit_one (K : Plane) (hK : ‖K‖ = 1) : |
| 365 | frameOfUnit K hK 1 = quarterTurn K := by |
| 366 | simp [frameOfUnit] |
| 367 | |
| 368 | noncomputable def normalScale (n : Space) : ℝ := ‖tail n‖ |
| 369 | noncomputable def radialSlope (n : Space) : ℝ := n 0 / normalScale n |
| 370 | noncomputable def normalDirection (n : Space) : Plane := (normalScale n)⁻¹ • tail n |
| 371 | |
| 372 | theorem normalScale_pos {n : Space} (hn : tail n ≠ 0) : 0 < normalScale n := |
| 373 | norm_pos_iff.mpr hn |
| 374 | |
| 375 | theorem normalDirection_unit {n : Space} (hn : tail n ≠ 0) : ‖normalDirection n‖ = 1 := by |
| 376 | simp only [normalDirection, normalScale, norm_smul, norm_inv, norm_norm] |
| 377 | exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr hn) |
| 378 | |
| 379 | noncomputable def normalFrame (n : Space) (hn : tail n ≠ 0) : Frame := |
| 380 | frameOfUnit (normalDirection n) (normalDirection_unit hn) |
| 381 | |
| 382 | @[simp] theorem normalFrame_zero (n : Space) (hn : tail n ≠ 0) : |
| 383 | normalFrame n hn 0 = normalDirection n := frameOfUnit_zero _ _ |
| 384 | |
| 385 | @[simp] theorem normalFrame_one (n : Space) (hn : tail n ≠ 0) : |
| 386 | normalFrame n hn 1 = quarterTurn (normalDirection n) := frameOfUnit_one _ _ |
| 387 | |
| 388 | /-- Reconstruction of the given normal, not an independent choice of reference |
| 389 | normal. Only its tangential part is required to be nonzero. -/ |
| 390 | theorem normal_reconstructed {n : Space} (hn : tail n ≠ 0) : |
| 391 | normal (normalScale n) (radialSlope n) (normalFrame n hn) = n := by |
| 392 | have hscale : normalScale n ≠ 0 := (normalScale_pos hn).ne' |
| 393 | simp only [normal, radialSlope, normalFrame_zero, normalDirection, |
| 394 | smul_smul, mul_inv_cancel₀ hscale, one_smul] |
| 395 | ext i |
| 396 | fin_cases i |
| 397 | · simp only [Fin.zero_eta, pack_zero] |
| 398 | field_simp |
| 399 | · rfl |
| 400 | · rfl |
| 401 | |
| 402 | section SmoothFrame |
| 403 | |
| 404 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 405 | variable {m : WithTop ℕ∞} {n : E → Space} {q : E} |
| 406 | |
| 407 | theorem contDiffAt_normalScale (hn : ContDiffAt ℝ m n q) (hne : tail (n q) ≠ 0) : |
| 408 | ContDiffAt ℝ m (fun p => normalScale (n p)) q := by |
| 409 | exact (tailCLM.contDiff.contDiffAt.comp q hn).norm ℝ hne |
| 410 | |
| 411 | theorem contDiffAt_radialSlope (hn : ContDiffAt ℝ m n q) (hne : tail (n q) ≠ 0) : |
| 412 | ContDiffAt ℝ m (fun p => radialSlope (n p)) q := by |
| 413 | exact ((PiLp.proj 2 (fun _ : Fin 3 => ℝ) 0).contDiff.contDiffAt.comp q hn).div |
| 414 | (contDiffAt_normalScale hn hne) (normalScale_pos hne).ne' |
| 415 | |
| 416 | theorem contDiffAt_normalDirection (hn : ContDiffAt ℝ m n q) (hne : tail (n q) ≠ 0) : |
| 417 | ContDiffAt ℝ m (fun p => normalDirection (n p)) q := by |
| 418 | exact ((contDiffAt_normalScale hn hne).inv (normalScale_pos hne).ne').smul |
| 419 | (tailCLM.contDiff.contDiffAt.comp q hn) |
| 420 | |
| 421 | theorem contDiffAt_transverseDirection (hn : ContDiffAt ℝ m n q) |
| 422 | (hne : tail (n q) ≠ 0) : |
| 423 | ContDiffAt ℝ m (fun p => quarterTurn (normalDirection (n p))) q := |
| 424 | quarterTurn.contDiff.contDiffAt.comp q (contDiffAt_normalDirection hn hne) |
| 425 | |
| 426 | end SmoothFrame |
| 427 | |
| 428 | /-- The reconstructed directions are jointly smooth functions of the actual |
| 429 | phase normal, away from the axis and zeros of its tangential part. -/ |
| 430 | theorem phase_frame_smooth (ε p pz x0 : ℝ) (F G : PhaseCalculus.Slow → ℝ) |
| 431 | (q : PhaseCalculus.Slot) (hR : q.1.1 ≠ 0) |
| 432 | (hF : ContDiff ℝ ∞ F) (hG : ContDiff ℝ ∞ G) |
| 433 | (hne : tail (PhaseCalculus.phaseNormal ε p pz x0 F G q) ≠ 0) : |
| 434 | ContDiffAt ℝ ∞ (fun r => radialSlope (PhaseCalculus.phaseNormal ε p pz x0 F G r)) q ∧ |
| 435 | ContDiffAt ℝ ∞ (fun r => normalDirection (PhaseCalculus.phaseNormal ε p pz x0 F G r)) q ∧ |
| 436 | ContDiffAt ℝ ∞ |
| 437 | (fun r => quarterTurn (normalDirection (PhaseCalculus.phaseNormal ε p pz x0 F G r))) q := by |
| 438 | have hn := PhaseCalculus.contDiffAt_phaseNormal ε p pz x0 F G q hR hF hG |
| 439 | exact ⟨contDiffAt_radialSlope hn hne, contDiffAt_normalDirection hn hne, |
| 440 | contDiffAt_transverseDirection hn hne⟩ |
| 441 | |
| 442 | /-- A differentiable unit vector has purely rotational derivative in its |
| 443 | orthonormal frame. The angular speed is computed from the derivative. -/ |
| 444 | theorem unit_curve_rotation {K : ℝ → Plane} {K' : Plane} {v : ℝ} |
| 445 | (hK : HasDerivAt K K' v) (hunit : ∀ᶠ s in nhds v, ‖K s‖ = 1) : |
| 446 | K' = ⟪quarterTurn (K v), K'⟫_ℝ • quarterTurn (K v) := by |
| 447 | have hnorm : ‖K v‖ = 1 := Filter.EventuallyEq.eq_of_nhds hunit |
| 448 | have heq : (fun s => ⟪K s, K s⟫_ℝ) =ᶠ[nhds v] (fun _ => (1 : ℝ)) := by |
| 449 | filter_upwards [hunit] with s hs |
| 450 | rw [real_inner_self_eq_norm_sq, hs, one_pow] |
| 451 | have hd := (hasDerivAt_const v (1 : ℝ)).congr_of_eventuallyEq heq |
| 452 | have hh := (hK.inner ℝ hK).unique hd |
| 453 | have horth : ⟪K v, K'⟫_ℝ = 0 := by |
| 454 | rw [real_inner_comm (K v) K'] at hh |
| 455 | linarith |
| 456 | have hb := frame_expand (frameOfUnit (K v) hnorm) K' |
| 457 | simpa only [frameOfUnit_zero, frameOfUnit_one, horth, zero_smul, zero_add] using hb.symm |
| 458 | |
| 459 | /-- Rotation of the second direction is derived, rather than assumed |
| 460 | independently of the first direction. -/ |
| 461 | theorem hasDerivAt_quarterTurn_of_rotation {K : ℝ → Plane} {v rot : ℝ} |
| 462 | (hK : HasDerivAt K (rot • quarterTurn (K v)) v) : |
| 463 | HasDerivAt (fun s => quarterTurn (K s)) (-rot • K v) v := by |
| 464 | have h := quarterTurn.hasFDerivAt.comp_hasDerivAt v hK |
| 465 | simpa only [Function.comp_def, map_smul, quarterTurn_square, smul_neg, neg_smul] using h |
| 466 | |
| 467 | /-- Every differentiable normal with nonzero tangential part supplies the |
| 468 | rotating frame needed by the exact coordinate equation. -/ |
| 469 | theorem reconstructed_frame_hasDerivAt {n : ℝ → Space} {n' : Space} {v : ℝ} |
| 470 | (hn : HasDerivAt n n' v) (hne : tail (n v) ≠ 0) : |
| 471 | ∃ rot : ℝ, |
| 472 | HasDerivAt (fun s => normalDirection (n s)) |
| 473 | (rot • quarterTurn (normalDirection (n v))) v ∧ |
| 474 | HasDerivAt (fun s => quarterTurn (normalDirection (n s))) |
| 475 | (-rot • normalDirection (n v)) v := by |
| 476 | have htail := tailCLM.hasFDerivAt.comp_hasDerivAt v hn |
| 477 | have hscale : HasDerivAt (fun s => normalScale (n s)) |
| 478 | (⟪tail (n v), tail n'⟫_ℝ / normalScale (n v)) v := by |
| 479 | have hsq := htail.norm_sq.sqrt (pow_ne_zero 2 (norm_ne_zero_iff.mpr hne)) |
| 480 | simp only [Function.comp_def, Real.sqrt_sq_eq_abs, abs_norm, |
| 481 | mul_div_mul_left _ _ (by norm_num : (2 : ℝ) ≠ 0)] at hsq |
| 482 | exact hsq |
| 483 | let Kdot : Plane := (normalScale (n v))⁻¹ • tail n' + |
| 484 | (-(⟪tail (n v), tail n'⟫_ℝ / normalScale (n v)) / normalScale (n v) ^ 2) • tail (n v) |
| 485 | have hdir : HasDerivAt (fun s => normalDirection (n s)) Kdot v := |
| 486 | (hscale.inv (normalScale_pos hne).ne').smul htail |
| 487 | have hunit : ∀ᶠ s in nhds v, ‖normalDirection (n s)‖ = 1 := by |
| 488 | have hne' : ∀ᶠ s in nhds v, tail (n s) ≠ 0 := |
| 489 | htail.continuousAt.eventually_ne hne |
| 490 | filter_upwards [hne'] with s hs |
| 491 | exact normalDirection_unit hs |
| 492 | have hrot := unit_curve_rotation hdir hunit |
| 493 | refine ⟨⟪quarterTurn (normalDirection (n v)), Kdot⟫_ℝ, ?_, ?_⟩ |
| 494 | · exact hrot ▸ hdir |
| 495 | · exact hasDerivAt_quarterTurn_of_rotation (hrot ▸ hdir) |
| 496 | |
| 497 | /-! ## Quantitative coefficient comparison -/ |
| 498 | |
| 499 | theorem abs_div_le_of_one_le (a d : ℝ) (hd : 1 ≤ d) : |a / d| ≤ |a| := by |
| 500 | rw [abs_div, abs_of_pos (lt_of_lt_of_le zero_lt_one hd)] |
| 501 | exact (div_le_iff₀ (lt_of_lt_of_le zero_lt_one hd)).2 |
| 502 | (by nlinarith [abs_nonneg a]) |
| 503 | |
| 504 | theorem reciprocal_quadratic_difference (r s : ℝ) : |
| 505 | |1 / (1 + r ^ 2) - 1 / (1 + s ^ 2)| ≤ |r - s| * (|r| + |s|) := by |
| 506 | have hr : 1 + r ^ 2 ≠ 0 := by positivity |
| 507 | have hs : 1 + s ^ 2 ≠ 0 := by positivity |
| 508 | have heq : 1 / (1 + r ^ 2) - 1 / (1 + s ^ 2) = |
| 509 | (s - r) * (s + r) / ((1 + r ^ 2) * (1 + s ^ 2)) := by |
| 510 | field_simp ; ring |
| 511 | rw [heq] |
| 512 | calc |
| 513 | |(s - r) * (s + r) / ((1 + r ^ 2) * (1 + s ^ 2))| ≤ |(s - r) * (s + r)| := |
| 514 | abs_div_le_of_one_le _ _ (by |
| 515 | nlinarith only [sq_nonneg r, sq_nonneg s, mul_nonneg (sq_nonneg r) (sq_nonneg s)]) |
| 516 | _ ≤ |r - s| * (|r| + |s|) := by |
| 517 | rw [abs_mul, abs_sub_comm s r] |
| 518 | exact mul_le_mul_of_nonneg_left (by linarith [abs_add_le s r]) (abs_nonneg _) |
| 519 | |
| 520 | theorem product_perturbation_le {F F0 N N0 M η : ℝ} |
| 521 | (hN : |N| ≤ 1) (hF0 : |F0| ≤ M) |
| 522 | (hF : |F - F0| ≤ η) (hNd : |N - N0| ≤ η) : |
| 523 | |F * N - F0 * N0| ≤ (1 + M) * η := by |
| 524 | have hη : 0 ≤ η := (abs_nonneg _).trans hF |
| 525 | have hM : 0 ≤ M := (abs_nonneg _).trans hF0 |
| 526 | calc |
| 527 | |F * N - F0 * N0| = |(F - F0) * N + F0 * (N - N0)| := by congr 1; ring |
| 528 | _ ≤ |(F - F0) * N| + |F0 * (N - N0)| := abs_add_le _ _ |
| 529 | _ = |F - F0| * |N| + |F0| * |N - N0| := by rw [abs_mul, abs_mul] |
| 530 | _ ≤ η * 1 + M * η := add_le_add |
| 531 | (mul_le_mul hF hN (abs_nonneg _) hη) |
| 532 | (mul_le_mul hF0 hNd (abs_nonneg _) hM) |
| 533 | _ = (1 + M) * η := by ring |
| 534 | |
| 535 | /-- Explicit bounds in geometric coordinates. The four small quantities are |
| 536 | the normal slope error, rotation, radial slope derivative and projected shear. |
| 537 | No coefficient or propagator estimate is included among the assumptions. -/ |
| 538 | theorem scalar_coefficients_close |
| 539 | {F F0 N N0 ρ s ρ' rot gK gN g0 M η : ℝ} |
| 540 | (hM : 1 ≤ M) (hη : 0 ≤ η) (hρ : |ρ| ≤ M) (hs : |s| ≤ M) |
| 541 | (hN : |N| ≤ 1) (hN0 : |N0| ≤ 1) (hF0 : |F0| ≤ M) |
| 542 | (hF : |F - F0| ≤ η) (hNd : |N - N0| ≤ η) (hρd : |ρ - s| ≤ η) |
| 543 | (hρ' : |ρ'| ≤ η) (hrot : |rot| ≤ η) (hgK : |gK| ≤ η) |
| 544 | (hgN : |gN - g0| ≤ η) : |
| 545 | |coeff11 ρ ρ' gK| ≤ 16 * M ^ 2 * η ∧ |
| 546 | |coeff12 F N ρ rot - 2 * F0 * N0 / (1 + s ^ 2)| ≤ 16 * M ^ 2 * η ∧ |
| 547 | |coeff21 F N gN ρ rot - (-(2 * F0 * N0 + g0))| ≤ 16 * M ^ 2 * η := by |
| 548 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 549 | have hprod := product_perturbation_le hN hF0 hF hNd |
| 550 | have hrotation : |ρ * rot| ≤ M * η := by |
| 551 | rw [abs_mul] |
| 552 | exact mul_le_mul hρ hrot (abs_nonneg _) hM0 |
| 553 | have htwoprod : |2 * F * N - 2 * F0 * N0| ≤ 2 * (1 + M) * η := by |
| 554 | calc |
| 555 | |2 * F * N - 2 * F0 * N0| = 2 * |F * N - F0 * N0| := by |
| 556 | calc |
| 557 | _ = |2 * (F * N - F0 * N0)| := by congr 1; ring |
| 558 | _ = _ := by rw [abs_mul, abs_of_pos (show (0 : ℝ) < 2 by norm_num)] |
| 559 | _ ≤ 2 * ((1 + M) * η) := mul_le_mul_of_nonneg_left hprod (by norm_num) |
| 560 | _ = _ := by ring |
| 561 | have hnum : |2 * F * N - ρ * rot - 2 * F0 * N0| ≤ (2 + 3 * M) * η := by |
| 562 | calc |
| 563 | |2 * F * N - ρ * rot - 2 * F0 * N0| = |
| 564 | |(2 * F * N - 2 * F0 * N0) - ρ * rot| := by congr 1; ring |
| 565 | _ ≤ |2 * F * N - 2 * F0 * N0| + |ρ * rot| := abs_sub _ _ |
| 566 | _ ≤ 2 * (1 + M) * η + M * η := add_le_add htwoprod hrotation |
| 567 | _ = _ := by ring |
| 568 | have hinv : |1 / (1 + ρ ^ 2) - 1 / (1 + s ^ 2)| ≤ 2 * M * η := by |
| 569 | calc |
| 570 | _ ≤ |ρ - s| * (|ρ| + |s|) := reciprocal_quadratic_difference ρ s |
| 571 | _ ≤ η * (M + M) := mul_le_mul hρd (add_le_add hρ hs) |
| 572 | (add_nonneg (abs_nonneg _) (abs_nonneg _)) hη |
| 573 | _ = _ := by ring |
| 574 | have hreference : |2 * F0 * N0| ≤ 2 * M := by |
| 575 | rw [abs_mul, abs_mul, abs_of_pos (show (0 : ℝ) < 2 by norm_num)] |
| 576 | calc |
| 577 | 2 * |F0| * |N0| ≤ (2 * M) * 1 := mul_le_mul |
| 578 | (mul_le_mul_of_nonneg_left hF0 (by norm_num)) hN0 (abs_nonneg _) (by positivity) |
| 579 | _ = _ := mul_one _ |
| 580 | constructor |
| 581 | · calc |
| 582 | |coeff11 ρ ρ' gK| ≤ |ρ * (gK - ρ')| := abs_div_le_of_one_le _ _ (by nlinarith only [sq_nonneg ρ]) |
| 583 | _ = |ρ| * |gK - ρ'| := abs_mul _ _ |
| 584 | _ ≤ M * (η + η) := mul_le_mul hρ ((abs_sub _ _).trans (add_le_add hgK hρ')) |
| 585 | (abs_nonneg _) hM0 |
| 586 | _ ≤ 16 * M ^ 2 * η := by |
| 587 | have h := mul_le_mul_of_nonneg_right (show 2 * M ≤ 16 * M ^ 2 by nlinarith only [hM, sq_nonneg (M - 1)]) hη |
| 588 | nlinarith only [h] |
| 589 | constructor |
| 590 | · have hρden : 1 + ρ ^ 2 ≠ 0 := by positivity |
| 591 | have hsden : 1 + s ^ 2 ≠ 0 := by positivity |
| 592 | have heq : coeff12 F N ρ rot - 2 * F0 * N0 / (1 + s ^ 2) = |
| 593 | (2 * F * N - ρ * rot - 2 * F0 * N0) / (1 + ρ ^ 2) + |
| 594 | (2 * F0 * N0) * (1 / (1 + ρ ^ 2) - 1 / (1 + s ^ 2)) := by |
| 595 | unfold coeff12 |
| 596 | field_simp ; ring |
| 597 | rw [heq] |
| 598 | calc |
| 599 | _ ≤ |(2 * F * N - ρ * rot - 2 * F0 * N0) / (1 + ρ ^ 2)| + |
| 600 | |(2 * F0 * N0) * (1 / (1 + ρ ^ 2) - 1 / (1 + s ^ 2))| := abs_add_le _ _ |
| 601 | _ ≤ (2 + 3 * M) * η + (2 * M) * (2 * M * η) := add_le_add |
| 602 | ((abs_div_le_of_one_le _ _ (by nlinarith only [sq_nonneg ρ])).trans hnum) |
| 603 | (by rw [abs_mul]; exact mul_le_mul hreference hinv (abs_nonneg _) (by positivity)) |
| 604 | _ ≤ 16 * M ^ 2 * η := by |
| 605 | have h := mul_le_mul_of_nonneg_right |
| 606 | (show 2 + 3 * M + 4 * M ^ 2 ≤ 16 * M ^ 2 by nlinarith only [hM, sq_nonneg (M - 1)]) hη |
| 607 | nlinarith only [h] |
| 608 | · calc |
| 609 | |coeff21 F N gN ρ rot - (-(2 * F0 * N0 + g0))| = |
| 610 | |-(2 * F * N - 2 * F0 * N0) - (gN - g0) + ρ * rot| := by |
| 611 | unfold coeff21 |
| 612 | congr 1 |
| 613 | ring |
| 614 | _ ≤ |-(2 * F * N - 2 * F0 * N0) - (gN - g0)| + |ρ * rot| := abs_add_le _ _ |
| 615 | _ ≤ (|2 * F * N - 2 * F0 * N0| + |gN - g0|) + |ρ * rot| := by |
| 616 | exact add_le_add_left (by |
| 617 | simpa only [abs_neg] using abs_sub (-(2 * F * N - 2 * F0 * N0)) (gN - g0)) _ |
| 618 | _ ≤ (2 * (1 + M) * η + η) + M * η := add_le_add (add_le_add htwoprod hgN) hrotation |
| 619 | _ ≤ 16 * M ^ 2 * η := by |
| 620 | have h := mul_le_mul_of_nonneg_right (show 3 + 3 * M ≤ 16 * M ^ 2 by nlinarith only [hM, sq_nonneg (M - 1)]) hη |
| 621 | nlinarith only [h] |
| 622 | |
| 623 | theorem inner_perturbation_le {K K0 g g0 : Plane} {M η : ℝ} |
| 624 | (hK : ‖K‖ ≤ 1) (hg0 : ‖g0‖ ≤ M) |
| 625 | (hKd : ‖K - K0‖ ≤ η) (hgd : ‖g - g0‖ ≤ η) : |
| 626 | |⟪K, g⟫_ℝ - ⟪K0, g0⟫_ℝ| ≤ (1 + M) * η := by |
| 627 | have hη : 0 ≤ η := (norm_nonneg _).trans hKd |
| 628 | have hM : 0 ≤ M := (norm_nonneg _).trans hg0 |
| 629 | calc |
| 630 | |⟪K, g⟫_ℝ - ⟪K0, g0⟫_ℝ| = |⟪K, g - g0⟫_ℝ + ⟪K - K0, g0⟫_ℝ| := by |
| 631 | rw [inner_sub_left, inner_sub_right] |
| 632 | congr 1 |
| 633 | ring |
| 634 | _ ≤ |⟪K, g - g0⟫_ℝ| + |⟪K - K0, g0⟫_ℝ| := abs_add_le _ _ |
| 635 | _ ≤ ‖K‖ * ‖g - g0‖ + ‖K - K0‖ * ‖g0‖ := |
| 636 | add_le_add (abs_real_inner_le_norm _ _) (abs_real_inner_le_norm _ _) |
| 637 | _ ≤ 1 * η + η * M := add_le_add |
| 638 | (mul_le_mul hK hgd (norm_nonneg _) zero_le_one) |
| 639 | (mul_le_mul hKd hg0 (norm_nonneg _) hη) |
| 640 | _ = (1 + M) * η := by ring |
| 641 | |
| 642 | theorem frame_coordinate_abs_le_one (B : Frame) (i j : Fin 2) : |B i j| ≤ 1 := by |
| 643 | simpa only [Real.norm_eq_abs, B.norm_eq_one] using PiLp.norm_apply_le (B i) j |
| 644 | |
| 645 | theorem frame_coordinate_difference_le {B B0 : Frame} {i j : Fin 2} {η : ℝ} |
| 646 | (h : ‖B i - B0 i‖ ≤ η) : |B i j - B0 i j| ≤ η := by |
| 647 | have h' := (PiLp.norm_apply_le (B i - B0 i) j).trans h |
| 648 | simpa only [PiLp.sub_apply, Real.norm_eq_abs] using h' |
| 649 | |
| 650 | /-- Norm bounds on actual geometric data imply the matrix comparison. |
| 651 | Taking `η = C / S` gives the required `O(1/S)` with the displayed constant. |
| 652 | The reference shear is perpendicular to the reference normal direction. -/ |
| 653 | theorem frame_coefficients_close {B B0 : Frame} {g g0 : Plane} |
| 654 | {F F0 ρ s ρ' rot M η : ℝ} |
| 655 | (hM : 1 ≤ M) (hη : 0 ≤ η) (hρ : |ρ| ≤ M) (hs : |s| ≤ M) |
| 656 | (hF0 : |F0| ≤ M) (hg0 : ‖g0‖ ≤ M) (horth : ⟪B0 0, g0⟫_ℝ = 0) |
| 657 | (hF : |F - F0| ≤ η) (hg : ‖g - g0‖ ≤ η) |
| 658 | (hK : ‖B 0 - B0 0‖ ≤ η) (hN : ‖B 1 - B0 1‖ ≤ η) |
| 659 | (hρd : |ρ - s| ≤ η) (hρ' : |ρ'| ≤ η) (hrot : |rot| ≤ η) : |
| 660 | |coeff11 ρ ρ' ⟪B 0, g⟫_ℝ| ≤ (16 * M ^ 2 * (1 + M)) * η ∧ |
| 661 | |coeff12 F ((B 1) 0) ρ rot - 2 * F0 * ((B0 1) 0) / (1 + s ^ 2)| ≤ |
| 662 | (16 * M ^ 2 * (1 + M)) * η ∧ |
| 663 | |coeff21 F ((B 1) 0) ⟪B 1, g⟫_ℝ ρ rot - (-(2 * F0 * ((B0 1) 0) + ⟪B0 1, g0⟫_ℝ))| ≤ |
| 664 | (16 * M ^ 2 * (1 + M)) * η := by |
| 665 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 666 | have henlarge : η ≤ (1 + M) * η := by nlinarith only [mul_nonneg hM0 hη] |
| 667 | have hgK := inner_perturbation_le (le_of_eq (B.norm_eq_one 0)) hg0 hK hg |
| 668 | rw [horth, sub_zero] at hgK |
| 669 | have hgN := inner_perturbation_le (le_of_eq (B.norm_eq_one 1)) hg0 hN hg |
| 670 | have h := scalar_coefficients_close hM (hη.trans henlarge) hρ hs |
| 671 | (frame_coordinate_abs_le_one B 1 0) (frame_coordinate_abs_le_one B0 1 0) hF0 |
| 672 | (hF.trans henlarge) ((frame_coordinate_difference_le (j := 0) hN).trans henlarge) |
| 673 | (hρd.trans henlarge) (hρ'.trans henlarge) (hrot.trans henlarge) hgK hgN |
| 674 | simpa only [mul_assoc] using h |
| 675 | |
| 676 | /-! ## The moving eigenbasis, including its derivative -/ |
| 677 | |
| 678 | noncomputable def modal11 (a b c h rate : ℝ) : ℝ := (a + h * b + c / h - rate) / 2 |
| 679 | noncomputable def modal12 (a b c h rate : ℝ) : ℝ := (a - h * b + c / h + rate) / 2 |
| 680 | noncomputable def modal21 (a b c h rate : ℝ) : ℝ := (a + h * b - c / h + rate) / 2 |
| 681 | noncomputable def modal22 (a b c h rate : ℝ) : ℝ := (a - h * b - c / h - rate) / 2 |
| 682 | |
| 683 | /-- Exact change to `x = p + q`, `y = h (p - q)`, with `h' = rate * h`. |
| 684 | Here the reference off-diagonal entries are `λ/h` and `λ*h`, and `a,b,c` |
| 685 | are the three errors already estimated by `frame_coefficients_close`. -/ |
| 686 | theorem modal_equations_iff {h : ℝ} (hh : h ≠ 0) |
| 687 | (p q p' q' lam damping a b c rate fx fy : ℝ) : |
| 688 | (p' + q' = (a - damping) * (p + q) + (lam / h + b) * (h * (p - q)) + fx ∧ |
| 689 | rate * h * (p - q) + h * (p' - q') = |
| 690 | (lam * h + c) * (p + q) - damping * (h * (p - q)) + fy) ↔ |
| 691 | (p' = (lam - damping + modal11 a b c h rate) * p + modal12 a b c h rate * q + |
| 692 | (fx + fy / h) / 2 ∧ |
| 693 | q' = modal21 a b c h rate * p + (-lam - damping + modal22 a b c h rate) * q + |
| 694 | (fx - fy / h) / 2) := by |
| 695 | constructor |
| 696 | · rintro ⟨hx, hy⟩ |
| 697 | constructor |
| 698 | · calc |
| 699 | p' = ((p' + q') + ((rate * h * (p - q) + h * (p' - q')) / h - |
| 700 | rate * (p - q))) / 2 := by field_simp ; ring |
| 701 | _ = _ := by |
| 702 | rw [hx, hy] |
| 703 | unfold modal11 modal12 |
| 704 | field_simp ; ring |
| 705 | · calc |
| 706 | q' = ((p' + q') - ((rate * h * (p - q) + h * (p' - q')) / h - |
| 707 | rate * (p - q))) / 2 := by field_simp ; ring |
| 708 | _ = _ := by |
| 709 | rw [hx, hy] |
| 710 | unfold modal21 modal22 |
| 711 | field_simp ; ring |
| 712 | · rintro ⟨rfl, rfl⟩ |
| 713 | constructor |
| 714 | · unfold modal11 modal12 modal21 modal22 |
| 715 | field_simp ; ring |
| 716 | · unfold modal11 modal12 modal21 modal22 |
| 717 | field_simp ; ring |
| 718 | |
| 719 | noncomputable def pairCLM : (ℝ × ℝ) →L[ℝ] Plane := |
| 720 | LinearMap.toContinuousLinearMap { |
| 721 | toFun := fun z => !₂[z.1, z.2] |
| 722 | map_add' := by intro u v; ext i; fin_cases i <;> simp |
| 723 | map_smul' := by intro c u; ext i; fin_cases i <;> simp } |
| 724 | |
| 725 | /-- Actual differentiation of the moving eigenbasis gives the operator used |
| 726 | by `GrowingMode`; no propagator estimate or cone condition is assumed. -/ |
| 727 | theorem hasDerivAt_modal {p q h : ℝ → ℝ} |
| 728 | {v p' q' lam damping a b c rate fx fy : ℝ} |
| 729 | (hh0 : h v ≠ 0) (hp : HasDerivAt p p' v) (hq : HasDerivAt q q' v) |
| 730 | (hh : HasDerivAt h (rate * h v) v) |
| 731 | (hx : HasDerivAt (fun s => p s + q s) |
| 732 | ((a - damping) * (p v + q v) + (lam / h v + b) * (h v * (p v - q v)) + fx) v) |
| 733 | (hy : HasDerivAt (fun s => h s * (p s - q s)) |
| 734 | ((lam * h v + c) * (p v + q v) - damping * (h v * (p v - q v)) + fy) v) : |
| 735 | HasDerivAt (fun s => !₂[p s, q s]) |
| 736 | (GrowingMode.modalOperator lam damping (modal11 a b c (h v) rate) |
| 737 | (modal12 a b c (h v) rate) (modal21 a b c (h v) rate) |
| 738 | (modal22 a b c (h v) rate) !₂[p v, q v] + |
| 739 | !₂[(fx + fy / h v) / 2, (fx - fy / h v) / 2]) v := by |
| 740 | have hx' := (hp.add hq).unique hx |
| 741 | have hy' := (hh.fun_mul (hp.fun_sub hq)).unique hy |
| 742 | have hsys := (modal_equations_iff hh0 (p v) (q v) p' q' lam damping a b c rate fx fy).mp |
| 743 | ⟨hx', by nlinarith only [hy']⟩ |
| 744 | have hd : HasDerivAt (fun s => !₂[p s, q s]) !₂[p', q'] v := |
| 745 | pairCLM.hasFDerivAt.comp_hasDerivAt v (hp.prodMk hq) |
| 746 | convert! hd using 1 |
| 747 | ext i |
| 748 | fin_cases i <;> simp [hsys.1, hsys.2] |
| 749 | |
| 750 | theorem abs_four_sum_div_two_le {a b c d A B C D : ℝ} |
| 751 | (ha : |a| ≤ A) (hb : |b| ≤ B) (hc : |c| ≤ C) (hd : |d| ≤ D) : |
| 752 | |(a + b + c + d) / 2| ≤ A + B + C + D := by |
| 753 | calc |
| 754 | _ ≤ |a + b + c + d| := abs_div_le_of_one_le _ _ (by norm_num) |
| 755 | _ ≤ |a + b + c| + |d| := abs_add_le _ _ |
| 756 | _ ≤ (|a + b| + |c|) + |d| := add_le_add_left (abs_add_le _ _) _ |
| 757 | _ ≤ ((|a| + |b|) + |c|) + |d| := add_le_add_left (add_le_add_left (abs_add_le _ _) _) _ |
| 758 | _ ≤ A + B + C + D := add_le_add (add_le_add (add_le_add ha hb) hc) hd |
| 759 | |
| 760 | /-- All four modal errors are bounded explicitly. `rate = h'/h` is the |
| 761 | extra error arising from the time-dependent eigenbasis. -/ |
| 762 | theorem modal_errors_le {a b c h rate H δ κ : ℝ} |
| 763 | (hH : 0 ≤ H) |
| 764 | (ha : |a| ≤ δ) (hb : |b| ≤ δ) (hc : |c| ≤ δ) |
| 765 | (hh : |h| ≤ H) (hhi : |1 / h| ≤ H) (hrate : |rate| ≤ κ) : |
| 766 | |modal11 a b c h rate| ≤ (1 + 2 * H) * δ + κ ∧ |
| 767 | |modal12 a b c h rate| ≤ (1 + 2 * H) * δ + κ ∧ |
| 768 | |modal21 a b c h rate| ≤ (1 + 2 * H) * δ + κ ∧ |
| 769 | |modal22 a b c h rate| ≤ (1 + 2 * H) * δ + κ := by |
| 770 | have hhb : |h * b| ≤ H * δ := by rw [abs_mul]; exact mul_le_mul hh hb (abs_nonneg _) hH |
| 771 | have hch : |c / h| ≤ H * δ := by |
| 772 | calc |
| 773 | |c / h| = |1 / h| * |c| := by rw [abs_div, abs_div, abs_one]; ring |
| 774 | _ ≤ H * δ := mul_le_mul hhi hc (abs_nonneg _) hH |
| 775 | have hsum : δ + H * δ + H * δ + κ = (1 + 2 * H) * δ + κ := by ring |
| 776 | have hneg (x A : ℝ) (h : |x| ≤ A) : |-x| ≤ A := by simpa only [abs_neg] using h |
| 777 | refine ⟨?_, ?_, ?_, ?_⟩ |
| 778 | · simpa only [modal11, sub_eq_add_neg, hsum] using abs_four_sum_div_two_le ha hhb hch (hneg _ _ hrate) |
| 779 | · simpa only [modal12, sub_eq_add_neg, hsum] using abs_four_sum_div_two_le ha (hneg _ _ hhb) hch hrate |
| 780 | · simpa only [modal21, sub_eq_add_neg, hsum] using abs_four_sum_div_two_le ha hhb (hneg _ _ hch) hrate |
| 781 | · simpa only [modal22, sub_eq_add_neg, hsum] using |
| 782 | abs_four_sum_div_two_le ha (hneg _ _ hhb) (hneg _ _ hch) (hneg _ _ hrate) |
| 783 | |
| 784 | /-- A tangent ambient vector is recovered from its two coordinate values. -/ |
| 785 | theorem tangent_reconstructed {β ρ : ℝ} (hβ : β ≠ 0) (B : Frame) (t : Space) |
| 786 | (ht : ⟪normal β ρ B, t⟫_ℝ = 0) : |
| 787 | tangent ρ B (t 0) ⟪B 1, tail t⟫_ℝ = t := by |
| 788 | apply frame_ext B |
| 789 | · rfl |
| 790 | · rw [normal_inner] at ht |
| 791 | have hz : β * (ρ * t 0 + ⟪B 0, tail t⟫_ℝ) = 0 := by nlinarith only [ht] |
| 792 | have h := (mul_eq_zero.mp hz).resolve_left hβ |
| 793 | simp only [tangent, tail_pack, inner_add_right, inner_smul_right, |
| 794 | frame_inner00, frame_inner01, mul_one, mul_zero, add_zero] |
| 795 | linarith only [h] |
| 796 | · simp only [tangent, tail_pack, inner_add_right, inner_smul_right, |
| 797 | frame_inner10, frame_inner11, mul_zero, mul_one, zero_add] |
| 798 | |
| 799 | theorem modalOperator_eq_coefficient (lam damping e11 e12 e21 e22 : ℝ) : |
| 800 | GrowingMode.modalOperator lam damping e11 e12 e21 e22 = |
| 801 | ViscousPropagator.coefficient lam damping |
| 802 | (GrowingMode.modalOperator 0 0 e11 e12 e21 e22) := by |
| 803 | ext z i |
| 804 | fin_cases i <;> simp [GrowingMode.modalOperator, ViscousPropagator.coefficient, |
| 805 | ViscousPropagator.diagonal, ViscousPropagator.reflection] <;> ring |
| 806 | |
| 807 | theorem plane_norm_le_coordinate_sum (z : Plane) : ‖z‖ ≤ |z 0| + |z 1| := by |
| 808 | have h := ViscousPropagator.plane_norm_sq z |
| 809 | nlinarith only [h, norm_nonneg z, sq_abs (z 0), sq_abs (z 1), abs_nonneg (z 0), |
| 810 | abs_nonneg (z 1), mul_nonneg (abs_nonneg (z 0)) (abs_nonneg (z 1))] |
| 811 | |
| 812 | /-- Entrywise control gives a genuine Euclidean operator norm estimate. |
| 813 | The harmless factor four avoids any choice of an equivalent matrix norm. -/ |
| 814 | theorem modal_error_opNorm_le {e11 e12 e21 e22 ε : ℝ} |
| 815 | (he11 : |e11| ≤ ε) (he12 : |e12| ≤ ε) (he21 : |e21| ≤ ε) (he22 : |e22| ≤ ε) : |
| 816 | ‖GrowingMode.modalOperator 0 0 e11 e12 e21 e22‖ ≤ 4 * ε := by |
| 817 | have hε : 0 ≤ ε := (abs_nonneg _).trans he11 |
| 818 | apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg (by norm_num) hε) |
| 819 | intro z |
| 820 | have hz (i : Fin 2) : |z i| ≤ ‖z‖ := by |
| 821 | simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le z i |
| 822 | have hrow {a b : ℝ} (ha : |a| ≤ ε) (hb : |b| ≤ ε) : |
| 823 | |a * z 0 + b * z 1| ≤ 2 * ε * ‖z‖ := by |
| 824 | calc |
| 825 | _ ≤ |a * z 0| + |b * z 1| := abs_add_le _ _ |
| 826 | _ = |a| * |z 0| + |b| * |z 1| := by rw [abs_mul, abs_mul] |
| 827 | _ ≤ ε * ‖z‖ + ε * ‖z‖ := add_le_add |
| 828 | (mul_le_mul ha (hz 0) (abs_nonneg _) hε) |
| 829 | (mul_le_mul hb (hz 1) (abs_nonneg _) hε) |
| 830 | _ = _ := by ring |
| 831 | calc |
| 832 | _ ≤ |(GrowingMode.modalOperator 0 0 e11 e12 e21 e22 z) 0| + |
| 833 | |(GrowingMode.modalOperator 0 0 e11 e12 e21 e22 z) 1| := plane_norm_le_coordinate_sum _ |
| 834 | _ = |e11 * z 0 + e12 * z 1| + |e21 * z 0 + e22 * z 1| := by simp |
| 835 | _ ≤ 2 * ε * ‖z‖ + 2 * ε * ‖z‖ := add_le_add (hrow he11 he12) (hrow he21 he22) |
| 836 | _ = _ := by ring |
| 837 | |
| 838 | /-- This is the exact quadratic-form hypothesis accepted by the weighted |
| 839 | propagator and parameter-jet estimates. Scalar viscosity keeps its sign. -/ |
| 840 | theorem modal_energy_le {lam e11 e12 e21 e22 ε : ℝ} (hlam : 0 ≤ lam) (damping : ℝ) |
| 841 | (he11 : |e11| ≤ ε) (he12 : |e12| ≤ ε) (he21 : |e21| ≤ ε) (he22 : |e22| ≤ ε) |
| 842 | (z : Plane) : |
| 843 | ⟪z, GrowingMode.modalOperator lam damping e11 e12 e21 e22 z⟫_ℝ ≤ |
| 844 | (lam - damping + 4 * ε) * ‖z‖ ^ 2 := by |
| 845 | rw [modalOperator_eq_coefficient] |
| 846 | exact (ViscousPropagator.coefficient_energy_le hlam damping _ z).trans |
| 847 | (mul_le_mul_of_nonneg_right |
| 848 | (add_le_add_right (modal_error_opNorm_le he11 he12 he21 he22) _) (sq_nonneg _)) |
| 849 | |
| 850 | end NavierStokes.MovingFrameODE |