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.R3.ComparisonSetup |
| 2 | import NavierStokes.R3.CompactEnergy |
| 3 | import Mathlib.Analysis.Calculus.FDeriv.Symmetric |
| 4 | |
| 5 | /-! |
| 6 | # Conservative difference equations tested on compactly supported functions |
| 7 | |
| 8 | All integrals use Euclidean Lebesgue measure. Compact support is required only |
| 9 | of the test function; the velocities and pressures need no support or decay |
| 10 | assumptions for the identities in this module. |
| 11 | -/ |
| 12 | |
| 13 | |
| 14 | noncomputable section |
| 15 | |
| 16 | open Set Filter MeasureTheory |
| 17 | open scoped Topology BigOperators ContDiff |
| 18 | |
| 19 | namespace NavierStokesR3.ConservativeDifference |
| 20 | |
| 21 | open NavierStokes.ProblemStatement |
| 22 | open NavierStokes.PeriodicIntegration (spatialPartial) |
| 23 | open NavierStokes.PeriodicUniqueness |
| 24 | open Comparison (tensorDiff) |
| 25 | |
| 26 | private theorem nat_le_infty (n : ℕ) : (n : WithTop ℕ∞) ≤ ∞ := |
| 27 | (ENat.natCast_lt_of_coe_top_le_withTop le_rfl n).le |
| 28 | |
| 29 | private theorem infty_add_one_le : (∞ : WithTop ℕ∞) + 1 ≤ ∞ := by |
| 30 | simpa only [ENat.coe_top_add_one] using (le_rfl : (∞ : WithTop ℕ∞) ≤ ∞) |
| 31 | |
| 32 | /-- The ordinary scalar Laplacian, with the same coordinate directions as the |
| 33 | vector Laplacian in the Navier--Stokes residual. -/ |
| 34 | def scalarLaplacian (f : Space → ℝ) (x : Space) : ℝ := |
| 35 | ∑ i : Fin 3, spatialPartial i (spatialPartial i f) x |
| 36 | |
| 37 | theorem scalarLaplacian_contDiff {f : Space → ℝ} (hf : ContDiff ℝ ∞ f) : |
| 38 | ContDiff ℝ ∞ (scalarLaplacian f) := |
| 39 | ContDiff.sum fun i _ => spatial_partial_contDiff (spatial_partial_contDiff hf i) i |
| 40 | |
| 41 | theorem compact_scalarLaplacian {f : Space → ℝ} (hf : HasCompactSupport f) : |
| 42 | HasCompactSupport (scalarLaplacian f) := by |
| 43 | have hh (i : Fin 3) := CompactEnergy.compact_partial |
| 44 | (CompactEnergy.compact_partial hf i) i |
| 45 | change HasCompactSupport (fun x => ∑ i : Fin 3, spatialPartial i (spatialPartial i f) x) |
| 46 | simpa only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero] using! |
| 47 | (hh 0).add ((hh 1).add (hh 2)) |
| 48 | |
| 49 | theorem partial_mul {f g : Space → ℝ} (hf : ContDiff ℝ ∞ f) |
| 50 | (hg : ContDiff ℝ ∞ g) (i : Fin 3) (x : Space) : |
| 51 | spatialPartial i (fun y => f y * g y) x = |
| 52 | f x * spatialPartial i g x + g x * spatialPartial i f x := by |
| 53 | unfold spatialPartial |
| 54 | rw [fderiv_fun_mul (hf.differentiable (by simp) x) |
| 55 | (hg.differentiable (by simp) x)] |
| 56 | rfl |
| 57 | |
| 58 | theorem partial_sub {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 59 | {f g : Space → V} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) |
| 60 | (i : Fin 3) (x : Space) : |
| 61 | spatialPartial i (fun y => f y - g y) x = |
| 62 | spatialPartial i f x - spatialPartial i g x := by |
| 63 | unfold spatialPartial |
| 64 | rw [fderiv_fun_sub (hf.differentiable (by simp) x) |
| 65 | (hg.differentiable (by simp) x)] |
| 66 | rfl |
| 67 | |
| 68 | theorem partial_component {f : Space → Space} (hf : ContDiff ℝ ∞ f) |
| 69 | (i k : Fin 3) (x : Space) : |
| 70 | spatialPartial i (fun y => f y k) x = spatialPartial i f x k := |
| 71 | fderiv_component hf k x (coordinateVector i) |
| 72 | |
| 73 | theorem pressureGradient_component (p : PressureField) (t : ℝ) |
| 74 | (x : Space) (k : Fin 3) : |
| 75 | pressureGradient p t x k = spatialPartial k (fun y => p (t, y)) x := by |
| 76 | change (EuclideanSpace.proj k : Space →L[ℝ] ℝ) |
| 77 | (∑ i : Fin 3, spatialPartial i (fun y => p (t, y)) x • coordinateVector i) = _ |
| 78 | simp [map_sum, coordinateVector] |
| 79 | |
| 80 | theorem spatialLaplacian_component {u : VelocityField} {t : ℝ} |
| 81 | (hu : ContDiff ℝ ∞ (fun x : Space => u (t, x))) (x : Space) (k : Fin 3) : |
| 82 | spatialLaplacian u t x k = scalarLaplacian (fun y => u (t, y) k) x := by |
| 83 | change (EuclideanSpace.proj k : Space →L[ℝ] ℝ) |
| 84 | (∑ i : Fin 3, spatialPartial i (spatialPartial i (fun y => u (t, y))) x) = _ |
| 85 | rw [map_sum] |
| 86 | unfold scalarLaplacian |
| 87 | apply Finset.sum_congr rfl |
| 88 | intro i _ |
| 89 | rw [show spatialPartial i (fun y => u (t, y) k) = |
| 90 | (fun y => spatialPartial i (fun z => u (t, z)) y k) from |
| 91 | funext (fun y => partial_component hu i k y)] |
| 92 | exact (partial_component (spatial_partial_contDiff hu i) i k x).symm |
| 93 | |
| 94 | theorem advection_component {u : VelocityField} {t : ℝ} |
| 95 | (hu : ContDiff ℝ ∞ (fun x : Space => u (t, x))) (x : Space) (k : Fin 3) : |
| 96 | advection u t x k = |
| 97 | ∑ i : Fin 3, u (t, x) i * spatialPartial i (fun y => u (t, y) k) x := by |
| 98 | rw [show advection u t x k = |
| 99 | fderiv ℝ (fun y => u (t, y) k) x (u (t, x)) from |
| 100 | (fderiv_component hu k x (u (t, x))).symm] |
| 101 | exact fderiv_apply_eq_sum _ _ _ |
| 102 | |
| 103 | /-- Divergence of the velocity outer product, before using incompressibility. -/ |
| 104 | theorem outerProduct_divergence {u : VelocityField} {t : ℝ} |
| 105 | (hu : ContDiff ℝ ∞ (fun x : Space => u (t, x))) (x : Space) (k : Fin 3) : |
| 106 | (∑ i : Fin 3, spatialPartial i (fun y => u (t, y) k * u (t, y) i) x) = |
| 107 | u (t, x) k * spatialDivergence u t x + advection u t x k := by |
| 108 | simp_rw [partial_mul (component_contDiff hu k) (component_contDiff hu _)] |
| 109 | rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← advection_component hu] |
| 110 | simp_rw [partial_component hu] |
| 111 | rfl |
| 112 | |
| 113 | theorem tensorDiff_contDiff {u v : VelocityField} {t : ℝ} |
| 114 | (hu : ContDiff ℝ ∞ (fun x : Space => u (t, x))) |
| 115 | (hv : ContDiff ℝ ∞ (fun x : Space => v (t, x))) (i j : Fin 3) : |
| 116 | ContDiff ℝ ∞ (tensorDiff u v t i j) := |
| 117 | ((component_contDiff hu i).mul (component_contDiff hu j)).sub |
| 118 | ((component_contDiff hv i).mul (component_contDiff hv j)) |
| 119 | |
| 120 | theorem tensorDiff_divergence {u v : VelocityField} {t : ℝ} |
| 121 | (hu : ContDiff ℝ ∞ (fun x : Space => u (t, x))) |
| 122 | (hv : ContDiff ℝ ∞ (fun x : Space => v (t, x))) |
| 123 | (x : Space) (k : Fin 3) |
| 124 | (hdivu : spatialDivergence u t x = 0) |
| 125 | (hdivv : spatialDivergence v t x = 0) : |
| 126 | (∑ i : Fin 3, spatialPartial i (tensorDiff u v t k i) x) = |
| 127 | advection u t x k - advection v t x k := by |
| 128 | unfold tensorDiff |
| 129 | simp_rw [partial_sub ((component_contDiff hu k).mul (component_contDiff hu _)) |
| 130 | ((component_contDiff hv k).mul (component_contDiff hv _))] |
| 131 | rw [Finset.sum_sub_distrib, outerProduct_divergence hu, |
| 132 | outerProduct_divergence hv, hdivu, hdivv] |
| 133 | simp |
| 134 | |
| 135 | /-- The exact conservative equation for a difference of smooth solutions |
| 136 | having the same viscosity-one residual. -/ |
| 137 | theorem conservative_difference_equation {u v : VelocityField} {p q : PressureField} |
| 138 | {t : ℝ} {x : Space} |
| 139 | (hu : ContDiff ℝ ∞ (fun y : Space => u (t, y))) |
| 140 | (hv : ContDiff ℝ ∞ (fun y : Space => v (t, y))) |
| 141 | (hp : ContDiff ℝ ∞ (fun y : Space => p (t, y))) |
| 142 | (hq : ContDiff ℝ ∞ (fun y : Space => q (t, y))) |
| 143 | (htu : DifferentiableAt ℝ (fun s : ℝ => u (s, x)) t) |
| 144 | (htv : DifferentiableAt ℝ (fun s : ℝ => v (s, x)) t) |
| 145 | (hdivu : spatialDivergence u t x = 0) |
| 146 | (hdivv : spatialDivergence v t x = 0) |
| 147 | (hNS : navierStokesResidual u p t x = navierStokesResidual v q t x) |
| 148 | (k : Fin 3) : |
| 149 | temporalDerivative (u - v) t x k = spatialLaplacian (u - v) t x k - |
| 150 | (∑ i : Fin 3, spatialPartial i (tensorDiff u v t k i) x) - |
| 151 | spatialPartial k (fun y => (p - q) (t, y)) x := by |
| 152 | have heq := congrArg (fun z : Space => z k) |
| 153 | (difference_equation hu hv hp hq htu htv hNS) |
| 154 | have hadv := congrArg (fun z : Space => z k) (advection_difference hu hv x) |
| 155 | simp only [PiLp.sub_apply, PiLp.add_apply] at heq hadv |
| 156 | rw [pressureGradient_component] at heq |
| 157 | rw [tensorDiff_divergence hu hv x k hdivu hdivv] |
| 158 | linarith |
| 159 | |
| 160 | /-- Twice integrating by parts transfers a scalar Laplacian to the compact |
| 161 | test function, regardless of growth of the other smooth function. -/ |
| 162 | theorem integral_scalarLaplacian_mul {f ψ : Space → ℝ} |
| 163 | (hf : ContDiff ℝ ∞ f) (hψ : ContDiff ℝ ∞ ψ) |
| 164 | (hcψ : HasCompactSupport ψ) : |
| 165 | (∫ x, scalarLaplacian f x * ψ x) = ∫ x, f x * scalarLaplacian ψ x := by |
| 166 | have hil (i : Fin 3) : |
| 167 | Integrable (fun x => spatialPartial i (spatialPartial i f) x * ψ x) := |
| 168 | ((spatial_partial_contDiff (spatial_partial_contDiff hf i) i).continuous.mul |
| 169 | hψ.continuous).integrable_of_hasCompactSupport hcψ.mul_left |
| 170 | have hir (i : Fin 3) : |
| 171 | Integrable (fun x => f x * spatialPartial i (spatialPartial i ψ) x) := |
| 172 | (hf.continuous.mul |
| 173 | (spatial_partial_contDiff (spatial_partial_contDiff hψ i) i).continuous).integrable_of_hasCompactSupport |
| 174 | (CompactEnergy.compact_partial (CompactEnergy.compact_partial hcψ i) i).mul_left |
| 175 | simp only [scalarLaplacian, Finset.sum_mul, Finset.mul_sum] |
| 176 | rw [integral_finsetSum _ (fun i _ => hil i), |
| 177 | integral_finsetSum _ (fun i _ => hir i)] |
| 178 | apply Finset.sum_congr rfl |
| 179 | intro i _ |
| 180 | have h1 := CompactEnergy.integral_mul_partial hψ (spatial_partial_contDiff hf i) hcψ i |
| 181 | have h2 := CompactEnergy.integral_mul_partial (spatial_partial_contDiff hψ i) hf |
| 182 | (CompactEnergy.compact_partial hcψ i) i |
| 183 | change (∫ x, ψ x * spatialPartial i (spatialPartial i f) x) = |
| 184 | -(∫ x, spatialPartial i f x * spatialPartial i ψ x) at h1 |
| 185 | change (∫ x, spatialPartial i ψ x * spatialPartial i f x) = |
| 186 | -(∫ x, f x * spatialPartial i (spatialPartial i ψ) x) at h2 |
| 187 | calc |
| 188 | _ = ∫ x, ψ x * spatialPartial i (spatialPartial i f) x := by |
| 189 | exact integral_congr_ae (Eventually.of_forall (fun x => mul_comm _ _)) |
| 190 | _ = -(∫ x, spatialPartial i f x * spatialPartial i ψ x) := h1 |
| 191 | _ = -(∫ x, spatialPartial i ψ x * spatialPartial i f x) := by |
| 192 | congr 1 |
| 193 | exact integral_congr_ae (Eventually.of_forall (fun x => mul_comm _ _)) |
| 194 | _ = -(-(∫ x, f x * spatialPartial i (spatialPartial i ψ) x)) := congrArg Neg.neg h2 |
| 195 | _ = _ := neg_neg _ |
| 196 | |
| 197 | theorem integrable_mul_test {f ψ : Space → ℝ} (hf : Continuous f) |
| 198 | (hψ : Continuous ψ) (hcψ : HasCompactSupport ψ) : |
| 199 | Integrable (fun x => f x * ψ x) := |
| 200 | (hf.mul hψ).integrable_of_hasCompactSupport hcψ.mul_left |
| 201 | |
| 202 | theorem integral_tensorDiff_divergence_mul {u v : VelocityField} {t : ℝ} |
| 203 | {ψ : Space → ℝ} |
| 204 | (hu : ContDiff ℝ ∞ (fun x : Space => u (t, x))) |
| 205 | (hv : ContDiff ℝ ∞ (fun x : Space => v (t, x))) |
| 206 | (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) (k : Fin 3) : |
| 207 | (∫ x, (∑ i : Fin 3, spatialPartial i (tensorDiff u v t k i) x) * ψ x) = |
| 208 | -(∑ i : Fin 3, ∫ x, tensorDiff u v t k i x * spatialPartial i ψ x) := by |
| 209 | have hi (i : Fin 3) : |
| 210 | Integrable (fun x => spatialPartial i (tensorDiff u v t k i) x * ψ x) := |
| 211 | integrable_mul_test (spatial_partial_contDiff (tensorDiff_contDiff hu hv k i) i).continuous |
| 212 | hψ.continuous hcψ |
| 213 | simp only [Finset.sum_mul] |
| 214 | rw [integral_finsetSum _ (fun i _ => hi i), ← Finset.sum_neg_distrib] |
| 215 | apply Finset.sum_congr rfl |
| 216 | intro i _ |
| 217 | simpa only [spatialPartial, mul_comm] using |
| 218 | CompactEnergy.integral_mul_partial hψ (tensorDiff_contDiff hu hv k i) hcψ i |
| 219 | |
| 220 | /-- Testing the conservative equation against a compact scalar test transfers |
| 221 | all spatial derivatives off the velocity difference and tensor difference. |
| 222 | No global integrability assumption is imposed on either pressure. -/ |
| 223 | theorem weak_pressure_gradient {u v : VelocityField} {p q : PressureField} |
| 224 | {t : ℝ} {ψ : Space → ℝ} |
| 225 | (hu : ContDiff ℝ ∞ (fun x : Space => u (t, x))) |
| 226 | (hv : ContDiff ℝ ∞ (fun x : Space => v (t, x))) |
| 227 | (hp : ContDiff ℝ ∞ (fun x : Space => p (t, x))) |
| 228 | (hq : ContDiff ℝ ∞ (fun x : Space => q (t, x))) |
| 229 | (htu : ∀ x, DifferentiableAt ℝ (fun s : ℝ => u (s, x)) t) |
| 230 | (htv : ∀ x, DifferentiableAt ℝ (fun s : ℝ => v (s, x)) t) |
| 231 | (hdivu : ∀ x, spatialDivergence u t x = 0) |
| 232 | (hdivv : ∀ x, spatialDivergence v t x = 0) |
| 233 | (hNS : ∀ x, navierStokesResidual u p t x = navierStokesResidual v q t x) |
| 234 | (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) (k : Fin 3) : |
| 235 | (∫ x, spatialPartial k (fun y => (p - q) (t, y)) x * ψ x) = |
| 236 | (∫ x, (u - v) (t, x) k * scalarLaplacian ψ x) - |
| 237 | (∫ x, temporalDerivative (u - v) t x k * ψ x) + |
| 238 | ∑ i : Fin 3, ∫ x, tensorDiff u v t k i x * spatialPartial i ψ x := by |
| 239 | have hL : Continuous (fun x => spatialLaplacian (u - v) t x k) := |
| 240 | (component_contDiff (spatialLaplacian_contDiff (hu.sub hv)) k).continuous |
| 241 | have hG : Continuous (fun x => ∑ i : Fin 3, spatialPartial i (tensorDiff u v t k i) x) := |
| 242 | (ContDiff.sum fun i _ => spatial_partial_contDiff (tensorDiff_contDiff hu hv k i) i).continuous |
| 243 | have hP : Continuous (spatialPartial k (fun y => (p - q) (t, y))) := |
| 244 | (spatial_partial_contDiff (hp.sub hq) k).continuous |
| 245 | have hdt : Continuous (fun x => temporalDerivative (u - v) t x k) := by |
| 246 | have heq : (fun x => temporalDerivative (u - v) t x k) = |
| 247 | (fun x => spatialLaplacian (u - v) t x k - |
| 248 | (∑ i : Fin 3, spatialPartial i (tensorDiff u v t k i) x) - |
| 249 | spatialPartial k (fun y => (p - q) (t, y)) x) := |
| 250 | funext fun x => conservative_difference_equation hu hv hp hq (htu x) (htv x) |
| 251 | (hdivu x) (hdivv x) (hNS x) k |
| 252 | rw [heq] |
| 253 | exact (hL.sub hG).sub hP |
| 254 | have hiL := integrable_mul_test hL hψ.continuous hcψ |
| 255 | have hiG := integrable_mul_test hG hψ.continuous hcψ |
| 256 | have hidt := integrable_mul_test hdt hψ.continuous hcψ |
| 257 | have hiLD : Integrable (fun x => spatialLaplacian (u - v) t x k * ψ x - |
| 258 | temporalDerivative (u - v) t x k * ψ x) := hiL.sub hidt |
| 259 | have hpoint : (fun x => spatialPartial k (fun y => (p - q) (t, y)) x * ψ x) = |
| 260 | (fun x => spatialLaplacian (u - v) t x k * ψ x - |
| 261 | temporalDerivative (u - v) t x k * ψ x - |
| 262 | (∑ i : Fin 3, spatialPartial i (tensorDiff u v t k i) x) * ψ x) := by |
| 263 | funext x |
| 264 | have h := conservative_difference_equation hu hv hp hq (htu x) (htv x) |
| 265 | (hdivu x) (hdivv x) (hNS x) k |
| 266 | have hpEq : spatialPartial k (fun y => (p - q) (t, y)) x = |
| 267 | spatialLaplacian (u - v) t x k - temporalDerivative (u - v) t x k - |
| 268 | (∑ i : Fin 3, spatialPartial i (tensorDiff u v t k i) x) := by linarith |
| 269 | rw [hpEq] |
| 270 | ring |
| 271 | have hLap : (∫ x, spatialLaplacian (u - v) t x k * ψ x) = |
| 272 | ∫ x, (u - v) (t, x) k * scalarLaplacian ψ x := by |
| 273 | simp_rw [spatialLaplacian_component (u := u - v) (t := t) (hu.sub hv)] |
| 274 | exact integral_scalarLaplacian_mul (component_contDiff (hu.sub hv) k) hψ hcψ |
| 275 | rw [hpoint, integral_sub hiLD hiG, integral_sub hiL hidt, |
| 276 | hLap, integral_tensorDiff_divergence_mul hu hv hψ hcψ k] |
| 277 | ring |
| 278 | |
| 279 | /-- A slab version of the compact weak identity with time differentiability |
| 280 | supplied by joint smoothness. -/ |
| 281 | theorem weak_pressure_gradient_on_slab {a b t : ℝ} {u v : VelocityField} |
| 282 | {p q : PressureField} {ψ : Space → ℝ} |
| 283 | (hu : ContDiffOn ℝ ∞ u (Comparison.slab a b)) |
| 284 | (hv : ContDiffOn ℝ ∞ v (Comparison.slab a b)) |
| 285 | (hp : ContDiffOn ℝ ∞ p (Comparison.slab a b)) |
| 286 | (hq : ContDiffOn ℝ ∞ q (Comparison.slab a b)) |
| 287 | (ht : t ∈ Ioo a b) |
| 288 | (hdivu : ∀ x, spatialDivergence u t x = 0) |
| 289 | (hdivv : ∀ x, spatialDivergence v t x = 0) |
| 290 | (hNS : ∀ x, navierStokesResidual u p t x = navierStokesResidual v q t x) |
| 291 | (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) (k : Fin 3) : |
| 292 | (∫ x, spatialPartial k (fun y => (p - q) (t, y)) x * ψ x) = |
| 293 | (∫ x, (u - v) (t, x) k * scalarLaplacian ψ x) - |
| 294 | (∫ x, temporalDerivative (u - v) t x k * ψ x) + |
| 295 | ∑ i : Fin 3, ∫ x, tensorDiff u v t k i x * spatialPartial i ψ x := by |
| 296 | exact weak_pressure_gradient (spatial_smooth hu (Ioo_subset_Icc_self ht)) |
| 297 | (spatial_smooth hv (Ioo_subset_Icc_self ht)) (spatial_smooth hp (Ioo_subset_Icc_self ht)) |
| 298 | (spatial_smooth hq (Ioo_subset_Icc_self ht)) |
| 299 | (fun x => time_differentiable_at_interior hu ht x) |
| 300 | (fun x => time_differentiable_at_interior hv ht x) hdivu hdivv hNS hψ hcψ k |
| 301 | |
| 302 | theorem partial_partial_eq_fderiv {f : Space → ℝ} (hf : ContDiff ℝ ∞ f) |
| 303 | (i j : Fin 3) (x : Space) : |
| 304 | spatialPartial i (spatialPartial j f) x = |
| 305 | fderiv ℝ (fderiv ℝ f) x (coordinateVector i) (coordinateVector j) := by |
| 306 | have hdf := (hf.fderiv_right infty_add_one_le).differentiable (by simp) x |
| 307 | change fderiv ℝ (fun y => fderiv ℝ f y (coordinateVector j)) x (coordinateVector i) = _ |
| 308 | rw [fderiv_clm_apply hdf (differentiableAt_const (coordinateVector j))] |
| 309 | simp |
| 310 | |
| 311 | theorem partial_comm {f : Space → ℝ} (hf : ContDiff ℝ ∞ f) |
| 312 | (i j : Fin 3) (x : Space) : |
| 313 | spatialPartial i (spatialPartial j f) x = |
| 314 | spatialPartial j (spatialPartial i f) x := by |
| 315 | rw [partial_partial_eq_fderiv hf, partial_partial_eq_fderiv hf] |
| 316 | exact ((hf.of_le (nat_le_infty 2)).contDiffAt.isSymmSndFDerivAt (by simp)) _ _ |
| 317 | |
| 318 | theorem partial_sum {f : Fin 3 → Space → ℝ} |
| 319 | (hf : ∀ i, ContDiff ℝ ∞ (f i)) (k : Fin 3) (x : Space) : |
| 320 | spatialPartial k (fun y => ∑ i : Fin 3, f i y) x = |
| 321 | ∑ i : Fin 3, spatialPartial k (f i) x := by |
| 322 | unfold spatialPartial |
| 323 | rw [fderiv_fun_sum (fun i _ => (hf i).differentiable (by simp) x)] |
| 324 | simp |
| 325 | |
| 326 | theorem partial_scalarLaplacian {f : Space → ℝ} (hf : ContDiff ℝ ∞ f) |
| 327 | (k : Fin 3) (x : Space) : |
| 328 | spatialPartial k (scalarLaplacian f) x = scalarLaplacian (spatialPartial k f) x := by |
| 329 | change spatialPartial k (fun y => ∑ i : Fin 3, |
| 330 | spatialPartial i (spatialPartial i f) y) x = _ |
| 331 | rw [partial_sum (f := fun i => spatialPartial i (spatialPartial i f)) |
| 332 | (fun i => spatial_partial_contDiff (spatial_partial_contDiff hf i) i)] |
| 333 | unfold scalarLaplacian |
| 334 | apply Finset.sum_congr rfl |
| 335 | intro i _ |
| 336 | rw [partial_comm (f := spatialPartial i f) (spatial_partial_contDiff hf i) k i x] |
| 337 | exact congrArg (fun g : Space → ℝ => spatialPartial i g x) |
| 338 | (funext (fun y => partial_comm hf k i y)) |
| 339 | |
| 340 | /-- A compact scalar test detects the ordinary divergence, even when the |
| 341 | vector field has no compact support. -/ |
| 342 | theorem integral_divergence_free_test {w : Space → Space} {ψ : Space → ℝ} |
| 343 | (hw : ContDiff ℝ ∞ w) (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) |
| 344 | (hdiv : ∀ x, (∑ i : Fin 3, spatialPartial i w x i) = 0) : |
| 345 | (∑ i : Fin 3, ∫ x, w x i * spatialPartial i ψ x) = 0 := by |
| 346 | have hi (i : Fin 3) : Integrable (fun x => ψ x * spatialPartial i w x i) := |
| 347 | (hψ.continuous.mul |
| 348 | (component_contDiff (spatial_partial_contDiff hw i) i).continuous).integrable_of_hasCompactSupport |
| 349 | hcψ.mul_right |
| 350 | have hparts (i : Fin 3) : (∫ x, w x i * spatialPartial i ψ x) = |
| 351 | -(∫ x, ψ x * spatialPartial i w x i) := by |
| 352 | have h := CompactEnergy.integral_mul_partial hψ (component_contDiff hw i) hcψ i |
| 353 | simp_rw [partial_component hw] at h |
| 354 | linarith |
| 355 | rw [Finset.sum_congr rfl (fun i _ => hparts i), Finset.sum_neg_distrib] |
| 356 | have hsum : (∫ x, ψ x * ∑ i : Fin 3, spatialPartial i w x i) = |
| 357 | ∑ i : Fin 3, ∫ x, ψ x * spatialPartial i w x i := by |
| 358 | simp only [Finset.mul_sum] |
| 359 | exact integral_finsetSum _ (fun i _ => hi i) |
| 360 | rw [← hsum] |
| 361 | simp only [hdiv, mul_zero, integral_zero, neg_zero] |
| 362 | |
| 363 | /-- Differentiation of one component paired with a fixed compact spatial |
| 364 | test. The compact support supplies a common spatial domain for differentiation. -/ |
| 365 | theorem component_test_hasDerivAt {a b t : ℝ} {w : VelocityField} {ψ : Space → ℝ} |
| 366 | (hw : ContDiffOn ℝ ∞ w (Comparison.slab a b)) (ht : t ∈ Ioo a b) |
| 367 | (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) (k : Fin 3) : |
| 368 | HasDerivAt (fun s => ∫ x, w (s, x) k * ψ x) |
| 369 | (∫ x, temporalDerivative w t x k * ψ x) t := by |
| 370 | have hF : ContDiffOn ℝ 1 (fun z : SpaceTime => w z k * ψ z.2) |
| 371 | (Icc a b ×ˢ univ) := |
| 372 | (((EuclideanSpace.proj k : Space →L[ℝ] ℝ).contDiff.comp_contDiffOn hw).mul |
| 373 | (hψ.comp contDiff_snd).contDiffOn).of_le (nat_le_infty 1) |
| 374 | refine CompactTimeIntegral.hasDerivAt_integral_of_contDiffOn_of_hasDerivAt |
| 375 | hcψ hF ?_ ht ?_ |
| 376 | · intro s hs x hx |
| 377 | rw [image_eq_zero_of_notMem_tsupport hx, mul_zero] |
| 378 | · intro x |
| 379 | have htime : HasDerivAt (fun s => w (s, x)) (temporalDerivative w t x) t := |
| 380 | (time_differentiable_at_interior hw ht x).hasDerivAt |
| 381 | exact ((EuclideanSpace.proj k : Space →L[ℝ] ℝ).hasFDerivAt.comp_hasDerivAt t htime).mul_const (ψ x) |
| 382 | |
| 383 | /-- The time derivative has zero distributional divergence. This follows by |
| 384 | differentiating a compact pairing that is identically zero on the time interval. -/ |
| 385 | theorem integral_time_derivative_divergence_free {a b t : ℝ} {w : VelocityField} |
| 386 | {ψ : Space → ℝ} |
| 387 | (hw : ContDiffOn ℝ ∞ w (Comparison.slab a b)) (ht : t ∈ Ioo a b) |
| 388 | (hdiv : ∀ s ∈ Ioo a b, ∀ x, spatialDivergence w s x = 0) |
| 389 | (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) : |
| 390 | (∑ k : Fin 3, ∫ x, temporalDerivative w t x k * spatialPartial k ψ x) = 0 := by |
| 391 | have hderiv : HasDerivAt |
| 392 | (fun s => ∑ k : Fin 3, ∫ x, w (s, x) k * spatialPartial k ψ x) |
| 393 | (∑ k : Fin 3, ∫ x, temporalDerivative w t x k * spatialPartial k ψ x) t := |
| 394 | HasDerivAt.fun_sum fun k _ => component_test_hasDerivAt hw ht |
| 395 | (spatial_partial_contDiff hψ k) (CompactEnergy.compact_partial hcψ k) k |
| 396 | have heq : (fun s => ∑ k : Fin 3, ∫ x, w (s, x) k * spatialPartial k ψ x) =ᶠ[𝓝 t] |
| 397 | (fun _ => (0 : ℝ)) := by |
| 398 | filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs |
| 399 | exact integral_divergence_free_test (spatial_smooth hw (Ioo_subset_Icc_self hs)) |
| 400 | hψ hcψ (hdiv s hs) |
| 401 | exact (hderiv.congr_of_eventuallyEq heq.symm).unique (hasDerivAt_const t (0 : ℝ)) |
| 402 | |
| 403 | theorem integral_gradient_pairing {f ψ : Space → ℝ} |
| 404 | (hf : ContDiff ℝ ∞ f) (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) : |
| 405 | (∑ k : Fin 3, ∫ x, spatialPartial k f x * spatialPartial k ψ x) = |
| 406 | -(∫ x, f x * scalarLaplacian ψ x) := by |
| 407 | have hparts (k : Fin 3) : |
| 408 | (∫ x, spatialPartial k f x * spatialPartial k ψ x) = |
| 409 | -(∫ x, f x * spatialPartial k (spatialPartial k ψ) x) := by |
| 410 | have h := CompactEnergy.integral_mul_partial (spatial_partial_contDiff hψ k) hf |
| 411 | (CompactEnergy.compact_partial hcψ k) k |
| 412 | change (∫ x, spatialPartial k ψ x * spatialPartial k f x) = |
| 413 | -(∫ x, f x * spatialPartial k (spatialPartial k ψ) x) at h |
| 414 | calc |
| 415 | _ = ∫ x, spatialPartial k ψ x * spatialPartial k f x := |
| 416 | integral_congr_ae (Eventually.of_forall (fun x => mul_comm _ _)) |
| 417 | _ = _ := h |
| 418 | have hi (k : Fin 3) : |
| 419 | Integrable (fun x => f x * spatialPartial k (spatialPartial k ψ) x) := |
| 420 | integrable_mul_test hf.continuous |
| 421 | (spatial_partial_contDiff (spatial_partial_contDiff hψ k) k).continuous |
| 422 | (CompactEnergy.compact_partial (CompactEnergy.compact_partial hcψ k) k) |
| 423 | rw [Finset.sum_congr rfl (fun k _ => hparts k), Finset.sum_neg_distrib] |
| 424 | congr 1 |
| 425 | simp only [scalarLaplacian, Finset.mul_sum] |
| 426 | exact (integral_finsetSum _ (fun k _ => hi k)).symm |
| 427 | |
| 428 | /-- The pressure difference solves the compact-test Poisson equation obtained |
| 429 | from the actual Navier--Stokes residual and incompressibility. No pressure |
| 430 | normalization, growth hypothesis, or integrability at infinity is used. -/ |
| 431 | theorem weak_pressure_poisson {a b t : ℝ} {u v : VelocityField} |
| 432 | {p q : PressureField} {ψ : Space → ℝ} |
| 433 | (hu : ContDiffOn ℝ ∞ u (Comparison.slab a b)) |
| 434 | (hv : ContDiffOn ℝ ∞ v (Comparison.slab a b)) |
| 435 | (hp : ContDiffOn ℝ ∞ p (Comparison.slab a b)) |
| 436 | (hq : ContDiffOn ℝ ∞ q (Comparison.slab a b)) |
| 437 | (ht : t ∈ Ioo a b) |
| 438 | (hdivu : ∀ s ∈ Ioo a b, ∀ x, spatialDivergence u s x = 0) |
| 439 | (hdivv : ∀ s ∈ Ioo a b, ∀ x, spatialDivergence v s x = 0) |
| 440 | (hNS : ∀ x, navierStokesResidual u p t x = navierStokesResidual v q t x) |
| 441 | (hψ : ContDiff ℝ ∞ ψ) (hcψ : HasCompactSupport ψ) : |
| 442 | (∫ x, (p - q) (t, x) * scalarLaplacian ψ x) = |
| 443 | -(∑ k : Fin 3, ∑ i : Fin 3, |
| 444 | ∫ x, tensorDiff u v t k i x * spatialPartial i (spatialPartial k ψ) x) := by |
| 445 | have hw : ContDiffOn ℝ ∞ (u - v) (Comparison.slab a b) := hu.sub hv |
| 446 | have hwspace := spatial_smooth hw (Ioo_subset_Icc_self ht) |
| 447 | have hdivw : ∀ s ∈ Ioo a b, ∀ x, spatialDivergence (u - v) s x = 0 := by |
| 448 | intro s hs x |
| 449 | rw [spatialDivergence_sub (spatial_smooth hu (Ioo_subset_Icc_self hs)) |
| 450 | (spatial_smooth hv (Ioo_subset_Icc_self hs)), hdivu s hs, hdivv s hs, sub_self] |
| 451 | have hL : (∑ k : Fin 3, ∫ x, (u - v) (t, x) k * |
| 452 | scalarLaplacian (spatialPartial k ψ) x) = 0 := by |
| 453 | simp_rw [← partial_scalarLaplacian hψ] |
| 454 | exact integral_divergence_free_test hwspace (scalarLaplacian_contDiff hψ) |
| 455 | (compact_scalarLaplacian hcψ) (hdivw t ht) |
| 456 | have hT := integral_time_derivative_divergence_free hw ht hdivw hψ hcψ |
| 457 | have hsum : (∑ k : Fin 3, ∫ x, |
| 458 | spatialPartial k (fun y => (p - q) (t, y)) x * spatialPartial k ψ x) = |
| 459 | ∑ k : Fin 3, ((∫ x, (u - v) (t, x) k * scalarLaplacian (spatialPartial k ψ) x) - |
| 460 | (∫ x, temporalDerivative (u - v) t x k * spatialPartial k ψ x) + |
| 461 | ∑ i : Fin 3, ∫ x, tensorDiff u v t k i x * spatialPartial i (spatialPartial k ψ) x) := by |
| 462 | apply Finset.sum_congr rfl |
| 463 | intro k _ |
| 464 | exact weak_pressure_gradient_on_slab hu hv hp hq ht (hdivu t ht) (hdivv t ht) hNS |
| 465 | (spatial_partial_contDiff hψ k) (CompactEnergy.compact_partial hcψ k) k |
| 466 | rw [integral_gradient_pairing (f := fun y => (p - q) (t, y)) |
| 467 | ((spatial_smooth hp (Ioo_subset_Icc_self ht)).sub (spatial_smooth hq (Ioo_subset_Icc_self ht))) |
| 468 | hψ hcψ, Finset.sum_add_distrib, Finset.sum_sub_distrib, hL, hT] at hsum |
| 469 | linarith |
| 470 | |
| 471 | end NavierStokesR3.ConservativeDifference |