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.CorrectionState |
| 2 | import NavierStokes.LinearWaveResidual |
| 3 | import NavierStokes.HarmonicFields |
| 4 | |
| 5 | /-! |
| 6 | # Finite harmonic extraction of the actual cylindrical residual |
| 7 | |
| 8 | The coefficient operations below reconstruct genuine differential fields. |
| 9 | Excluded errors remain explicit inputs with field-evaluation witnesses. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | namespace NavierStokes.HarmonicResidual |
| 15 | |
| 16 | open Set Function Filter MeasureTheory |
| 17 | open HarmonicFields HarmonicCalculus |
| 18 | open scoped Topology ContDiff BigOperators ComplexConjugate |
| 19 | |
| 20 | |
| 21 | variable {D : Type} [NormedAddCommGroup D] [NormedSpace ℝ D] |
| 22 | |
| 23 | abbrev Coefficients (D : Type) := HarmonicFields.Coefficients D |
| 24 | abbrev VectorCoefficients (D : Type) := Fin 3 → Coefficients D |
| 25 | |
| 26 | noncomputable def liftDomain (U : Set D) : Set (D × ℝ) := U ×ˢ univ |
| 27 | |
| 28 | omit [NormedSpace ℝ D] in |
| 29 | theorem liftDomain_open {U : Set D} (hU : IsOpen U) : IsOpen (liftDomain U) := |
| 30 | hU.prod isOpen_univ |
| 31 | |
| 32 | noncomputable def liftDirection (V : D → D) (p : D × ℝ) : D × ℝ := (V p.1, 0) |
| 33 | noncomputable def angularDirection (_p : D × ℝ) : D × ℝ := (0, 1) |
| 34 | |
| 35 | /-- Smoothness is required of actual coefficient functions. -/ |
| 36 | def SmoothCoefficients (U : Set D) (c : Coefficients D) : Prop := |
| 37 | ∀ j : ℤ, ContDiffOn ℝ ∞ (c j) U |
| 38 | |
| 39 | theorem smoothCoefficients_zero (U : Set D) : SmoothCoefficients U 0 := fun _ => contDiffOn_const |
| 40 | |
| 41 | theorem SmoothCoefficients.add {U : Set D} {c d : Coefficients D} |
| 42 | (hc : SmoothCoefficients U c) (hd : SmoothCoefficients U d) : SmoothCoefficients U (c + d) := |
| 43 | fun j => (hc j).add (hd j) |
| 44 | |
| 45 | theorem SmoothCoefficients.neg {U : Set D} {c : Coefficients D} |
| 46 | (hc : SmoothCoefficients U c) : SmoothCoefficients U (-c) := fun j => (hc j).neg |
| 47 | |
| 48 | theorem SmoothCoefficients.sub {U : Set D} {c d : Coefficients D} |
| 49 | (hc : SmoothCoefficients U c) (hd : SmoothCoefficients U d) : SmoothCoefficients U (c - d) := |
| 50 | fun j => (hc j).sub (hd j) |
| 51 | |
| 52 | theorem SmoothCoefficients.mul {U : Set D} {c d : Coefficients D} |
| 53 | (hc : SmoothCoefficients U c) (hd : SmoothCoefficients U d) : SmoothCoefficients U (c * d) := by |
| 54 | intro j |
| 55 | have he : (c * d) j = fun x => ∑ i ∈ c.support, c i x * d (j - i) x := by |
| 56 | funext x |
| 57 | exact HarmonicFields.convolution_apply c d j x |
| 58 | rw [he] |
| 59 | exact ContDiffOn.sum (fun i _ => (hc i).mul (hd (j - i))) |
| 60 | |
| 61 | theorem smoothCoefficients_constant {U : Set D} {f : D → ℂ} |
| 62 | (hf : ContDiffOn ℝ ∞ f U) : SmoothCoefficients U (constantCoefficient f) := by |
| 63 | intro j |
| 64 | by_cases hj : j = 0 |
| 65 | · simpa [constantCoefficient, hj] using hf |
| 66 | · change ContDiffOn ℝ ∞ ((Finsupp.single (0 : ℤ) f) j) U |
| 67 | rw [Finsupp.single_eq_of_ne hj] |
| 68 | exact contDiffOn_const |
| 69 | |
| 70 | theorem SmoothCoefficients.differentiate {U : Set D} (hU : IsOpen U) |
| 71 | {V : D → D} {Φ : D → ℝ} (hV : ContDiffOn ℝ ∞ V U) (hΦ : ContDiffOn ℝ ∞ Φ U) |
| 72 | (k : ℝ) {c : Coefficients D} (hc : SmoothCoefficients U c) : |
| 73 | SmoothCoefficients U (differentiate V k Φ c) := |
| 74 | fun j => derivativeCoefficient_contDiffOn hU hV hΦ (hc j) k j |
| 75 | |
| 76 | theorem SmoothCoefficients.angular {U : Set D} {c : Coefficients D} |
| 77 | (hc : SmoothCoefficients U c) (kp : ℤ) : SmoothCoefficients U (angularDifferentiate kp c) := |
| 78 | fun j => contDiffOn_const.mul (hc j) |
| 79 | |
| 80 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 81 | @[simp] theorem field_add (c d : Coefficients D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) (p : D × ℝ) : |
| 82 | field (c + d) k Φ kp p = field c k Φ kp p + field d k Φ kp p := |
| 83 | evaluate_add c d p.1 _ |
| 84 | |
| 85 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 86 | @[simp] theorem field_zero (k : ℝ) (Φ : D → ℝ) (kp : ℤ) (p : D × ℝ) : |
| 87 | field (0 : Coefficients D) k Φ kp p = 0 := evaluate_zero _ _ |
| 88 | |
| 89 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 90 | @[simp] theorem field_neg (c : Coefficients D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) (p : D × ℝ) : |
| 91 | field (-c) k Φ kp p = -field c k Φ kp p := (evaluateHom p.1 _).map_neg c |
| 92 | |
| 93 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 94 | @[simp] theorem field_sub (c d : Coefficients D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) (p : D × ℝ) : |
| 95 | field (c - d) k Φ kp p = field c k Φ kp p - field d k Φ kp p := (evaluateHom p.1 _).map_sub c d |
| 96 | |
| 97 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 98 | @[simp] theorem field_constant (f : D → ℂ) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) (p : D × ℝ) : |
| 99 | field (constantCoefficient f) k Φ kp p = f p.1 := by |
| 100 | unfold field constantCoefficient |
| 101 | rw [evaluate_single, character_zero, mul_one] |
| 102 | |
| 103 | theorem field_smoothOn {U : Set D} {c : Coefficients D} (hc : SmoothCoefficients U c) |
| 104 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) : |
| 105 | ContDiffOn ℝ ∞ (field c k Φ kp) (liftDomain U) := by |
| 106 | have hfst : MapsTo (Prod.fst : D × ℝ → D) (liftDomain U) U := fun _ hp => hp.1 |
| 107 | have hphase : ContDiffOn ℝ ∞ (fun p : D × ℝ => k * Φ p.1 + (kp : ℝ) * p.2) (liftDomain U) := |
| 108 | (contDiffOn_const.mul (hΦ.comp contDiffOn_fst hfst)).add |
| 109 | (contDiffOn_const.mul contDiffOn_snd) |
| 110 | unfold field evaluate HarmonicFields.Coefficients.sum Finsupp.sum |
| 111 | apply ContDiffOn.sum |
| 112 | intro j _ |
| 113 | apply ((hc j).comp contDiffOn_fst hfst).mul |
| 114 | unfold character |
| 115 | exact ((contDiffOn_const.mul (Complex.ofRealCLM.contDiff.comp_contDiffOn hphase)).mul contDiffOn_const).cexp |
| 116 | |
| 117 | theorem along_liftDirection {f : D × ℝ → ℂ} {x : D} {θ : ℝ} |
| 118 | (hf : DifferentiableAt ℝ f (x, θ)) (V : D → D) : |
| 119 | along (liftDirection V) f (x, θ) = along V (fun y => f (y, θ)) x := by |
| 120 | have hi : HasFDerivAt (fun y : D => (y, θ)) |
| 121 | ((ContinuousLinearMap.id ℝ D).prod (0 : D →L[ℝ] ℝ)) x := |
| 122 | (hasFDerivAt_id x).prodMk (hasFDerivAt_const θ x) |
| 123 | have hd := hf.hasFDerivAt.comp x hi |
| 124 | simp only [Function.comp_def] at hd |
| 125 | unfold along liftDirection |
| 126 | rw [hd.fderiv] |
| 127 | rfl |
| 128 | |
| 129 | theorem along_angularDirection {f : D × ℝ → ℂ} {x : D} {θ : ℝ} |
| 130 | (hf : DifferentiableAt ℝ f (x, θ)) : |
| 131 | along angularDirection f (x, θ) = deriv (fun t => f (x, t)) θ := by |
| 132 | have hi : HasDerivAt (fun t : ℝ => (x, t)) (0, 1) θ := |
| 133 | (hasDerivAt_const θ x).prodMk (hasDerivAt_id θ) |
| 134 | have hd := hf.hasFDerivAt.comp_hasDerivAt θ hi |
| 135 | exact hd.deriv.symm |
| 136 | |
| 137 | theorem field_differentiate {U : Set D} (hU : IsOpen U) {c : Coefficients D} |
| 138 | (hc : SmoothCoefficients U c) {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) |
| 139 | (V : D → D) (k : ℝ) (kp : ℤ) {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 140 | field (differentiate V k Φ c) k Φ kp p = along (liftDirection V) (field c k Φ kp) p := by |
| 141 | rcases p with ⟨x, θ⟩ |
| 142 | have hd := ((field_smoothOn hc hΦ k kp).contDiffAt ((liftDomain_open hU).mem_nhds hp)).differentiableAt (by simp) |
| 143 | rw [along_liftDirection hd] |
| 144 | exact (along_field_slow V k Φ kp c θ |
| 145 | ((hΦ.contDiffAt (hU.mem_nhds hp.1)).differentiableAt (by simp)) |
| 146 | (fun j _ => ((hc j).contDiffAt (hU.mem_nhds hp.1)).differentiableAt (by simp))).symm |
| 147 | |
| 148 | theorem field_angularDifferentiate {U : Set D} (hU : IsOpen U) {c : Coefficients D} |
| 149 | (hc : SmoothCoefficients U c) {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) |
| 150 | (k : ℝ) (kp : ℤ) {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 151 | field (angularDifferentiate kp c) k Φ kp p = along angularDirection (field c k Φ kp) p := by |
| 152 | rcases p with ⟨x, θ⟩ |
| 153 | have hd := ((field_smoothOn hc hΦ k kp).contDiffAt ((liftDomain_open hU).mem_nhds hp)).differentiableAt (by simp) |
| 154 | rw [along_angularDirection hd] |
| 155 | exact (field_hasDerivAt_angle c k Φ kp x θ).deriv.symm |
| 156 | |
| 157 | /-- The directions and the cylindrical radius of one normalized graph. -/ |
| 158 | structure Frame (D : Type) where |
| 159 | radius : D → ℝ |
| 160 | radial : D → D |
| 161 | axial : D → D |
| 162 | time : D → D |
| 163 | viscosity : ℝ |
| 164 | |
| 165 | noncomputable def vectorField (a : VectorCoefficients D) (k : ℝ) (Φ : D → ℝ) |
| 166 | (kp : ℤ) (p : D × ℝ) : ComplexVector := fun i => field (a i) k Φ kp p |
| 167 | |
| 168 | noncomputable def rotate (a : VectorCoefficients D) : VectorCoefficients D := ![-a 1, a 0, 0] |
| 169 | |
| 170 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 171 | @[simp] theorem vectorField_rotate (a : VectorCoefficients D) (k : ℝ) (Φ : D → ℝ) |
| 172 | (kp : ℤ) (p : D × ℝ) : |
| 173 | vectorField (rotate a) k Φ kp p = angularGenerator (vectorField a k Φ kp p) := by |
| 174 | ext i |
| 175 | fin_cases i <;> simp [vectorField, rotate, angularGenerator] |
| 176 | |
| 177 | noncomputable def scalarLaplacian (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 178 | (c : Coefficients D) : Coefficients D := |
| 179 | differentiate g.radial k Φ (differentiate g.radial k Φ c) + |
| 180 | constantCoefficient (fun x => ((g.radius x)⁻¹ : ℝ) : D → ℂ) * differentiate g.radial k Φ c + |
| 181 | constantCoefficient (fun x => (((g.radius x) ^ 2)⁻¹ : ℝ) : D → ℂ) * |
| 182 | angularDifferentiate kp (angularDifferentiate kp c) + |
| 183 | differentiate g.axial k Φ (differentiate g.axial k Φ c) |
| 184 | |
| 185 | noncomputable def vectorLaplacian (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 186 | (a : VectorCoefficients D) : VectorCoefficients D := fun i => |
| 187 | scalarLaplacian g k Φ kp (a i) + |
| 188 | constantCoefficient (fun x => (((g.radius x) ^ 2)⁻¹ : ℝ) : D → ℂ) * |
| 189 | (constantCoefficient (fun _ : D => (2 : ℂ)) * rotate (fun j => angularDifferentiate kp (a j)) i + |
| 190 | rotate (rotate a) i) |
| 191 | |
| 192 | noncomputable def transport (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 193 | (a b : VectorCoefficients D) : VectorCoefficients D := fun i => |
| 194 | a 0 * differentiate g.radial k Φ (b i) + |
| 195 | (a 1 * constantCoefficient (fun x => ((g.radius x : ℂ)⁻¹))) * |
| 196 | (angularDifferentiate kp (b i) + rotate b i) + |
| 197 | a 2 * differentiate g.axial k Φ (b i) |
| 198 | |
| 199 | noncomputable def gradient (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 200 | (p : Coefficients D) : VectorCoefficients D := |
| 201 | ![differentiate g.radial k Φ p, |
| 202 | constantCoefficient (fun x => ((g.radius x)⁻¹ : ℝ) : D → ℂ) * angularDifferentiate kp p, |
| 203 | differentiate g.axial k Φ p] |
| 204 | |
| 205 | /-- Literal coefficient formula for the differentiated linearized PDE. -/ |
| 206 | noncomputable def linearResidual (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 207 | (B a : VectorCoefficients D) (p : Coefficients D) : VectorCoefficients D := fun i => |
| 208 | differentiate g.time k Φ (a i) + transport g k Φ kp B a i + transport g k Φ kp a B i + |
| 209 | gradient g k Φ kp p i - |
| 210 | constantCoefficient (fun _ : D => (g.viscosity : ℂ)) * vectorLaplacian g k Φ kp a i |
| 211 | |
| 212 | noncomputable def nonlinearResidual (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 213 | (B a : VectorCoefficients D) (p : Coefficients D) : VectorCoefficients D := fun i => |
| 214 | linearResidual g k Φ kp B a p i + transport g k Φ kp a a i |
| 215 | |
| 216 | theorem field_secondDerivative {U : Set D} (hU : IsOpen U) {c : Coefficients D} |
| 217 | (hc : SmoothCoefficients U c) {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) |
| 218 | {V : D → D} (hV : ContDiffOn ℝ ∞ V U) (k : ℝ) (kp : ℤ) |
| 219 | {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 220 | field (differentiate V k Φ (differentiate V k Φ c)) k Φ kp p = |
| 221 | along (liftDirection V) (along (liftDirection V) (field c k Φ kp)) p := by |
| 222 | rw [field_differentiate hU (hc.differentiate hU hV hΦ k) hΦ V k kp hp] |
| 223 | exact along_congr (liftDomain_open hU) |
| 224 | (fun _ hy => field_differentiate hU hc hΦ V k kp hy) hp |
| 225 | |
| 226 | theorem field_secondAngular {U : Set D} (hU : IsOpen U) {c : Coefficients D} |
| 227 | (hc : SmoothCoefficients U c) {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) |
| 228 | (k : ℝ) (kp : ℤ) {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 229 | field (angularDifferentiate kp (angularDifferentiate kp c)) k Φ kp p = |
| 230 | along angularDirection (along angularDirection (field c k Φ kp)) p := by |
| 231 | rw [field_angularDifferentiate hU (hc.angular kp) hΦ k kp hp] |
| 232 | exact along_congr (liftDomain_open hU) |
| 233 | (fun _ hy => field_angularDifferentiate hU hc hΦ k kp hy) hp |
| 234 | |
| 235 | theorem field_scalarLaplacian {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 236 | (hr : ContDiffOn ℝ ∞ g.radial U) (hz : ContDiffOn ℝ ∞ g.axial U) |
| 237 | {c : Coefficients D} (hc : SmoothCoefficients U c) |
| 238 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 239 | {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 240 | field (scalarLaplacian g k Φ kp c) k Φ kp p = |
| 241 | cylindricalLaplacian (fun q => g.radius q.1) (liftDirection g.radial) |
| 242 | angularDirection (liftDirection g.axial) (field c k Φ kp) p := by |
| 243 | simp only [scalarLaplacian, field_add, HarmonicFields.field_mul, field_constant, |
| 244 | field_secondDerivative hU hc hΦ hr k kp hp, |
| 245 | field_secondDerivative hU hc hΦ hz k kp hp, |
| 246 | field_differentiate hU hc hΦ g.radial k kp hp, |
| 247 | field_secondAngular hU hc hΦ k kp hp, cylindricalLaplacian, Complex.real_smul] |
| 248 | |
| 249 | theorem field_vectorLaplacian {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 250 | (hr : ContDiffOn ℝ ∞ g.radial U) (hz : ContDiffOn ℝ ∞ g.axial U) |
| 251 | {a : VectorCoefficients D} (ha : ∀ i, SmoothCoefficients U (a i)) |
| 252 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 253 | {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 254 | vectorField (vectorLaplacian g k Φ kp a) k Φ kp p = |
| 255 | cylindricalVectorLaplacian (fun q => g.radius q.1) (liftDirection g.radial) |
| 256 | angularDirection (liftDirection g.axial) (vectorField a k Φ kp) p := by |
| 257 | have hang : vectorField (fun i => angularDifferentiate kp (a i)) k Φ kp p = |
| 258 | fun i => along angularDirection (fun q => vectorField a k Φ kp q i) p := by |
| 259 | ext i |
| 260 | exact field_angularDifferentiate hU (ha i) hΦ k kp hp |
| 261 | ext i |
| 262 | change field (vectorLaplacian g k Φ kp a i) k Φ kp p = _ |
| 263 | simp only [vectorLaplacian, field_add, HarmonicFields.field_mul, field_constant] |
| 264 | rw [field_scalarLaplacian hU g hr hz (ha i) hΦ k kp hp] |
| 265 | change _ + _ * ((2 : ℂ) * vectorField (rotate _) k Φ kp p i + |
| 266 | vectorField (rotate (rotate a)) k Φ kp p i) = _ |
| 267 | rw [vectorField_rotate, vectorField_rotate, vectorField_rotate, hang] |
| 268 | rfl |
| 269 | |
| 270 | theorem field_transport {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 271 | (a : VectorCoefficients D) {b : VectorCoefficients D} |
| 272 | (hb : ∀ i, SmoothCoefficients U (b i)) |
| 273 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 274 | {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 275 | vectorField (transport g k Φ kp a b) k Φ kp p = |
| 276 | LinearWaveResidual.transport (fun q => g.radius q.1) (liftDirection g.radial) |
| 277 | angularDirection (liftDirection g.axial) (vectorField a k Φ kp) |
| 278 | (vectorField b k Φ kp) p := by |
| 279 | ext i |
| 280 | change field (transport g k Φ kp a b i) k Φ kp p = _ |
| 281 | simp only [transport, field_add, HarmonicFields.field_mul, field_constant, |
| 282 | field_differentiate hU (hb i) hΦ g.radial k kp hp, |
| 283 | field_differentiate hU (hb i) hΦ g.axial k kp hp, |
| 284 | field_angularDifferentiate hU (hb i) hΦ k kp hp] |
| 285 | change _ + (_ * _) * (_ + vectorField (rotate b) k Φ kp p i) + _ = _ |
| 286 | rw [vectorField_rotate] |
| 287 | rfl |
| 288 | |
| 289 | theorem field_gradient {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 290 | {c : Coefficients D} (hc : SmoothCoefficients U c) |
| 291 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 292 | {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 293 | vectorField (gradient g k Φ kp c) k Φ kp p = |
| 294 | LinearWaveResidual.gradient (fun q => g.radius q.1) (liftDirection g.radial) |
| 295 | angularDirection (liftDirection g.axial) (field c k Φ kp) p := by |
| 296 | ext i |
| 297 | fin_cases i <;> simp [gradient, vectorField, LinearWaveResidual.gradient, |
| 298 | HarmonicFields.field_mul, field_differentiate hU hc hΦ _ k kp hp, |
| 299 | field_angularDifferentiate hU hc hΦ k kp hp, Complex.real_smul] |
| 300 | |
| 301 | theorem field_linearResidual {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 302 | (hr : ContDiffOn ℝ ∞ g.radial U) (hz : ContDiffOn ℝ ∞ g.axial U) |
| 303 | {B a : VectorCoefficients D} (hB : ∀ i, SmoothCoefficients U (B i)) |
| 304 | (ha : ∀ i, SmoothCoefficients U (a i)) {c : Coefficients D} (hc : SmoothCoefficients U c) |
| 305 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 306 | {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 307 | vectorField (linearResidual g k Φ kp B a c) k Φ kp p = |
| 308 | LinearWaveResidual.linearResidual g.viscosity (fun q => g.radius q.1) |
| 309 | (liftDirection g.radial) angularDirection (liftDirection g.axial) |
| 310 | (liftDirection g.time) (vectorField B k Φ kp) (vectorField a k Φ kp) |
| 311 | (field c k Φ kp) p := by |
| 312 | ext i |
| 313 | change field (linearResidual g k Φ kp B a c i) k Φ kp p = _ |
| 314 | simp only [linearResidual, field_sub, field_add, HarmonicFields.field_mul, field_constant, |
| 315 | field_differentiate hU (ha i) hΦ g.time k kp hp] |
| 316 | change _ + vectorField (transport _ _ _ _ _ _) k Φ kp p i + |
| 317 | vectorField (transport _ _ _ _ _ _) k Φ kp p i + |
| 318 | vectorField (gradient _ _ _ _ _) k Φ kp p i - |
| 319 | _ * vectorField (vectorLaplacian _ _ _ _ _) k Φ kp p i = _ |
| 320 | rw [field_transport hU g B ha hΦ k kp hp, field_transport hU g a hB hΦ k kp hp, |
| 321 | field_gradient hU g hc hΦ k kp hp, field_vectorLaplacian hU g hr hz ha hΦ k kp hp] |
| 322 | rfl |
| 323 | |
| 324 | theorem field_nonlinearResidual {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 325 | (hr : ContDiffOn ℝ ∞ g.radial U) (hz : ContDiffOn ℝ ∞ g.axial U) |
| 326 | {B a : VectorCoefficients D} (hB : ∀ i, SmoothCoefficients U (B i)) |
| 327 | (ha : ∀ i, SmoothCoefficients U (a i)) {c : Coefficients D} (hc : SmoothCoefficients U c) |
| 328 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 329 | {p : D × ℝ} (hp : p ∈ liftDomain U) : |
| 330 | vectorField (nonlinearResidual g k Φ kp B a c) k Φ kp p = |
| 331 | LinearWaveResidual.linearResidual g.viscosity (fun q => g.radius q.1) |
| 332 | (liftDirection g.radial) angularDirection (liftDirection g.axial) |
| 333 | (liftDirection g.time) (vectorField B k Φ kp) (vectorField a k Φ kp) |
| 334 | (field c k Φ kp) p + |
| 335 | LinearWaveResidual.transport (fun q => g.radius q.1) (liftDirection g.radial) |
| 336 | angularDirection (liftDirection g.axial) (vectorField a k Φ kp) (vectorField a k Φ kp) p := by |
| 337 | ext i |
| 338 | change field (linearResidual _ _ _ _ _ _ _ i + transport _ _ _ _ _ _ i) _ _ _ _ = _ |
| 339 | rw [field_add] |
| 340 | exact congrFun (congrArg₂ (· + ·) (field_linearResidual hU g hr hz hB ha hc hΦ k kp hp) |
| 341 | (field_transport hU g a ha hΦ k kp hp)) i |
| 342 | |
| 343 | /-! ## Reality, actual extraction, and harmonic values -/ |
| 344 | |
| 345 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 346 | theorem band_zero (N : ℕ) : BandLimited (0 : Coefficients D) N := by |
| 347 | intro j hj |
| 348 | simp at hj |
| 349 | |
| 350 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 351 | theorem band_neg {c : Coefficients D} {N : ℕ} (hc : BandLimited c N) : |
| 352 | BandLimited (-c) N := by |
| 353 | intro j hj |
| 354 | have hj' : j ∈ (-c.coeff).support := hj |
| 355 | rw [Finsupp.support_neg] at hj' |
| 356 | exact hc j hj' |
| 357 | |
| 358 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 359 | theorem band_sub {c d : Coefficients D} {N : ℕ} (hc : BandLimited c N) |
| 360 | (hd : BandLimited d N) : BandLimited (c - d) N := by |
| 361 | simpa only [sub_eq_add_neg] using hc.add (band_neg hd) |
| 362 | |
| 363 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 364 | theorem band_constant_mul (f : D → ℂ) {c : Coefficients D} {N : ℕ} |
| 365 | (hc : BandLimited c N) : BandLimited (constantCoefficient f * c) N := by |
| 366 | simpa only [zero_add] using (band_constantCoefficient f).mul hc |
| 367 | |
| 368 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 369 | theorem band_mul_constant {c : Coefficients D} {N : ℕ} |
| 370 | (hc : BandLimited c N) (f : D → ℂ) : BandLimited (c * constantCoefficient f) N := by |
| 371 | simpa only [add_zero] using hc.mul (band_constantCoefficient f) |
| 372 | |
| 373 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 374 | theorem band_rotate {a : VectorCoefficients D} {N : ℕ} (ha : ∀ i, BandLimited (a i) N) : |
| 375 | ∀ i, BandLimited (rotate a i) N := by |
| 376 | intro i |
| 377 | fin_cases i |
| 378 | · exact band_neg (ha 1) |
| 379 | · exact ha 0 |
| 380 | · exact band_zero N |
| 381 | |
| 382 | theorem band_scalarLaplacian (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 383 | {c : Coefficients D} {N : ℕ} (hc : BandLimited c N) : |
| 384 | BandLimited (scalarLaplacian g k Φ kp c) N := by |
| 385 | unfold scalarLaplacian |
| 386 | exact (((hc.differentiate _ _ _).differentiate _ _ _).add |
| 387 | (band_constant_mul _ (hc.differentiate _ _ _))).add |
| 388 | (band_constant_mul _ ((hc.angularDifferentiate kp).angularDifferentiate kp)) |>.add |
| 389 | ((hc.differentiate _ _ _).differentiate _ _ _) |
| 390 | |
| 391 | theorem band_vectorLaplacian (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 392 | {a : VectorCoefficients D} {N : ℕ} (ha : ∀ i, BandLimited (a i) N) : |
| 393 | ∀ i, BandLimited (vectorLaplacian g k Φ kp a i) N := by |
| 394 | intro i |
| 395 | exact (band_scalarLaplacian g k Φ kp (ha i)).add |
| 396 | (band_constant_mul _ ((band_constant_mul _ (band_rotate |
| 397 | (fun j => (ha j).angularDifferentiate kp) i)).add (band_rotate (band_rotate ha) i))) |
| 398 | |
| 399 | theorem band_transport (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 400 | {a b : VectorCoefficients D} {M N : ℕ} |
| 401 | (ha : ∀ i, BandLimited (a i) M) (hb : ∀ i, BandLimited (b i) N) : |
| 402 | ∀ i, BandLimited (transport g k Φ kp a b i) (M + N) := by |
| 403 | intro i |
| 404 | exact (((ha 0).mul ((hb i).differentiate _ _ _)).add |
| 405 | ((band_mul_constant (ha 1) _).mul (((hb i).angularDifferentiate kp).add |
| 406 | (band_rotate hb i)))).add ((ha 2).mul ((hb i).differentiate _ _ _)) |
| 407 | |
| 408 | theorem band_gradient (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 409 | {c : Coefficients D} {N : ℕ} (hc : BandLimited c N) : |
| 410 | ∀ i, BandLimited (gradient g k Φ kp c i) N := by |
| 411 | intro i |
| 412 | fin_cases i |
| 413 | · exact hc.differentiate _ _ _ |
| 414 | · exact band_constant_mul _ (hc.angularDifferentiate kp) |
| 415 | · exact hc.differentiate _ _ _ |
| 416 | |
| 417 | theorem band_linearResidual (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 418 | {B a : VectorCoefficients D} {c : Coefficients D} {N : ℕ} |
| 419 | (hB : ∀ i, BandLimited (B i) 0) (ha : ∀ i, BandLimited (a i) N) |
| 420 | (hc : BandLimited c N) : ∀ i, BandLimited (linearResidual g k Φ kp B a c i) N := by |
| 421 | intro i |
| 422 | have hBa : BandLimited (transport g k Φ kp B a i) N := by |
| 423 | simpa only [zero_add] using band_transport g k Φ kp hB ha i |
| 424 | have haB : BandLimited (transport g k Φ kp a B i) N := by |
| 425 | simpa only [add_zero] using band_transport g k Φ kp ha hB i |
| 426 | exact band_sub ((((ha i).differentiate _ _ _).add hBa).add haB |>.add |
| 427 | (band_gradient g k Φ kp hc i)) |
| 428 | (band_constant_mul _ (band_vectorLaplacian g k Φ kp ha i)) |
| 429 | |
| 430 | /-- The bound concerns harmonic values `|j|`, not the number of terms. -/ |
| 431 | theorem band_nonlinearResidual (g : Frame D) (k : ℝ) (Φ : D → ℝ) (kp : ℤ) |
| 432 | {B a : VectorCoefficients D} {c : Coefficients D} {N : ℕ} |
| 433 | (hB : ∀ i, BandLimited (B i) 0) (ha : ∀ i, BandLimited (a i) N) |
| 434 | (hc : BandLimited c N) : |
| 435 | ∀ i, BandLimited (nonlinearResidual g k Φ kp B a c i) (N + N) := by |
| 436 | intro i |
| 437 | exact ((band_linearResidual g k Φ kp hB ha hc i).mono (Nat.le_add_right _ _)).add |
| 438 | (band_transport g k Φ kp ha ha i) |
| 439 | |
| 440 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 441 | theorem band_conjugateReverse {c : Coefficients D} {N : ℕ} (hc : BandLimited c N) : |
| 442 | BandLimited (conjugateReverse c) N := by |
| 443 | intro j hj |
| 444 | have hj' : -j ∈ c.support := by |
| 445 | by_contra hh |
| 446 | have he : c (-j) = 0 := Finsupp.notMem_support_iff.mp hh |
| 447 | apply (Finsupp.mem_support_iff.mp hj) |
| 448 | ext x |
| 449 | simp [he] |
| 450 | simpa only [Int.natAbs_neg] using hc (-j) hj' |
| 451 | |
| 452 | /-- Canonical real projection, with exactly the conjugate negative harmonics. -/ |
| 453 | noncomputable def realCoefficients (c : Coefficients D) : Coefficients D := |
| 454 | constantCoefficient (fun _ : D => (2 : ℂ)⁻¹) * (c + conjugateReverse c) |
| 455 | |
| 456 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 457 | @[simp] theorem realCoefficients_apply (c : Coefficients D) (j : ℤ) (x : D) : |
| 458 | realCoefficients c j x = (2 : ℂ)⁻¹ * (c j x + conj (c (-j) x)) := by |
| 459 | rw [realCoefficients, constantCoefficient, AddMonoidAlgebra.coeff_single_zero_mul] |
| 460 | rfl |
| 461 | |
| 462 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 463 | theorem realCoefficients_conjugate (c : Coefficients D) : |
| 464 | ConjugateSymmetric (realCoefficients c) := by |
| 465 | intro j x |
| 466 | have htwo : conj (2 : ℂ) = (2 : ℂ) := Complex.conj_ofReal 2 |
| 467 | simp [realCoefficients_apply, map_mul, map_add, htwo, add_comm] |
| 468 | |
| 469 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 470 | theorem realCoefficients_eq_self {c : Coefficients D} (hc : ConjugateSymmetric c) : |
| 471 | realCoefficients c = c := by |
| 472 | ext j x |
| 473 | rw [realCoefficients_apply, hc j x] |
| 474 | simp |
| 475 | ring |
| 476 | |
| 477 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 478 | theorem field_realCoefficients (c : Coefficients D) (k : ℝ) (Φ : D → ℝ) |
| 479 | (kp : ℤ) (p : D × ℝ) : |
| 480 | field (realCoefficients c) k Φ kp p = ((field c k Φ kp p).re : ℂ) := by |
| 481 | simp only [realCoefficients, HarmonicFields.field_mul, field_constant, field_add] |
| 482 | rw [show field (conjugateReverse c) k Φ kp p = conj (field c k Φ kp p) from |
| 483 | evaluate_conjugateReverse c p.1 _] |
| 484 | rw [Complex.add_conj] |
| 485 | push_cast |
| 486 | ring |
| 487 | |
| 488 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 489 | theorem band_realCoefficients {c : Coefficients D} {N : ℕ} (hc : BandLimited c N) : |
| 490 | BandLimited (realCoefficients c) N := |
| 491 | band_constant_mul _ (hc.add (band_conjugateReverse hc)) |
| 492 | |
| 493 | theorem SmoothCoefficients.conjugateReverse {U : Set D} {c : Coefficients D} |
| 494 | (hc : SmoothCoefficients U c) : SmoothCoefficients U (conjugateReverse c) := |
| 495 | fun j => Complex.conjCLE.contDiff.comp_contDiffOn (hc (-j)) |
| 496 | |
| 497 | theorem SmoothCoefficients.realCoefficients {U : Set D} {c : Coefficients D} |
| 498 | (hc : SmoothCoefficients U c) : SmoothCoefficients U (realCoefficients c) := |
| 499 | (smoothCoefficients_constant contDiffOn_const).mul (hc.add hc.conjugateReverse) |
| 500 | |
| 501 | /-- Extraction is integration against the conjugate carrier, including its slow phase. -/ |
| 502 | noncomputable def extract (f : D × ℝ → ℂ) (k : ℝ) (Φ : D → ℝ) (kp j : ℤ) |
| 503 | (x : D) : ℂ := |
| 504 | angularMean (fun θ => f (x, θ) * |
| 505 | field (AddMonoidAlgebra.single (-j) (fun _ : D => (1 : ℂ))) k Φ kp (x, θ)) |
| 506 | |
| 507 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 508 | theorem extract_field (c : Coefficients D) (k : ℝ) (Φ : D → ℝ) |
| 509 | {kp : ℤ} (hkp : kp ≠ 0) (j : ℤ) (x : D) : |
| 510 | extract (field c k Φ kp) k Φ kp j x = c j x := by |
| 511 | unfold extract |
| 512 | simp_rw [← HarmonicFields.field_mul] |
| 513 | rw [angularMean_field _ k Φ hkp x] |
| 514 | change (c * AddMonoidAlgebra.single (-j) (fun _ : D => (1 : ℂ))).coeff 0 x = _ |
| 515 | rw [AddMonoidAlgebra.coeff_mul_single_apply] |
| 516 | simp |
| 517 | |
| 518 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 519 | /-- For a nonzero angular frequency the coefficients are uniquely determined by the field. -/ |
| 520 | theorem coefficients_unique {c d : Coefficients D} (k : ℝ) (Φ : D → ℝ) |
| 521 | {kp : ℤ} (hkp : kp ≠ 0) (he : field c k Φ kp = field d k Φ kp) : c = d := by |
| 522 | ext j x |
| 523 | rw [← extract_field c k Φ hkp j x, he, extract_field d k Φ hkp j x] |
| 524 | |
| 525 | noncomputable def nonconstant (c : Coefficients D) : Coefficients D := c.erase 0 |
| 526 | |
| 527 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 528 | theorem nonconstant_eq_sub (c : Coefficients D) : |
| 529 | nonconstant c = c - constantCoefficient (c 0) := by |
| 530 | ext j x |
| 531 | change c.erase 0 j x = c j x - Finsupp.single 0 (c 0) j x |
| 532 | by_cases hj : j = 0 |
| 533 | · subst j |
| 534 | simp [] |
| 535 | · simp [ Finsupp.erase_ne hj, |
| 536 | hj] |
| 537 | |
| 538 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 539 | theorem field_nonconstant (c : Coefficients D) (k : ℝ) (Φ : D → ℝ) |
| 540 | (kp : ℤ) (p : D × ℝ) : |
| 541 | field (nonconstant c) k Φ kp p = field c k Φ kp p - c 0 p.1 := by |
| 542 | rw [nonconstant_eq_sub, field_sub, field_constant] |
| 543 | |
| 544 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 545 | theorem angularMean_nonconstant (c : Coefficients D) (k : ℝ) (Φ : D → ℝ) |
| 546 | {kp : ℤ} (hkp : kp ≠ 0) (x : D) : |
| 547 | angularMean (fun θ => field (nonconstant c) k Φ kp (x, θ)) = 0 := by |
| 548 | rw [angularMean_field _ k Φ hkp x] |
| 549 | simp [nonconstant] |
| 550 | |
| 551 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 552 | theorem nonconstant_conjugate {c : Coefficients D} (hc : ConjugateSymmetric c) : |
| 553 | ConjugateSymmetric (nonconstant c) := by |
| 554 | intro j x |
| 555 | by_cases hj : j = 0 |
| 556 | · simp [nonconstant, hj] |
| 557 | · simp [nonconstant, Finsupp.erase_ne hj, Finsupp.erase_ne (neg_ne_zero.mpr hj), hc j x] |
| 558 | |
| 559 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 560 | theorem band_nonconstant {c : Coefficients D} {N : ℕ} (hc : BandLimited c N) : |
| 561 | BandLimited (nonconstant c) N := by |
| 562 | intro j hj |
| 563 | exact hc j ((Finset.mem_erase.mp (show j ∈ c.support.erase 0 by |
| 564 | simpa only [nonconstant, HarmonicFields.Coefficients.support, AddMonoidAlgebra.coeff_erase, Finsupp.support_erase] using hj)).2) |
| 565 | |
| 566 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 567 | theorem nonconstant_support {c : Coefficients D} {j : ℤ} |
| 568 | (hj : j ∈ (nonconstant c).support) : j ≠ 0 := by |
| 569 | exact (Finset.mem_erase.mp (show j ∈ c.support.erase 0 by |
| 570 | simpa only [nonconstant, HarmonicFields.Coefficients.support, AddMonoidAlgebra.coeff_erase, Finsupp.support_erase] using hj)).1 |
| 571 | |
| 572 | theorem SmoothCoefficients.nonconstant {U : Set D} {c : Coefficients D} |
| 573 | (hc : SmoothCoefficients U c) : SmoothCoefficients U (nonconstant c) := by |
| 574 | rw [nonconstant_eq_sub] |
| 575 | exact hc.sub (smoothCoefficients_constant (hc 0)) |
| 576 | |
| 577 | namespace Actual |
| 578 | |
| 579 | theorem angularGenerator_add (a b : ComplexVector) : |
| 580 | angularGenerator (a + b) = angularGenerator a + angularGenerator b := by |
| 581 | ext i |
| 582 | fin_cases i <;> simp [angularGenerator] |
| 583 | abel |
| 584 | |
| 585 | theorem transport_add_left (R : D → ℝ) (Vr Vθ Vz : D → D) |
| 586 | (a b v : D → ComplexVector) (x : D) : |
| 587 | LinearWaveResidual.transport R Vr Vθ Vz (a + b) v x = |
| 588 | LinearWaveResidual.transport R Vr Vθ Vz a v x + LinearWaveResidual.transport R Vr Vθ Vz b v x := by |
| 589 | ext i |
| 590 | simp only [LinearWaveResidual.transport, Pi.add_apply] |
| 591 | ring |
| 592 | |
| 593 | theorem transport_add_right (R : D → ℝ) (Vr Vθ Vz : D → D) |
| 594 | (u a b : D → ComplexVector) {x : D} |
| 595 | (ha : ∀ i, DifferentiableAt ℝ (fun y => a y i) x) |
| 596 | (hb : ∀ i, DifferentiableAt ℝ (fun y => b y i) x) : |
| 597 | LinearWaveResidual.transport R Vr Vθ Vz u (a + b) x = |
| 598 | LinearWaveResidual.transport R Vr Vθ Vz u a x + LinearWaveResidual.transport R Vr Vθ Vz u b x := by |
| 599 | ext i |
| 600 | simp only [LinearWaveResidual.transport, Pi.add_apply, angularGenerator_add, |
| 601 | along_add _ (ha i) (hb i)] |
| 602 | ring |
| 603 | |
| 604 | theorem twiceAlong_add {U : Set D} (hU : IsOpen U) {V : D → D} |
| 605 | (hV : ContDiffOn ℝ ∞ V U) {f g : D → ℂ} |
| 606 | (hf : ContDiffOn ℝ ∞ f U) (hg : ContDiffOn ℝ ∞ g U) |
| 607 | {x : D} (hx : x ∈ U) : |
| 608 | along V (along V (f + g)) x = along V (along V f) x + along V (along V g) x := by |
| 609 | have heq : EqOn (along V (f + g)) (along V f + along V g) U := by |
| 610 | intro y hy |
| 611 | exact along_add V ((hf.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) |
| 612 | ((hg.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) |
| 613 | rw [along_congr hU heq hx] |
| 614 | exact along_add V |
| 615 | (((contDiffOn_along hU hV hf).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) |
| 616 | (((contDiffOn_along hU hV hg).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) |
| 617 | |
| 618 | theorem cylindricalLaplacian_add {U : Set D} (hU : IsOpen U) (R : D → ℝ) |
| 619 | {Vr Vθ Vz : D → D} (hr : ContDiffOn ℝ ∞ Vr U) |
| 620 | (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) |
| 621 | {f g : D → ℂ} (hf : ContDiffOn ℝ ∞ f U) (hg : ContDiffOn ℝ ∞ g U) |
| 622 | {x : D} (hx : x ∈ U) : |
| 623 | cylindricalLaplacian R Vr Vθ Vz (f + g) x = |
| 624 | cylindricalLaplacian R Vr Vθ Vz f x + cylindricalLaplacian R Vr Vθ Vz g x := by |
| 625 | have df := (hf.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 626 | have dg := (hg.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 627 | have hfirst : along Vr (f + g) x = along Vr f x + along Vr g x := along_add Vr df dg |
| 628 | simp only [cylindricalLaplacian, twiceAlong_add hU hr hf hg hx, |
| 629 | twiceAlong_add hU hθ hf hg hx, twiceAlong_add hU hz hf hg hx, |
| 630 | hfirst, smul_add] |
| 631 | abel |
| 632 | |
| 633 | theorem cylindricalVectorLaplacian_add {U : Set D} (hU : IsOpen U) (R : D → ℝ) |
| 634 | {Vr Vθ Vz : D → D} (hr : ContDiffOn ℝ ∞ Vr U) |
| 635 | (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) |
| 636 | {a b : D → ComplexVector} |
| 637 | (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) |
| 638 | (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) |
| 639 | {x : D} (hx : x ∈ U) : |
| 640 | cylindricalVectorLaplacian R Vr Vθ Vz (a + b) x = |
| 641 | cylindricalVectorLaplacian R Vr Vθ Vz a x + |
| 642 | cylindricalVectorLaplacian R Vr Vθ Vz b x := by |
| 643 | have hL i : cylindricalLaplacian R Vr Vθ Vz (fun y => a y i + b y i) x = |
| 644 | cylindricalLaplacian R Vr Vθ Vz (fun y => a y i) x + |
| 645 | cylindricalLaplacian R Vr Vθ Vz (fun y => b y i) x := |
| 646 | cylindricalLaplacian_add hU R hr hθ hz (ha i) (hb i) hx |
| 647 | have hD i := along_add Vθ |
| 648 | (((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) |
| 649 | (((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) |
| 650 | ext i |
| 651 | fin_cases i <;> |
| 652 | simp [cylindricalVectorLaplacian, angularGenerator, hL 0, hL 1, hL 2, |
| 653 | hD 0, hD 1, Complex.real_smul] <;> ring |
| 654 | |
| 655 | theorem gradient_add (R : D → ℝ) (Vr Vθ Vz : D → D) |
| 656 | {p q : D → ℂ} {x : D} (hp : DifferentiableAt ℝ p x) |
| 657 | (hq : DifferentiableAt ℝ q x) : |
| 658 | LinearWaveResidual.gradient R Vr Vθ Vz (p + q) x = LinearWaveResidual.gradient R Vr Vθ Vz p x + LinearWaveResidual.gradient R Vr Vθ Vz q x := by |
| 659 | have hd (V : D → D) : along V (p + q) x = along V p x + along V q x := along_add V hp hq |
| 660 | ext i |
| 661 | fin_cases i <;> simp [LinearWaveResidual.gradient, hd, smul_add] |
| 662 | |
| 663 | theorem linearResidual_add {U : Set D} (hU : IsOpen U) (ε : ℝ) (R : D → ℝ) |
| 664 | {Vr Vθ Vz : D → D} (Vt : D → D) (hr : ContDiffOn ℝ ∞ Vr U) |
| 665 | (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) |
| 666 | (B a b : D → ComplexVector) (p q : D → ℂ) |
| 667 | (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) |
| 668 | (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) |
| 669 | (hp : ContDiffOn ℝ ∞ p U) (hq : ContDiffOn ℝ ∞ q U) |
| 670 | {x : D} (hx : x ∈ U) : |
| 671 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B (a + b) (p + q) x = |
| 672 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B a p x + LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B b q x := by |
| 673 | have da i := ((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 674 | have db i := ((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 675 | have dp := (hp.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 676 | have dq := (hq.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 677 | have hL := cylindricalVectorLaplacian_add hU R hr hθ hz ha hb hx |
| 678 | ext i |
| 679 | simp only [LinearWaveResidual.linearResidual, Pi.add_apply, along_add _ (da i) (db i), |
| 680 | transport_add_left, transport_add_right R Vr Vθ Vz B a b da db, |
| 681 | gradient_add R Vr Vθ Vz dp dq, hL] |
| 682 | ring |
| 683 | |
| 684 | /-- Exact residual of a perturbation of a fixed base, before the virtual |
| 685 | stress and the separately retained base residual are added. -/ |
| 686 | noncomputable def nonlinearResidual (ε : ℝ) (R : D → ℝ) (Vr Vθ Vz Vt : D → D) |
| 687 | (B a : D → ComplexVector) (p : D → ℂ) (x : D) : ComplexVector := |
| 688 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B a p x + LinearWaveResidual.transport R Vr Vθ Vz a a x |
| 689 | |
| 690 | theorem nonlinearResidual_add_sub {U : Set D} (hU : IsOpen U) (ε : ℝ) (R : D → ℝ) |
| 691 | {Vr Vθ Vz : D → D} (Vt : D → D) (hr : ContDiffOn ℝ ∞ Vr U) |
| 692 | (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) |
| 693 | (B a b : D → ComplexVector) (p q : D → ℂ) |
| 694 | (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) |
| 695 | (hb : ∀ i, ContDiffOn ℝ ∞ (fun y => b y i) U) |
| 696 | (hp : ContDiffOn ℝ ∞ p U) (hq : ContDiffOn ℝ ∞ q U) |
| 697 | {x : D} (hx : x ∈ U) : |
| 698 | nonlinearResidual ε R Vr Vθ Vz Vt B (a + b) (p + q) x - |
| 699 | nonlinearResidual ε R Vr Vθ Vz Vt B a p x = |
| 700 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B b q x + LinearWaveResidual.transport R Vr Vθ Vz a b x + |
| 701 | LinearWaveResidual.transport R Vr Vθ Vz b a x + LinearWaveResidual.transport R Vr Vθ Vz b b x := by |
| 702 | have da i := ((ha i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 703 | have db i := ((hb i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp) |
| 704 | rw [nonlinearResidual, linearResidual_add hU ε R Vt hr hθ hz B a b p q ha hb hp hq hx, |
| 705 | transport_add_left, transport_add_right R Vr Vθ Vz a a b da db, |
| 706 | transport_add_right R Vr Vθ Vz b a b da db, nonlinearResidual] |
| 707 | abel |
| 708 | |
| 709 | |
| 710 | theorem transport_zero_of_disjoint (R : D → ℝ) (Vr Vθ Vz : D → D) |
| 711 | {u v : D → ComplexVector} (hd : Disjoint (tsupport u) (tsupport v)) (x : D) : |
| 712 | LinearWaveResidual.transport R Vr Vθ Vz u v x = 0 := by |
| 713 | by_cases hu : u x = 0 |
| 714 | · ext i |
| 715 | simp [LinearWaveResidual.transport, hu] |
| 716 | · have hux : x ∈ tsupport u := subset_closure (by simpa only [Function.mem_support] using hu) |
| 717 | have hvx : x ∉ tsupport v := fun hx => Set.disjoint_left.mp hd hux hx |
| 718 | have he : v =ᶠ[𝓝 x] 0 := notMem_tsupport_iff_eventuallyEq.mp hvx |
| 719 | have hv : v x = 0 := he.eq_of_nhds |
| 720 | have hvd (i : Fin 3) (V : D → D) : along V (fun y => v y i) x = 0 := by |
| 721 | have hei : (fun y => v y i) =ᶠ[𝓝 x] (fun _ : D => (0 : ℂ)) := |
| 722 | he.mono (fun _ hy => congrFun hy i) |
| 723 | simp only [along, hei.fderiv_eq, fderiv_fun_const, Pi.zero_apply, _root_.zero_apply] |
| 724 | ext i |
| 725 | fin_cases i <;> simp [LinearWaveResidual.transport, hv, hvd, angularGenerator] |
| 726 | |
| 727 | theorem transport_sum_left {ι : Type*} (s : Finset ι) (R : D → ℝ) (Vr Vθ Vz : D → D) |
| 728 | (u : ι → D → ComplexVector) (v : D → ComplexVector) (x : D) : |
| 729 | LinearWaveResidual.transport R Vr Vθ Vz (∑ l ∈ s, u l) v x = |
| 730 | ∑ l ∈ s, LinearWaveResidual.transport R Vr Vθ Vz (u l) v x := by |
| 731 | classical |
| 732 | induction s using Finset.induction_on with |
| 733 | | empty => |
| 734 | ext i |
| 735 | simp [LinearWaveResidual.transport] |
| 736 | | @insert l s hl ih => |
| 737 | rw [Finset.sum_insert hl, Finset.sum_insert hl, transport_add_left, ih] |
| 738 | |
| 739 | theorem transport_sum_right {ι : Type*} (s : Finset ι) (R : D → ℝ) (Vr Vθ Vz : D → D) |
| 740 | (u : D → ComplexVector) (v : ι → D → ComplexVector) {x : D} |
| 741 | (hv : ∀ l ∈ s, ∀ i, DifferentiableAt ℝ (fun y => v l y i) x) : |
| 742 | LinearWaveResidual.transport R Vr Vθ Vz u (∑ l ∈ s, v l) x = |
| 743 | ∑ l ∈ s, LinearWaveResidual.transport R Vr Vθ Vz u (v l) x := by |
| 744 | classical |
| 745 | induction s using Finset.induction_on with |
| 746 | | empty => |
| 747 | ext i |
| 748 | fin_cases i <;> simp [LinearWaveResidual.transport, along, angularGenerator] |
| 749 | | @insert l s hl ih => |
| 750 | rw [Finset.sum_insert hl, Finset.sum_insert hl] |
| 751 | have hlv := hv l (Finset.mem_insert_self l s) |
| 752 | have hsv := fun j hj => hv j (Finset.mem_insert_of_mem hj) |
| 753 | have hsum (i : Fin 3) : DifferentiableAt ℝ (fun y => (∑ j ∈ s, v j) y i) x := by |
| 754 | simpa only [Finset.sum_apply] using DifferentiableAt.fun_sum (fun j hj => hsv j hj i) |
| 755 | rw [transport_add_right R Vr Vθ Vz u (v l) _ hlv hsum, ih hsv] |
| 756 | |
| 757 | theorem transport_sum_self {ι : Type*} (s : Finset ι) (R : D → ℝ) (Vr Vθ Vz : D → D) |
| 758 | (u : ι → D → ComplexVector) {x : D} |
| 759 | (hu : ∀ l ∈ s, ∀ i, DifferentiableAt ℝ (fun y => u l y i) x) |
| 760 | (hdisj : ∀ l ∈ s, ∀ j ∈ s, l ≠ j → Disjoint (tsupport (u l)) (tsupport (u j))) : |
| 761 | LinearWaveResidual.transport R Vr Vθ Vz (∑ l ∈ s, u l) (∑ l ∈ s, u l) x = |
| 762 | ∑ l ∈ s, LinearWaveResidual.transport R Vr Vθ Vz (u l) (u l) x := by |
| 763 | classical |
| 764 | rw [transport_sum_left] |
| 765 | apply Finset.sum_congr rfl |
| 766 | intro l hl |
| 767 | rw [transport_sum_right s R Vr Vθ Vz (u l) u hu] |
| 768 | apply Finset.sum_eq_single l |
| 769 | · intro j hj hjl |
| 770 | exact transport_zero_of_disjoint R Vr Vθ Vz (hdisj l hl j hj (Ne.symm hjl)) x |
| 771 | · exact fun h => (h hl).elim |
| 772 | |
| 773 | theorem linearResidual_sum {ι : Type*} (s : Finset ι) {U : Set D} (hU : IsOpen U) |
| 774 | (ε : ℝ) (R : D → ℝ) {Vr Vθ Vz : D → D} (Vt : D → D) |
| 775 | (hr : ContDiffOn ℝ ∞ Vr U) (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) |
| 776 | (B : D → ComplexVector) (u : ι → D → ComplexVector) (p : ι → D → ℂ) |
| 777 | (hu : ∀ l ∈ s, ∀ i, ContDiffOn ℝ ∞ (fun y => u l y i) U) |
| 778 | (hp : ∀ l ∈ s, ContDiffOn ℝ ∞ (p l) U) {x : D} (hx : x ∈ U) : |
| 779 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B (∑ l ∈ s, u l) (∑ l ∈ s, p l) x = |
| 780 | ∑ l ∈ s, LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B (u l) (p l) x := by |
| 781 | classical |
| 782 | induction s using Finset.induction_on with |
| 783 | | empty => |
| 784 | have hzero (V : D → D) : along V (fun _ : D => (0 : ℂ)) = 0 := by |
| 785 | funext y |
| 786 | simp [along] |
| 787 | ext i |
| 788 | fin_cases i <;> |
| 789 | simp [LinearWaveResidual.linearResidual, LinearWaveResidual.transport, |
| 790 | LinearWaveResidual.gradient, cylindricalVectorLaplacian, cylindricalLaplacian, |
| 791 | hzero, along, angularGenerator] |
| 792 | | @insert l s hl ih => |
| 793 | rw [Finset.sum_insert hl, Finset.sum_insert hl, Finset.sum_insert hl] |
| 794 | have hlu := hu l (Finset.mem_insert_self l s) |
| 795 | have hlp := hp l (Finset.mem_insert_self l s) |
| 796 | have hsu := fun j hj => hu j (Finset.mem_insert_of_mem hj) |
| 797 | have hsp := fun j hj => hp j (Finset.mem_insert_of_mem hj) |
| 798 | have hsum (i : Fin 3) : ContDiffOn ℝ ∞ (fun y => (∑ j ∈ s, u j) y i) U := by |
| 799 | simpa only [Finset.sum_apply] using ContDiffOn.sum (fun j hj => hsu j hj i) |
| 800 | have hsump : ContDiffOn ℝ ∞ (∑ j ∈ s, p j) U := by |
| 801 | convert! ContDiffOn.sum hsp using 1 |
| 802 | ext y |
| 803 | simp only [Finset.sum_apply] |
| 804 | rw [linearResidual_add hU ε R Vt hr hθ hz B (u l) _ (p l) _ hlu hsum hlp |
| 805 | hsump hx, ih hsu hsp] |
| 806 | |
| 807 | theorem nonlinearResidual_sum {ι : Type*} (s : Finset ι) {U : Set D} (hU : IsOpen U) |
| 808 | (ε : ℝ) (R : D → ℝ) {Vr Vθ Vz : D → D} (Vt : D → D) |
| 809 | (hr : ContDiffOn ℝ ∞ Vr U) (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) |
| 810 | (B : D → ComplexVector) (u : ι → D → ComplexVector) (p : ι → D → ℂ) |
| 811 | (hu : ∀ l ∈ s, ∀ i, ContDiffOn ℝ ∞ (fun y => u l y i) U) |
| 812 | (hp : ∀ l ∈ s, ContDiffOn ℝ ∞ (p l) U) |
| 813 | (hdisj : ∀ l ∈ s, ∀ j ∈ s, l ≠ j → Disjoint (tsupport (u l)) (tsupport (u j))) |
| 814 | {x : D} (hx : x ∈ U) : |
| 815 | nonlinearResidual ε R Vr Vθ Vz Vt B (∑ l ∈ s, u l) (∑ l ∈ s, p l) x = |
| 816 | ∑ l ∈ s, nonlinearResidual ε R Vr Vθ Vz Vt B (u l) (p l) x := by |
| 817 | unfold nonlinearResidual |
| 818 | rw [linearResidual_sum s hU ε R Vt hr hθ hz B u p hu hp hx, |
| 819 | transport_sum_self s R Vr Vθ Vz u (fun l hl i => |
| 820 | ((hu l hl i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) hdisj, |
| 821 | Finset.sum_add_distrib] |
| 822 | |
| 823 | theorem linearResidual_base_add (ε : ℝ) (R : D → ℝ) (Vr Vθ Vz Vt : D → D) |
| 824 | (B M a : D → ComplexVector) (p : D → ℂ) {x : D} |
| 825 | (hB : ∀ i, DifferentiableAt ℝ (fun y => B y i) x) |
| 826 | (hM : ∀ i, DifferentiableAt ℝ (fun y => M y i) x) : |
| 827 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt (B + M) a p x = |
| 828 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B a p x + |
| 829 | LinearWaveResidual.transport R Vr Vθ Vz M a x + |
| 830 | LinearWaveResidual.transport R Vr Vθ Vz a M x := by |
| 831 | ext i |
| 832 | simp only [LinearWaveResidual.linearResidual, transport_add_left, |
| 833 | transport_add_right R Vr Vθ Vz a B M hB hM, Pi.add_apply] |
| 834 | ring |
| 835 | |
| 836 | theorem nonlinearResidual_mean_add {U : Set D} (hU : IsOpen U) |
| 837 | (ε : ℝ) (R : D → ℝ) {Vr Vθ Vz : D → D} (Vt : D → D) |
| 838 | (hr : ContDiffOn ℝ ∞ Vr U) (hθ : ContDiffOn ℝ ∞ Vθ U) (hz : ContDiffOn ℝ ∞ Vz U) |
| 839 | (B M a : D → ComplexVector) (p q : D → ℂ) |
| 840 | (hB : ∀ i, ContDiffOn ℝ ∞ (fun y => B y i) U) |
| 841 | (hM : ∀ i, ContDiffOn ℝ ∞ (fun y => M y i) U) |
| 842 | (ha : ∀ i, ContDiffOn ℝ ∞ (fun y => a y i) U) |
| 843 | (hp : ContDiffOn ℝ ∞ p U) (hq : ContDiffOn ℝ ∞ q U) |
| 844 | {x : D} (hx : x ∈ U) : |
| 845 | nonlinearResidual ε R Vr Vθ Vz Vt B (M + a) (p + q) x = |
| 846 | nonlinearResidual ε R Vr Vθ Vz Vt B M p x + |
| 847 | nonlinearResidual ε R Vr Vθ Vz Vt (B + M) a q x := by |
| 848 | have he := nonlinearResidual_add_sub hU ε R Vt hr hθ hz B M a p q hM ha hp hq hx |
| 849 | have hb := linearResidual_base_add ε R Vr Vθ Vz Vt B M a q |
| 850 | (fun i => ((hB i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) |
| 851 | (fun i => ((hM i).contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp)) |
| 852 | have hb' : nonlinearResidual ε R Vr Vθ Vz Vt (B + M) a q x = |
| 853 | LinearWaveResidual.linearResidual ε R Vr Vθ Vz Vt B a q x + |
| 854 | LinearWaveResidual.transport R Vr Vθ Vz M a x + |
| 855 | LinearWaveResidual.transport R Vr Vθ Vz a M x + |
| 856 | LinearWaveResidual.transport R Vr Vθ Vz a a x := by |
| 857 | change _ + _ = _ |
| 858 | rw [hb] |
| 859 | rw [hb'] |
| 860 | ext i |
| 861 | have hei := congrFun he i |
| 862 | simp only [Pi.sub_apply, Pi.add_apply] at hei ⊢ |
| 863 | linear_combination hei |
| 864 | |
| 865 | end Actual |
| 866 | |
| 867 | /-- Regularity of the actual graph directions, with the cylindrical radius nonzero. -/ |
| 868 | structure Frame.Regular (g : Frame D) (U : Set D) : Prop where |
| 869 | radius : ContDiffOn ℝ ∞ g.radius U |
| 870 | radius_ne : ∀ x ∈ U, g.radius x ≠ 0 |
| 871 | radial : ContDiffOn ℝ ∞ g.radial U |
| 872 | axial : ContDiffOn ℝ ∞ g.axial U |
| 873 | time : ContDiffOn ℝ ∞ g.time U |
| 874 | |
| 875 | theorem liftDirection_smooth {U : Set D} {V : D → D} (hV : ContDiffOn ℝ ∞ V U) : |
| 876 | ContDiffOn ℝ ∞ (liftDirection V) (liftDomain U) := |
| 877 | (hV.comp contDiffOn_fst (fun _ hp => hp.1)).prodMk contDiffOn_const |
| 878 | |
| 879 | theorem smooth_rotate {U : Set D} {a : VectorCoefficients D} |
| 880 | (ha : ∀ i, SmoothCoefficients U (a i)) : ∀ i, SmoothCoefficients U (rotate a i) := by |
| 881 | intro i |
| 882 | fin_cases i |
| 883 | · exact (ha 1).neg |
| 884 | · exact ha 0 |
| 885 | · exact smoothCoefficients_zero U |
| 886 | |
| 887 | theorem Frame.Regular.invRadius {g : Frame D} {U : Set D} (hg : g.Regular U) : |
| 888 | SmoothCoefficients U (constantCoefficient (fun x => ((g.radius x)⁻¹ : ℝ) : D → ℂ)) := |
| 889 | smoothCoefficients_constant (Complex.ofRealCLM.contDiff.comp_contDiffOn (hg.radius.inv hg.radius_ne)) |
| 890 | |
| 891 | theorem Frame.Regular.invSquare {g : Frame D} {U : Set D} (hg : g.Regular U) : |
| 892 | SmoothCoefficients U (constantCoefficient (fun x => (((g.radius x) ^ 2)⁻¹ : ℝ) : D → ℂ)) := |
| 893 | smoothCoefficients_constant (Complex.ofRealCLM.contDiff.comp_contDiffOn |
| 894 | ((hg.radius.pow 2).inv (fun x hx => pow_ne_zero 2 (hg.radius_ne x hx)))) |
| 895 | |
| 896 | theorem smooth_scalarLaplacian {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 897 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 898 | {c : Coefficients D} (hc : SmoothCoefficients U c) : |
| 899 | SmoothCoefficients U (scalarLaplacian g k Φ kp c) := |
| 900 | (((hc.differentiate hU hg.radial hΦ k).differentiate hU hg.radial hΦ k).add |
| 901 | (hg.invRadius.mul (hc.differentiate hU hg.radial hΦ k))).add |
| 902 | (hg.invSquare.mul ((hc.angular kp).angular kp)) |>.add |
| 903 | ((hc.differentiate hU hg.axial hΦ k).differentiate hU hg.axial hΦ k) |
| 904 | |
| 905 | theorem smooth_vectorLaplacian {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 906 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 907 | {a : VectorCoefficients D} (ha : ∀ i, SmoothCoefficients U (a i)) : |
| 908 | ∀ i, SmoothCoefficients U (vectorLaplacian g k Φ kp a i) := fun i => |
| 909 | (smooth_scalarLaplacian hU hg hΦ k kp (ha i)).add |
| 910 | (hg.invSquare.mul (((smoothCoefficients_constant contDiffOn_const).mul |
| 911 | (smooth_rotate (fun j => (ha j).angular kp) i)).add (smooth_rotate (smooth_rotate ha) i))) |
| 912 | |
| 913 | theorem smooth_transport {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 914 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 915 | {a b : VectorCoefficients D} (ha : ∀ i, SmoothCoefficients U (a i)) |
| 916 | (hb : ∀ i, SmoothCoefficients U (b i)) : |
| 917 | ∀ i, SmoothCoefficients U (transport g k Φ kp a b i) := by |
| 918 | have hri : SmoothCoefficients U (constantCoefficient (fun x => (g.radius x : ℂ)⁻¹)) := by |
| 919 | simpa only [Complex.ofReal_inv] using hg.invRadius |
| 920 | intro i |
| 921 | exact (((ha 0).mul ((hb i).differentiate hU hg.radial hΦ k)).add |
| 922 | (((ha 1).mul hri).mul (((hb i).angular kp).add (smooth_rotate hb i)))).add |
| 923 | ((ha 2).mul ((hb i).differentiate hU hg.axial hΦ k)) |
| 924 | |
| 925 | theorem smooth_gradient {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 926 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 927 | {c : Coefficients D} (hc : SmoothCoefficients U c) : |
| 928 | ∀ i, SmoothCoefficients U (gradient g k Φ kp c i) := by |
| 929 | intro i |
| 930 | fin_cases i |
| 931 | · exact hc.differentiate hU hg.radial hΦ k |
| 932 | · exact hg.invRadius.mul (hc.angular kp) |
| 933 | · exact hc.differentiate hU hg.axial hΦ k |
| 934 | |
| 935 | theorem smooth_nonlinearResidual {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 936 | {Φ : D → ℝ} (hΦ : ContDiffOn ℝ ∞ Φ U) (k : ℝ) (kp : ℤ) |
| 937 | {B a : VectorCoefficients D} (hB : ∀ i, SmoothCoefficients U (B i)) |
| 938 | (ha : ∀ i, SmoothCoefficients U (a i)) {c : Coefficients D} (hc : SmoothCoefficients U c) : |
| 939 | ∀ i, SmoothCoefficients U (nonlinearResidual g k Φ kp B a c i) := fun i => |
| 940 | (((((ha i).differentiate hU hg.time hΦ k).add (smooth_transport hU hg hΦ k kp hB ha i)).add |
| 941 | (smooth_transport hU hg hΦ k kp ha hB i)).add (smooth_gradient hU hg hΦ k kp hc i) |>.sub |
| 942 | ((smoothCoefficients_constant contDiffOn_const).mul (smooth_vectorLaplacian hU hg hΦ k kp ha i))).add |
| 943 | (smooth_transport hU hg hΦ k kp ha ha i) |
| 944 | |
| 945 | noncomputable def constantVector (a : D → ComplexVector) : VectorCoefficients D := |
| 946 | fun i => constantCoefficient (fun x => a x i) |
| 947 | |
| 948 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 949 | @[simp] theorem vectorField_constantVector (a : D → ComplexVector) (k : ℝ) (Φ : D → ℝ) |
| 950 | (kp : ℤ) (p : D × ℝ) : vectorField (constantVector a) k Φ kp p = a p.1 := by |
| 951 | ext i |
| 952 | exact field_constant _ _ _ _ _ |
| 953 | |
| 954 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 955 | theorem band_zero_eq_constant {c : Coefficients D} (hc : BandLimited c 0) : |
| 956 | c = constantCoefficient (c 0) := by |
| 957 | ext j x |
| 958 | change c j x = Finsupp.single 0 (c 0) j x |
| 959 | by_cases hj : j = 0 |
| 960 | · simp [hj] |
| 961 | · have hnj : j ∉ c.support := by |
| 962 | intro h |
| 963 | have hz : j.natAbs = 0 := Nat.eq_zero_of_le_zero (hc j h) |
| 964 | exact hj (Int.natAbs_eq_zero.mp hz) |
| 965 | simp [Finsupp.notMem_support_iff.mp hnj, hj] |
| 966 | |
| 967 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 968 | theorem field_band_zero {c : Coefficients D} (hc : BandLimited c 0) |
| 969 | (k : ℝ) (Φ : D → ℝ) (kp : ℤ) (p : D × ℝ) : field c k Φ kp p = c 0 p.1 := by |
| 970 | calc |
| 971 | _ = field (constantCoefficient (c 0)) k Φ kp p := congrArg (fun a => field a k Φ kp p) |
| 972 | (band_zero_eq_constant hc) |
| 973 | _ = _ := field_constant _ _ _ _ _ |
| 974 | |
| 975 | /-- A label retains its own slow phase and native angular frequency. -/ |
| 976 | structure LabelData (D : Type) where |
| 977 | frequency : ℝ |
| 978 | phase : D → ℝ |
| 979 | angularFrequency : ℤ |
| 980 | velocity : VectorCoefficients D |
| 981 | pressure : Coefficients D |
| 982 | gaussian : VectorCoefficients D |
| 983 | aliasError : VectorCoefficients D |
| 984 | |
| 985 | noncomputable def LabelData.wave (d : LabelData D) : D × ℝ → ComplexVector := |
| 986 | vectorField d.velocity d.frequency d.phase d.angularFrequency |
| 987 | |
| 988 | noncomputable def LabelData.pressureField (d : LabelData D) : D × ℝ → ℂ := |
| 989 | field d.pressure d.frequency d.phase d.angularFrequency |
| 990 | |
| 991 | noncomputable def LabelData.gaussianField (d : LabelData D) : D × ℝ → ComplexVector := |
| 992 | vectorField d.gaussian d.frequency d.phase d.angularFrequency |
| 993 | |
| 994 | noncomputable def LabelData.aliasField (d : LabelData D) : D × ℝ → ComplexVector := |
| 995 | vectorField d.aliasError d.frequency d.phase d.angularFrequency |
| 996 | |
| 997 | structure LabelData.Regular (d : LabelData D) (U : Set D) : Prop where |
| 998 | phase : ContDiffOn ℝ ∞ d.phase U |
| 999 | velocity : ∀ i, SmoothCoefficients U (d.velocity i) |
| 1000 | pressure : SmoothCoefficients U d.pressure |
| 1001 | |
| 1002 | noncomputable def meanCoefficients (g : Frame D) (B M : D → ComplexVector) (p : D → ℂ) : |
| 1003 | VectorCoefficients D := |
| 1004 | nonlinearResidual g 0 (fun _ => 0) 1 (constantVector B) (constantVector M) (constantCoefficient p) |
| 1005 | |
| 1006 | /-- Gaussian and alias fields are subtracted after the actual nonlinear differential residual. -/ |
| 1007 | noncomputable def LabelData.residualCoefficients (d : LabelData D) (g : Frame D) |
| 1008 | (B M : D → ComplexVector) : VectorCoefficients D := fun i => |
| 1009 | realCoefficients (nonlinearResidual g d.frequency d.phase d.angularFrequency |
| 1010 | (constantVector (B + M)) d.velocity d.pressure i - d.gaussian i - d.aliasError i) |
| 1011 | |
| 1012 | noncomputable def LabelData.waveResidualCoefficients (d : LabelData D) (g : Frame D) |
| 1013 | (B M : D → ComplexVector) : VectorCoefficients D := fun i => |
| 1014 | nonconstant (d.residualCoefficients g B M i) |
| 1015 | |
| 1016 | noncomputable def goodResidual {ι : Type*} (labels : Finset ι) (data : ι → LabelData D) |
| 1017 | (g : Frame D) (B M : D → ComplexVector) (p : D → ℂ) (virtual : D → Fin 3 → ℝ) |
| 1018 | (x : D × ℝ) (i : Fin 3) : ℝ := |
| 1019 | (Actual.nonlinearResidual g.viscosity (fun y => g.radius y.1) |
| 1020 | (liftDirection g.radial) angularDirection (liftDirection g.axial) (liftDirection g.time) |
| 1021 | (fun y => B y.1) ((fun y => M y.1) + ∑ l ∈ labels, (data l).wave) |
| 1022 | ((fun y => p y.1) + ∑ l ∈ labels, (data l).pressureField) x i).re + virtual x.1 i - |
| 1023 | ∑ l ∈ labels, ((data l).gaussianField x i).re - |
| 1024 | ∑ l ∈ labels, ((data l).aliasField x i).re |
| 1025 | |
| 1026 | theorem meanCoefficients_band (g : Frame D) (B M : D → ComplexVector) (p : D → ℂ) : |
| 1027 | ∀ i, BandLimited (meanCoefficients g B M p i) 0 := by |
| 1028 | intro i |
| 1029 | exact band_nonlinearResidual g 0 (fun _ => 0) 1 (fun _ => band_constantCoefficient _) |
| 1030 | (fun _ => band_constantCoefficient _) (band_constantCoefficient _) i |
| 1031 | |
| 1032 | theorem meanCoefficients_field {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 1033 | (hr : ContDiffOn ℝ ∞ g.radial U) (hz : ContDiffOn ℝ ∞ g.axial U) |
| 1034 | (B M : D → ComplexVector) (p : D → ℂ) |
| 1035 | (hB : ∀ i, ContDiffOn ℝ ∞ (fun y => B y i) U) |
| 1036 | (hM : ∀ i, ContDiffOn ℝ ∞ (fun y => M y i) U) (hp : ContDiffOn ℝ ∞ p U) |
| 1037 | {x : D × ℝ} (hx : x ∈ liftDomain U) : |
| 1038 | Actual.nonlinearResidual g.viscosity (fun y => g.radius y.1) |
| 1039 | (liftDirection g.radial) angularDirection (liftDirection g.axial) (liftDirection g.time) |
| 1040 | (fun y => B y.1) (fun y => M y.1) (fun y => p y.1) x = |
| 1041 | fun i => meanCoefficients g B M p i 0 x.1 := by |
| 1042 | have he := field_nonlinearResidual hU g hr hz |
| 1043 | (fun i => smoothCoefficients_constant (hB i)) (fun i => smoothCoefficients_constant (hM i)) |
| 1044 | (smoothCoefficients_constant hp) (Φ := fun _ => 0) contDiffOn_const 0 1 hx |
| 1045 | have hconst (a : D → ComplexVector) : |
| 1046 | vectorField (constantVector a) 0 (fun _ => 0) 1 = fun y : D × ℝ => a y.1 := by |
| 1047 | funext y |
| 1048 | exact vectorField_constantVector a _ _ _ y |
| 1049 | have hpconst : field (constantCoefficient p) 0 (fun _ => 0) 1 = fun y : D × ℝ => p y.1 := by |
| 1050 | funext y |
| 1051 | exact field_constant _ _ _ _ _ |
| 1052 | change vectorField (meanCoefficients g B M p) 0 (fun _ => 0) 1 x = |
| 1053 | Actual.nonlinearResidual g.viscosity (fun y => g.radius y.1) |
| 1054 | (liftDirection g.radial) angularDirection (liftDirection g.axial) (liftDirection g.time) |
| 1055 | (vectorField (constantVector B) 0 (fun _ => 0) 1) |
| 1056 | (vectorField (constantVector M) 0 (fun _ => 0) 1) |
| 1057 | (field (constantCoefficient p) 0 (fun _ => 0) 1) x at he |
| 1058 | rw [hconst, hconst, hpconst] at he |
| 1059 | rw [← he] |
| 1060 | ext i |
| 1061 | exact field_band_zero (meanCoefficients_band g B M p i) _ _ _ _ |
| 1062 | |
| 1063 | theorem LabelData.residualCoefficients_field {U : Set D} (hU : IsOpen U) (g : Frame D) |
| 1064 | (hr : ContDiffOn ℝ ∞ g.radial U) (hz : ContDiffOn ℝ ∞ g.axial U) |
| 1065 | (B M : D → ComplexVector) (hB : ∀ i, ContDiffOn ℝ ∞ (fun y => B y i) U) |
| 1066 | (hM : ∀ i, ContDiffOn ℝ ∞ (fun y => M y i) U) |
| 1067 | (d : LabelData D) (hd : d.Regular U) {x : D × ℝ} (hx : x ∈ liftDomain U) (i : Fin 3) : |
| 1068 | (field (d.residualCoefficients g B M i) d.frequency d.phase d.angularFrequency x).re = |
| 1069 | (Actual.nonlinearResidual g.viscosity (fun y => g.radius y.1) |
| 1070 | (liftDirection g.radial) angularDirection (liftDirection g.axial) (liftDirection g.time) |
| 1071 | ((fun y => B y.1) + (fun y => M y.1)) d.wave d.pressureField x i).re - |
| 1072 | (d.gaussianField x i).re - (d.aliasField x i).re := by |
| 1073 | have he := field_nonlinearResidual hU g hr hz |
| 1074 | (fun i => smoothCoefficients_constant ((hB i).add (hM i))) hd.velocity hd.pressure hd.phase |
| 1075 | d.frequency d.angularFrequency hx |
| 1076 | have hconst : vectorField (constantVector (B + M)) d.frequency d.phase d.angularFrequency = |
| 1077 | (fun y : D × ℝ => B y.1) + (fun y => M y.1) := by |
| 1078 | funext y |
| 1079 | exact vectorField_constantVector (B + M) _ _ _ y |
| 1080 | change vectorField (nonlinearResidual g d.frequency d.phase d.angularFrequency |
| 1081 | (constantVector (B + M)) d.velocity d.pressure) d.frequency d.phase d.angularFrequency x = |
| 1082 | Actual.nonlinearResidual g.viscosity (fun y => g.radius y.1) (liftDirection g.radial) |
| 1083 | angularDirection (liftDirection g.axial) (liftDirection g.time) |
| 1084 | (vectorField (constantVector (B + M)) d.frequency d.phase d.angularFrequency) |
| 1085 | d.wave d.pressureField x at he |
| 1086 | rw [hconst] at he |
| 1087 | simp only [residualCoefficients, field_realCoefficients, Complex.ofReal_re, field_sub, Complex.sub_re] |
| 1088 | rw [← he] |
| 1089 | rfl |
| 1090 | |
| 1091 | theorem goodResidual_grouped {ι : Type*} (labels : Finset ι) (data : ι → LabelData D) |
| 1092 | {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 1093 | (B M : D → ComplexVector) (p : D → ℂ) (virtual : D → Fin 3 → ℝ) |
| 1094 | (hB : ∀ i, ContDiffOn ℝ ∞ (fun y => B y i) U) |
| 1095 | (hM : ∀ i, ContDiffOn ℝ ∞ (fun y => M y i) U) (hp : ContDiffOn ℝ ∞ p U) |
| 1096 | (hd : ∀ l ∈ labels, (data l).Regular U) |
| 1097 | (hdisj : ∀ l ∈ labels, ∀ j ∈ labels, l ≠ j → |
| 1098 | Disjoint (tsupport (data l).wave) (tsupport (data j).wave)) |
| 1099 | {x : D × ℝ} (hx : x ∈ liftDomain U) (i : Fin 3) : |
| 1100 | goodResidual labels data g B M p virtual x i = |
| 1101 | (meanCoefficients g B M p i 0 x.1).re + virtual x.1 i + |
| 1102 | ∑ l ∈ labels, (field ((data l).residualCoefficients g B M i) |
| 1103 | (data l).frequency (data l).phase (data l).angularFrequency x).re := by |
| 1104 | have hlu := liftDomain_open hU |
| 1105 | have hf : MapsTo (Prod.fst : D × ℝ → D) (liftDomain U) U := fun _ hy => hy.1 |
| 1106 | have hBl i : ContDiffOn ℝ ∞ (fun y : D × ℝ => B y.1 i) (liftDomain U) := |
| 1107 | (hB i).comp contDiffOn_fst hf |
| 1108 | have hMl i : ContDiffOn ℝ ∞ (fun y : D × ℝ => M y.1 i) (liftDomain U) := |
| 1109 | (hM i).comp contDiffOn_fst hf |
| 1110 | have hpl : ContDiffOn ℝ ∞ (fun y : D × ℝ => p y.1) (liftDomain U) := |
| 1111 | hp.comp contDiffOn_fst hf |
| 1112 | have hvel (l) (hl : l ∈ labels) (j : Fin 3) : |
| 1113 | ContDiffOn ℝ ∞ (fun y => (data l).wave y j) (liftDomain U) := |
| 1114 | field_smoothOn ((hd l hl).velocity j) (hd l hl).phase _ _ |
| 1115 | have hpres (l) (hl : l ∈ labels) : |
| 1116 | ContDiffOn ℝ ∞ (data l).pressureField (liftDomain U) := |
| 1117 | field_smoothOn (hd l hl).pressure (hd l hl).phase _ _ |
| 1118 | have hsumv (j : Fin 3) : ContDiffOn ℝ ∞ |
| 1119 | (fun y => (∑ l ∈ labels, (data l).wave) y j) (liftDomain U) := by |
| 1120 | simpa only [Finset.sum_apply] using ContDiffOn.sum (fun l hl => hvel l hl j) |
| 1121 | have hsump : ContDiffOn ℝ ∞ (∑ l ∈ labels, (data l).pressureField) (liftDomain U) := by |
| 1122 | convert! ContDiffOn.sum hpres using 1 |
| 1123 | ext y |
| 1124 | simp only [Finset.sum_apply] |
| 1125 | have hm := Actual.nonlinearResidual_mean_add (Vθ := angularDirection) hlu g.viscosity (fun y => g.radius y.1) |
| 1126 | (liftDirection g.time) (liftDirection_smooth hg.radial) contDiffOn_const |
| 1127 | (liftDirection_smooth hg.axial) (fun y => B y.1) (fun y => M y.1) |
| 1128 | (∑ l ∈ labels, (data l).wave) (fun y => p y.1) (∑ l ∈ labels, (data l).pressureField) |
| 1129 | hBl hMl hsumv hpl hsump hx |
| 1130 | have hs := Actual.nonlinearResidual_sum (Vθ := angularDirection) labels hlu g.viscosity (fun y => g.radius y.1) |
| 1131 | (liftDirection g.time) (liftDirection_smooth hg.radial) contDiffOn_const |
| 1132 | (liftDirection_smooth hg.axial) ((fun y => B y.1) + (fun y => M y.1)) |
| 1133 | (fun l => (data l).wave) (fun l => (data l).pressureField) hvel hpres hdisj hx |
| 1134 | have hcoef := meanCoefficients_field hU g hg.radial hg.axial B M p hB hM hp hx |
| 1135 | have hsumcoef := Finset.sum_congr (s₁ := labels) (s₂ := labels) rfl (fun l hl => |
| 1136 | LabelData.residualCoefficients_field hU g hg.radial hg.axial B M hB hM |
| 1137 | (data l) (hd l hl) hx i) |
| 1138 | unfold goodResidual |
| 1139 | rw [hm, hs, hcoef] |
| 1140 | simp only [Pi.add_apply, Finset.sum_apply, Complex.add_re, Complex.re_sum] |
| 1141 | rw [hsumcoef] |
| 1142 | simp only [Finset.sum_sub_distrib] |
| 1143 | ring |
| 1144 | |
| 1145 | theorem LabelData.residualCoefficients_band (d : LabelData D) (g : Frame D) |
| 1146 | (B M : D → ComplexVector) {N E : ℕ} |
| 1147 | (hu : ∀ i, BandLimited (d.velocity i) N) (hp : BandLimited d.pressure N) |
| 1148 | (hg : ∀ i, BandLimited (d.gaussian i) E) (ha : ∀ i, BandLimited (d.aliasError i) E) : |
| 1149 | ∀ i, BandLimited (d.residualCoefficients g B M i) (max (N + N) E) := by |
| 1150 | intro i |
| 1151 | apply band_realCoefficients |
| 1152 | exact band_sub (band_sub ((band_nonlinearResidual g d.frequency d.phase d.angularFrequency |
| 1153 | (fun _ => band_constantCoefficient _) hu hp i).mono (Nat.le_max_left _ _)) |
| 1154 | ((hg i).mono (Nat.le_max_right _ _))) ((ha i).mono (Nat.le_max_right _ _)) |
| 1155 | |
| 1156 | theorem LabelData.waveResidualCoefficients_band (d : LabelData D) (g : Frame D) |
| 1157 | (B M : D → ComplexVector) {N E : ℕ} |
| 1158 | (hu : ∀ i, BandLimited (d.velocity i) N) (hp : BandLimited d.pressure N) |
| 1159 | (hg : ∀ i, BandLimited (d.gaussian i) E) (ha : ∀ i, BandLimited (d.aliasError i) E) : |
| 1160 | ∀ i, BandLimited (d.waveResidualCoefficients g B M i) (max (N + N) E) := |
| 1161 | fun i => band_nonconstant (d.residualCoefficients_band g B M hu hp hg ha i) |
| 1162 | |
| 1163 | theorem LabelData.waveResidualCoefficients_values (d : LabelData D) (g : Frame D) |
| 1164 | (B M : D → ComplexVector) {N E : ℕ} |
| 1165 | (hu : ∀ i, BandLimited (d.velocity i) N) (hp : BandLimited d.pressure N) |
| 1166 | (hg : ∀ i, BandLimited (d.gaussian i) E) (ha : ∀ i, BandLimited (d.aliasError i) E) |
| 1167 | (i : Fin 3) (j : ℤ) (hj : j ∈ (d.waveResidualCoefficients g B M i).support) : |
| 1168 | j ≠ 0 ∧ j.natAbs ≤ max (N + N) E := |
| 1169 | ⟨nonconstant_support hj, d.waveResidualCoefficients_band g B M hu hp hg ha i j hj⟩ |
| 1170 | |
| 1171 | theorem LabelData.residualCoefficients_conjugate (d : LabelData D) (g : Frame D) |
| 1172 | (B M : D → ComplexVector) (i : Fin 3) : ConjugateSymmetric (d.residualCoefficients g B M i) := |
| 1173 | realCoefficients_conjugate _ |
| 1174 | |
| 1175 | theorem LabelData.waveResidualCoefficients_conjugate (d : LabelData D) (g : Frame D) |
| 1176 | (B M : D → ComplexVector) (i : Fin 3) : ConjugateSymmetric (d.waveResidualCoefficients g B M i) := |
| 1177 | nonconstant_conjugate (d.residualCoefficients_conjugate g B M i) |
| 1178 | |
| 1179 | theorem LabelData.waveResidualCoefficients_smooth {U : Set D} (hU : IsOpen U) |
| 1180 | {g : Frame D} (hg : g.Regular U) (B M : D → ComplexVector) |
| 1181 | (hB : ∀ i, ContDiffOn ℝ ∞ (fun y => B y i) U) |
| 1182 | (hM : ∀ i, ContDiffOn ℝ ∞ (fun y => M y i) U) |
| 1183 | (d : LabelData D) (hd : d.Regular U) |
| 1184 | (hgaussian : ∀ i, SmoothCoefficients U (d.gaussian i)) |
| 1185 | (halias : ∀ i, SmoothCoefficients U (d.aliasError i)) : |
| 1186 | ∀ i, SmoothCoefficients U (d.waveResidualCoefficients g B M i) := by |
| 1187 | intro i |
| 1188 | exact (((smooth_nonlinearResidual hU hg hd.phase d.frequency d.angularFrequency |
| 1189 | (fun i => smoothCoefficients_constant ((hB i).add (hM i))) hd.velocity hd.pressure i).sub |
| 1190 | (hgaussian i)).sub (halias i)).realCoefficients.nonconstant |
| 1191 | |
| 1192 | theorem LabelData.extract_residual (d : LabelData D) (g : Frame D) |
| 1193 | (B M : D → ComplexVector) (hkp : d.angularFrequency ≠ 0) (i : Fin 3) (j : ℤ) (x : D) : |
| 1194 | extract (field (d.residualCoefficients g B M i) d.frequency d.phase d.angularFrequency) |
| 1195 | d.frequency d.phase d.angularFrequency j x = d.residualCoefficients g B M i j x := |
| 1196 | extract_field _ _ _ hkp _ _ |
| 1197 | |
| 1198 | noncomputable def realAngularMean (f : ℝ → ℝ) : ℝ := |
| 1199 | (∫ θ in (0 : ℝ)..period, f θ) / period |
| 1200 | |
| 1201 | theorem realAngularMean_const (a : ℝ) : realAngularMean (fun _ => a) = a := by |
| 1202 | simp only [realAngularMean, intervalIntegral.integral_const, sub_zero, smul_eq_mul] |
| 1203 | field_simp [period_ne_zero] |
| 1204 | |
| 1205 | theorem realAngularMean_add {f g : ℝ → ℝ} (hf : Continuous f) (hg : Continuous g) : |
| 1206 | realAngularMean (fun θ => f θ + g θ) = realAngularMean f + realAngularMean g := by |
| 1207 | simp only [realAngularMean] |
| 1208 | rw [intervalIntegral.integral_add (hf.intervalIntegrable _ _) (hg.intervalIntegrable _ _), add_div] |
| 1209 | |
| 1210 | theorem realAngularMean_sum {ι : Type*} (s : Finset ι) (f : ι → ℝ → ℝ) |
| 1211 | (hf : ∀ l ∈ s, Continuous (f l)) : |
| 1212 | realAngularMean (fun θ => ∑ l ∈ s, f l θ) = ∑ l ∈ s, realAngularMean (f l) := by |
| 1213 | simp only [realAngularMean] |
| 1214 | rw [intervalIntegral.integral_finsetSum (fun l hl => (hf l hl).intervalIntegrable _ _), Finset.sum_div] |
| 1215 | |
| 1216 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 1217 | theorem realAngularMean_field (c : Coefficients D) (k : ℝ) (Φ : D → ℝ) |
| 1218 | {kp : ℤ} (hkp : kp ≠ 0) (x : D) : |
| 1219 | realAngularMean (fun θ => (field c k Φ kp (x, θ)).re) = (c 0 x).re := by |
| 1220 | have hi := Complex.reCLM.intervalIntegral_comp_comm (μ := volume) |
| 1221 | ((field_angular_continuous c k Φ kp x).intervalIntegrable (0 : ℝ) period) |
| 1222 | have he := congrArg Complex.re (angularMean_field c k Φ hkp x) |
| 1223 | simp only [Complex.reCLM_apply] at hi |
| 1224 | simp only [angularMean, ← Complex.ofReal_inv, Complex.mul_re, Complex.ofReal_re, |
| 1225 | Complex.ofReal_im, zero_mul, sub_zero] at he |
| 1226 | rw [← hi] at he |
| 1227 | simpa only [realAngularMean, div_eq_mul_inv, mul_comm] using he |
| 1228 | |
| 1229 | noncomputable def meanResidualValue {ι : Type*} (labels : Finset ι) (data : ι → LabelData D) |
| 1230 | (g : Frame D) (B M : D → ComplexVector) (p : D → ℂ) (virtual : D → Fin 3 → ℝ) |
| 1231 | (x : D) (i : Fin 3) : ℝ := |
| 1232 | (meanCoefficients g B M p i 0 x).re + virtual x i + |
| 1233 | ∑ l ∈ labels, (data l |>.residualCoefficients g B M i 0 x).re |
| 1234 | |
| 1235 | theorem goodResidual_angularMean {ι : Type*} (labels : Finset ι) (data : ι → LabelData D) |
| 1236 | {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 1237 | (B M : D → ComplexVector) (p : D → ℂ) (virtual : D → Fin 3 → ℝ) |
| 1238 | (hB : ∀ i, ContDiffOn ℝ ∞ (fun y => B y i) U) |
| 1239 | (hM : ∀ i, ContDiffOn ℝ ∞ (fun y => M y i) U) (hp : ContDiffOn ℝ ∞ p U) |
| 1240 | (hd : ∀ l ∈ labels, (data l).Regular U) |
| 1241 | (hdisj : ∀ l ∈ labels, ∀ j ∈ labels, l ≠ j → |
| 1242 | Disjoint (tsupport (data l).wave) (tsupport (data j).wave)) |
| 1243 | (hkp : ∀ l ∈ labels, (data l).angularFrequency ≠ 0) {x : D} (hx : x ∈ U) (i : Fin 3) : |
| 1244 | realAngularMean (fun θ => goodResidual labels data g B M p virtual (x, θ) i) = |
| 1245 | meanResidualValue labels data g B M p virtual x i := by |
| 1246 | have he : (fun θ => goodResidual labels data g B M p virtual (x, θ) i) = |
| 1247 | fun θ => (meanCoefficients g B M p i 0 x).re + virtual x i + |
| 1248 | ∑ l ∈ labels, (field ((data l).residualCoefficients g B M i) |
| 1249 | (data l).frequency (data l).phase (data l).angularFrequency (x, θ)).re := by |
| 1250 | funext θ |
| 1251 | exact goodResidual_grouped labels data hU hg B M p virtual hB hM hp hd hdisj ⟨hx, mem_univ θ⟩ i |
| 1252 | let F : ι → ℝ → ℝ := fun l θ => (field ((data l).residualCoefficients g B M i) |
| 1253 | (data l).frequency (data l).phase (data l).angularFrequency (x, θ)).re |
| 1254 | have hF (l : ι) : Continuous (F l) := |
| 1255 | Complex.continuous_re.comp (field_angular_continuous _ _ _ _ _) |
| 1256 | rw [he] |
| 1257 | change realAngularMean (fun θ => (meanCoefficients g B M p i 0 x).re + virtual x i + |
| 1258 | ∑ l ∈ labels, F l θ) = _ |
| 1259 | rw [realAngularMean_add (f := fun _ => (meanCoefficients g B M p i 0 x).re + virtual x i) |
| 1260 | (g := fun θ => ∑ l ∈ labels, F l θ) continuous_const |
| 1261 | (continuous_finsetSum labels (fun l _ => hF l)), |
| 1262 | realAngularMean_const, realAngularMean_sum labels F (fun l _ => hF l)] |
| 1263 | congr 1 |
| 1264 | apply Finset.sum_congr rfl |
| 1265 | intro l hl |
| 1266 | exact realAngularMean_field _ _ _ (hkp l hl) x |
| 1267 | |
| 1268 | noncomputable def goodWaveResidual {ι : Type*} (labels : Finset ι) (data : ι → LabelData D) |
| 1269 | (g : Frame D) (B M : D → ComplexVector) (p : D → ℂ) (virtual : D → Fin 3 → ℝ) |
| 1270 | (x : D × ℝ) (i : Fin 3) : ℝ := |
| 1271 | goodResidual labels data g B M p virtual x i - |
| 1272 | realAngularMean (fun θ => goodResidual labels data g B M p virtual (x.1, θ) i) |
| 1273 | |
| 1274 | /-- Exact reconstruction of the good nonconstant PDE residual by native-label blocks. -/ |
| 1275 | theorem goodWaveResidual_grouped {ι : Type*} (labels : Finset ι) (data : ι → LabelData D) |
| 1276 | {U : Set D} (hU : IsOpen U) {g : Frame D} (hg : g.Regular U) |
| 1277 | (B M : D → ComplexVector) (p : D → ℂ) (virtual : D → Fin 3 → ℝ) |
| 1278 | (hB : ∀ i, ContDiffOn ℝ ∞ (fun y => B y i) U) |
| 1279 | (hM : ∀ i, ContDiffOn ℝ ∞ (fun y => M y i) U) (hp : ContDiffOn ℝ ∞ p U) |
| 1280 | (hd : ∀ l ∈ labels, (data l).Regular U) |
| 1281 | (hdisj : ∀ l ∈ labels, ∀ j ∈ labels, l ≠ j → |
| 1282 | Disjoint (tsupport (data l).wave) (tsupport (data j).wave)) |
| 1283 | (hkp : ∀ l ∈ labels, (data l).angularFrequency ≠ 0) {x : D × ℝ} |
| 1284 | (hx : x ∈ liftDomain U) (i : Fin 3) : |
| 1285 | goodWaveResidual labels data g B M p virtual x i = |
| 1286 | ∑ l ∈ labels, (field ((data l).waveResidualCoefficients g B M i) |
| 1287 | (data l).frequency (data l).phase (data l).angularFrequency x).re := by |
| 1288 | rw [goodWaveResidual, goodResidual_grouped labels data hU hg B M p virtual hB hM hp hd hdisj hx i, |
| 1289 | goodResidual_angularMean labels data hU hg B M p virtual hB hM hp hd hdisj hkp hx.1 i] |
| 1290 | simp only [meanResidualValue, LabelData.waveResidualCoefficients, field_nonconstant, Complex.sub_re, |
| 1291 | Finset.sum_sub_distrib] |
| 1292 | ring |
| 1293 | |
| 1294 | /-! ## The stored correction state and its actual grouped residual -/ |
| 1295 | |
| 1296 | noncomputable def contextFrame (c : CorrectionState.Context D) (n : ℕ) : Frame D where |
| 1297 | radius := c.operators.radius |
| 1298 | radial := fun x => c.operators.eR + |
| 1299 | (c.operators.radialFrequency n * c.operators.radialProfile x) • c.operators.vR |
| 1300 | axial := fun _ => c.operators.epsilon n • c.operators.eZ |
| 1301 | time := fun _ => c.operators.fastCoefficient n • c.operators.vT - c.operators.epsilon n • c.operators.eT |
| 1302 | viscosity := c.operators.epsilon n |
| 1303 | |
| 1304 | noncomputable def contextBase (c : CorrectionState.Context D) (n : ℕ) (x : D) : ComplexVector := |
| 1305 | ![(c.base.radial n x : ℂ), (c.base.angular n x : ℂ), (c.base.axial n x : ℂ)] |
| 1306 | |
| 1307 | noncomputable def stateMean (s : CorrectionState.State D) (n : ℕ) (x : D) : ComplexVector := |
| 1308 | ![(s.mean.radial n x : ℂ), (s.mean.angular n x : ℂ), (s.mean.axial n x : ℂ)] |
| 1309 | |
| 1310 | noncomputable def statePerturbation (s : CorrectionState.State D) (n : ℕ) (x : D × ℝ) : ComplexVector := |
| 1311 | ![(s.mean.radial n x.1 + s.oscillation n x 0 : ℝ), |
| 1312 | (s.mean.angular n x.1 + s.oscillation n x 1 : ℝ), |
| 1313 | (s.mean.axial n x.1 + s.oscillation n x 2 : ℝ)] |
| 1314 | |
| 1315 | noncomputable def statePressure (s : CorrectionState.State D) (n : ℕ) (x : D × ℝ) : ℂ := |
| 1316 | (s.totalPressureIncrement n x : ℝ) |
| 1317 | |
| 1318 | noncomputable def contextVirtual (c : CorrectionState.Context D) (n : ℕ) (x : D) : Fin 3 → ℝ := |
| 1319 | ![0, -(c.operators.radialDiv 2 c.virtualTheta n x), -(c.operators.radialDiv 1 c.virtualAxial n x)] |
| 1320 | |
| 1321 | /-- The same full normalized differential field used by the correction cycle. -/ |
| 1322 | noncomputable def stateFullResidual (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1323 | (n : ℕ) (x : D × ℝ) (i : Fin 3) : ℝ := |
| 1324 | (Actual.nonlinearResidual (contextFrame c n).viscosity (fun y => (contextFrame c n).radius y.1) |
| 1325 | (liftDirection (contextFrame c n).radial) angularDirection |
| 1326 | (liftDirection (contextFrame c n).axial) (liftDirection (contextFrame c n).time) |
| 1327 | (fun y => contextBase c n y.1) (statePerturbation s n) (statePressure s n) x i).re + |
| 1328 | contextVirtual c n x.1 i + s.errors.base n x i |
| 1329 | |
| 1330 | noncomputable def stateGoodResidual (c : CorrectionState.Context D) (s : CorrectionState.State D) : |
| 1331 | CorrectionState.Oscillation D := stateFullResidual c s - s.errors.total |
| 1332 | |
| 1333 | noncomputable def stateGoodWaveResidual (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1334 | (n : ℕ) (x : D × ℝ) (i : Fin 3) : ℝ := |
| 1335 | stateGoodResidual c s n x i - |
| 1336 | CorrectionState.angularAverage (fun m y => stateGoodResidual c s m y i) n x.1 |
| 1337 | |
| 1338 | abbrev BlockCoefficients (D : Type) := ℕ → VectorCoefficients D |
| 1339 | |
| 1340 | /-- Input blocks are interpreted as their actual real fields. The real projection |
| 1341 | does not enlarge the largest harmonic value and is the identity for conjugate data. -/ |
| 1342 | noncomputable def ofBlock (b : CorrectionState.HarmonicBlock D) |
| 1343 | (gaussian aliasError : BlockCoefficients D) (n : ℕ) : LabelData D where |
| 1344 | frequency := b.frequency n |
| 1345 | phase := b.phase n |
| 1346 | angularFrequency := b.angularFrequency n |
| 1347 | velocity := fun i => realCoefficients (b.velocity n i) |
| 1348 | pressure := realCoefficients (b.pressure n) |
| 1349 | gaussian := gaussian n |
| 1350 | aliasError := aliasError n |
| 1351 | |
| 1352 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 1353 | theorem ofBlock_wave (b : CorrectionState.HarmonicBlock D) |
| 1354 | (gaussian aliasError : BlockCoefficients D) (n : ℕ) (x : D × ℝ) (i : Fin 3) : |
| 1355 | (ofBlock b gaussian aliasError n).wave x i = (b.oscillation n x i : ℂ) := |
| 1356 | field_realCoefficients _ _ _ _ _ |
| 1357 | |
| 1358 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 1359 | theorem ofBlock_pressure (b : CorrectionState.HarmonicBlock D) |
| 1360 | (gaussian aliasError : BlockCoefficients D) (n : ℕ) (x : D × ℝ) : |
| 1361 | (ofBlock b gaussian aliasError n).pressureField x = (b.oscillatoryPressure n x : ℂ) := |
| 1362 | field_realCoefficients _ _ _ _ _ |
| 1363 | |
| 1364 | omit [NormedSpace ℝ D] in |
| 1365 | theorem ofBlock_tsupport_wave (b : CorrectionState.HarmonicBlock D) |
| 1366 | (gaussian aliasError : BlockCoefficients D) (n : ℕ) : |
| 1367 | tsupport (ofBlock b gaussian aliasError n).wave = tsupport (b.oscillation n) := by |
| 1368 | apply congrArg closure |
| 1369 | ext x |
| 1370 | change (_ ≠ 0) ↔ (_ ≠ 0) |
| 1371 | apply not_congr |
| 1372 | constructor |
| 1373 | · intro h |
| 1374 | ext i |
| 1375 | have hi := congrFun h i |
| 1376 | rw [ofBlock_wave] at hi |
| 1377 | exact Complex.ofReal_eq_zero.mp hi |
| 1378 | · intro h |
| 1379 | ext i |
| 1380 | rw [ofBlock_wave, h] |
| 1381 | rfl |
| 1382 | |
| 1383 | theorem ofBlock_regular {U : Set D} (b : CorrectionState.HarmonicBlock D) |
| 1384 | (gaussian aliasError : BlockCoefficients D) (n : ℕ) |
| 1385 | (hΦ : ContDiffOn ℝ ∞ (b.phase n) U) |
| 1386 | (hv : ∀ i, SmoothCoefficients U (b.velocity n i)) (hp : SmoothCoefficients U (b.pressure n)) : |
| 1387 | (ofBlock b gaussian aliasError n).Regular U := |
| 1388 | ⟨hΦ, fun i => (hv i).realCoefficients, hp.realCoefficients⟩ |
| 1389 | |
| 1390 | /-- Only representations of the stored fields are inputs; no residual identity is assumed. |
| 1391 | The finite label set may vary with the band. -/ |
| 1392 | structure BlockRepresentation {ι : Type*} (labels : ℕ → Finset ι) |
| 1393 | (blocks : ι → CorrectionState.HarmonicBlock D) |
| 1394 | (gaussianCoeffs aliasCoeffs : ι → BlockCoefficients D) (s : CorrectionState.State D) : Prop where |
| 1395 | velocity : ∀ n x i, s.oscillation n x i = ∑ l ∈ labels n, (blocks l).oscillation n x i |
| 1396 | pressure : ∀ n x, s.oscillatoryPressure n x = ∑ l ∈ labels n, (blocks l).oscillatoryPressure n x |
| 1397 | gaussian : ∀ n x i, s.errors.gaussian n x i = |
| 1398 | ∑ l ∈ labels n, ((ofBlock (blocks l) (gaussianCoeffs l) (aliasCoeffs l) n).gaussianField x i).re |
| 1399 | aliasError : ∀ n x i, s.errors.aliasError n x i = |
| 1400 | ∑ l ∈ labels n, ((ofBlock (blocks l) (gaussianCoeffs l) (aliasCoeffs l) n).aliasField x i).re |
| 1401 | |
| 1402 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 1403 | theorem BlockRepresentation.perturbation {ι : Type*} {labels : ℕ → Finset ι} |
| 1404 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} |
| 1405 | {s : CorrectionState.State D} (hrep : BlockRepresentation labels blocks gaussian aliasError s) (n : ℕ) : |
| 1406 | statePerturbation s n = (fun x => stateMean s n x.1) + |
| 1407 | ∑ l ∈ labels n, (ofBlock (blocks l) (gaussian l) (aliasError l) n).wave := by |
| 1408 | ext x i |
| 1409 | fin_cases i <;> |
| 1410 | simp [statePerturbation, stateMean, Finset.sum_apply, ofBlock_wave, hrep.velocity, |
| 1411 | Complex.ofReal_sum, Complex.ofReal_add] |
| 1412 | |
| 1413 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 1414 | theorem BlockRepresentation.pressureField {ι : Type*} {labels : ℕ → Finset ι} |
| 1415 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} |
| 1416 | {s : CorrectionState.State D} (hrep : BlockRepresentation labels blocks gaussian aliasError s) (n : ℕ) : |
| 1417 | statePressure s n = (fun x => (s.pressure n x.1 : ℂ)) + |
| 1418 | ∑ l ∈ labels n, (ofBlock (blocks l) (gaussian l) (aliasError l) n).pressureField := by |
| 1419 | ext x |
| 1420 | simp [statePressure, CorrectionState.State.totalPressureIncrement, Finset.sum_apply, |
| 1421 | ofBlock_pressure, hrep.pressure, Complex.ofReal_sum, Complex.ofReal_add] |
| 1422 | |
| 1423 | /-- The fixed base error cancels literally; Gaussian and alias errors stay additive. -/ |
| 1424 | theorem BlockRepresentation.goodResidual_eq {ι : Type*} {labels : ℕ → Finset ι} |
| 1425 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} |
| 1426 | {s : CorrectionState.State D} (hrep : BlockRepresentation labels blocks gaussian aliasError s) |
| 1427 | (c : CorrectionState.Context D) (n : ℕ) (x : D × ℝ) (i : Fin 3) : |
| 1428 | stateGoodResidual c s n x i = goodResidual (labels n) |
| 1429 | (fun l => ofBlock (blocks l) (gaussian l) (aliasError l) n) |
| 1430 | (contextFrame c n) (contextBase c n) (stateMean s n) (fun y => (s.pressure n y : ℂ)) |
| 1431 | (contextVirtual c n) x i := by |
| 1432 | simp only [stateGoodResidual, Pi.sub_apply, stateFullResidual, goodResidual] |
| 1433 | rw [hrep.perturbation n, hrep.pressureField n] |
| 1434 | simp only [CorrectionState.ExcludedErrors.total, Pi.add_apply] |
| 1435 | rw [hrep.gaussian n x i, hrep.aliasError n x i] |
| 1436 | ring |
| 1437 | |
| 1438 | noncomputable def residualBlock (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1439 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) : |
| 1440 | CorrectionState.HarmonicBlock D where |
| 1441 | velocity := fun n => (ofBlock b gaussian aliasError n).waveResidualCoefficients |
| 1442 | (contextFrame c n) (contextBase c n) (stateMean s n) |
| 1443 | pressure := fun _ => 0 |
| 1444 | frequency := b.frequency |
| 1445 | phase := b.phase |
| 1446 | angularFrequency := b.angularFrequency |
| 1447 | |
| 1448 | theorem BlockRepresentation.goodWaveResidual_eq {ι : Type*} {labels : ℕ → Finset ι} |
| 1449 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} |
| 1450 | {s : CorrectionState.State D} (hrep : BlockRepresentation labels blocks gaussian aliasError s) |
| 1451 | (c : CorrectionState.Context D) (n : ℕ) (x : D × ℝ) (i : Fin 3) : |
| 1452 | stateGoodWaveResidual c s n x i = goodWaveResidual (labels n) |
| 1453 | (fun l => ofBlock (blocks l) (gaussian l) (aliasError l) n) |
| 1454 | (contextFrame c n) (contextBase c n) (stateMean s n) (fun y => (s.pressure n y : ℂ)) |
| 1455 | (contextVirtual c n) x i := by |
| 1456 | simp only [stateGoodWaveResidual, goodWaveResidual, CorrectionState.angularAverage, |
| 1457 | realAngularMean, period] |
| 1458 | simp_rw [hrep.goodResidual_eq c n] |
| 1459 | |
| 1460 | /-- Conditions on the actual graph, represented fields, and actual closed supports. -/ |
| 1461 | structure ExtractionRegular {ι : Type*} (U : Set D) (c : CorrectionState.Context D) |
| 1462 | (s : CorrectionState.State D) (labels : ℕ → Finset ι) |
| 1463 | (blockFamily : ι → CorrectionState.HarmonicBlock D) |
| 1464 | (gaussianCoeffs aliasCoeffs : ι → BlockCoefficients D) (n : ℕ) : Prop where |
| 1465 | frame : (contextFrame c n).Regular U |
| 1466 | base : ∀ i, ContDiffOn ℝ ∞ (fun x => contextBase c n x i) U |
| 1467 | mean : ∀ i, ContDiffOn ℝ ∞ (fun x => stateMean s n x i) U |
| 1468 | pressure : ContDiffOn ℝ ∞ (s.pressure n) U |
| 1469 | blocks : ∀ l ∈ labels n, (ofBlock (blockFamily l) (gaussianCoeffs l) (aliasCoeffs l) n).Regular U |
| 1470 | gaussian : ∀ l ∈ labels n, ∀ i, SmoothCoefficients U (gaussianCoeffs l n i) |
| 1471 | aliasError : ∀ l ∈ labels n, ∀ i, SmoothCoefficients U (aliasCoeffs l n i) |
| 1472 | disjoint : ∀ l ∈ labels n, ∀ j ∈ labels n, l ≠ j → |
| 1473 | Disjoint (tsupport ((blockFamily l).oscillation n)) (tsupport ((blockFamily j).oscillation n)) |
| 1474 | angular_nonzero : ∀ l ∈ labels n, (blockFamily l).angularFrequency n ≠ 0 |
| 1475 | |
| 1476 | theorem ExtractionRegular.dataDisjoint {ι : Type*} {U : Set D} {c : CorrectionState.Context D} |
| 1477 | {s : CorrectionState.State D} {labels : ℕ → Finset ι} |
| 1478 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} {n : ℕ} |
| 1479 | (h : ExtractionRegular U c s labels blocks gaussian aliasError n) : |
| 1480 | ∀ l ∈ labels n, ∀ j ∈ labels n, l ≠ j → |
| 1481 | Disjoint (tsupport (ofBlock (blocks l) (gaussian l) (aliasError l) n).wave) |
| 1482 | (tsupport (ofBlock (blocks j) (gaussian j) (aliasError j) n).wave) := by |
| 1483 | intro l hl j hj hlj |
| 1484 | simpa only [ofBlock_tsupport_wave] using h.disjoint l hl j hj hlj |
| 1485 | |
| 1486 | /-- The forcing supplied to each copy solve consists of the actual nonconstant |
| 1487 | PDE coefficients. Finite active sets can change with `n`. -/ |
| 1488 | theorem stateGoodWaveResidual_grouped {ι : Type*} {U : Set D} (hU : IsOpen U) |
| 1489 | {c : CorrectionState.Context D} {s : CorrectionState.State D} {labels : ℕ → Finset ι} |
| 1490 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} |
| 1491 | (hrep : BlockRepresentation labels blocks gaussian aliasError s) {n : ℕ} |
| 1492 | (h : ExtractionRegular U c s labels blocks gaussian aliasError n) |
| 1493 | {x : D × ℝ} (hx : x ∈ liftDomain U) (i : Fin 3) : |
| 1494 | stateGoodWaveResidual c s n x i = |
| 1495 | ∑ l ∈ labels n, (residualBlock c s (blocks l) (gaussian l) (aliasError l)).oscillation n x i := by |
| 1496 | rw [hrep.goodWaveResidual_eq c n x i] |
| 1497 | exact goodWaveResidual_grouped (labels n) _ hU h.frame _ _ _ _ h.base h.mean |
| 1498 | (Complex.ofRealCLM.contDiff.comp_contDiffOn h.pressure) h.blocks h.dataDisjoint h.angular_nonzero hx i |
| 1499 | |
| 1500 | noncomputable def stateMeanCoefficientValue {ι : Type*} (labels : ℕ → Finset ι) |
| 1501 | (blocks : ι → CorrectionState.HarmonicBlock D) (gaussian aliasError : ι → BlockCoefficients D) |
| 1502 | (c : CorrectionState.Context D) (s : CorrectionState.State D) (n : ℕ) (x : D) (i : Fin 3) : ℝ := |
| 1503 | meanResidualValue (labels n) (fun l => ofBlock (blocks l) (gaussian l) (aliasError l) n) |
| 1504 | (contextFrame c n) (contextBase c n) (stateMean s n) (fun y => (s.pressure n y : ℂ)) |
| 1505 | (contextVirtual c n) x i |
| 1506 | |
| 1507 | /-- The selected zero mode is the actual angular mean of the stored good residual. -/ |
| 1508 | theorem stateMeanCoefficientValue_eq_average {ι : Type*} {U : Set D} (hU : IsOpen U) |
| 1509 | {c : CorrectionState.Context D} {s : CorrectionState.State D} {labels : ℕ → Finset ι} |
| 1510 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} |
| 1511 | (hrep : BlockRepresentation labels blocks gaussian aliasError s) {n : ℕ} |
| 1512 | (h : ExtractionRegular U c s labels blocks gaussian aliasError n) |
| 1513 | {x : D} (hx : x ∈ U) (i : Fin 3) : |
| 1514 | stateMeanCoefficientValue labels blocks gaussian aliasError c s n x i = |
| 1515 | CorrectionState.angularAverage (fun m y => stateGoodResidual c s m y i) n x := by |
| 1516 | simp only [CorrectionState.angularAverage] |
| 1517 | simp_rw [hrep.goodResidual_eq c n] |
| 1518 | exact (goodResidual_angularMean (labels n) _ hU h.frame _ _ _ _ h.base h.mean |
| 1519 | (Complex.ofRealCLM.contDiff.comp_contDiffOn h.pressure) h.blocks h.dataDisjoint |
| 1520 | h.angular_nonzero hx i).symm |
| 1521 | |
| 1522 | theorem residualBlock_band (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1523 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) |
| 1524 | {N E : ℕ} (hb : b.BandLimited N) |
| 1525 | (hg : ∀ n i, BandLimited (gaussian n i) E) (ha : ∀ n i, BandLimited (aliasError n i) E) : |
| 1526 | (residualBlock c s b gaussian aliasError).BandLimited (max (N + N) E) := by |
| 1527 | refine ⟨?_, fun n => band_zero _⟩ |
| 1528 | intro n i |
| 1529 | exact (ofBlock b gaussian aliasError n).waveResidualCoefficients_band _ _ _ |
| 1530 | (fun j => band_realCoefficients (hb.1 n j)) (band_realCoefficients (hb.2 n)) (hg n) (ha n) i |
| 1531 | |
| 1532 | theorem residualBlock_conjugate (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1533 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) (n : ℕ) (i : Fin 3) : |
| 1534 | ConjugateSymmetric ((residualBlock c s b gaussian aliasError).velocity n i) := |
| 1535 | LabelData.waveResidualCoefficients_conjugate _ _ _ _ _ |
| 1536 | |
| 1537 | theorem residualBlock_zero_mode (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1538 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) (n : ℕ) (i : Fin 3) : |
| 1539 | (residualBlock c s b gaussian aliasError).velocity n i 0 = 0 := |
| 1540 | Finsupp.erase_same |
| 1541 | |
| 1542 | theorem residualBlock_smooth {ι : Type*} {U : Set D} (hU : IsOpen U) |
| 1543 | {c : CorrectionState.Context D} {s : CorrectionState.State D} {labels : ℕ → Finset ι} |
| 1544 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} {n : ℕ} |
| 1545 | (h : ExtractionRegular U c s labels blocks gaussian aliasError n) {l : ι} (hl : l ∈ labels n) : |
| 1546 | ∀ i, SmoothCoefficients U ((residualBlock c s (blocks l) (gaussian l) (aliasError l)).velocity n i) := |
| 1547 | LabelData.waveResidualCoefficients_smooth hU h.frame _ _ h.base h.mean _ |
| 1548 | (h.blocks l hl) (h.gaussian l hl) (h.aliasError l hl) |
| 1549 | |
| 1550 | theorem residualBlock_values (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1551 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) |
| 1552 | {N E : ℕ} (hb : b.BandLimited N) |
| 1553 | (hg : ∀ n i, BandLimited (gaussian n i) E) (ha : ∀ n i, BandLimited (aliasError n i) E) |
| 1554 | (n : ℕ) (i : Fin 3) (j : ℤ) |
| 1555 | (hj : j ∈ ((residualBlock c s b gaussian aliasError).velocity n i).support) : |
| 1556 | j ≠ 0 ∧ j.natAbs ≤ max (N + N) E := |
| 1557 | ⟨nonconstant_support hj, (residualBlock_band c s b gaussian aliasError hb hg ha).1 n i j hj⟩ |
| 1558 | |
| 1559 | /-- A fixed stage can have large harmonic values, but the next quadratic stage |
| 1560 | has an explicit bound independent of band and label count. -/ |
| 1561 | theorem residualBlock_stage_band (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1562 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) |
| 1563 | (stage : ℕ) (hb : b.BandLimited (2 ^ stage)) |
| 1564 | (hg : ∀ n i, BandLimited (gaussian n i) (2 ^ (stage + 1))) |
| 1565 | (ha : ∀ n i, BandLimited (aliasError n i) (2 ^ (stage + 1))) : |
| 1566 | (residualBlock c s b gaussian aliasError).BandLimited (2 ^ (stage + 1)) := by |
| 1567 | have he : 2 ^ stage + 2 ^ stage = 2 ^ (stage + 1) := by omega |
| 1568 | simpa only [he, max_self] using residualBlock_band c s b gaussian aliasError hb hg ha |
| 1569 | |
| 1570 | theorem residualBlock_extract (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1571 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) |
| 1572 | (n : ℕ) (hkp : b.angularFrequency n ≠ 0) (i : Fin 3) (j : ℤ) (x : D) : |
| 1573 | extract (fun y => ((residualBlock c s b gaussian aliasError).oscillation n y i : ℂ)) |
| 1574 | (b.frequency n) (b.phase n) (b.angularFrequency n) j x = |
| 1575 | (residualBlock c s b gaussian aliasError).velocity n i j x := by |
| 1576 | have he : (fun y => ((residualBlock c s b gaussian aliasError).oscillation n y i : ℂ)) = |
| 1577 | field ((residualBlock c s b gaussian aliasError).velocity n i) |
| 1578 | (b.frequency n) (b.phase n) (b.angularFrequency n) := by |
| 1579 | funext y |
| 1580 | exact field_real (residualBlock_conjugate c s b gaussian aliasError n i) _ _ _ _ |
| 1581 | rw [he] |
| 1582 | exact extract_field _ _ _ hkp _ _ |
| 1583 | |
| 1584 | theorem residualBlock_mean_zero (c : CorrectionState.Context D) (s : CorrectionState.State D) |
| 1585 | (b : CorrectionState.HarmonicBlock D) (gaussian aliasError : BlockCoefficients D) |
| 1586 | (n : ℕ) (hkp : b.angularFrequency n ≠ 0) (i : Fin 3) (x : D) : |
| 1587 | CorrectionState.angularAverage |
| 1588 | (fun m y => (residualBlock c s b gaussian aliasError).oscillation m y i) n x = 0 := by |
| 1589 | change realAngularMean (fun θ => (field |
| 1590 | ((residualBlock c s b gaussian aliasError).velocity n i) |
| 1591 | (b.frequency n) (b.phase n) (b.angularFrequency n) (x, θ)).re) = 0 |
| 1592 | rw [realAngularMean_field _ _ _ hkp x, residualBlock_zero_mode] |
| 1593 | rfl |
| 1594 | |
| 1595 | /-- Reconstruction of the full differentiated residual, with every excluded error restored once. -/ |
| 1596 | theorem stateFullResidual_reconstructed {ι : Type*} {U : Set D} (hU : IsOpen U) |
| 1597 | {c : CorrectionState.Context D} {s : CorrectionState.State D} {labels : ℕ → Finset ι} |
| 1598 | {blocks : ι → CorrectionState.HarmonicBlock D} {gaussian aliasError : ι → BlockCoefficients D} |
| 1599 | (hrep : BlockRepresentation labels blocks gaussian aliasError s) {n : ℕ} |
| 1600 | (h : ExtractionRegular U c s labels blocks gaussian aliasError n) |
| 1601 | {x : D × ℝ} (hx : x ∈ liftDomain U) (i : Fin 3) : |
| 1602 | stateFullResidual c s n x i = |
| 1603 | (∑ l ∈ labels n, (residualBlock c s (blocks l) (gaussian l) (aliasError l)).oscillation n x i) + |
| 1604 | stateMeanCoefficientValue labels blocks gaussian aliasError c s n x.1 i + s.errors.total n x i := by |
| 1605 | rw [← stateGoodWaveResidual_grouped hU hrep h hx i, |
| 1606 | stateMeanCoefficientValue_eq_average hU hrep h hx.1 i] |
| 1607 | simp only [stateGoodWaveResidual, stateGoodResidual, Pi.sub_apply] |
| 1608 | ring |
| 1609 | |
| 1610 | /-- The actual graph formula gives smooth directions whenever its primitive radius |
| 1611 | and radial profile are smooth on the annular domain. -/ |
| 1612 | theorem contextFrame_regular {U : Set D} (c : CorrectionState.Context D) (n : ℕ) |
| 1613 | (hR : ContDiffOn ℝ ∞ c.operators.radius U) |
| 1614 | (hRn : ∀ x ∈ U, c.operators.radius x ≠ 0) |
| 1615 | (hprofile : ContDiffOn ℝ ∞ c.operators.radialProfile U) : |
| 1616 | (contextFrame c n).Regular U := by |
| 1617 | refine ⟨hR, hRn, ?_, contDiffOn_const, contDiffOn_const⟩ |
| 1618 | exact contDiffOn_const.add ((contDiffOn_const.mul hprofile).smul contDiffOn_const) |
| 1619 | |
| 1620 | end NavierStokes.HarmonicResidual |