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.LocalAxisymmetricResidual |
| 2 | import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv |
| 3 | import Mathlib.Tactic.FieldSimp |
| 4 | import Mathlib.Tactic.Module |
| 5 | import Mathlib.Tactic.LinearCombination |
| 6 | |
| 7 | /-! |
| 8 | # Actual Cartesian differential operators in cylindrical coordinates |
| 9 | |
| 10 | The chart is `(r,theta,z) ↦ (r cos theta,r sin theta,z)`. Coordinate |
| 11 | derivatives are actual Fréchet derivatives. Pulling Cartesian fields back |
| 12 | through this chart avoids choosing a global inverse angular coordinate. |
| 13 | -/ |
| 14 | |
| 15 | namespace NavierStokes.CylindricalResidual |
| 16 | |
| 17 | noncomputable section |
| 18 | |
| 19 | open ProblemStatement Filter |
| 20 | open AxisymmetricFields (projection) |
| 21 | open AxisymmetricResidual (pack pack_zero pack_one pack_two packDerivative |
| 22 | packDerivative_apply hasFDerivAt_pack) |
| 23 | open scoped BigOperators ContDiff Topology |
| 24 | |
| 25 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 26 | variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 27 | |
| 28 | /-- The three arguments are `r`, `theta`, and `z`, respectively. -/ |
| 29 | noncomputable def chart (q : Space) : Space := |
| 30 | pack (q 0 * Real.cos (q 1)) (q 0 * Real.sin (q 1)) (q 2) |
| 31 | |
| 32 | noncomputable def horizontal : Space →L[ℝ] Space := |
| 33 | packDerivative (projection 0) (projection 1) 0 |
| 34 | |
| 35 | /-- Infinitesimal rotation: `(a,b,c) ↦ (-b,a,0)`. -/ |
| 36 | noncomputable def connection : Space →L[ℝ] Space := |
| 37 | packDerivative (-(projection 1)) (projection 0) 0 |
| 38 | |
| 39 | noncomputable def vertical : Space →L[ℝ] Space := |
| 40 | packDerivative 0 0 (projection 2) |
| 41 | |
| 42 | noncomputable def frame (θ : ℝ) : Space →L[ℝ] Space := |
| 43 | Real.cos θ • horizontal + Real.sin θ • connection + vertical |
| 44 | |
| 45 | theorem frame_apply (θ : ℝ) (v : Space) : |
| 46 | frame θ v = pack (Real.cos θ * v 0 - Real.sin θ * v 1) |
| 47 | (Real.sin θ * v 0 + Real.cos θ * v 1) (v 2) := by |
| 48 | ext i |
| 49 | fin_cases i <;> simp [frame, horizontal, connection, vertical, pack, coordinateVector] <;> ring |
| 50 | |
| 51 | theorem connection_apply (v : Space) : connection v = pack (-v 1) (v 0) 0 := by |
| 52 | simp [connection, packDerivative_apply] |
| 53 | |
| 54 | theorem frame_inverse (θ : ℝ) (v : Space) : frame (-θ) (frame θ v) = v := by |
| 55 | ext i |
| 56 | fin_cases i |
| 57 | · simp [frame_apply, Real.cos_neg] |
| 58 | linear_combination (v 0) * Real.cos_sq_add_sin_sq θ |
| 59 | · simp [frame_apply, Real.cos_neg, Real.sin_neg] |
| 60 | linear_combination (v 1) * Real.cos_sq_add_sin_sq θ |
| 61 | · simp [frame_apply] |
| 62 | |
| 63 | theorem frame_inverse' (θ : ℝ) (v : Space) : frame θ (frame (-θ) v) = v := by |
| 64 | simpa only [neg_neg] using frame_inverse (-θ) v |
| 65 | |
| 66 | noncomputable def chartJacobian (q : Space) : Space →L[ℝ] Space := |
| 67 | (frame (q 1)).comp (packDerivative (projection 0) (q 0 • projection 1) (projection 2)) |
| 68 | |
| 69 | theorem chartJacobian_apply (q v : Space) : |
| 70 | chartJacobian q v = frame (q 1) (pack (v 0) (q 0 * v 1) (v 2)) := by |
| 71 | simp [chartJacobian, packDerivative_apply] |
| 72 | |
| 73 | theorem hasFDerivAt_chart (q : Space) : HasFDerivAt chart (chartJacobian q) q := by |
| 74 | have h0 := (projection 0).hasFDerivAt (x := q) |
| 75 | have h1 := (projection 1).hasFDerivAt (x := q) |
| 76 | have h2 := (projection 2).hasFDerivAt (x := q) |
| 77 | convert! hasFDerivAt_pack (h0.mul h1.cos) (h0.mul h1.sin) h2 using 1 |
| 78 | ext v i |
| 79 | fin_cases i <;> simp [chartJacobian_apply, frame_apply] <;> ring |
| 80 | |
| 81 | theorem contDiff_chart {n : WithTop ℕ∞} : ContDiff ℝ n chart := by |
| 82 | unfold chart pack |
| 83 | exact ((((projection 0).contDiff.mul (projection 1).contDiff.cos).smul contDiff_const).add |
| 84 | (((projection 0).contDiff.mul (projection 1).contDiff.sin).smul contDiff_const)).add |
| 85 | ((projection 2).contDiff.smul contDiff_const) |
| 86 | |
| 87 | noncomputable def dCoord (i : Fin 3) (f : Space → E) (q : Space) : E := |
| 88 | fderiv ℝ f q (coordinateVector i) |
| 89 | |
| 90 | noncomputable def euclideanLaplacian (f : Space → E) (x : Space) : E := |
| 91 | ∑ i : Fin 3, dCoord i (dCoord i f) x |
| 92 | |
| 93 | noncomputable def scalarLaplacian (f : Space → E) (q : Space) : E := |
| 94 | dCoord 0 (dCoord 0 f) q + (q 0)⁻¹ • dCoord 0 f q + |
| 95 | ((q 0) ^ 2)⁻¹ • dCoord 1 (dCoord 1 f) q + dCoord 2 (dCoord 2 f) q |
| 96 | |
| 97 | theorem contDiffAt_dCoord {f : Space → E} {q : Space} {m n : WithTop ℕ∞} |
| 98 | (hf : ContDiffAt ℝ n f q) (hmn : m + 1 ≤ n) (i : Fin 3) : |
| 99 | ContDiffAt ℝ m (dCoord i f) q := |
| 100 | (hf.fderiv_right hmn).clm_apply contDiffAt_const |
| 101 | |
| 102 | theorem dCoord_congr {f g : Space → E} {q : Space} |
| 103 | (h : f =ᶠ[𝓝 q] g) (i : Fin 3) : dCoord i f q = dCoord i g q := by |
| 104 | unfold dCoord |
| 105 | rw [h.fderiv_eq] |
| 106 | |
| 107 | theorem dCoord_add {f g : Space → E} {q : Space} |
| 108 | (hf : DifferentiableAt ℝ f q) (hg : DifferentiableAt ℝ g q) (i : Fin 3) : |
| 109 | dCoord i (fun y => f y + g y) q = dCoord i f q + dCoord i g q := by |
| 110 | unfold dCoord |
| 111 | rw [fderiv_fun_add hf hg] |
| 112 | rfl |
| 113 | |
| 114 | theorem dCoord_map (L : E →L[ℝ] F) {f : Space → E} {q : Space} |
| 115 | (hf : DifferentiableAt ℝ f q) (i : Fin 3) : |
| 116 | dCoord i (fun y => L (f y)) q = L (dCoord i f q) := by |
| 117 | unfold dCoord |
| 118 | change (fderiv ℝ (L ∘ f) q) _ = _ |
| 119 | rw [(L.hasFDerivAt.comp q hf.hasFDerivAt).fderiv] |
| 120 | rfl |
| 121 | |
| 122 | theorem fderiv_pullback {f : Space → E} {q : Space} |
| 123 | (hf : DifferentiableAt ℝ f (chart q)) (v : Space) : |
| 124 | fderiv ℝ (fun y => f (chart y)) q v = fderiv ℝ f (chart q) (chartJacobian q v) := by |
| 125 | change (fderiv ℝ (f ∘ chart) q) _ = _ |
| 126 | rw [(hf.hasFDerivAt.comp q (hasFDerivAt_chart q)).fderiv] |
| 127 | rfl |
| 128 | |
| 129 | /-- Resolve a Cartesian vector into chart-coordinate components. -/ |
| 130 | noncomputable def chartVector (q v : Space) : Space := |
| 131 | let w := frame (-(q 1)) v |
| 132 | pack (w 0) (w 1 / q 0) (w 2) |
| 133 | |
| 134 | theorem chartJacobian_chartVector (q v : Space) (hr : q 0 ≠ 0) : |
| 135 | chartJacobian q (chartVector q v) = v := by |
| 136 | rw [chartJacobian_apply] |
| 137 | have hpack : pack ((chartVector q v) 0) (q 0 * (chartVector q v) 1) |
| 138 | ((chartVector q v) 2) = frame (-(q 1)) v := by |
| 139 | ext i |
| 140 | fin_cases i <;> simp [chartVector, hr, mul_div_cancel₀] |
| 141 | rw [hpack, frame_inverse'] |
| 142 | |
| 143 | /-- Exact first-order bridge from ordinary Cartesian derivatives. -/ |
| 144 | theorem cartesian_derivative_from_pullback {f : Space → E} {q : Space} |
| 145 | (hf : DifferentiableAt ℝ f (chart q)) (hr : q 0 ≠ 0) (v : Space) : |
| 146 | fderiv ℝ f (chart q) v = |
| 147 | fderiv ℝ (fun y => f (chart y)) q (chartVector q v) := by |
| 148 | rw [fderiv_pullback hf, chartJacobian_chartVector q v hr] |
| 149 | |
| 150 | /-- The actual second Fréchet derivative, with the two directions displayed. -/ |
| 151 | noncomputable def hessian (f : Space → E) (x v w : Space) : E := |
| 152 | fderiv ℝ (fderiv ℝ f) x v w |
| 153 | |
| 154 | theorem dCoord_dCoord {f : Space → E} {q : Space} |
| 155 | (hf : ContDiffAt ℝ 2 f q) (i : Fin 3) : |
| 156 | dCoord i (dCoord i f) q = hessian f q (coordinateVector i) (coordinateVector i) := by |
| 157 | have hD : DifferentiableAt ℝ (fderiv ℝ f) q := |
| 158 | (hf.fderiv_right (m := 1) (by norm_num)).differentiableAt (by norm_num) |
| 159 | unfold dCoord hessian |
| 160 | rw [fderiv_clm_apply hD (differentiableAt_const _)] |
| 161 | simp |
| 162 | |
| 163 | theorem second_chain {f : Space → E} {g : Space → Space} {q : Space} |
| 164 | (hf : ContDiffAt ℝ 2 f (g q)) (hg : ContDiffAt ℝ 2 g q) (i : Fin 3) : |
| 165 | dCoord i (dCoord i (f ∘ g)) q = |
| 166 | hessian f (g q) (dCoord i g q) (dCoord i g q) + |
| 167 | fderiv ℝ f (g q) (dCoord i (dCoord i g) q) := by |
| 168 | have hnear : dCoord i (f ∘ g) =ᶠ[𝓝 q] |
| 169 | fun y => fderiv ℝ f (g y) (dCoord i g y) := by |
| 170 | have hfnear : ∀ᶠ y in 𝓝 q, ContDiffAt ℝ 2 f (g y) := |
| 171 | hg.continuousAt (hf.eventually (by norm_num)) |
| 172 | filter_upwards [hfnear, hg.eventually (by norm_num)] with y hyf hyg |
| 173 | exact congrArg (fun L : Space →L[ℝ] E => L (coordinateVector i)) |
| 174 | ((hyf.differentiableAt (by norm_num)).hasFDerivAt.comp y |
| 175 | (hyg.differentiableAt (by norm_num)).hasFDerivAt).fderiv |
| 176 | rw [dCoord_congr hnear] |
| 177 | have hD := (hf.fderiv_right (m := 1) (by norm_num)).differentiableAt (by norm_num) |
| 178 | have hgD := hg.differentiableAt (by norm_num) |
| 179 | have hDi := (contDiffAt_dCoord hg (m := 1) (by norm_num) i).differentiableAt (by norm_num) |
| 180 | change (fderiv ℝ (fun y => ((fderiv ℝ f) ∘ g) y (dCoord i g y)) q) |
| 181 | (coordinateVector i) = _ |
| 182 | rw [fderiv_clm_apply (hD.comp q hgD) hDi] |
| 183 | rw [show fderiv ℝ ((fderiv ℝ f) ∘ g) q = |
| 184 | (fderiv ℝ (fderiv ℝ f) (g q)).comp (fderiv ℝ g q) from |
| 185 | (hD.hasFDerivAt.comp q hgD.hasFDerivAt).fderiv] |
| 186 | simp [dCoord, hessian, add_comm] |
| 187 | |
| 188 | theorem dCoord_chart_zero (q : Space) : |
| 189 | dCoord 0 chart q = pack (Real.cos (q 1)) (Real.sin (q 1)) 0 := by |
| 190 | simp [dCoord, (hasFDerivAt_chart q).fderiv, chartJacobian_apply, frame_apply, |
| 191 | coordinateVector] |
| 192 | |
| 193 | theorem dCoord_chart_one (q : Space) : |
| 194 | dCoord 1 chart q = pack (-(q 0) * Real.sin (q 1)) (q 0 * Real.cos (q 1)) 0 := by |
| 195 | simp [dCoord, (hasFDerivAt_chart q).fderiv, chartJacobian_apply, frame_apply, |
| 196 | coordinateVector] |
| 197 | ring_nf |
| 198 | |
| 199 | theorem dCoord_chart_two (q : Space) : dCoord 2 chart q = coordinateVector 2 := by |
| 200 | simp [dCoord, (hasFDerivAt_chart q).fderiv, chartJacobian_apply, frame_apply, |
| 201 | coordinateVector, pack] |
| 202 | |
| 203 | theorem dCoord_dCoord_chart_zero (q : Space) : dCoord 0 (dCoord 0 chart) q = 0 := by |
| 204 | rw [show dCoord 0 chart = fun y => pack (Real.cos (y 1)) (Real.sin (y 1)) 0 from |
| 205 | funext dCoord_chart_zero] |
| 206 | have h1 : HasFDerivAt (fun y : Space => y 1) (projection 1) q := |
| 207 | (projection 1).hasFDerivAt |
| 208 | have hz : HasFDerivAt (fun _ : Space => (0 : ℝ)) 0 q := hasFDerivAt_const (𝕜 := ℝ) 0 q |
| 209 | unfold dCoord |
| 210 | rw [(hasFDerivAt_pack h1.cos h1.sin hz).fderiv] |
| 211 | simp [packDerivative_apply, coordinateVector, pack] |
| 212 | |
| 213 | theorem dCoord_dCoord_chart_one (q : Space) : |
| 214 | dCoord 1 (dCoord 1 chart) q = -(q 0) • dCoord 0 chart q := by |
| 215 | rw [show dCoord 1 chart = fun y => |
| 216 | pack (-(y 0) * Real.sin (y 1)) (y 0 * Real.cos (y 1)) 0 from |
| 217 | funext dCoord_chart_one] |
| 218 | have h0 : HasFDerivAt (fun y : Space => y 0) (projection 0) q := |
| 219 | (projection 0).hasFDerivAt |
| 220 | have h1 : HasFDerivAt (fun y : Space => y 1) (projection 1) q := |
| 221 | (projection 1).hasFDerivAt |
| 222 | have hz : HasFDerivAt (fun _ : Space => (0 : ℝ)) 0 q := hasFDerivAt_const (𝕜 := ℝ) 0 q |
| 223 | change (fderiv ℝ (fun y => pack (-y 0 * Real.sin (y 1)) |
| 224 | (y 0 * Real.cos (y 1)) 0) q) _ = _ |
| 225 | rw [(hasFDerivAt_pack (h0.fun_neg.fun_mul h1.sin) (h0.fun_mul h1.cos) hz).fderiv, |
| 226 | dCoord_chart_zero] |
| 227 | ext i |
| 228 | fin_cases i <;> simp [packDerivative_apply, coordinateVector] |
| 229 | |
| 230 | theorem dCoord_dCoord_chart_two (q : Space) : dCoord 2 (dCoord 2 chart) q = 0 := by |
| 231 | rw [show dCoord 2 chart = fun _ => coordinateVector 2 from funext dCoord_chart_two] |
| 232 | simp [dCoord] |
| 233 | |
| 234 | theorem dCoord_pullback {f : Space → E} {q : Space} |
| 235 | (hf : DifferentiableAt ℝ f (chart q)) (i : Fin 3) : |
| 236 | dCoord i (f ∘ chart) q = |
| 237 | fderiv ℝ f (chart q) (dCoord i chart q) := by |
| 238 | simpa only [dCoord, Function.comp_def, (hasFDerivAt_chart q).fderiv] using |
| 239 | fderiv_pullback hf (coordinateVector i) |
| 240 | |
| 241 | /-- The cylindrical scalar Laplacian is the pullback of the Cartesian trace. -/ |
| 242 | theorem scalarLaplacian_pullback {f : Space → E} {q : Space} |
| 243 | (hf : ContDiffAt ℝ 2 f (chart q)) (hr : q 0 ≠ 0) : |
| 244 | scalarLaplacian (fun y => f (chart y)) q = euclideanLaplacian f (chart q) := by |
| 245 | have hc : ContDiffAt ℝ 2 chart q := contDiff_chart.contDiffAt |
| 246 | change scalarLaplacian (f ∘ chart) q = _ |
| 247 | unfold scalarLaplacian euclideanLaplacian |
| 248 | rw [second_chain hf hc 0, second_chain hf hc 1, second_chain hf hc 2, |
| 249 | dCoord_pullback (hf.differentiableAt (by norm_num)) 0, |
| 250 | dCoord_dCoord_chart_zero, dCoord_dCoord_chart_one, dCoord_dCoord_chart_two] |
| 251 | simp only [Fin.sum_univ_three, dCoord_dCoord hf, dCoord_chart_zero, |
| 252 | dCoord_chart_one, dCoord_chart_two, hessian, pack, map_add, map_smul, |
| 253 | map_zero, _root_.add_apply, _root_.smul_apply, |
| 254 | zero_smul, add_zero] |
| 255 | match_scalars <;> field_simp [hr] <;> linarith [Real.cos_sq_add_sin_sq (q 1)] |
| 256 | |
| 257 | theorem contDiff_frame {n : WithTop ℕ∞} : ContDiff ℝ n frame := by |
| 258 | unfold frame |
| 259 | exact ((contDiff_id.cos.smul contDiff_const).add |
| 260 | (contDiff_id.sin.smul contDiff_const)).add contDiff_const |
| 261 | |
| 262 | theorem hasFDerivAt_frameField (q : Space) : |
| 263 | HasFDerivAt (fun y : Space => frame (y 1)) |
| 264 | ((projection 1).smulRight ((frame (q 1)).comp connection)) q := by |
| 265 | have h1 : HasFDerivAt (fun y : Space => y 1) (projection 1) q := |
| 266 | (projection 1).hasFDerivAt |
| 267 | convert! ((h1.cos.smul_const horizontal).add (h1.sin.smul_const connection)).add_const |
| 268 | vertical using 1 |
| 269 | ext v w i |
| 270 | fin_cases i <;> simp [ frame_apply, horizontal, connection, pack, coordinateVector] <;> ring |
| 271 | |
| 272 | /-- Cartesian representation of cylindrical vector components. -/ |
| 273 | noncomputable def encode (w : Space → Space) (q : Space) : Space := frame (q 1) (w q) |
| 274 | |
| 275 | theorem fderiv_encode {w : Space → Space} {q : Space} |
| 276 | (hw : DifferentiableAt ℝ w q) (v : Space) : |
| 277 | fderiv ℝ (encode w) q v = |
| 278 | frame (q 1) (fderiv ℝ w q v + v 1 • connection (w q)) := by |
| 279 | unfold encode |
| 280 | rw [((hasFDerivAt_frameField q).clm_apply hw.hasFDerivAt).fderiv] |
| 281 | simp [map_add, map_smul] |
| 282 | |
| 283 | theorem dCoord_encode {w : Space → Space} {q : Space} |
| 284 | (hw : DifferentiableAt ℝ w q) (i : Fin 3) : |
| 285 | dCoord i (encode w) q = |
| 286 | frame (q 1) (dCoord i w q + (coordinateVector i) 1 • connection (w q)) := |
| 287 | fderiv_encode hw (coordinateVector i) |
| 288 | |
| 289 | theorem dCoord_const_smul {f : Space → E} {q : Space} |
| 290 | (hf : DifferentiableAt ℝ f q) (a : ℝ) (i : Fin 3) : |
| 291 | dCoord i (fun y => a • f y) q = a • dCoord i f q := by |
| 292 | unfold dCoord |
| 293 | rw [fderiv_fun_const_smul hf a] |
| 294 | rfl |
| 295 | |
| 296 | theorem dCoord_dCoord_encode {w : Space → Space} {q : Space} |
| 297 | (hw : ContDiffAt ℝ 2 w q) (i : Fin 3) : |
| 298 | dCoord i (dCoord i (encode w)) q = frame (q 1) |
| 299 | (dCoord i (dCoord i w) q + |
| 300 | (2 * (coordinateVector i) 1) • connection (dCoord i w q) + |
| 301 | ((coordinateVector i) 1) ^ 2 • connection (connection (w q))) := by |
| 302 | have hwD := hw.differentiableAt (by norm_num) |
| 303 | have hDi := (contDiffAt_dCoord hw (m := 1) (by norm_num) i).differentiableAt (by norm_num) |
| 304 | have hJ : DifferentiableAt ℝ (fun y => connection (w y)) q := |
| 305 | connection.differentiableAt.comp q hwD |
| 306 | have hnear : dCoord i (encode w) =ᶠ[𝓝 q] |
| 307 | encode (fun y => dCoord i w y + (coordinateVector i) 1 • connection (w y)) := by |
| 308 | filter_upwards [hw.eventually (by norm_num)] with y hy |
| 309 | exact dCoord_encode (hy.differentiableAt (by norm_num)) i |
| 310 | rw [dCoord_congr hnear i, |
| 311 | dCoord_encode (hDi.fun_add (hJ.fun_const_smul _)) i, |
| 312 | dCoord_add hDi (hJ.fun_const_smul _) i, |
| 313 | dCoord_const_smul hJ _ i, dCoord_map connection hwD i] |
| 314 | congr 1 |
| 315 | simp only [map_add, map_smul] |
| 316 | module |
| 317 | |
| 318 | /-- Vector Laplacian of physical components in the moving cylindrical basis. -/ |
| 319 | noncomputable def vectorLaplacian (w : Space → Space) (q : Space) : Space := |
| 320 | scalarLaplacian w q + (2 / (q 0) ^ 2) • connection (dCoord 1 w q) + |
| 321 | ((q 0) ^ 2)⁻¹ • connection (connection (w q)) |
| 322 | |
| 323 | theorem scalarLaplacian_encode {w : Space → Space} {q : Space} |
| 324 | (hw : ContDiffAt ℝ 2 w q) : |
| 325 | scalarLaplacian (encode w) q = frame (q 1) (vectorLaplacian w q) := by |
| 326 | unfold scalarLaplacian vectorLaplacian |
| 327 | rw [dCoord_dCoord_encode hw 0, dCoord_dCoord_encode hw 1, |
| 328 | dCoord_dCoord_encode hw 2, dCoord_encode (hw.differentiableAt (by norm_num)) 0] |
| 329 | simp only [coordinateVector, PiLp.single_apply, ↓reduceIte, Fin.reduceEq, mul_zero, zero_smul, zero_pow (by norm_num : 2 ≠ 0), |
| 330 | add_zero, mul_one, one_pow, one_smul, map_add, map_smul] |
| 331 | simp only [scalarLaplacian, map_add, map_smul] |
| 332 | module |
| 333 | |
| 334 | /-- Cylindrical components of an arbitrary Cartesian vector field. -/ |
| 335 | noncomputable def components (f : Space → Space) (q : Space) : Space := |
| 336 | frame (-(q 1)) (f (chart q)) |
| 337 | |
| 338 | theorem encode_components (f : Space → Space) : |
| 339 | encode (components f) = fun q => f (chart q) := by |
| 340 | funext q |
| 341 | exact frame_inverse' (q 1) (f (chart q)) |
| 342 | |
| 343 | theorem differentiableAt_components {f : Space → Space} {q : Space} |
| 344 | (hf : DifferentiableAt ℝ f (chart q)) : DifferentiableAt ℝ (components f) q := |
| 345 | (((contDiff_frame (n := 1)).differentiable (by norm_num) _).comp q |
| 346 | (projection 1).differentiableAt.neg).clm_apply |
| 347 | (hf.comp q (hasFDerivAt_chart q).differentiableAt) |
| 348 | |
| 349 | theorem contDiffAt_components {f : Space → Space} {q : Space} {n : WithTop ℕ∞} |
| 350 | (hf : ContDiffAt ℝ n f (chart q)) : ContDiffAt ℝ n (components f) q := |
| 351 | (contDiff_frame.contDiffAt.comp q (projection 1).contDiff.contDiffAt.neg).clm_apply |
| 352 | (hf.comp q contDiff_chart.contDiffAt) |
| 353 | |
| 354 | theorem cartesianLaplacian_components {f : Space → Space} {q : Space} |
| 355 | (hf : ContDiffAt ℝ 2 f (chart q)) (hr : q 0 ≠ 0) : |
| 356 | euclideanLaplacian f (chart q) = frame (q 1) (vectorLaplacian (components f) q) := by |
| 357 | rw [← scalarLaplacian_pullback hf hr, ← encode_components, |
| 358 | scalarLaplacian_encode (contDiffAt_components hf)] |
| 359 | |
| 360 | theorem fderiv_pack (f : Space → E) (q : Space) (a b c : ℝ) : |
| 361 | fderiv ℝ f q (pack a b c) = |
| 362 | a • dCoord 0 f q + b • dCoord 1 f q + c • dCoord 2 f q := by |
| 363 | simp [pack, dCoord] |
| 364 | |
| 365 | /-- Cartesian directional differentiation, resolved in the cylindrical frame. -/ |
| 366 | theorem cartesianDerivative_components {f : Space → Space} {q : Space} |
| 367 | (hf : DifferentiableAt ℝ f (chart q)) (hr : q 0 ≠ 0) (b : Space) : |
| 368 | frame (-(q 1)) (fderiv ℝ f (chart q) (frame (q 1) b)) = |
| 369 | b 0 • dCoord 0 (components f) q + |
| 370 | (b 1 / q 0) • (dCoord 1 (components f) q + connection (components f q)) + |
| 371 | b 2 • dCoord 2 (components f) q := by |
| 372 | rw [cartesian_derivative_from_pullback hf hr, ← encode_components, |
| 373 | fderiv_encode (differentiableAt_components hf), frame_inverse] |
| 374 | simp only [chartVector, frame_inverse, fderiv_pack, pack_one] |
| 375 | module |
| 376 | |
| 377 | noncomputable def vectorAdvection (w : Space → Space) (q : Space) : Space := |
| 378 | w q 0 • dCoord 0 w q + (w q 1 / q 0) • (dCoord 1 w q + connection (w q)) + |
| 379 | w q 2 • dCoord 2 w q |
| 380 | |
| 381 | theorem cartesianAdvection_components {f : Space → Space} {q : Space} |
| 382 | (hf : DifferentiableAt ℝ f (chart q)) (hr : q 0 ≠ 0) : |
| 383 | fderiv ℝ f (chart q) (f (chart q)) = |
| 384 | frame (q 1) (vectorAdvection (components f) q) := by |
| 385 | have h := cartesianDerivative_components hf hr (components f q) |
| 386 | have hrec : frame (q 1) (components f q) = f (chart q) := frame_inverse' _ _ |
| 387 | rw [hrec] at h |
| 388 | unfold vectorAdvection |
| 389 | rw [← h, frame_inverse'] |
| 390 | |
| 391 | noncomputable def euclideanDivergence (f : Space → Space) (x : Space) : ℝ := |
| 392 | ∑ i : Fin 3, (fderiv ℝ f x (coordinateVector i)) i |
| 393 | |
| 394 | noncomputable def vectorDivergence (w : Space → Space) (q : Space) : ℝ := |
| 395 | (dCoord 0 w q) 0 + w q 0 / q 0 + (dCoord 1 w q) 1 / q 0 + (dCoord 2 w q) 2 |
| 396 | |
| 397 | theorem trace_rotation (A : Space →L[ℝ] Space) (θ : ℝ) : |
| 398 | (∑ i : Fin 3, (A (coordinateVector i)) i) = |
| 399 | ∑ i : Fin 3, (frame (-θ) (A (frame θ (coordinateVector i)))) i := by |
| 400 | simp [Fin.sum_univ_three, frame_apply, pack, coordinateVector] |
| 401 | linear_combination -((A (EuclideanSpace.single 0 1)) 0 + |
| 402 | (A (EuclideanSpace.single 1 1)) 1) * Real.cos_sq_add_sin_sq θ |
| 403 | |
| 404 | theorem cartesianDivergence_components {f : Space → Space} {q : Space} |
| 405 | (hf : DifferentiableAt ℝ f (chart q)) (hr : q 0 ≠ 0) : |
| 406 | euclideanDivergence f (chart q) = vectorDivergence (components f) q := by |
| 407 | unfold euclideanDivergence |
| 408 | rw [trace_rotation _ (q 1)] |
| 409 | simp_rw [cartesianDerivative_components hf hr] |
| 410 | simp [Fin.sum_univ_three, vectorDivergence, coordinateVector, connection_apply] |
| 411 | ring |
| 412 | |
| 413 | noncomputable def euclideanGradient (f : Space → ℝ) (x : Space) : Space := |
| 414 | ∑ i : Fin 3, dCoord i f x • coordinateVector i |
| 415 | |
| 416 | noncomputable def scalarGradient (f : Space → ℝ) (q : Space) : Space := |
| 417 | pack (dCoord 0 f q) (dCoord 1 f q / q 0) (dCoord 2 f q) |
| 418 | |
| 419 | theorem cartesianGradient_pullback {f : Space → ℝ} {q : Space} |
| 420 | (hf : DifferentiableAt ℝ f (chart q)) (hr : q 0 ≠ 0) : |
| 421 | euclideanGradient f (chart q) = frame (q 1) (scalarGradient (f ∘ chart) q) := by |
| 422 | unfold scalarGradient |
| 423 | rw [dCoord_pullback hf 0, dCoord_pullback hf 1, dCoord_pullback hf 2] |
| 424 | rw [dCoord_chart_zero, dCoord_chart_one, dCoord_chart_two] |
| 425 | ext i |
| 426 | fin_cases i |
| 427 | · simp [euclideanGradient, Fin.sum_univ_three, frame_apply, pack, dCoord, coordinateVector] |
| 428 | field_simp [hr] |
| 429 | linear_combination -(fderiv ℝ f (chart q) (EuclideanSpace.single 0 1)) * |
| 430 | Real.cos_sq_add_sin_sq (q 1) |
| 431 | · simp [euclideanGradient, Fin.sum_univ_three, frame_apply, pack, dCoord, coordinateVector] |
| 432 | field_simp [hr] |
| 433 | linear_combination -(fderiv ℝ f (chart q) (EuclideanSpace.single 1 1)) * |
| 434 | Real.cos_sq_add_sin_sq (q 1) |
| 435 | · simp [euclideanGradient, Fin.sum_univ_three, frame_apply, |
| 436 | dCoord, coordinateVector] |
| 437 | |
| 438 | /-- Pullback of a time-dependent velocity into the moving cylindrical frame. -/ |
| 439 | noncomputable def velocityComponents (u : VelocityField) : VelocityField := |
| 440 | fun tq => components (fun x => u (tq.1, x)) tq.2 |
| 441 | |
| 442 | noncomputable def pressurePullback (p : PressureField) : PressureField := |
| 443 | fun tq => p (tq.1, chart tq.2) |
| 444 | |
| 445 | noncomputable def cylindricalResidual (w : VelocityField) (p : PressureField) |
| 446 | (t : ℝ) (q : Space) : Space := |
| 447 | temporalDerivative w t q + vectorAdvection (fun y => w (t, y)) q - |
| 448 | vectorLaplacian (fun y => w (t, y)) q + scalarGradient (fun y => p (t, y)) q |
| 449 | |
| 450 | theorem temporalDerivative_components {u : VelocityField} {t : ℝ} {q : Space} |
| 451 | (ht : DifferentiableAt ℝ (fun s => u (s, chart q)) t) : |
| 452 | temporalDerivative (velocityComponents u) t q = |
| 453 | frame (-(q 1)) (temporalDerivative u t (chart q)) := by |
| 454 | unfold temporalDerivative velocityComponents components |
| 455 | change (fderiv ℝ ((frame (-(q 1))) ∘ (fun s => u (s, chart q))) t) 1 = _ |
| 456 | rw [((frame (-(q 1))).hasFDerivAt.comp t ht.hasFDerivAt).fderiv] |
| 457 | rfl |
| 458 | |
| 459 | /-- The full actual Cartesian Navier--Stokes residual, under local regularity. -/ |
| 460 | theorem navierStokesResidual_cylindrical_of_slices |
| 461 | {u : VelocityField} {p : PressureField} {t : ℝ} {q : Space} |
| 462 | (hu : ContDiffAt ℝ 2 (fun x => u (t, x)) (chart q)) |
| 463 | (ht : DifferentiableAt ℝ (fun s => u (s, chart q)) t) |
| 464 | (hp : DifferentiableAt ℝ (fun x => p (t, x)) (chart q)) |
| 465 | (hr : 0 < q 0) : |
| 466 | navierStokesResidual u p t (chart q) = |
| 467 | frame (q 1) (cylindricalResidual (velocityComponents u) (pressurePullback p) t q) := by |
| 468 | have hr' : q 0 ≠ 0 := ne_of_gt hr |
| 469 | have huD := hu.differentiableAt (by norm_num) |
| 470 | have ht' : temporalDerivative u t (chart q) = |
| 471 | frame (q 1) (temporalDerivative (velocityComponents u) t q) := by |
| 472 | rw [temporalDerivative_components ht, frame_inverse'] |
| 473 | change temporalDerivative u t (chart q) + |
| 474 | fderiv ℝ (fun x => u (t, x)) (chart q) (u (t, chart q)) - |
| 475 | euclideanLaplacian (fun x => u (t, x)) (chart q) + |
| 476 | euclideanGradient (fun x => p (t, x)) (chart q) = _ |
| 477 | rw [ht', cartesianAdvection_components huD hr', cartesianLaplacian_components hu hr', |
| 478 | cartesianGradient_pullback hp hr'] |
| 479 | simp only [cylindricalResidual, velocityComponents, pressurePullback, map_add, map_sub] |
| 480 | rfl |
| 481 | |
| 482 | /-- Joint local C² regularity supplies all velocity slice hypotheses. -/ |
| 483 | theorem navierStokesResidual_cylindrical |
| 484 | {u : VelocityField} {p : PressureField} {t : ℝ} {q : Space} |
| 485 | (hu : ContDiffAt ℝ 2 u (t, chart q)) |
| 486 | (hp : DifferentiableAt ℝ p (t, chart q)) (hr : 0 < q 0) : |
| 487 | navierStokesResidual u p t (chart q) = |
| 488 | frame (q 1) (cylindricalResidual (velocityComponents u) (pressurePullback p) t q) := by |
| 489 | apply navierStokesResidual_cylindrical_of_slices |
| 490 | · exact hu.comp (chart q) (contDiffAt_const.prodMk contDiffAt_id) |
| 491 | · exact (hu.differentiableAt (by norm_num)).comp t |
| 492 | (differentiableAt_id.prodMk (differentiableAt_const _)) |
| 493 | · exact hp.comp (chart q) ((differentiableAt_const _).prodMk differentiableAt_id) |
| 494 | · exact hr |
| 495 | |
| 496 | theorem divergence_cylindrical {u : VelocityField} {t : ℝ} {q : Space} |
| 497 | (hu : DifferentiableAt ℝ (fun x => u (t, x)) (chart q)) (hr : 0 < q 0) : |
| 498 | spatialDivergence u t (chart q) = |
| 499 | vectorDivergence (fun y => velocityComponents u (t, y)) q := |
| 500 | cartesianDivergence_components hu (ne_of_gt hr) |
| 501 | |
| 502 | theorem vectorAdvection_radial (w : Space → Space) (q : Space) : |
| 503 | vectorAdvection w q 0 = |
| 504 | w q 0 * dCoord 0 w q 0 + w q 1 / q 0 * dCoord 1 w q 0 + |
| 505 | w q 2 * dCoord 2 w q 0 - (w q 1) ^ 2 / q 0 := by |
| 506 | simp [vectorAdvection, connection_apply] |
| 507 | ring |
| 508 | |
| 509 | theorem vectorAdvection_angular (w : Space → Space) (q : Space) : |
| 510 | vectorAdvection w q 1 = |
| 511 | w q 0 * dCoord 0 w q 1 + w q 1 / q 0 * dCoord 1 w q 1 + |
| 512 | w q 2 * dCoord 2 w q 1 + w q 0 * w q 1 / q 0 := by |
| 513 | simp [vectorAdvection, connection_apply] |
| 514 | ring |
| 515 | |
| 516 | theorem vectorAdvection_axial (w : Space → Space) (q : Space) : |
| 517 | vectorAdvection w q 2 = |
| 518 | w q 0 * dCoord 0 w q 2 + w q 1 / q 0 * dCoord 1 w q 2 + |
| 519 | w q 2 * dCoord 2 w q 2 := by |
| 520 | simp [vectorAdvection, connection_apply] |
| 521 | |
| 522 | theorem vectorLaplacian_radial (w : Space → Space) (q : Space) : |
| 523 | vectorLaplacian w q 0 = scalarLaplacian w q 0 - |
| 524 | w q 0 / (q 0) ^ 2 - 2 * dCoord 1 w q 1 / (q 0) ^ 2 := by |
| 525 | simp [vectorLaplacian, connection_apply] |
| 526 | ring |
| 527 | |
| 528 | theorem vectorLaplacian_angular (w : Space → Space) (q : Space) : |
| 529 | vectorLaplacian w q 1 = scalarLaplacian w q 1 - |
| 530 | w q 1 / (q 0) ^ 2 + 2 * dCoord 1 w q 0 / (q 0) ^ 2 := by |
| 531 | simp [vectorLaplacian, connection_apply] |
| 532 | ring |
| 533 | |
| 534 | theorem vectorLaplacian_axial (w : Space → Space) (q : Space) : |
| 535 | vectorLaplacian w q 2 = scalarLaplacian w q 2 := by |
| 536 | simp [vectorLaplacian, connection_apply] |
| 537 | |
| 538 | theorem dCoord_eventuallyEq {f g : Space → E} {q : Space} |
| 539 | (h : f =ᶠ[𝓝 q] g) (i : Fin 3) : dCoord i f =ᶠ[𝓝 q] dCoord i g := by |
| 540 | filter_upwards [h.fderiv (𝕜 := ℝ)] with y hy |
| 541 | exact congrArg (fun L : Space →L[ℝ] E => L (coordinateVector i)) hy |
| 542 | |
| 543 | theorem scalarLaplacian_congr {f g : Space → E} {q : Space} |
| 544 | (h : f =ᶠ[𝓝 q] g) : scalarLaplacian f q = scalarLaplacian g q := by |
| 545 | simp only [scalarLaplacian, dCoord_congr (dCoord_eventuallyEq h 0) 0, |
| 546 | dCoord_congr h 0, dCoord_congr (dCoord_eventuallyEq h 1) 1, |
| 547 | dCoord_congr (dCoord_eventuallyEq h 2) 2] |
| 548 | |
| 549 | /-- Every cylindrical operator depends only on the local germ of its fields. -/ |
| 550 | theorem cylindricalResidual_congr {u v : VelocityField} {p P : PressureField} |
| 551 | {t : ℝ} {q : Space} (hu : u =ᶠ[𝓝 (t, q)] v) (hp : p =ᶠ[𝓝 (t, q)] P) : |
| 552 | cylindricalResidual u p t q = cylindricalResidual v P t q := by |
| 553 | have hs : (fun y => u (t, y)) =ᶠ[𝓝 q] (fun y => v (t, y)) := |
| 554 | hu.comp_tendsto (continuous_const.prodMk continuous_id).continuousAt |
| 555 | have ht : (fun s => u (s, q)) =ᶠ[𝓝 t] (fun s => v (s, q)) := |
| 556 | hu.comp_tendsto (continuous_id.prodMk continuous_const).continuousAt |
| 557 | have hps : (fun y => p (t, y)) =ᶠ[𝓝 q] (fun y => P (t, y)) := |
| 558 | hp.comp_tendsto (continuous_const.prodMk continuous_id).continuousAt |
| 559 | unfold cylindricalResidual temporalDerivative vectorAdvection vectorLaplacian scalarGradient |
| 560 | rw [ht.fderiv_eq] |
| 561 | dsimp only |
| 562 | rw [hs.eq_of_nhds] |
| 563 | simp only [dCoord_congr hs 0, dCoord_congr hs 1, dCoord_congr hs 2, |
| 564 | dCoord_congr hps 0, dCoord_congr hps 1, dCoord_congr hps 2, scalarLaplacian_congr hs] |
| 565 | |
| 566 | /-- Apply the coordinate law to an arbitrary locally specified cylindrical ansatz. |
| 567 | The velocity premise is an equality of values on a neighborhood, not an assumed |
| 568 | identity between derivatives or differential operators. -/ |
| 569 | theorem navierStokesResidual_of_representation |
| 570 | {u w : VelocityField} {p P : PressureField} {t : ℝ} {q : Space} |
| 571 | (hu : ContDiffAt ℝ 2 u (t, chart q)) |
| 572 | (hp : DifferentiableAt ℝ p (t, chart q)) (hr : 0 < q 0) |
| 573 | (hw : (fun tq : SpaceTime => u (tq.1, chart tq.2)) =ᶠ[𝓝 (t, q)] |
| 574 | (fun tq => frame (tq.2 1) (w tq))) |
| 575 | (hP : pressurePullback p =ᶠ[𝓝 (t, q)] P) : |
| 576 | navierStokesResidual u p t (chart q) = frame (q 1) (cylindricalResidual w P t q) := by |
| 577 | have hc : velocityComponents u =ᶠ[𝓝 (t, q)] w := by |
| 578 | filter_upwards [hw] with tq hq |
| 579 | change frame (-(tq.2 1)) (u (tq.1, chart tq.2)) = w tq |
| 580 | rw [hq, frame_inverse] |
| 581 | rw [navierStokesResidual_cylindrical hu hp hr, cylindricalResidual_congr hc hP] |
| 582 | |
| 583 | theorem dCoord_dCoord_map (L : E →L[ℝ] F) {f : Space → E} {q : Space} |
| 584 | (hf : ContDiffAt ℝ 2 f q) (i : Fin 3) : |
| 585 | dCoord i (dCoord i (fun y => L (f y))) q = L (dCoord i (dCoord i f) q) := by |
| 586 | have hnear : dCoord i (fun y => L (f y)) =ᶠ[𝓝 q] fun y => L (dCoord i f y) := by |
| 587 | filter_upwards [hf.eventually (by norm_num)] with y hy |
| 588 | exact dCoord_map L (hy.differentiableAt (by norm_num)) i |
| 589 | rw [dCoord_congr hnear, dCoord_map L |
| 590 | ((contDiffAt_dCoord hf (m := 1) (by norm_num) i).differentiableAt (by norm_num))] |
| 591 | |
| 592 | theorem scalarLaplacian_map (L : E →L[ℝ] F) {f : Space → E} {q : Space} |
| 593 | (hf : ContDiffAt ℝ 2 f q) : |
| 594 | scalarLaplacian (fun y => L (f y)) q = L (scalarLaplacian f q) := by |
| 595 | simp only [scalarLaplacian, dCoord_dCoord_map L hf, |
| 596 | dCoord_map L (hf.differentiableAt (by norm_num)), map_add, map_smul] |
| 597 | |
| 598 | /-- The vector-valued scalar Laplacian has the expected actual scalar components. -/ |
| 599 | theorem scalarLaplacian_component {w : Space → Space} {q : Space} |
| 600 | (hw : ContDiffAt ℝ 2 w q) (j : Fin 3) : |
| 601 | scalarLaplacian (fun y => w y j) q = scalarLaplacian w q j := |
| 602 | scalarLaplacian_map (projection j) hw |
| 603 | |
| 604 | end |
| 605 | |
| 606 | end NavierStokes.CylindricalResidual |