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

Merge pull request #31 from p2-correction-full-residual
Browse filesrefactor(NavierStokes): extract the exact full residual update
Checks
build Program · lake build and Comparator
Details
challenge Program · challenge files and build config
Details
+4 −356 NavierStokes/CorrectionStep.lean View file
| @@ -45,13 +45,15 @@ import NavierStokes.ParticularWaveAssembly | ||
| 45 | 45 | import NavierStokes.LocalRankDefect |
| 46 | 46 | import NavierStokes.StateReindex |
| 47 | 47 | import NavierStokes.CorrectionStepCovariance |
| 48 | +import NavierStokes.CorrectionStepFullResidual | |
| 48 | 49 | |
| 49 | 50 | /-! |
| 50 | 51 | # Exact field bookkeeping for one correction cycle |
| 51 | 52 | |
| 52 | 53 | `NavierStokes.CorrectionStepCovariance` supplies the exact changes of the |
| 53 | -angularly averaged residual. Here we track the full residual and its averaged | |
| 54 | -components through a correction cycle, retaining the old/new cross terms. | |
| 54 | +angularly averaged residual, and `NavierStokes.CorrectionStepFullResidual` | |
| 55 | +assembles the full residual and its exact increment. Here we use these | |
| 56 | +identities to track the residual through the stages of a correction cycle. | |
| 55 | 57 | -/ |
| 56 | 58 | |
| 57 | 59 | noncomputable section |
| @@ -63,360 +65,6 @@ open scoped ContDiff BigOperators | ||
| 63 | 65 | |
| 64 | 66 | variable {D : Type} [NormedAddCommGroup D] [NormedSpace ℝ D] |
| 65 | 67 | |
| 66 | -/-! ## The full differential residual, before angular averaging -/ | |
| 67 | - | |
| 68 | -section FullCalculus | |
| 69 | - | |
| 70 | -open HarmonicCalculus LinearWaveResidual | |
| 71 | - | |
| 72 | -theorem angularGenerator_add (a b : ComplexVector) : | |
| 73 | - angularGenerator (a + b) = angularGenerator a + angularGenerator b := by | |
| 74 | - ext i | |
| 75 | - fin_cases i <;> simp [angularGenerator] | |
| 76 | - abel | |
| 77 | - | |
| 78 | -theorem transport_add_left (R : D → ℝ) (Vr Vθ Vz : D → D) | |
| 79 | - (a b v : D → ComplexVector) (x : D) : | |
| 80 | - transport R Vr Vθ Vz (a + b) v x = | |
| 81 | - transport R Vr Vθ Vz a v x + transport R Vr Vθ Vz b v x := by | |
| 82 | - ext i | |
| 83 | - simp only [transport, Pi.add_apply] | |
| 84 | - ring | |
| 85 | - | |
| 86 | -theorem transport_add_right (R : D → ℝ) (Vr Vθ Vz : D → D) | |
| 87 | - (u a b : D → ComplexVector) {x : D} | |
| 88 | - (ha : ∀ i, DifferentiableAt ℝ (fun y => a y i) x) | |
| 89 | - (hb : ∀ i, DifferentiableAt ℝ (fun y => b y i) x) : | |
| 90 | - transport R Vr Vθ Vz u (a + b) x = | |
| 91 | - transport R Vr Vθ Vz u a x + transport R Vr Vθ Vz u b x := by | |
| 92 | - ext i | |
| 93 | - simp only [transport, Pi.add_apply, angularGenerator_add, | |
| 94 | - along_add _ (ha i) (hb i)] | |
| 95 | - ring | |
| 96 | - | |
| 97 | -theorem twiceAlong_add {U : Set D} (hU : IsOpen U) {V : D → D} | |
| 98 | - (hV : ContDiffOn ℝ ∞ V U) {f g : D → ℂ} | |
| 99 | - (hf : ContDiffOn ℝ ∞ f U) (hg : ContDiffOn ℝ ∞ g U) | |
| 100 | - {x : D} (hx : x ∈ U) : | |
| 101 | - along V (along V (f + g)) x = along V (along V f) x + along V (along V g) x := by | |
| 102 | - have heq : EqOn (along V (f + g)) (along V f + along V g) U := by | |
| 103 | - intro y hy | |
| 104 | - exact along_add V ((hf.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) | |
| 105 | - ((hg.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) | |
| 106 | - rw [along_congr hU heq hx] | |
| 107 | - exact along_add V | |
| 108 | - (((contDiffOn_along hU hV hf).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 109 | - (((contDiffOn_along hU hV hg).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 110 | - | |
| 111 | -theorem cylindricalLaplacian_add {U : Set D} (hU : IsOpen U) (R : D → ℝ) | |
| 112 | - {Vr Vθ Vz : D → D} (hr : ContDiffOn ℝ ∞ Vr U) | |
| 113 | - (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 114 | - {f g : D → ℂ} (hf : ContDiffOn ℝ ∞ f U) (hg : ContDiffOn ℝ ∞ g U) | |
| 115 | - {x : D} (hx : x ∈ U) : | |
| 116 | - cylindricalLaplacian R Vr Vθ Vz (f + g) x = | |
| 117 | - cylindricalLaplacian R Vr Vθ Vz f x + cylindricalLaplacian R Vr Vθ Vz g x := by | |
| 118 | - have df := (hf.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 119 | - have dg := (hg.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 120 | - have hfirst : along Vr (f + g) x = along Vr f x + along Vr g x := along_add Vr df dg | |
| 121 | - simp only [cylindricalLaplacian, twiceAlong_add hU hr hf hg hx, | |
| 122 | - twiceAlong_add hU hθ hf hg hx, twiceAlong_add hU hz hf hg hx, | |
| 123 | - hfirst, smul_add] | |
| 124 | - abel | |
| 125 | - | |
| 126 | -theorem cylindricalVectorLaplacian_add {U : Set D} (hU : IsOpen U) (R : D → ℝ) | |
| 127 | - {Vr Vθ Vz : D → D} (hr : ContDiffOn ℝ ∞ Vr U) | |
| 128 | - (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 129 | - {a b : D → ComplexVector} | |
| 130 | - (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) | |
| 131 | - (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) | |
| 132 | - {x : D} (hx : x ∈ U) : | |
| 133 | - cylindricalVectorLaplacian R Vr Vθ Vz (a + b) x = | |
| 134 | - cylindricalVectorLaplacian R Vr Vθ Vz a x + | |
| 135 | - cylindricalVectorLaplacian R Vr Vθ Vz b x := by | |
| 136 | - have hL i : cylindricalLaplacian R Vr Vθ Vz (fun y => a y i + b y i) x = | |
| 137 | - cylindricalLaplacian R Vr Vθ Vz (fun y => a y i) x + | |
| 138 | - cylindricalLaplacian R Vr Vθ Vz (fun y => b y i) x := | |
| 139 | - cylindricalLaplacian_add hU R hr hθ hz (ha i) (hb i) hx | |
| 140 | - have hD i := along_add Vθ | |
| 141 | - (((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 142 | - (((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 143 | - ext i | |
| 144 | - fin_cases i <;> | |
| 145 | - simp [cylindricalVectorLaplacian, angularGenerator, hL 0, hL 1, hL 2, | |
| 146 | - hD 0, hD 1, Complex.real_smul] <;> ring | |
| 147 | - | |
| 148 | -theorem gradient_add (R : D → ℝ) (Vr Vθ Vz : D → D) | |
| 149 | - {p q : D → ℂ} {x : D} (hp : DifferentiableAt ℝ p x) | |
| 150 | - (hq : DifferentiableAt ℝ q x) : | |
| 151 | - gradient R Vr Vθ Vz (p + q) x = gradient R Vr Vθ Vz p x + gradient R Vr Vθ Vz q x := by | |
| 152 | - have hd (V : D → D) : along V (p + q) x = along V p x + along V q x := along_add V hp hq | |
| 153 | - ext i | |
| 154 | - fin_cases i <;> simp [gradient, hd, smul_add] | |
| 155 | - | |
| 156 | -theorem linearResidual_add {U : Set D} (hU : IsOpen U) (ε : ℝ) (R : D → ℝ) | |
| 157 | - {Vr Vθ Vz : D → D} (Vt : D → D) (hr : ContDiffOn ℝ ∞ Vr U) | |
| 158 | - (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 159 | - (B a b : D → ComplexVector) (p q : D → ℂ) | |
| 160 | - (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) | |
| 161 | - (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) | |
| 162 | - (hp : ContDiffOn ℝ ∞ p U) (hq : ContDiffOn ℝ ∞ q U) | |
| 163 | - {x : D} (hx : x ∈ U) : | |
| 164 | - linearResidual ε R Vr Vθ Vz Vt B (a + b) (p + q) x = | |
| 165 | - linearResidual ε R Vr Vθ Vz Vt B a p x + linearResidual ε R Vr Vθ Vz Vt B b q x := by | |
| 166 | - have da i := ((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 167 | - have db i := ((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 168 | - have dp := (hp.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 169 | - have dq := (hq.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 170 | - have hL := cylindricalVectorLaplacian_add hU R hr hθ hz ha hb hx | |
| 171 | - ext i | |
| 172 | - simp only [linearResidual, Pi.add_apply, along_add _ (da i) (db i), | |
| 173 | - transport_add_left, transport_add_right R Vr Vθ Vz B a b da db, | |
| 174 | - gradient_add R Vr Vθ Vz dp dq, hL] | |
| 175 | - ring | |
| 176 | - | |
| 177 | -/-- Exact residual of a perturbation of a fixed base, before the virtual | |
| 178 | -stress and the separately retained base residual are added. -/ | |
| 179 | -noncomputable def nonlinearResidual (ε : ℝ) (R : D → ℝ) (Vr Vθ Vz Vt : D → D) | |
| 180 | - (B a : D → ComplexVector) (p : D → ℂ) (x : D) : ComplexVector := | |
| 181 | - linearResidual ε R Vr Vθ Vz Vt B a p x + transport R Vr Vθ Vz a a x | |
| 182 | - | |
| 183 | -theorem nonlinearResidual_add_sub {U : Set D} (hU : IsOpen U) (ε : ℝ) (R : D → ℝ) | |
| 184 | - {Vr Vθ Vz : D → D} (Vt : D → D) (hr : ContDiffOn ℝ ∞ Vr U) | |
| 185 | - (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 186 | - (B a b : D → ComplexVector) (p q : D → ℂ) | |
| 187 | - (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) | |
| 188 | - (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) | |
| 189 | - (hp : ContDiffOn ℝ ∞ p U) (hq : ContDiffOn ℝ ∞ q U) | |
| 190 | - {x : D} (hx : x ∈ U) : | |
| 191 | - nonlinearResidual ε R Vr Vθ Vz Vt B (a + b) (p + q) x - | |
| 192 | - nonlinearResidual ε R Vr Vθ Vz Vt B a p x = | |
| 193 | - linearResidual ε R Vr Vθ Vz Vt B b q x + transport R Vr Vθ Vz a b x + | |
| 194 | - transport R Vr Vθ Vz b a x + transport R Vr Vθ Vz b b x := by | |
| 195 | - have da i := ((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 196 | - have db i := ((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 197 | - rw [nonlinearResidual, linearResidual_add hU ε R Vt hr hθ hz B a b p q ha hb hp hq hx, | |
| 198 | - transport_add_left, transport_add_right R Vr Vθ Vz a a b da db, | |
| 199 | - transport_add_right R Vr Vθ Vz b a b da db, nonlinearResidual] | |
| 200 | - abel | |
| 201 | - | |
| 202 | -end FullCalculus | |
| 203 | - | |
| 204 | -section FullFields | |
| 205 | - | |
| 206 | -open CorrectionState HarmonicCalculus | |
| 207 | - | |
| 208 | -noncomputable def radialDirection (c : Context D) (n : ℕ) (x : D × ℝ) : D × ℝ := | |
| 209 | - (c.operators.eR + (c.operators.radialFrequency n * c.operators.radialProfile x.1) • | |
| 210 | - c.operators.vR, 0) | |
| 211 | - | |
| 212 | -noncomputable def axialDirection (c : Context D) (n : ℕ) (_x : D × ℝ) : D × ℝ := | |
| 213 | - (c.operators.epsilon n • c.operators.eZ, 0) | |
| 214 | - | |
| 215 | -noncomputable def angularDirection (_x : D × ℝ) : D × ℝ := (0, 1) | |
| 216 | - | |
| 217 | -noncomputable def timeDirection (c : Context D) (n : ℕ) (_x : D × ℝ) : D × ℝ := | |
| 218 | - (c.operators.fastCoefficient n • c.operators.vT - c.operators.epsilon n • c.operators.eT, 0) | |
| 219 | - | |
| 220 | -noncomputable def complexBase (c : Context D) (n : ℕ) (x : D × ℝ) : ComplexVector := | |
| 221 | - ![(c.base.radial n x.1 : ℂ), (c.base.angular n x.1 : ℂ), (c.base.axial n x.1 : ℂ)] | |
| 222 | - | |
| 223 | -noncomputable def complexPerturbation (u : State D) (n : ℕ) (x : D × ℝ) : ComplexVector := | |
| 224 | - ![(u.mean.radial n x.1 + u.oscillation n x 0 : ℝ), | |
| 225 | - (u.mean.angular n x.1 + u.oscillation n x 1 : ℝ), | |
| 226 | - (u.mean.axial n x.1 + u.oscillation n x 2 : ℝ)] | |
| 227 | - | |
| 228 | -noncomputable def complexPressure (u : State D) (n : ℕ) (x : D × ℝ) : ℂ := | |
| 229 | - (u.totalPressureIncrement n x : ℝ) | |
| 230 | - | |
| 231 | -noncomputable def virtualDivergence (c : Context D) (n : ℕ) (x : D × ℝ) : Fin 3 → ℝ := | |
| 232 | - ![0, -(c.operators.radialDiv 2 c.virtualTheta n x.1), | |
| 233 | - -(c.operators.radialDiv 1 c.virtualAxial n x.1)] | |
| 234 | - | |
| 235 | -/-- This field uses actual Fréchet derivatives. The base flat error is | |
| 236 | -restored once, alongside the negative virtual-stress divergence. -/ | |
| 237 | -noncomputable def fullResidual (c : Context D) (u : State D) : Oscillation D := fun n x i => | |
| 238 | - (nonlinearResidual (c.operators.epsilon n) (fun y : D × ℝ => c.operators.radius y.1) | |
| 239 | - (radialDirection c n) angularDirection (axialDirection c n) (timeDirection c n) | |
| 240 | - (complexBase c n) (complexPerturbation u n) (complexPressure u n) x i).re + | |
| 241 | - virtualDivergence c n x i + u.errors.base n x i | |
| 242 | - | |
| 243 | -noncomputable def fullGoodResidual (c : Context D) (u : State D) : Oscillation D := | |
| 244 | - fullResidual c u - u.errors.total | |
| 245 | - | |
| 246 | -noncomputable def angularMeanVector (f : Oscillation D) : MeanVector D := | |
| 247 | - fun n x i => angularAverage (fun k p => f k p i) n x | |
| 248 | - | |
| 249 | -noncomputable def angularNonconstant (f : Oscillation D) : Oscillation D := | |
| 250 | - fun n x i => f n x i - angularMeanVector f n x.1 i | |
| 251 | - | |
| 252 | -noncomputable def fullGoodWaveResidual (c : Context D) (u : State D) : Oscillation D := | |
| 253 | - angularNonconstant (fullGoodResidual c u) | |
| 254 | - | |
| 255 | -theorem fullResidual_eq_good_add_excluded (c : Context D) (u : State D) : | |
| 256 | - fullResidual c u = fullGoodResidual c u + u.errors.total := by | |
| 257 | - simp [fullGoodResidual] | |
| 258 | - | |
| 259 | -theorem fullResidual_decomposition (c : Context D) (u : State D) : | |
| 260 | - fullResidual c u = fun n x i => fullGoodWaveResidual c u n x i + | |
| 261 | - angularMeanVector (fullGoodResidual c u) n x.1 i + u.errors.total n x i := by | |
| 262 | - funext n x i | |
| 263 | - simp only [fullGoodWaveResidual, angularNonconstant, fullGoodResidual, | |
| 264 | - Pi.sub_apply] | |
| 265 | - ring | |
| 266 | - | |
| 267 | -end FullFields | |
| 268 | - | |
| 269 | -section ActualCovariance | |
| 270 | - | |
| 271 | -open CorrectionState MeasureTheory | |
| 272 | - | |
| 273 | -def AngularContinuous (u : Oscillation D) : Prop := | |
| 274 | - ∀ n x i, Continuous (fun θ : ℝ => u n (x, θ) i) | |
| 275 | - | |
| 276 | -omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 277 | -theorem AngularContinuous.add {u v : Oscillation D} | |
| 278 | - (hu : AngularContinuous u) (hv : AngularContinuous v) : AngularContinuous (u + v) := | |
| 279 | - fun n x i => (hu n x i).add (hv n x i) | |
| 280 | - | |
| 281 | -omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 282 | -theorem bilinearCovariance_add_left {u v w : Oscillation D} | |
| 283 | - (hu : AngularContinuous u) (hv : AngularContinuous v) (hw : AngularContinuous w) : | |
| 284 | - bilinearCovariance (u + v) w = bilinearCovariance u w + bilinearCovariance v w := by | |
| 285 | - funext i j n x | |
| 286 | - have he : (fun θ : ℝ => (u + v) n (x, θ) i * w n (x, θ) j) = | |
| 287 | - (fun θ => u n (x, θ) i * w n (x, θ) j + v n (x, θ) i * w n (x, θ) j) := by | |
| 288 | - funext θ | |
| 289 | - simp only [Pi.add_apply] | |
| 290 | - ring | |
| 291 | - change (∫ θ in (0 : ℝ)..2 * Real.pi, (u + v) n (x, θ) i * w n (x, θ) j) / | |
| 292 | - (2 * Real.pi) = _ | |
| 293 | - rw [he, intervalIntegral.integral_add (((hu n x i).fun_mul (hw n x j)).intervalIntegrable _ _) | |
| 294 | - (((hv n x i).fun_mul (hw n x j)).intervalIntegrable _ _), add_div] | |
| 295 | - rfl | |
| 296 | - | |
| 297 | -omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 298 | -theorem bilinearCovariance_add_right {u v w : Oscillation D} | |
| 299 | - (hu : AngularContinuous u) (hv : AngularContinuous v) (hw : AngularContinuous w) : | |
| 300 | - bilinearCovariance u (v + w) = bilinearCovariance u v + bilinearCovariance u w := by | |
| 301 | - funext i j | |
| 302 | - rw [bilinearCovariance_comm u (v + w) i j, | |
| 303 | - congrFun (congrFun (bilinearCovariance_add_left hv hw hu) j) i] | |
| 304 | - simp only [Pi.add_apply, bilinearCovariance_comm v u j i, bilinearCovariance_comm w u j i] | |
| 305 | - | |
| 306 | -/-- The actual covariance increment contains both cross terms and the | |
| 307 | -entire square of the exact increment. -/ | |
| 308 | -noncomputable def covarianceIncrement (u v : Oscillation D) : Tensor D := | |
| 309 | - bilinearCovariance u v + bilinearCovariance v u + bilinearCovariance v v | |
| 310 | - | |
| 311 | -omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 312 | -theorem covariance_add {u v : Oscillation D} | |
| 313 | - (hu : AngularContinuous u) (hv : AngularContinuous v) : | |
| 314 | - bilinearCovariance (u + v) (u + v) = | |
| 315 | - bilinearCovariance u u + covarianceIncrement u v := by | |
| 316 | - rw [bilinearCovariance_add_left hu hv (hu.add hv), | |
| 317 | - bilinearCovariance_add_right hu hu hv, bilinearCovariance_add_right hv hu hv] | |
| 318 | - unfold covarianceIncrement | |
| 319 | - abel | |
| 320 | - | |
| 321 | -omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 322 | -theorem covariance_actual_update (s : State D) (m : Triple D) (p : ScalarField D) | |
| 323 | - (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) | |
| 324 | - (hu : AngularContinuous s.oscillation) (hv : AngularContinuous v) : | |
| 325 | - (s.addIncrement m p v q e).covariance = s.covariance + covarianceIncrement s.oscillation v := | |
| 326 | - covariance_add hu hv | |
| 327 | - | |
| 328 | -end ActualCovariance | |
| 329 | - | |
| 330 | -section ActualFullUpdate | |
| 331 | - | |
| 332 | -open CorrectionState HarmonicCalculus | |
| 333 | - | |
| 334 | -noncomputable def complexIncrement (m : Triple D) (v : Oscillation D) | |
| 335 | - (n : ℕ) (x : D × ℝ) : ComplexVector := | |
| 336 | - ![(m.radial n x.1 + v n x 0 : ℝ), (m.angular n x.1 + v n x 1 : ℝ), | |
| 337 | - (m.axial n x.1 + v n x 2 : ℝ)] | |
| 338 | - | |
| 339 | -noncomputable def complexPressureIncrement (p : ScalarField D) (q : OscillatoryScalar D) | |
| 340 | - (n : ℕ) (x : D × ℝ) : ℂ := (p n x.1 + q n x : ℝ) | |
| 341 | - | |
| 342 | -omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 343 | -theorem complexPerturbation_actual_update (s : State D) (m : Triple D) (p : ScalarField D) | |
| 344 | - (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) : | |
| 345 | - complexPerturbation (s.addIncrement m p v q e) n = | |
| 346 | - complexPerturbation s n + complexIncrement m v n := by | |
| 347 | - funext x i | |
| 348 | - fin_cases i <;> simp [complexPerturbation, complexIncrement, State.addIncrement, updated] <;> ring | |
| 349 | - | |
| 350 | -omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 351 | -theorem complexPressure_actual_update (s : State D) (m : Triple D) (p : ScalarField D) | |
| 352 | - (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) : | |
| 353 | - complexPressure (s.addIncrement m p v q e) n = | |
| 354 | - complexPressure s n + complexPressureIncrement p q n := by | |
| 355 | - funext x | |
| 356 | - simp [complexPressure, complexPressureIncrement, State.totalPressureIncrement, State.addIncrement] | |
| 357 | - ring | |
| 358 | - | |
| 359 | -/-- The differential increment uses the old *exact* perturbation in both | |
| 360 | -cross terms. The stored excluded residual is not multiplied into the PDE. -/ | |
| 361 | -noncomputable def fullDifferentialIncrement (c : Context D) (s : State D) | |
| 362 | - (m : Triple D) (p : ScalarField D) (v : Oscillation D) (q : OscillatoryScalar D) : | |
| 363 | - ℕ → D × ℝ → ComplexVector := fun n x => | |
| 364 | - let R : D × ℝ → ℝ := fun y => c.operators.radius y.1 | |
| 365 | - let a := complexPerturbation s n | |
| 366 | - let b := complexIncrement m v n | |
| 367 | - LinearWaveResidual.linearResidual (c.operators.epsilon n) R | |
| 368 | - (radialDirection c n) angularDirection (axialDirection c n) (timeDirection c n) | |
| 369 | - (complexBase c n) b (complexPressureIncrement p q n) x + | |
| 370 | - LinearWaveResidual.transport R (radialDirection c n) angularDirection (axialDirection c n) a b x + | |
| 371 | - LinearWaveResidual.transport R (radialDirection c n) angularDirection (axialDirection c n) b a x + | |
| 372 | - LinearWaveResidual.transport R (radialDirection c n) angularDirection (axialDirection c n) b b x | |
| 373 | - | |
| 374 | -theorem fullResidual_actual_update {U : Set (D × ℝ)} (hU : IsOpen U) | |
| 375 | - (c : Context D) (s : State D) (m : Triple D) (p : ScalarField D) | |
| 376 | - (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) | |
| 377 | - (hr : ContDiffOn ℝ ∞ (radialDirection c n) U) | |
| 378 | - (ha : ∀ i, ContDiffOn ℝ ∞ (fun x => complexPerturbation s n x i) U) | |
| 379 | - (hb : ∀ i, ContDiffOn ℝ ∞ (fun x => complexIncrement m v n x i) U) | |
| 380 | - (hp : ContDiffOn ℝ ∞ (complexPressure s n) U) | |
| 381 | - (hq : ContDiffOn ℝ ∞ (complexPressureIncrement p q n) U) | |
| 382 | - {x : D × ℝ} (hx : x ∈ U) (i : Fin 3) : | |
| 383 | - fullResidual c (s.addIncrement m p v q e) n x i - fullResidual c s n x i = | |
| 384 | - (fullDifferentialIncrement c s m p v q n x i).re + e.base n x i := by | |
| 385 | - have hd := nonlinearResidual_add_sub hU (c.operators.epsilon n) | |
| 386 | - (fun y : D × ℝ => c.operators.radius y.1) (timeDirection c n) hr | |
| 387 | - (show ContDiffOn ℝ ∞ (angularDirection : D × ℝ → D × ℝ) U from contDiffOn_const) | |
| 388 | - (show ContDiffOn ℝ ∞ (axialDirection c n) U from contDiffOn_const) | |
| 389 | - (complexBase c n) (complexPerturbation s n) (complexIncrement m v n) | |
| 390 | - (complexPressure s n) (complexPressureIncrement p q n) ha hb hp hq hx | |
| 391 | - have hdreal := congrArg Complex.re (congrFun hd i) | |
| 392 | - simp only [Pi.sub_apply, Pi.add_apply, Complex.sub_re, Complex.add_re] at hdreal | |
| 393 | - simp only [fullResidual] | |
| 394 | - rw [complexPerturbation_actual_update, complexPressure_actual_update] | |
| 395 | - simp only [State.addIncrement, ExcludedErrors.add, Pi.add_apply] | |
| 396 | - change _ = (fullDifferentialIncrement c s m p v q n x i).re + _ | |
| 397 | - unfold fullDifferentialIncrement | |
| 398 | - simp only [Pi.add_apply, Complex.add_re] | |
| 399 | - linarith | |
| 400 | - | |
| 401 | -theorem fullGoodResidual_actual_update {U : Set (D × ℝ)} (hU : IsOpen U) | |
| 402 | - (c : Context D) (s : State D) (m : Triple D) (p : ScalarField D) | |
| 403 | - (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) | |
| 404 | - (hr : ContDiffOn ℝ ∞ (radialDirection c n) U) | |
| 405 | - (ha : ∀ i, ContDiffOn ℝ ∞ (fun x => complexPerturbation s n x i) U) | |
| 406 | - (hb : ∀ i, ContDiffOn ℝ ∞ (fun x => complexIncrement m v n x i) U) | |
| 407 | - (hp : ContDiffOn ℝ ∞ (complexPressure s n) U) | |
| 408 | - (hq : ContDiffOn ℝ ∞ (complexPressureIncrement p q n) U) | |
| 409 | - {x : D × ℝ} (hx : x ∈ U) (i : Fin 3) : | |
| 410 | - fullGoodResidual c (s.addIncrement m p v q e) n x i - fullGoodResidual c s n x i = | |
| 411 | - (fullDifferentialIncrement c s m p v q n x i).re - | |
| 412 | - e.gaussian n x i - e.aliasError n x i := by | |
| 413 | - have hd := fullResidual_actual_update hU c s m p v q e n hr ha hb hp hq hx i | |
| 414 | - simp only [fullGoodResidual, State.addIncrement, ExcludedErrors.total, | |
| 415 | - ExcludedErrors.add, Pi.sub_apply, Pi.add_apply] at * | |
| 416 | - linarith | |
| 417 | - | |
| 418 | -end ActualFullUpdate | |
| 419 | - | |
| 420 | 68 | section TemporalComposition |
| 421 | 69 | |
| 422 | 70 | open CorrectionState |
+383 −0 NavierStokes/CorrectionStepFullResidual.lean added View file
| @@ -0,0 +1,383 @@ | ||
| 1 | +import NavierStokes.CorrectionState | |
| 2 | +import NavierStokes.LinearWaveResidual | |
| 3 | +import NavierStokes.CorrectionStepCovariance | |
| 4 | + | |
| 5 | +/-! | |
| 6 | +# Exact full residual and its increment | |
| 7 | + | |
| 8 | +The 166-page Navier–Stokes paper uses cylindrical transport with frame terms | |
| 9 | +in §9.1, equation (9.2) and Lemma 9.2. This module supplies the addition laws | |
| 10 | +for those differential operators and their exact expansion under an update. | |
| 11 | +It assembles the velocity and pressure corrections of §9.3, equation (9.7), | |
| 12 | +and separates the angular mean, nonconstant angular part and stored errors | |
| 13 | +as in the residual decomposition of §9.2, equations (9.3)–(9.4). It keeps both | |
| 14 | +old/new transport terms and the square of the increment. The angular | |
| 15 | +covariance uses the full oscillation as in §8.1, equation (8.1). Its exact | |
| 16 | +update gives the cross terms and square used in the split in §9.3, | |
| 17 | +equation (9.13). | |
| 18 | +-/ | |
| 19 | + | |
| 20 | +noncomputable section | |
| 21 | + | |
| 22 | +namespace NavierStokes.CorrectionStep | |
| 23 | + | |
| 24 | +open Set WeightedClasses MeanIncrementBounds | |
| 25 | +open scoped ContDiff BigOperators | |
| 26 | + | |
| 27 | +variable {D : Type} [NormedAddCommGroup D] [NormedSpace ℝ D] | |
| 28 | + | |
| 29 | +/-! ## The full differential residual, before angular averaging -/ | |
| 30 | + | |
| 31 | +section FullCalculus | |
| 32 | + | |
| 33 | +open HarmonicCalculus LinearWaveResidual | |
| 34 | + | |
| 35 | +theorem angularGenerator_add (a b : ComplexVector) : | |
| 36 | + angularGenerator (a + b) = angularGenerator a + angularGenerator b := by | |
| 37 | + ext i | |
| 38 | + fin_cases i <;> simp [angularGenerator] | |
| 39 | + abel | |
| 40 | + | |
| 41 | +theorem transport_add_left (R : D → ℝ) (Vr Vθ Vz : D → D) | |
| 42 | + (a b v : D → ComplexVector) (x : D) : | |
| 43 | + transport R Vr Vθ Vz (a + b) v x = | |
| 44 | + transport R Vr Vθ Vz a v x + transport R Vr Vθ Vz b v x := by | |
| 45 | + ext i | |
| 46 | + simp only [transport, Pi.add_apply] | |
| 47 | + ring | |
| 48 | + | |
| 49 | +theorem transport_add_right (R : D → ℝ) (Vr Vθ Vz : D → D) | |
| 50 | + (u a b : D → ComplexVector) {x : D} | |
| 51 | + (ha : ∀ i, DifferentiableAt ℝ (fun y => a y i) x) | |
| 52 | + (hb : ∀ i, DifferentiableAt ℝ (fun y => b y i) x) : | |
| 53 | + transport R Vr Vθ Vz u (a + b) x = | |
| 54 | + transport R Vr Vθ Vz u a x + transport R Vr Vθ Vz u b x := by | |
| 55 | + ext i | |
| 56 | + simp only [transport, Pi.add_apply, angularGenerator_add, | |
| 57 | + along_add _ (ha i) (hb i)] | |
| 58 | + ring | |
| 59 | + | |
| 60 | +theorem twiceAlong_add {U : Set D} (hU : IsOpen U) {V : D → D} | |
| 61 | + (hV : ContDiffOn ℝ ∞ V U) {f g : D → ℂ} | |
| 62 | + (hf : ContDiffOn ℝ ∞ f U) (hg : ContDiffOn ℝ ∞ g U) | |
| 63 | + {x : D} (hx : x ∈ U) : | |
| 64 | + along V (along V (f + g)) x = along V (along V f) x + along V (along V g) x := by | |
| 65 | + have heq : EqOn (along V (f + g)) (along V f + along V g) U := by | |
| 66 | + intro y hy | |
| 67 | + exact along_add V ((hf.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) | |
| 68 | + ((hg.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) | |
| 69 | + rw [along_congr hU heq hx] | |
| 70 | + exact along_add V | |
| 71 | + (((contDiffOn_along hU hV hf).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 72 | + (((contDiffOn_along hU hV hg).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 73 | + | |
| 74 | +theorem cylindricalLaplacian_add {U : Set D} (hU : IsOpen U) (R : D → ℝ) | |
| 75 | + {Vr Vθ Vz : D → D} (hr : ContDiffOn ℝ ∞ Vr U) | |
| 76 | + (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 77 | + {f g : D → ℂ} (hf : ContDiffOn ℝ ∞ f U) (hg : ContDiffOn ℝ ∞ g U) | |
| 78 | + {x : D} (hx : x ∈ U) : | |
| 79 | + cylindricalLaplacian R Vr Vθ Vz (f + g) x = | |
| 80 | + cylindricalLaplacian R Vr Vθ Vz f x + cylindricalLaplacian R Vr Vθ Vz g x := by | |
| 81 | + have df := (hf.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 82 | + have dg := (hg.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 83 | + have hfirst : along Vr (f + g) x = along Vr f x + along Vr g x := along_add Vr df dg | |
| 84 | + simp only [cylindricalLaplacian, twiceAlong_add hU hr hf hg hx, | |
| 85 | + twiceAlong_add hU hθ hf hg hx, twiceAlong_add hU hz hf hg hx, | |
| 86 | + hfirst, smul_add] | |
| 87 | + abel | |
| 88 | + | |
| 89 | +theorem cylindricalVectorLaplacian_add {U : Set D} (hU : IsOpen U) (R : D → ℝ) | |
| 90 | + {Vr Vθ Vz : D → D} (hr : ContDiffOn ℝ ∞ Vr U) | |
| 91 | + (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 92 | + {a b : D → ComplexVector} | |
| 93 | + (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) | |
| 94 | + (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) | |
| 95 | + {x : D} (hx : x ∈ U) : | |
| 96 | + cylindricalVectorLaplacian R Vr Vθ Vz (a + b) x = | |
| 97 | + cylindricalVectorLaplacian R Vr Vθ Vz a x + | |
| 98 | + cylindricalVectorLaplacian R Vr Vθ Vz b x := by | |
| 99 | + have hL i : cylindricalLaplacian R Vr Vθ Vz (fun y => a y i + b y i) x = | |
| 100 | + cylindricalLaplacian R Vr Vθ Vz (fun y => a y i) x + | |
| 101 | + cylindricalLaplacian R Vr Vθ Vz (fun y => b y i) x := | |
| 102 | + cylindricalLaplacian_add hU R hr hθ hz (ha i) (hb i) hx | |
| 103 | + have hD i := along_add Vθ | |
| 104 | + (((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 105 | + (((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) | |
| 106 | + ext i | |
| 107 | + fin_cases i <;> | |
| 108 | + simp [cylindricalVectorLaplacian, angularGenerator, hL 0, hL 1, hL 2, | |
| 109 | + hD 0, hD 1, Complex.real_smul] <;> ring | |
| 110 | + | |
| 111 | +theorem gradient_add (R : D → ℝ) (Vr Vθ Vz : D → D) | |
| 112 | + {p q : D → ℂ} {x : D} (hp : DifferentiableAt ℝ p x) | |
| 113 | + (hq : DifferentiableAt ℝ q x) : | |
| 114 | + gradient R Vr Vθ Vz (p + q) x = gradient R Vr Vθ Vz p x + gradient R Vr Vθ Vz q x := by | |
| 115 | + have hd (V : D → D) : along V (p + q) x = along V p x + along V q x := along_add V hp hq | |
| 116 | + ext i | |
| 117 | + fin_cases i <;> simp [gradient, hd, smul_add] | |
| 118 | + | |
| 119 | +theorem linearResidual_add {U : Set D} (hU : IsOpen U) (ε : ℝ) (R : D → ℝ) | |
| 120 | + {Vr Vθ Vz : D → D} (Vt : D → D) (hr : ContDiffOn ℝ ∞ Vr U) | |
| 121 | + (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 122 | + (B a b : D → ComplexVector) (p q : D → ℂ) | |
| 123 | + (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) | |
| 124 | + (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) | |
| 125 | + (hp : ContDiffOn ℝ ∞ p U) (hq : ContDiffOn ℝ ∞ q U) | |
| 126 | + {x : D} (hx : x ∈ U) : | |
| 127 | + linearResidual ε R Vr Vθ Vz Vt B (a + b) (p + q) x = | |
| 128 | + linearResidual ε R Vr Vθ Vz Vt B a p x + linearResidual ε R Vr Vθ Vz Vt B b q x := by | |
| 129 | + have da i := ((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 130 | + have db i := ((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 131 | + have dp := (hp.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 132 | + have dq := (hq.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 133 | + have hL := cylindricalVectorLaplacian_add hU R hr hθ hz ha hb hx | |
| 134 | + ext i | |
| 135 | + simp only [linearResidual, Pi.add_apply, along_add _ (da i) (db i), | |
| 136 | + transport_add_left, transport_add_right R Vr Vθ Vz B a b da db, | |
| 137 | + gradient_add R Vr Vθ Vz dp dq, hL] | |
| 138 | + ring | |
| 139 | + | |
| 140 | +/-- Exact residual of a perturbation of a fixed base, before the virtual | |
| 141 | +stress and the separately retained base residual are added. -/ | |
| 142 | +noncomputable def nonlinearResidual (ε : ℝ) (R : D → ℝ) (Vr Vθ Vz Vt : D → D) | |
| 143 | + (B a : D → ComplexVector) (p : D → ℂ) (x : D) : ComplexVector := | |
| 144 | + linearResidual ε R Vr Vθ Vz Vt B a p x + transport R Vr Vθ Vz a a x | |
| 145 | + | |
| 146 | +theorem nonlinearResidual_add_sub {U : Set D} (hU : IsOpen U) (ε : ℝ) (R : D → ℝ) | |
| 147 | + {Vr Vθ Vz : D → D} (Vt : D → D) (hr : ContDiffOn ℝ ∞ Vr U) | |
| 148 | + (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) | |
| 149 | + (B a b : D → ComplexVector) (p q : D → ℂ) | |
| 150 | + (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) | |
| 151 | + (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) | |
| 152 | + (hp : ContDiffOn ℝ ∞ p U) (hq : ContDiffOn ℝ ∞ q U) | |
| 153 | + {x : D} (hx : x ∈ U) : | |
| 154 | + nonlinearResidual ε R Vr Vθ Vz Vt B (a + b) (p + q) x - | |
| 155 | + nonlinearResidual ε R Vr Vθ Vz Vt B a p x = | |
| 156 | + linearResidual ε R Vr Vθ Vz Vt B b q x + transport R Vr Vθ Vz a b x + | |
| 157 | + transport R Vr Vθ Vz b a x + transport R Vr Vθ Vz b b x := by | |
| 158 | + have da i := ((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 159 | + have db i := ((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) | |
| 160 | + rw [nonlinearResidual, linearResidual_add hU ε R Vt hr hθ hz B a b p q ha hb hp hq hx, | |
| 161 | + transport_add_left, transport_add_right R Vr Vθ Vz a a b da db, | |
| 162 | + transport_add_right R Vr Vθ Vz b a b da db, nonlinearResidual] | |
| 163 | + abel | |
| 164 | + | |
| 165 | +end FullCalculus | |
| 166 | + | |
| 167 | +section FullFields | |
| 168 | + | |
| 169 | +open CorrectionState HarmonicCalculus | |
| 170 | + | |
| 171 | +noncomputable def radialDirection (c : Context D) (n : ℕ) (x : D × ℝ) : D × ℝ := | |
| 172 | + (c.operators.eR + (c.operators.radialFrequency n * c.operators.radialProfile x.1) • | |
| 173 | + c.operators.vR, 0) | |
| 174 | + | |
| 175 | +noncomputable def axialDirection (c : Context D) (n : ℕ) (_x : D × ℝ) : D × ℝ := | |
| 176 | + (c.operators.epsilon n • c.operators.eZ, 0) | |
| 177 | + | |
| 178 | +noncomputable def angularDirection (_x : D × ℝ) : D × ℝ := (0, 1) | |
| 179 | + | |
| 180 | +noncomputable def timeDirection (c : Context D) (n : ℕ) (_x : D × ℝ) : D × ℝ := | |
| 181 | + (c.operators.fastCoefficient n • c.operators.vT - c.operators.epsilon n • c.operators.eT, 0) | |
| 182 | + | |
| 183 | +noncomputable def complexBase (c : Context D) (n : ℕ) (x : D × ℝ) : ComplexVector := | |
| 184 | + ![(c.base.radial n x.1 : ℂ), (c.base.angular n x.1 : ℂ), (c.base.axial n x.1 : ℂ)] | |
| 185 | + | |
| 186 | +noncomputable def complexPerturbation (u : State D) (n : ℕ) (x : D × ℝ) : ComplexVector := | |
| 187 | + ![(u.mean.radial n x.1 + u.oscillation n x 0 : ℝ), | |
| 188 | + (u.mean.angular n x.1 + u.oscillation n x 1 : ℝ), | |
| 189 | + (u.mean.axial n x.1 + u.oscillation n x 2 : ℝ)] | |
| 190 | + | |
| 191 | +noncomputable def complexPressure (u : State D) (n : ℕ) (x : D × ℝ) : ℂ := | |
| 192 | + (u.totalPressureIncrement n x : ℝ) | |
| 193 | + | |
| 194 | +noncomputable def virtualDivergence (c : Context D) (n : ℕ) (x : D × ℝ) : Fin 3 → ℝ := | |
| 195 | + ![0, -(c.operators.radialDiv 2 c.virtualTheta n x.1), | |
| 196 | + -(c.operators.radialDiv 1 c.virtualAxial n x.1)] | |
| 197 | + | |
| 198 | +/-- This field uses actual Fréchet derivatives. The base flat error is | |
| 199 | +restored once, alongside the negative virtual-stress divergence. -/ | |
| 200 | +noncomputable def fullResidual (c : Context D) (u : State D) : Oscillation D := fun n x i => | |
| 201 | + (nonlinearResidual (c.operators.epsilon n) (fun y : D × ℝ => c.operators.radius y.1) | |
| 202 | + (radialDirection c n) angularDirection (axialDirection c n) (timeDirection c n) | |
| 203 | + (complexBase c n) (complexPerturbation u n) (complexPressure u n) x i).re + | |
| 204 | + virtualDivergence c n x i + u.errors.base n x i | |
| 205 | + | |
| 206 | +noncomputable def fullGoodResidual (c : Context D) (u : State D) : Oscillation D := | |
| 207 | + fullResidual c u - u.errors.total | |
| 208 | + | |
| 209 | +noncomputable def angularMeanVector (f : Oscillation D) : MeanVector D := | |
| 210 | + fun n x i => angularAverage (fun k p => f k p i) n x | |
| 211 | + | |
| 212 | +noncomputable def angularNonconstant (f : Oscillation D) : Oscillation D := | |
| 213 | + fun n x i => f n x i - angularMeanVector f n x.1 i | |
| 214 | + | |
| 215 | +noncomputable def fullGoodWaveResidual (c : Context D) (u : State D) : Oscillation D := | |
| 216 | + angularNonconstant (fullGoodResidual c u) | |
| 217 | + | |
| 218 | +theorem fullResidual_eq_good_add_excluded (c : Context D) (u : State D) : | |
| 219 | + fullResidual c u = fullGoodResidual c u + u.errors.total := by | |
| 220 | + simp [fullGoodResidual] | |
| 221 | + | |
| 222 | +theorem fullResidual_decomposition (c : Context D) (u : State D) : | |
| 223 | + fullResidual c u = fun n x i => fullGoodWaveResidual c u n x i + | |
| 224 | + angularMeanVector (fullGoodResidual c u) n x.1 i + u.errors.total n x i := by | |
| 225 | + funext n x i | |
| 226 | + simp only [fullGoodWaveResidual, angularNonconstant, fullGoodResidual, | |
| 227 | + Pi.sub_apply] | |
| 228 | + ring | |
| 229 | + | |
| 230 | +end FullFields | |
| 231 | + | |
| 232 | +section ActualCovariance | |
| 233 | + | |
| 234 | +open CorrectionState MeasureTheory | |
| 235 | + | |
| 236 | +def AngularContinuous (u : Oscillation D) : Prop := | |
| 237 | + ∀ n x i, Continuous (fun θ : ℝ => u n (x, θ) i) | |
| 238 | + | |
| 239 | +omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 240 | +theorem AngularContinuous.add {u v : Oscillation D} | |
| 241 | + (hu : AngularContinuous u) (hv : AngularContinuous v) : AngularContinuous (u + v) := | |
| 242 | + fun n x i => (hu n x i).add (hv n x i) | |
| 243 | + | |
| 244 | +omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 245 | +theorem bilinearCovariance_add_left {u v w : Oscillation D} | |
| 246 | + (hu : AngularContinuous u) (hv : AngularContinuous v) (hw : AngularContinuous w) : | |
| 247 | + bilinearCovariance (u + v) w = bilinearCovariance u w + bilinearCovariance v w := by | |
| 248 | + funext i j n x | |
| 249 | + have he : (fun θ : ℝ => (u + v) n (x, θ) i * w n (x, θ) j) = | |
| 250 | + (fun θ => u n (x, θ) i * w n (x, θ) j + v n (x, θ) i * w n (x, θ) j) := by | |
| 251 | + funext θ | |
| 252 | + simp only [Pi.add_apply] | |
| 253 | + ring | |
| 254 | + change (∫ θ in (0 : ℝ)..2 * Real.pi, (u + v) n (x, θ) i * w n (x, θ) j) / | |
| 255 | + (2 * Real.pi) = _ | |
| 256 | + rw [he, intervalIntegral.integral_add (((hu n x i).fun_mul (hw n x j)).intervalIntegrable _ _) | |
| 257 | + (((hv n x i).fun_mul (hw n x j)).intervalIntegrable _ _), add_div] | |
| 258 | + rfl | |
| 259 | + | |
| 260 | +omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 261 | +theorem bilinearCovariance_add_right {u v w : Oscillation D} | |
| 262 | + (hu : AngularContinuous u) (hv : AngularContinuous v) (hw : AngularContinuous w) : | |
| 263 | + bilinearCovariance u (v + w) = bilinearCovariance u v + bilinearCovariance u w := by | |
| 264 | + funext i j | |
| 265 | + rw [bilinearCovariance_comm u (v + w) i j, | |
| 266 | + congrFun (congrFun (bilinearCovariance_add_left hv hw hu) j) i] | |
| 267 | + simp only [Pi.add_apply, bilinearCovariance_comm v u j i, bilinearCovariance_comm w u j i] | |
| 268 | + | |
| 269 | +/-- The actual covariance increment contains both cross terms and the | |
| 270 | +entire square of the exact increment. -/ | |
| 271 | +noncomputable def covarianceIncrement (u v : Oscillation D) : Tensor D := | |
| 272 | + bilinearCovariance u v + bilinearCovariance v u + bilinearCovariance v v | |
| 273 | + | |
| 274 | +omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 275 | +theorem covariance_add {u v : Oscillation D} | |
| 276 | + (hu : AngularContinuous u) (hv : AngularContinuous v) : | |
| 277 | + bilinearCovariance (u + v) (u + v) = | |
| 278 | + bilinearCovariance u u + covarianceIncrement u v := by | |
| 279 | + rw [bilinearCovariance_add_left hu hv (hu.add hv), | |
| 280 | + bilinearCovariance_add_right hu hu hv, bilinearCovariance_add_right hv hu hv] | |
| 281 | + unfold covarianceIncrement | |
| 282 | + abel | |
| 283 | + | |
| 284 | +omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 285 | +theorem covariance_actual_update (s : State D) (m : Triple D) (p : ScalarField D) | |
| 286 | + (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) | |
| 287 | + (hu : AngularContinuous s.oscillation) (hv : AngularContinuous v) : | |
| 288 | + (s.addIncrement m p v q e).covariance = s.covariance + covarianceIncrement s.oscillation v := | |
| 289 | + covariance_add hu hv | |
| 290 | + | |
| 291 | +end ActualCovariance | |
| 292 | + | |
| 293 | +section ActualFullUpdate | |
| 294 | + | |
| 295 | +open CorrectionState HarmonicCalculus | |
| 296 | + | |
| 297 | +noncomputable def complexIncrement (m : Triple D) (v : Oscillation D) | |
| 298 | + (n : ℕ) (x : D × ℝ) : ComplexVector := | |
| 299 | + ![(m.radial n x.1 + v n x 0 : ℝ), (m.angular n x.1 + v n x 1 : ℝ), | |
| 300 | + (m.axial n x.1 + v n x 2 : ℝ)] | |
| 301 | + | |
| 302 | +noncomputable def complexPressureIncrement (p : ScalarField D) (q : OscillatoryScalar D) | |
| 303 | + (n : ℕ) (x : D × ℝ) : ℂ := (p n x.1 + q n x : ℝ) | |
| 304 | + | |
| 305 | +omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 306 | +theorem complexPerturbation_actual_update (s : State D) (m : Triple D) (p : ScalarField D) | |
| 307 | + (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) : | |
| 308 | + complexPerturbation (s.addIncrement m p v q e) n = | |
| 309 | + complexPerturbation s n + complexIncrement m v n := by | |
| 310 | + funext x i | |
| 311 | + fin_cases i <;> simp [complexPerturbation, complexIncrement, State.addIncrement, updated] <;> ring | |
| 312 | + | |
| 313 | +omit [NormedAddCommGroup D] [NormedSpace ℝ D] in | |
| 314 | +theorem complexPressure_actual_update (s : State D) (m : Triple D) (p : ScalarField D) | |
| 315 | + (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) : | |
| 316 | + complexPressure (s.addIncrement m p v q e) n = | |
| 317 | + complexPressure s n + complexPressureIncrement p q n := by | |
| 318 | + funext x | |
| 319 | + simp [complexPressure, complexPressureIncrement, State.totalPressureIncrement, State.addIncrement] | |
| 320 | + ring | |
| 321 | + | |
| 322 | +/-- The differential increment uses the old *exact* perturbation in both | |
| 323 | +cross terms. The stored excluded residual is not multiplied into the PDE. -/ | |
| 324 | +noncomputable def fullDifferentialIncrement (c : Context D) (s : State D) | |
| 325 | + (m : Triple D) (p : ScalarField D) (v : Oscillation D) (q : OscillatoryScalar D) : | |
| 326 | + ℕ → D × ℝ → ComplexVector := fun n x => | |
| 327 | + let R : D × ℝ → ℝ := fun y => c.operators.radius y.1 | |
| 328 | + let a := complexPerturbation s n | |
| 329 | + let b := complexIncrement m v n | |
| 330 | + LinearWaveResidual.linearResidual (c.operators.epsilon n) R | |
| 331 | + (radialDirection c n) angularDirection (axialDirection c n) (timeDirection c n) | |
| 332 | + (complexBase c n) b (complexPressureIncrement p q n) x + | |
| 333 | + LinearWaveResidual.transport R (radialDirection c n) angularDirection (axialDirection c n) a b x + | |
| 334 | + LinearWaveResidual.transport R (radialDirection c n) angularDirection (axialDirection c n) b a x + | |
| 335 | + LinearWaveResidual.transport R (radialDirection c n) angularDirection (axialDirection c n) b b x | |
| 336 | + | |
| 337 | +theorem fullResidual_actual_update {U : Set (D × ℝ)} (hU : IsOpen U) | |
| 338 | + (c : Context D) (s : State D) (m : Triple D) (p : ScalarField D) | |
| 339 | + (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) | |
| 340 | + (hr : ContDiffOn ℝ ∞ (radialDirection c n) U) | |
| 341 | + (ha : ∀ i, ContDiffOn ℝ ∞ (fun x => complexPerturbation s n x i) U) | |
| 342 | + (hb : ∀ i, ContDiffOn ℝ ∞ (fun x => complexIncrement m v n x i) U) | |
| 343 | + (hp : ContDiffOn ℝ ∞ (complexPressure s n) U) | |
| 344 | + (hq : ContDiffOn ℝ ∞ (complexPressureIncrement p q n) U) | |
| 345 | + {x : D × ℝ} (hx : x ∈ U) (i : Fin 3) : | |
| 346 | + fullResidual c (s.addIncrement m p v q e) n x i - fullResidual c s n x i = | |
| 347 | + (fullDifferentialIncrement c s m p v q n x i).re + e.base n x i := by | |
| 348 | + have hd := nonlinearResidual_add_sub hU (c.operators.epsilon n) | |
| 349 | + (fun y : D × ℝ => c.operators.radius y.1) (timeDirection c n) hr | |
| 350 | + (show ContDiffOn ℝ ∞ (angularDirection : D × ℝ → D × ℝ) U from contDiffOn_const) | |
| 351 | + (show ContDiffOn ℝ ∞ (axialDirection c n) U from contDiffOn_const) | |
| 352 | + (complexBase c n) (complexPerturbation s n) (complexIncrement m v n) | |
| 353 | + (complexPressure s n) (complexPressureIncrement p q n) ha hb hp hq hx | |
| 354 | + have hdreal := congrArg Complex.re (congrFun hd i) | |
| 355 | + simp only [Pi.sub_apply, Pi.add_apply, Complex.sub_re, Complex.add_re] at hdreal | |
| 356 | + simp only [fullResidual] | |
| 357 | + rw [complexPerturbation_actual_update, complexPressure_actual_update] | |
| 358 | + simp only [State.addIncrement, ExcludedErrors.add, Pi.add_apply] | |
| 359 | + change _ = (fullDifferentialIncrement c s m p v q n x i).re + _ | |
| 360 | + unfold fullDifferentialIncrement | |
| 361 | + simp only [Pi.add_apply, Complex.add_re] | |
| 362 | + linarith | |
| 363 | + | |
| 364 | +theorem fullGoodResidual_actual_update {U : Set (D × ℝ)} (hU : IsOpen U) | |
| 365 | + (c : Context D) (s : State D) (m : Triple D) (p : ScalarField D) | |
| 366 | + (v : Oscillation D) (q : OscillatoryScalar D) (e : ExcludedErrors D) (n : ℕ) | |
| 367 | + (hr : ContDiffOn ℝ ∞ (radialDirection c n) U) | |
| 368 | + (ha : ∀ i, ContDiffOn ℝ ∞ (fun x => complexPerturbation s n x i) U) | |
| 369 | + (hb : ∀ i, ContDiffOn ℝ ∞ (fun x => complexIncrement m v n x i) U) | |
| 370 | + (hp : ContDiffOn ℝ ∞ (complexPressure s n) U) | |
| 371 | + (hq : ContDiffOn ℝ ∞ (complexPressureIncrement p q n) U) | |
| 372 | + {x : D × ℝ} (hx : x ∈ U) (i : Fin 3) : | |
| 373 | + fullGoodResidual c (s.addIncrement m p v q e) n x i - fullGoodResidual c s n x i = | |
| 374 | + (fullDifferentialIncrement c s m p v q n x i).re - | |
| 375 | + e.gaussian n x i - e.aliasError n x i := by | |
| 376 | + have hd := fullResidual_actual_update hU c s m p v q e n hr ha hb hp hq hx i | |
| 377 | + simp only [fullGoodResidual, State.addIncrement, ExcludedErrors.total, | |
| 378 | + ExcludedErrors.add, Pi.sub_apply, Pi.add_apply] at * | |
| 379 | + linarith | |
| 380 | + | |
| 381 | +end ActualFullUpdate | |
| 382 | + | |
| 383 | +end NavierStokes.CorrectionStep | |
+16 −0 routes/p2-correction-full-residual/README.md added View file
| @@ -0,0 +1,16 @@ | ||
| 1 | +--- | |
| 2 | +issue: 3 | |
| 3 | +status: working | |
| 4 | +--- | |
| 5 | + | |
| 6 | +# P-2: Extract the exact full-residual update | |
| 7 | + | |
| 8 | +Second slice after [PR #30](https://shoal.club/shoal/navier-stokes/pull/30). `NavierStokes/CorrectionStepFullResidual.lean` contains the contiguous `FullCalculus`, `FullFields`, `ActualCovariance`, and `ActualFullUpdate` sections, ending before `TemporalComposition`. The 354-line block contains 39 declarations and is identical to the corresponding block at `c3a1eab`, including its section scopes, declaration text, and proofs. `NavierStokes.CorrectionStep` imports the new module under the same declaration namespace. | |
| 9 | + | |
| 10 | +In the [166-page paper](https://cdn.openai.com/pdf/32d9f210-8b73-45e0-91bc-82a30aef8a9a/navier-stokes.pdf), §9.1, equation (9.2) and Lemma 9.2 describe the cylindrical differential operators and the transport frame terms. `fullResidual` assembles the mean and oscillatory corrections from §9.3, equation (9.7), with the fixed base's flat error restored separately alongside the virtual-stress divergence. `fullResidual_decomposition` records the split into the angular mean, nonconstant angular part, and excluded errors from the bookkeeping of §9.2, equations (9.3)–(9.4). The exact increment expands the quadratic transport with both old/new terms and the square of the increment. `covarianceIncrement` expands the covariance of the full oscillation from §8.1, equation (8.1), before the additional decomposition and auxiliary averaging in §9.3, equation (9.13). | |
| 11 | + | |
| 12 | +To reproduce the move check, compare the original block from the `## The full differential residual` marker through `end ActualFullUpdate` at `c3a1eab` with the same block of the new module. Run `python3 checks/challenge.py .` from an LF checkout, then `lake build NavierStokes.CorrectionStepFullResidual NavierStokes.CorrectionStep` with the pinned toolchain. The pinned toolchain was unavailable locally. The remote `build` is the compilation evidence for this slice. | |
| 13 | + | |
| 14 | +## Next | |
| 15 | + | |
| 16 | +Review this slice against its `challenge`, `build`, and `replay` results. The next contiguous section begins at `TemporalComposition`; check its dependencies and map its temporal mean work to the paper before proposing another split. | |