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.PhysicalParticularWave |
| 2 | import NavierStokes.HarmonicSourceSupport |
| 3 | |
| 4 | /-! |
| 5 | # Naturality of the actual lifted residual coefficients |
| 6 | |
| 7 | The hypotheses in this file concern the full free auxiliary-variable lift. |
| 8 | Equality only on the physical graph is deliberately insufficient. The source |
| 9 | is always the literal `HarmonicResidual.residualBlock`, including its real |
| 10 | projection and its Gaussian and alias subtractions. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | |
| 15 | namespace NavierStokes.PhysicalResidualNaturality |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Topology ComplexConjugate |
| 19 | open HarmonicCalculus HarmonicFields |
| 20 | |
| 21 | |
| 22 | variable {D E F : Type} [NormedAddCommGroup D] [NormedSpace ℝ D] |
| 23 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 24 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 25 | |
| 26 | /-- Scalar multiplication by a nonzero real number, with its actual inverse. -/ |
| 27 | noncomputable def scalarEquiv (F : Type) [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 28 | (a : ℝ) (ha : a ≠ 0) : F ≃L[ℝ] F := |
| 29 | { LinearEquiv.smulOfNeZero ℝ F a ha with |
| 30 | continuous_toFun := continuous_const.smul continuous_id |
| 31 | continuous_invFun := continuous_const.smul continuous_id } |
| 32 | |
| 33 | @[simp] theorem scalarEquiv_apply (a : ℝ) (ha : a ≠ 0) (x : F) : |
| 34 | scalarEquiv F a ha x = a • x := rfl |
| 35 | |
| 36 | /-- This version also handles non-differentiable functions and the zero scalar. -/ |
| 37 | theorem fderiv_scalar (a : ℝ) (f : D → F) (x : D) : |
| 38 | fderiv ℝ (fun y => a • f y) x = a • fderiv ℝ f x := by |
| 39 | by_cases ha : a = 0 |
| 40 | · subst a |
| 41 | simp |
| 42 | · have he := (scalarEquiv F a ha).comp_fderiv (f := f) (x := x) |
| 43 | exact he |
| 44 | |
| 45 | theorem along_pull (e : D ≃L[ℝ] E) (a b : ℝ) (V : D → D) (W : E → E) |
| 46 | (f : E → F) (x : D) (hV : e (V x) = b • W (e x)) : |
| 47 | along V (fun y => a • f (e y)) x = (a * b) • along W f (e x) := by |
| 48 | unfold along |
| 49 | rw [fderiv_scalar] |
| 50 | change a • ((fderiv ℝ (f ∘ e) x) (V x)) = _ |
| 51 | rw [e.comp_right_fderiv, ContinuousLinearMap.comp_apply] |
| 52 | change a • (fderiv ℝ f (e x)) (e (V x)) = _ |
| 53 | rw [hV, map_smul, smul_smul] |
| 54 | |
| 55 | /-- Equality of every coefficient on a full lifted open set, with one weight. -/ |
| 56 | def CoefficientsOn (U : Set D) (e : D ≃L[ℝ] E) (a : ℝ) |
| 57 | (c : Coefficients D) (d : Coefficients E) : Prop := |
| 58 | ∀ j x, x ∈ U → c j x = a • d j (e x) |
| 59 | |
| 60 | namespace CoefficientsOn |
| 61 | |
| 62 | theorem reweight {U : Set D} {e : D ≃L[ℝ] E} {a b : ℝ} |
| 63 | {c : Coefficients D} {d : Coefficients E} (hc : CoefficientsOn U e a c d) |
| 64 | (hab : a = b) : CoefficientsOn U e b c d := hab ▸ hc |
| 65 | |
| 66 | theorem zero (U : Set D) (e : D ≃L[ℝ] E) (a : ℝ) : |
| 67 | CoefficientsOn U e a 0 0 := by |
| 68 | intro j x hx |
| 69 | simp |
| 70 | |
| 71 | theorem add {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 72 | {c₁ c₂ : Coefficients D} {d₁ d₂ : Coefficients E} |
| 73 | (h₁ : CoefficientsOn U e a c₁ d₁) (h₂ : CoefficientsOn U e a c₂ d₂) : |
| 74 | CoefficientsOn U e a (c₁ + c₂) (d₁ + d₂) := by |
| 75 | intro j x hx |
| 76 | change c₁ j x + c₂ j x = a • (d₁ j (e x) + d₂ j (e x)) |
| 77 | rw [h₁ j x hx, h₂ j x hx, smul_add] |
| 78 | |
| 79 | theorem sub {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 80 | {c₁ c₂ : Coefficients D} {d₁ d₂ : Coefficients E} |
| 81 | (h₁ : CoefficientsOn U e a c₁ d₁) (h₂ : CoefficientsOn U e a c₂ d₂) : |
| 82 | CoefficientsOn U e a (c₁ - c₂) (d₁ - d₂) := by |
| 83 | intro j x hx |
| 84 | change c₁ j x - c₂ j x = a • (d₁ j (e x) - d₂ j (e x)) |
| 85 | rw [h₁ j x hx, h₂ j x hx, smul_sub] |
| 86 | |
| 87 | theorem neg {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 88 | {c : Coefficients D} {d : Coefficients E} (hc : CoefficientsOn U e a c d) : |
| 89 | CoefficientsOn U e a (-c) (-d) := by |
| 90 | intro j x hx |
| 91 | change -c j x = a • (-d j (e x)) |
| 92 | rw [hc j x hx, smul_neg] |
| 93 | |
| 94 | theorem constant {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 95 | {f : D → ℂ} {g : E → ℂ} (h : ∀ x ∈ U, f x = a • g (e x)) : |
| 96 | CoefficientsOn U e a (constantCoefficient f) (constantCoefficient g) := by |
| 97 | intro j x hx |
| 98 | by_cases hj : j = 0 |
| 99 | · subst j |
| 100 | simpa only [constantCoefficient, AddMonoidAlgebra.coeff_single, Finsupp.single_eq_same] using h x hx |
| 101 | · simp [constantCoefficient, hj] |
| 102 | |
| 103 | theorem convolution_sum {A : Type} (c d : Coefficients A) (S : Finset ℤ) |
| 104 | (hS : c.support ⊆ S) (j : ℤ) (x : A) : |
| 105 | (c * d) j x = ∑ k ∈ S, c k x * d (j-k) x := by |
| 106 | rw [convolution_apply] |
| 107 | exact Finset.sum_subset hS (by |
| 108 | intro k hk hkc |
| 109 | simp [Finsupp.notMem_support_iff.mp hkc]) |
| 110 | |
| 111 | theorem mul {U : Set D} {e : D ≃L[ℝ] E} {a b : ℝ} |
| 112 | {c₁ c₂ : Coefficients D} {d₁ d₂ : Coefficients E} |
| 113 | (h₁ : CoefficientsOn U e a c₁ d₁) (h₂ : CoefficientsOn U e b c₂ d₂) : |
| 114 | CoefficientsOn U e (a*b) (c₁*c₂) (d₁*d₂) := by |
| 115 | intro j x hx |
| 116 | let S := c₁.support ∪ d₁.support |
| 117 | rw [convolution_sum c₁ c₂ S Finset.subset_union_left, |
| 118 | convolution_sum d₁ d₂ S Finset.subset_union_right, Finset.smul_sum] |
| 119 | apply Finset.sum_congr rfl |
| 120 | intro k hk |
| 121 | rw [h₁ k x hx, h₂ (j-k) x hx] |
| 122 | simp only [Complex.real_smul, Complex.ofReal_mul] |
| 123 | ring |
| 124 | |
| 125 | theorem scale {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 126 | {c : Coefficients D} {d : Coefficients E} (hc : CoefficientsOn U e a c d) |
| 127 | (b : ℝ) : CoefficientsOn U e (b*a) (b • c) d := by |
| 128 | intro j x hx |
| 129 | change b • c j x = (b*a) • d j (e x) |
| 130 | rw [hc j x hx, smul_smul] |
| 131 | |
| 132 | theorem angular {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 133 | {c : Coefficients D} {d : Coefficients E} (hc : CoefficientsOn U e a c d) |
| 134 | (k : ℤ) : CoefficientsOn U e a (angularDifferentiate k c) (angularDifferentiate k d) := by |
| 135 | intro j x hx |
| 136 | change _ * c j x = a • (_ * d j (e x)) |
| 137 | rw [hc j x hx] |
| 138 | simp only [Complex.real_smul] |
| 139 | ring |
| 140 | |
| 141 | theorem realCoefficients {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 142 | {c : Coefficients D} {d : Coefficients E} (hc : CoefficientsOn U e a c d) : |
| 143 | CoefficientsOn U e a (HarmonicResidual.realCoefficients c) (HarmonicResidual.realCoefficients d) := by |
| 144 | intro j x hx |
| 145 | simp only [HarmonicResidual.realCoefficients_apply, hc j x hx, hc (-j) x hx, |
| 146 | Complex.real_smul, map_mul, Complex.conj_ofReal] |
| 147 | ring |
| 148 | |
| 149 | theorem nonconstant {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 150 | {c : Coefficients D} {d : Coefficients E} (hc : CoefficientsOn U e a c d) : |
| 151 | CoefficientsOn U e a (HarmonicResidual.nonconstant c) (HarmonicResidual.nonconstant d) := by |
| 152 | intro j x hx |
| 153 | by_cases hj : j = 0 |
| 154 | · subst j |
| 155 | simp [HarmonicResidual.nonconstant] |
| 156 | · simpa only [HarmonicResidual.nonconstant, AddMonoidAlgebra.coeff_erase, Finsupp.erase_ne hj] using hc j x hx |
| 157 | |
| 158 | /-- Carrier compatibility is an equality before restriction to the graph. -/ |
| 159 | theorem differentiate {U : Set D} (hU : IsOpen U) {e : D ≃L[ℝ] E} |
| 160 | {a b k kr : ℝ} {c : Coefficients D} {d : Coefficients E} |
| 161 | {V : D → D} {W : E → E} {Phi : D → ℝ} {Psi : E → ℝ} |
| 162 | (hc : CoefficientsOn U e a c d) |
| 163 | (hV : ∀ x ∈ U, e (V x) = b • W (e x)) |
| 164 | (hphase : EqOn (fun x => k * Phi x) (fun x => kr * Psi (e x)) U) : |
| 165 | CoefficientsOn U e (a*b) (differentiate V k Phi c) (differentiate W kr Psi d) := by |
| 166 | intro j x hx |
| 167 | have hv := hV x hx |
| 168 | have he : c j =ᶠ[𝓝 x] (fun y => a • d j (e y)) := by |
| 169 | filter_upwards [hU.mem_nhds hx] with y hy |
| 170 | exact hc j y hy |
| 171 | have hp : (fun y => k * Phi y) =ᶠ[𝓝 x] (fun y => kr * Psi (e y)) := by |
| 172 | filter_upwards [hU.mem_nhds hx] with y hy |
| 173 | exact hphase hy |
| 174 | have hd : along V (c j) x = (a*b) • along W (d j) (e x) := by |
| 175 | unfold along |
| 176 | rw [he.fderiv_eq] |
| 177 | exact along_pull e a b V W (d j) x hv |
| 178 | have hdp : k * along V Phi x = (kr*b) * along W Psi (e x) := by |
| 179 | have heq := congrArg (fun L : D →L[ℝ] ℝ => L (V x)) hp.fderiv_eq |
| 180 | change along V (fun y => k • Phi y) x = along V (fun y => kr • Psi (e y)) x at heq |
| 181 | rw [along_pull e kr b V W Psi x hv] at heq |
| 182 | change (fderiv ℝ (fun y => k • Phi y) x) (V x) = _ at heq |
| 183 | rw [fderiv_scalar] at heq |
| 184 | exact heq |
| 185 | simp only [differentiate_apply, derivativeCoefficient, hd, hc j x hx, |
| 186 | Complex.real_smul, phaseFactor, Complex.ofReal_mul] |
| 187 | have hz := congrArg Complex.ofReal hdp |
| 188 | simp only [Complex.ofReal_mul] at hz |
| 189 | calc |
| 190 | _ = (a : ℂ) * (b : ℂ) * along W (d j) (e x) + |
| 191 | (a : ℂ) * ((j : ℝ) : ℂ) * Complex.I * |
| 192 | ((k : ℂ) * ((along V Phi x : ℝ) : ℂ)) * d j (e x) := by ring |
| 193 | _ = _ := by rw [hz]; ring |
| 194 | |
| 195 | end CoefficientsOn |
| 196 | |
| 197 | /-! ## The actual cylindrical operator, including its frame terms -/ |
| 198 | |
| 199 | /-- Primitive chart identities. The time and viscosity identities include |
| 200 | the slow-time sign and the physical viscosity normalization. -/ |
| 201 | structure FrameOn (U : Set D) (e : D ≃L[ℝ] E) (c l : ℝ) |
| 202 | (g : HarmonicResidual.Frame D) (r : HarmonicResidual.Frame E) : Prop where |
| 203 | radial : ∀ x ∈ U, e (g.radial x) = l • r.radial (e x) |
| 204 | axial : ∀ x ∈ U, e (g.axial x) = l • r.axial (e x) |
| 205 | time : ∀ x ∈ U, e (g.time x) = (c*l) • r.time (e x) |
| 206 | radius : ∀ x ∈ U, r.radius (e x) = l * g.radius x |
| 207 | viscosity : g.viscosity * l = c * r.viscosity |
| 208 | |
| 209 | namespace FrameOn |
| 210 | |
| 211 | variable {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 212 | {g : HarmonicResidual.Frame D} {r : HarmonicResidual.Frame E} |
| 213 | |
| 214 | theorem inverseRadius (H : FrameOn U e c l g r) (hl : l ≠ 0) : |
| 215 | CoefficientsOn U e l |
| 216 | (constantCoefficient (fun x => ((g.radius x)⁻¹ : ℝ) : D → ℂ)) |
| 217 | (constantCoefficient (fun x => ((r.radius x)⁻¹ : ℝ) : E → ℂ)) := by |
| 218 | apply CoefficientsOn.constant |
| 219 | intro x hx |
| 220 | have hrad : (g.radius x)⁻¹ = l * (r.radius (e x))⁻¹ := by |
| 221 | rw [H.radius x hx, mul_inv_rev] |
| 222 | calc |
| 223 | _ = (l * l⁻¹) * (g.radius x)⁻¹ := by rw [mul_inv_cancel₀ hl, one_mul] |
| 224 | _ = _ := by ring |
| 225 | simpa only [Complex.real_smul, ← Complex.ofReal_mul] using congrArg Complex.ofReal hrad |
| 226 | |
| 227 | theorem inverseRadiusSq (H : FrameOn U e c l g r) (hl : l ≠ 0) : |
| 228 | CoefficientsOn U e (l*l) |
| 229 | (constantCoefficient (fun x => (((g.radius x)^2)⁻¹ : ℝ) : D → ℂ)) |
| 230 | (constantCoefficient (fun x => (((r.radius x)^2)⁻¹ : ℝ) : E → ℂ)) := by |
| 231 | apply CoefficientsOn.constant |
| 232 | intro x hx |
| 233 | have hrad : ((g.radius x)^2)⁻¹ = (l*l) * ((r.radius (e x))^2)⁻¹ := by |
| 234 | rw [H.radius x hx, mul_pow, mul_inv_rev] |
| 235 | calc |
| 236 | _ = (l^2 * (l^2)⁻¹) * (g.radius x ^ 2)⁻¹ := by |
| 237 | rw [mul_inv_cancel₀ (pow_ne_zero 2 hl), one_mul] |
| 238 | _ = _ := by ring |
| 239 | simpa only [Complex.real_smul, ← Complex.ofReal_mul] using congrArg Complex.ofReal hrad |
| 240 | |
| 241 | theorem scalarLaplacian (H : FrameOn U e c l g r) (hU : IsOpen U) (hl : l ≠ 0) |
| 242 | {a k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} (kp : ℤ) |
| 243 | {f : Coefficients D} {q : Coefficients E} (hf : CoefficientsOn U e a f q) |
| 244 | (hp : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) : |
| 245 | CoefficientsOn U e (a*(l*l)) |
| 246 | (HarmonicResidual.scalarLaplacian g k Phi kp f) |
| 247 | (HarmonicResidual.scalarLaplacian r kr Psi kp q) := by |
| 248 | have hrr := (hf.differentiate hU H.radial hp).differentiate hU H.radial hp |
| 249 | have hr := (H.inverseRadius hl).mul (hf.differentiate hU H.radial hp) |
| 250 | have ht := (H.inverseRadiusSq hl).mul ((hf.angular kp).angular kp) |
| 251 | have hzz := (hf.differentiate hU H.axial hp).differentiate hU H.axial hp |
| 252 | have hrr' := hrr.reweight (b := a*(l*l)) (by ring) |
| 253 | have hr' := hr.reweight (b := a*(l*l)) (by ring) |
| 254 | have ht' := ht.reweight (b := a*(l*l)) (by ring) |
| 255 | have hzz' := hzz.reweight (b := a*(l*l)) (by ring) |
| 256 | exact ((hrr'.add hr').add ht').add hzz' |
| 257 | |
| 258 | theorem rotate {a : ℝ} {f : HarmonicResidual.VectorCoefficients D} |
| 259 | {q : HarmonicResidual.VectorCoefficients E} |
| 260 | (hf : ∀ i, CoefficientsOn U e a (f i) (q i)) : |
| 261 | ∀ i, CoefficientsOn U e a (HarmonicResidual.rotate f i) (HarmonicResidual.rotate q i) := by |
| 262 | intro i |
| 263 | fin_cases i |
| 264 | · exact (hf 1).neg |
| 265 | · exact hf 0 |
| 266 | · exact CoefficientsOn.zero U e a |
| 267 | |
| 268 | theorem vectorLaplacian (H : FrameOn U e c l g r) (hU : IsOpen U) (hl : l ≠ 0) |
| 269 | {a k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} (kp : ℤ) |
| 270 | {f : HarmonicResidual.VectorCoefficients D} {q : HarmonicResidual.VectorCoefficients E} |
| 271 | (hf : ∀ i, CoefficientsOn U e a (f i) (q i)) |
| 272 | (hp : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) : |
| 273 | ∀ i, CoefficientsOn U e (a*(l*l)) |
| 274 | (HarmonicResidual.vectorLaplacian g k Phi kp f i) |
| 275 | (HarmonicResidual.vectorLaplacian r kr Psi kp q i) := by |
| 276 | intro i |
| 277 | have htwo : CoefficientsOn U e 1 |
| 278 | (constantCoefficient (fun _ : D => (2 : ℂ))) |
| 279 | (constantCoefficient (fun _ : E => (2 : ℂ))) := |
| 280 | CoefficientsOn.constant (by intro x hx; simp) |
| 281 | have ht := htwo.mul (rotate (fun i => (hf i).angular kp) i) |
| 282 | have ht' := ht.reweight (b := a) (one_mul a) |
| 283 | have hframe := (H.inverseRadiusSq hl).mul (ht'.add (rotate (rotate hf) i)) |
| 284 | have hframe' := hframe.reweight (b := a*(l*l)) (by ring) |
| 285 | exact (H.scalarLaplacian hU hl kp (hf i) hp).add hframe' |
| 286 | |
| 287 | theorem transport (H : FrameOn U e c l g r) (hU : IsOpen U) (hl : l ≠ 0) |
| 288 | {a b k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} (kp : ℤ) |
| 289 | {f v : HarmonicResidual.VectorCoefficients D} {q w : HarmonicResidual.VectorCoefficients E} |
| 290 | (hf : ∀ i, CoefficientsOn U e a (f i) (q i)) |
| 291 | (hv : ∀ i, CoefficientsOn U e b (v i) (w i)) |
| 292 | (hp : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) : |
| 293 | ∀ i, CoefficientsOn U e (a*b*l) |
| 294 | (HarmonicResidual.transport g k Phi kp f v i) |
| 295 | (HarmonicResidual.transport r kr Psi kp q w i) := by |
| 296 | intro i |
| 297 | have hr := (hf 0).mul ((hv i).differentiate hU H.radial hp) |
| 298 | have ht := ((hf 1).mul (H.inverseRadius hl)).mul ((hv i).angular kp |>.add (rotate hv i)) |
| 299 | have hz := (hf 2).mul ((hv i).differentiate hU H.axial hp) |
| 300 | have hr' := hr.reweight (b := a*b*l) (by ring) |
| 301 | have ht' := ht.reweight (b := a*b*l) (by ring) |
| 302 | have hz' := hz.reweight (b := a*b*l) (by ring) |
| 303 | simpa only [HarmonicResidual.transport, Complex.ofReal_inv] using (hr'.add ht').add hz' |
| 304 | |
| 305 | theorem gradient (H : FrameOn U e c l g r) (hU : IsOpen U) (hl : l ≠ 0) |
| 306 | {a k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} (kp : ℤ) |
| 307 | {f : Coefficients D} {q : Coefficients E} (hf : CoefficientsOn U e a f q) |
| 308 | (hp : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) : |
| 309 | ∀ i, CoefficientsOn U e (a*l) |
| 310 | (HarmonicResidual.gradient g k Phi kp f i) |
| 311 | (HarmonicResidual.gradient r kr Psi kp q i) := by |
| 312 | intro i |
| 313 | fin_cases i |
| 314 | · exact hf.differentiate hU H.radial hp |
| 315 | · have ht := (H.inverseRadius hl).mul (hf.angular kp) |
| 316 | exact ht.reweight (mul_comm l a) |
| 317 | · exact hf.differentiate hU H.axial hp |
| 318 | |
| 319 | theorem linearResidual (H : FrameOn U e c l g r) (hU : IsOpen U) (hl : l ≠ 0) |
| 320 | {k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} (kp : ℤ) |
| 321 | {B f : HarmonicResidual.VectorCoefficients D} {Br q : HarmonicResidual.VectorCoefficients E} |
| 322 | {p : Coefficients D} {pr : Coefficients E} |
| 323 | (hB : ∀ i, CoefficientsOn U e c (B i) (Br i)) |
| 324 | (hf : ∀ i, CoefficientsOn U e c (f i) (q i)) |
| 325 | (hp : CoefficientsOn U e (c*c) p pr) |
| 326 | (hphase : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) : |
| 327 | ∀ i, CoefficientsOn U e (c*c*l) |
| 328 | (HarmonicResidual.linearResidual g k Phi kp B f p i) |
| 329 | (HarmonicResidual.linearResidual r kr Psi kp Br q pr i) := by |
| 330 | intro i |
| 331 | have htime := (hf i).differentiate hU H.time hphase |
| 332 | have htime' := htime.reweight (b := c*c*l) (by ring) |
| 333 | have hfirst := ((htime'.add (H.transport hU hl kp hB hf hphase i)).add |
| 334 | (H.transport hU hl kp hf hB hphase i)).add (H.gradient hU hl kp hp hphase i) |
| 335 | have hv : CoefficientsOn U e (c*c*l) |
| 336 | (constantCoefficient (fun _ => (g.viscosity : ℂ)) * |
| 337 | HarmonicResidual.vectorLaplacian g k Phi kp f i) |
| 338 | (constantCoefficient (fun _ => (r.viscosity : ℂ)) * |
| 339 | HarmonicResidual.vectorLaplacian r kr Psi kp q i) := by |
| 340 | intro j x hx |
| 341 | have he := H.vectorLaplacian hU hl kp hf hphase i j x hx |
| 342 | simp only [constantCoefficient, AddMonoidAlgebra.coeff_single_zero_mul, Pi.mul_apply, |
| 343 | he, Complex.real_smul, Complex.ofReal_mul] |
| 344 | have hvis := congrArg Complex.ofReal H.viscosity |
| 345 | simp only [Complex.ofReal_mul] at hvis |
| 346 | calc |
| 347 | _ = (c : ℂ) * (l : ℂ) * ((g.viscosity : ℂ) * (l : ℂ)) * |
| 348 | HarmonicResidual.vectorLaplacian r kr Psi kp q i j (e x) := by ring |
| 349 | _ = _ := by rw [hvis]; ring |
| 350 | exact hfirst.sub hv |
| 351 | |
| 352 | theorem nonlinearResidual (H : FrameOn U e c l g r) (hU : IsOpen U) (hl : l ≠ 0) |
| 353 | {k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} (kp : ℤ) |
| 354 | {B f : HarmonicResidual.VectorCoefficients D} {Br q : HarmonicResidual.VectorCoefficients E} |
| 355 | {p : Coefficients D} {pr : Coefficients E} |
| 356 | (hB : ∀ i, CoefficientsOn U e c (B i) (Br i)) |
| 357 | (hf : ∀ i, CoefficientsOn U e c (f i) (q i)) |
| 358 | (hp : CoefficientsOn U e (c*c) p pr) |
| 359 | (hphase : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) : |
| 360 | ∀ i, CoefficientsOn U e (c*c*l) |
| 361 | (HarmonicResidual.nonlinearResidual g k Phi kp B f p i) |
| 362 | (HarmonicResidual.nonlinearResidual r kr Psi kp Br q pr i) := by |
| 363 | intro i |
| 364 | exact (H.linearResidual hU hl kp hB hf hp hphase i).add |
| 365 | (H.transport hU hl kp hf hf hphase i) |
| 366 | |
| 367 | end FrameOn |
| 368 | |
| 369 | /-! ## Recovering the source from actual field compatibility -/ |
| 370 | |
| 371 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] [NormedAddCommGroup E] [NormedSpace ℝ E] in |
| 372 | /-- Uniqueness at one full angular fiber. Frequencies may differ, but the |
| 373 | integer angular carrier and the complete slow carrier agree. -/ |
| 374 | theorem coefficient_of_field {a k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} |
| 375 | {kp : ℤ} (hkp : kp ≠ 0) (f : Coefficients D) (q : Coefficients E) |
| 376 | (x : D) (y : E) (hphase : k*Phi x = kr*Psi y) |
| 377 | (hfield : ∀ theta, field f k Phi kp (x,theta) = |
| 378 | a • field q kr Psi kp (y,theta)) (j : ℤ) : f j x = a • q j y := by |
| 379 | rw [← HarmonicResidual.extract_field f k Phi hkp j x, |
| 380 | ← HarmonicResidual.extract_field q kr Psi hkp j y] |
| 381 | unfold HarmonicResidual.extract |
| 382 | have htest (theta : ℝ) : |
| 383 | field (AddMonoidAlgebra.single (-j) (fun _ : D => (1 : ℂ))) k Phi kp (x,theta) = |
| 384 | field (AddMonoidAlgebra.single (-j) (fun _ : E => (1 : ℂ))) kr Psi kp (y,theta) := by |
| 385 | simp only [field, evaluate_single, hphase] |
| 386 | simp_rw [hfield, htest, Complex.real_smul] |
| 387 | simp only [angularMean] |
| 388 | simp_rw [mul_assoc] |
| 389 | rw [intervalIntegral.integral_const_mul] |
| 390 | ring |
| 391 | |
| 392 | theorem CoefficientsOn.of_fields {U : Set D} {e : D ≃L[ℝ] E} |
| 393 | {a k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} {kp : ℤ} (hkp : kp ≠ 0) |
| 394 | {f : Coefficients D} {q : Coefficients E} |
| 395 | (hp : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) |
| 396 | (hf : ∀ x ∈ U, ∀ theta, field f k Phi kp (x,theta) = |
| 397 | a • field q kr Psi kp (e x,theta)) : CoefficientsOn U e a f q := by |
| 398 | intro j x hx |
| 399 | exact coefficient_of_field hkp f q x (e x) (hp hx) (hf x hx) j |
| 400 | |
| 401 | theorem CoefficientsOn.of_real_fields {U : Set D} {e : D ≃L[ℝ] E} |
| 402 | {a k kr : ℝ} {Phi : D → ℝ} {Psi : E → ℝ} {kp : ℤ} (hkp : kp ≠ 0) |
| 403 | {f : Coefficients D} {q : Coefficients E} |
| 404 | (hp : EqOn (fun x => k*Phi x) (fun x => kr*Psi (e x)) U) |
| 405 | (hf : ∀ x ∈ U, ∀ theta, (field f k Phi kp (x,theta)).re = |
| 406 | a * (field q kr Psi kp (e x,theta)).re) : |
| 407 | CoefficientsOn U e a (HarmonicResidual.realCoefficients f) |
| 408 | (HarmonicResidual.realCoefficients q) := by |
| 409 | apply CoefficientsOn.of_fields hkp hp |
| 410 | intro x hx theta |
| 411 | simp only [HarmonicResidual.field_realCoefficients, hf x hx theta, |
| 412 | Complex.real_smul, Complex.ofReal_mul] |
| 413 | |
| 414 | omit [NormedAddCommGroup D] [NormedSpace ℝ D] in |
| 415 | theorem realCoefficients_sub (a b : Coefficients D) : |
| 416 | HarmonicResidual.realCoefficients (a-b) = |
| 417 | HarmonicResidual.realCoefficients a - HarmonicResidual.realCoefficients b := by |
| 418 | ext j x |
| 419 | change HarmonicResidual.realCoefficients (a-b) j x = |
| 420 | HarmonicResidual.realCoefficients a j x - HarmonicResidual.realCoefficients b j x |
| 421 | simp only [HarmonicResidual.realCoefficients_apply] |
| 422 | change (2 : ℂ)⁻¹ * (a j x - b j x + conj (a (-j) x - b (-j) x)) = _ |
| 423 | rw [map_sub] |
| 424 | ring |
| 425 | |
| 426 | /-- Compatibility of a label's primitive fields. Gaussian and alias inputs |
| 427 | are compared as real fields, exactly as in the physical residual. -/ |
| 428 | structure LabelOn (U : Set D) (e : D ≃L[ℝ] E) (c l : ℝ) |
| 429 | (d : HarmonicResidual.LabelData D) (r : HarmonicResidual.LabelData E) : Prop where |
| 430 | phase : EqOn (fun x => d.frequency*d.phase x) |
| 431 | (fun x => r.frequency*r.phase (e x)) U |
| 432 | angular : d.angularFrequency = r.angularFrequency |
| 433 | velocity : ∀ i, CoefficientsOn U e c (d.velocity i) (r.velocity i) |
| 434 | pressure : CoefficientsOn U e (c*c) d.pressure r.pressure |
| 435 | gaussian : ∀ i, CoefficientsOn U e (c*c*l) |
| 436 | (HarmonicResidual.realCoefficients (d.gaussian i)) |
| 437 | (HarmonicResidual.realCoefficients (r.gaussian i)) |
| 438 | aliasError : ∀ i, CoefficientsOn U e (c*c*l) |
| 439 | (HarmonicResidual.realCoefficients (d.aliasError i)) |
| 440 | (HarmonicResidual.realCoefficients (r.aliasError i)) |
| 441 | |
| 442 | theorem LabelOn.residualCoefficients {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 443 | {d : HarmonicResidual.LabelData D} {r : HarmonicResidual.LabelData E} |
| 444 | (H : LabelOn U e c l d r) (hU : IsOpen U) (hl : l ≠ 0) |
| 445 | {g : HarmonicResidual.Frame D} {gr : HarmonicResidual.Frame E} |
| 446 | (hg : FrameOn U e c l g gr) |
| 447 | {B M : D → ComplexVector} {Br Mr : E → ComplexVector} |
| 448 | (hB : ∀ x ∈ U, B x = c • Br (e x)) |
| 449 | (hM : ∀ x ∈ U, M x = c • Mr (e x)) : |
| 450 | ∀ i, CoefficientsOn U e (c*c*l) |
| 451 | (d.residualCoefficients g B M i) (r.residualCoefficients gr Br Mr i) := by |
| 452 | have hbase : ∀ i, CoefficientsOn U e c |
| 453 | (HarmonicResidual.constantVector (B+M) i) |
| 454 | (HarmonicResidual.constantVector (Br+Mr) i) := by |
| 455 | intro i |
| 456 | apply CoefficientsOn.constant |
| 457 | intro x hx |
| 458 | have he := congrArg (fun z : ComplexVector => z i) (congrArg₂ (·+·) (hB x hx) (hM x hx)) |
| 459 | simpa only [Pi.add_apply, Pi.smul_apply, smul_add] using he |
| 460 | have hn := hg.nonlinearResidual hU hl d.angularFrequency hbase H.velocity H.pressure H.phase |
| 461 | rw [H.angular] at hn |
| 462 | intro i |
| 463 | simp only [HarmonicResidual.LabelData.residualCoefficients, realCoefficients_sub] |
| 464 | rw [H.angular] |
| 465 | exact ((hn i).realCoefficients.sub (H.gaussian i)).sub (H.aliasError i) |
| 466 | |
| 467 | theorem LabelOn.waveResidualCoefficients {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 468 | {d : HarmonicResidual.LabelData D} {r : HarmonicResidual.LabelData E} |
| 469 | (H : LabelOn U e c l d r) (hU : IsOpen U) (hl : l ≠ 0) |
| 470 | {g : HarmonicResidual.Frame D} {gr : HarmonicResidual.Frame E} |
| 471 | (hg : FrameOn U e c l g gr) |
| 472 | {B M : D → ComplexVector} {Br Mr : E → ComplexVector} |
| 473 | (hB : ∀ x ∈ U, B x = c • Br (e x)) |
| 474 | (hM : ∀ x ∈ U, M x = c • Mr (e x)) : |
| 475 | ∀ i, CoefficientsOn U e (c*c*l) |
| 476 | (d.waveResidualCoefficients g B M i) (r.waveResidualCoefficients gr Br Mr i) := |
| 477 | fun i => (H.residualCoefficients hU hl hg hB hM i).nonconstant |
| 478 | |
| 479 | /-- Only actual full-lift fields and their carrier are compared here. In |
| 480 | particular, this does not assume compatibility of an already computed source. -/ |
| 481 | structure BlockFieldsOn (U : Set D) (e : D ≃L[ℝ] E) (c l : ℝ) |
| 482 | (b : CorrectionState.HarmonicBlock D) (br : CorrectionState.HarmonicBlock E) |
| 483 | (G A : HarmonicResidual.BlockCoefficients D) (Gr Ar : HarmonicResidual.BlockCoefficients E) |
| 484 | (n nr : ℕ) : Prop where |
| 485 | phase : EqOn (fun x => b.frequency n*b.phase n x) |
| 486 | (fun x => br.frequency nr*br.phase nr (e x)) U |
| 487 | angular : b.angularFrequency n = br.angularFrequency nr |
| 488 | angular_ne : b.angularFrequency n ≠ 0 |
| 489 | velocity : ∀ x ∈ U, ∀ theta i, b.oscillation n (x,theta) i = |
| 490 | c * br.oscillation nr (e x,theta) i |
| 491 | pressure : ∀ x ∈ U, ∀ theta, b.oscillatoryPressure n (x,theta) = |
| 492 | (c*c) * br.oscillatoryPressure nr (e x,theta) |
| 493 | gaussian : ∀ x ∈ U, ∀ theta i, |
| 494 | (field (G n i) (b.frequency n) (b.phase n) (b.angularFrequency n) (x,theta)).re = |
| 495 | (c*c*l) * (field (Gr nr i) (br.frequency nr) (br.phase nr) |
| 496 | (br.angularFrequency nr) (e x,theta)).re |
| 497 | aliasError : ∀ x ∈ U, ∀ theta i, |
| 498 | (field (A n i) (b.frequency n) (b.phase n) (b.angularFrequency n) (x,theta)).re = |
| 499 | (c*c*l) * (field (Ar nr i) (br.frequency nr) (br.phase nr) |
| 500 | (br.angularFrequency nr) (e x,theta)).re |
| 501 | |
| 502 | theorem BlockFieldsOn.labelOn {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 503 | {b : CorrectionState.HarmonicBlock D} {br : CorrectionState.HarmonicBlock E} |
| 504 | {G A : HarmonicResidual.BlockCoefficients D} {Gr Ar : HarmonicResidual.BlockCoefficients E} |
| 505 | {n nr : ℕ} (H : BlockFieldsOn U e c l b br G A Gr Ar n nr) : |
| 506 | LabelOn U e c l (HarmonicResidual.ofBlock b G A n) (HarmonicResidual.ofBlock br Gr Ar nr) := by |
| 507 | have hkp : br.angularFrequency nr ≠ 0 := H.angular ▸ H.angular_ne |
| 508 | refine ⟨H.phase, H.angular, ?_, ?_, ?_, ?_⟩ |
| 509 | · intro i |
| 510 | apply CoefficientsOn.of_real_fields hkp H.phase |
| 511 | intro x hx theta |
| 512 | have he := H.velocity x hx theta i |
| 513 | simpa only [CorrectionState.HarmonicBlock.oscillation, H.angular] using he |
| 514 | · apply CoefficientsOn.of_real_fields hkp H.phase |
| 515 | intro x hx theta |
| 516 | have he := H.pressure x hx theta |
| 517 | simpa only [CorrectionState.HarmonicBlock.oscillatoryPressure, H.angular] using he |
| 518 | · intro i |
| 519 | apply CoefficientsOn.of_real_fields hkp H.phase |
| 520 | intro x hx theta |
| 521 | have he := H.gaussian x hx theta i |
| 522 | simp only [H.angular] at he |
| 523 | exact he |
| 524 | · intro i |
| 525 | apply CoefficientsOn.of_real_fields hkp H.phase |
| 526 | intro x hx theta |
| 527 | have he := H.aliasError x hx theta i |
| 528 | simp only [H.angular] at he |
| 529 | exact he |
| 530 | |
| 531 | /-- Exact naturality of the literal source supplied to the Volterra solve. -/ |
| 532 | theorem residualSource_naturality {U : Set D} (hU : IsOpen U) {e : D ≃L[ℝ] E} |
| 533 | {c l : ℝ} (hl : l ≠ 0) |
| 534 | {C : CorrectionState.Context D} {Cr : CorrectionState.Context E} |
| 535 | {s : CorrectionState.State D} {sr : CorrectionState.State E} |
| 536 | {b : CorrectionState.HarmonicBlock D} {br : CorrectionState.HarmonicBlock E} |
| 537 | {G A : HarmonicResidual.BlockCoefficients D} {Gr Ar : HarmonicResidual.BlockCoefficients E} |
| 538 | {n nr : ℕ} |
| 539 | (hg : FrameOn U e c l (HarmonicResidual.contextFrame C n) (HarmonicResidual.contextFrame Cr nr)) |
| 540 | (hB : ∀ x ∈ U, HarmonicResidual.contextBase C n x = c • HarmonicResidual.contextBase Cr nr (e x)) |
| 541 | (hM : ∀ x ∈ U, HarmonicResidual.stateMean s n x = c • HarmonicResidual.stateMean sr nr (e x)) |
| 542 | (H : BlockFieldsOn U e c l b br G A Gr Ar n nr) |
| 543 | (j : ℤ) {x : D} (hx : x ∈ U) : |
| 544 | ParticularWaveAssembly.residualSource C s b G A j n x = |
| 545 | (c*c*l) • ParticularWaveAssembly.residualSource Cr sr br Gr Ar j nr (e x) := by |
| 546 | ext i |
| 547 | exact H.labelOn.waveResidualCoefficients hU hl hg hB hM i j x hx |
| 548 | |
| 549 | /-! ## The concrete common-cover chart -/ |
| 550 | |
| 551 | open PhysicalParticularWave CommonCoverSolve |
| 552 | |
| 553 | abbrev Lift := PhysicalResidualBridge.Lift |
| 554 | abbrev Associated := PhysicalParticularWave.Parameter × TorusInverse.Plane |
| 555 | |
| 556 | /-- The invertible real-lift map underlying the integer torus cover. -/ |
| 557 | noncomputable def chartEquiv (h : ℝ) {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) |
| 558 | (gap : ℕ) : Lift ≃L[ℝ] Lift := |
| 559 | (scalarEquiv ℝ (ratioPower Q Qr (1/2)) (ratioPower_pos hQ hQr _).ne').prodCongr |
| 560 | (((scalarEquiv ℝ (ratioPower Q Qr (CoordinateAlgebra.D h)) (ratioPower_pos hQ hQr _).ne').prodCongr |
| 561 | (scalarEquiv ℝ (ratioPower Q Qr 1) (ratioPower_pos hQ hQr _).ne')).prodCongr (coverPower gap)) |
| 562 | |
| 563 | @[simp] theorem chartEquiv_apply (h : ℝ) {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) |
| 564 | (gap : ℕ) (x : Lift) : chartEquiv h hQ hQr gap x = chartChange h Q Qr gap x := rfl |
| 565 | |
| 566 | /-- Actual graph directions on the free lift, before adjoining the angle. -/ |
| 567 | noncomputable def commonFrame (h Q : ℝ) (i : ℕ) : HarmonicResidual.Frame Lift where |
| 568 | radius := Prod.fst |
| 569 | radial x := ((PhysicalResidualBridge.commonGraph Q h i).radial (x,0)).1 |
| 570 | axial x := ((PhysicalResidualBridge.commonGraph Q h i).axial (x,0)).1 |
| 571 | time x := ((PhysicalResidualBridge.commonGraph Q h i).temporal (x,0)).1 |
| 572 | viscosity := Q ^ h |
| 573 | |
| 574 | theorem weight_time {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) (h : ℝ) : |
| 575 | velocityWeight h Q Qr * ratioPower Q Qr (1/2) = clockWeight h Q Qr := |
| 576 | ratioPower_mul hQ hQr _ _ |
| 577 | |
| 578 | theorem weight_pressure {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) (h : ℝ) : |
| 579 | velocityWeight h Q Qr * velocityWeight h Q Qr = pressureWeight h Q Qr := by |
| 580 | unfold velocityWeight pressureWeight |
| 581 | rw [ratioPower_mul hQ hQr] |
| 582 | congr 1 |
| 583 | ring |
| 584 | |
| 585 | theorem weight_source {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) (h : ℝ) : |
| 586 | velocityWeight h Q Qr * velocityWeight h Q Qr * ratioPower Q Qr (1/2) = |
| 587 | sourceWeight h Q Qr := by |
| 588 | rw [mul_assoc, weight_time hQ hQr, mul_comm, clock_mul_velocity hQ hQr] |
| 589 | |
| 590 | theorem weight_viscosity {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) (h : ℝ) : |
| 591 | Q ^ h * ratioPower Q Qr (1/2) = velocityWeight h Q Qr * Qr ^ h := by |
| 592 | change Q ^ h * (Q ^ (1/2 : ℝ) / Qr ^ (1/2 : ℝ)) = |
| 593 | (Q ^ CoordinateAlgebra.A h / Qr ^ CoordinateAlgebra.A h) * Qr ^ h |
| 594 | rw [← mul_div_assoc, div_mul_eq_mul_div] |
| 595 | apply (div_eq_div_iff (Real.rpow_pos_of_pos hQr (1/2)).ne' |
| 596 | (Real.rpow_pos_of_pos hQr (CoordinateAlgebra.A h)).ne').2 |
| 597 | rw [← Real.rpow_add hQ] |
| 598 | have ha : h + (1/2 : ℝ) = CoordinateAlgebra.A h := by unfold CoordinateAlgebra.A; ring |
| 599 | rw [ha] |
| 600 | calc |
| 601 | _ = Q ^ CoordinateAlgebra.A h * (Qr ^ h * Qr ^ (1/2 : ℝ)) := by |
| 602 | rw [← Real.rpow_add hQr, ha] |
| 603 | _ = _ := by ring |
| 604 | |
| 605 | theorem commonFrame_chart (h : ℝ) {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) |
| 606 | (i gap : ℕ) : |
| 607 | FrameOn {x : Lift | 0 < x.1} (chartEquiv h hQ hQr gap) |
| 608 | (velocityWeight h Q Qr) (ratioPower Q Qr (1/2)) |
| 609 | (commonFrame h Q i) (commonFrame h Qr (i+gap)) := by |
| 610 | constructor |
| 611 | · intro x hx |
| 612 | exact congrArg Prod.fst (cylinderChange_radial hQ hQr h i gap (x := (x,0)) hx) |
| 613 | · intro x hx |
| 614 | exact congrArg Prod.fst (cylinderChange_axial hQ hQr h i gap (x,0)) |
| 615 | · intro x hx |
| 616 | rw [weight_time hQ hQr] |
| 617 | exact congrArg Prod.fst (cylinderChange_temporal hQ hQr h i gap (x,0)) |
| 618 | · intro x hx |
| 619 | rfl |
| 620 | · exact weight_viscosity hQ hQr h |
| 621 | |
| 622 | /-- Association and the `(T,Z)` order used by the correction state. -/ |
| 623 | noncomputable def associatedToLift : Associated ≃ₗᵢ[ℝ] Lift := |
| 624 | (ParticularWaveBounds.liftAssoc TorusInverse.Plane).symm.trans PhysicalResidualTZ.swapSlow |
| 625 | |
| 626 | @[simp] theorem associatedToLift_apply (x : Associated) : |
| 627 | associatedToLift x = (x.1.1, ((x.1.2.2,x.1.2.1),x.2)) := rfl |
| 628 | |
| 629 | noncomputable def associatedChart (h : ℝ) {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) |
| 630 | (gap : ℕ) : Associated ≃L[ℝ] Associated := |
| 631 | (associatedToLift.toContinuousLinearEquiv.trans (chartEquiv h hQ hQr gap)).trans |
| 632 | associatedToLift.symm.toContinuousLinearEquiv |
| 633 | |
| 634 | @[simp] theorem associatedChart_apply (h : ℝ) {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) |
| 635 | (gap : ℕ) (x : Associated) : |
| 636 | associatedChart h hQ hQr gap x = (parameterChange h Q Qr x.1, coverPower gap x.2) := rfl |
| 637 | |
| 638 | noncomputable def associatedFrame (h Q : ℝ) (i : ℕ) : HarmonicResidual.Frame Associated := |
| 639 | StateReindex.frame associatedToLift (commonFrame h Q i) |
| 640 | |
| 641 | theorem associatedFrame_chart (h : ℝ) {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) |
| 642 | (i gap : ℕ) : |
| 643 | FrameOn {x : Associated | 0 < x.1.1} (associatedChart h hQ hQr gap) |
| 644 | (velocityWeight h Q Qr) (ratioPower Q Qr (1/2)) |
| 645 | (associatedFrame h Q i) (associatedFrame h Qr (i+gap)) := by |
| 646 | have H := commonFrame_chart h hQ hQr i gap |
| 647 | constructor |
| 648 | · intro x hx |
| 649 | apply associatedToLift.injective |
| 650 | simpa only [associatedChart, associatedFrame, StateReindex.frame, StateReindex.vector, |
| 651 | ParticularWaveBounds.reindexVector, ContinuousLinearEquiv.trans_apply, |
| 652 | LinearIsometryEquiv.coe_toContinuousLinearEquiv, LinearIsometryEquiv.apply_symm_apply, |
| 653 | LinearIsometryEquiv.map_smul] using H.radial (associatedToLift x) hx |
| 654 | · intro x hx |
| 655 | apply associatedToLift.injective |
| 656 | simpa only [associatedChart, associatedFrame, StateReindex.frame, StateReindex.vector, |
| 657 | ParticularWaveBounds.reindexVector, ContinuousLinearEquiv.trans_apply, |
| 658 | LinearIsometryEquiv.coe_toContinuousLinearEquiv, LinearIsometryEquiv.apply_symm_apply, |
| 659 | LinearIsometryEquiv.map_smul] using H.axial (associatedToLift x) hx |
| 660 | · intro x hx |
| 661 | apply associatedToLift.injective |
| 662 | simpa only [associatedChart, associatedFrame, StateReindex.frame, StateReindex.vector, |
| 663 | ParticularWaveBounds.reindexVector, ContinuousLinearEquiv.trans_apply, |
| 664 | LinearIsometryEquiv.coe_toContinuousLinearEquiv, LinearIsometryEquiv.apply_symm_apply, |
| 665 | LinearIsometryEquiv.map_smul] using H.time (associatedToLift x) hx |
| 666 | · intro x hx |
| 667 | rfl |
| 668 | · exact H.viscosity |
| 669 | |
| 670 | /-- The positive-radius free lift. Every auxiliary variable remains free. -/ |
| 671 | def positiveLift : Set Associated := {x | 0 < x.1.1} |
| 672 | |
| 673 | theorem positiveLift_open : IsOpen positiveLift := isOpen_lt continuous_const continuous_fst.fst |
| 674 | |
| 675 | /-- Concrete primitive coherence needed by a band solve. These are field, |
| 676 | phase, and explicit operator identities, never an identity of residuals or |
| 677 | of solved waves. -/ |
| 678 | structure BandCoherence (D : ParticularWaveAssembly.AssemblyData PhysicalParticularWave.Parameter) |
| 679 | (h : ℝ) {Q Qr : ℝ} (hQ : 0 < Q) (hQr : 0 < Qr) (i gap n : ℕ) : Prop where |
| 680 | targetFrame : HarmonicResidual.contextFrame D.context n = associatedFrame h Q i |
| 681 | referenceFrame : HarmonicResidual.contextFrame D.context D.reference.band = |
| 682 | associatedFrame h Qr (i+gap) |
| 683 | base : ∀ x ∈ positiveLift, HarmonicResidual.contextBase D.context n x = |
| 684 | velocityWeight h Q Qr • HarmonicResidual.contextBase D.context D.reference.band |
| 685 | (associatedChart h hQ hQr gap x) |
| 686 | mean : ∀ x ∈ positiveLift, HarmonicResidual.stateMean D.state n x = |
| 687 | velocityWeight h Q Qr • HarmonicResidual.stateMean D.state D.reference.band |
| 688 | (associatedChart h hQ hQr gap x) |
| 689 | block : BlockFieldsOn positiveLift (associatedChart h hQ hQr gap) |
| 690 | (velocityWeight h Q Qr) (ratioPower Q Qr (1/2)) |
| 691 | D.carrierBlock D.carrierBlock D.gaussianInput D.aliasInput D.gaussianInput D.aliasInput |
| 692 | n D.reference.band |
| 693 | |
| 694 | theorem BandCoherence.source_on |
| 695 | {D : ParticularWaveAssembly.AssemblyData PhysicalParticularWave.Parameter} |
| 696 | {h Q Qr : ℝ} {hQ : 0 < Q} {hQr : 0 < Qr} {i gap n : ℕ} |
| 697 | (H : BandCoherence D h hQ hQr i gap n) (j : ℤ) {x : Associated} (hx : x ∈ positiveLift) : |
| 698 | ParticularWaveAssembly.residualSource D.context D.state D.carrierBlock |
| 699 | D.gaussianInput D.aliasInput j n x = transportedResidualSource D h Q Qr gap j x := by |
| 700 | have hf : FrameOn positiveLift (associatedChart h hQ hQr gap) |
| 701 | (velocityWeight h Q Qr) (ratioPower Q Qr (1/2)) |
| 702 | (HarmonicResidual.contextFrame D.context n) |
| 703 | (HarmonicResidual.contextFrame D.context D.reference.band) := by |
| 704 | rw [H.targetFrame, H.referenceFrame] |
| 705 | exact associatedFrame_chart h hQ hQr i gap |
| 706 | have he := residualSource_naturality positiveLift_open (ratioPower_pos hQ hQr (1/2)).ne' |
| 707 | hf H.base H.mean H.block j hx |
| 708 | rw [weight_source hQ hQr] at he |
| 709 | rw [transportedResidualSource_apply D h hQ hQr] |
| 710 | exact he |
| 711 | |
| 712 | /-- Primitive support assumptions, allowing arbitrary zero-mode aliases. -/ |
| 713 | structure PositiveSupport (b : CorrectionState.HarmonicBlock Associated) |
| 714 | (G A : HarmonicResidual.BlockCoefficients Associated) (n : ℕ) where |
| 715 | supportSet : Set Associated |
| 716 | closed : IsClosed supportSet |
| 717 | positive : supportSet ⊆ positiveLift |
| 718 | velocity : ∀ i, HarmonicSourceSupport.NonzeroSupported supportSet |
| 719 | (HarmonicResidual.realCoefficients (b.velocity n i)) |
| 720 | pressure : HarmonicSourceSupport.NonzeroSupported supportSet |
| 721 | (HarmonicResidual.realCoefficients (b.pressure n)) |
| 722 | gaussian : ∀ i, HarmonicSourceSupport.NonzeroSupported supportSet |
| 723 | (HarmonicResidual.realCoefficients (G n i)) |
| 724 | aliasError : ∀ i, HarmonicSourceSupport.NonzeroSupported supportSet |
| 725 | (HarmonicResidual.realCoefficients (A n i)) |
| 726 | |
| 727 | theorem PositiveSupport.source_zero |
| 728 | {b : CorrectionState.HarmonicBlock Associated} |
| 729 | {G A : HarmonicResidual.BlockCoefficients Associated} {n : ℕ} |
| 730 | (H : PositiveSupport b G A n) (C : CorrectionState.Context Associated) |
| 731 | (s : CorrectionState.State Associated) (j : ℤ) {x : Associated} (hx : x ∉ positiveLift) : |
| 732 | ParticularWaveAssembly.residualSource C s b G A j n x = 0 := by |
| 733 | have hs := HarmonicSourceSupport.residualSource_support_of_real C s b G A H.closed n |
| 734 | H.velocity H.pressure H.gaussian H.aliasError j |
| 735 | by_contra hn |
| 736 | exact hx (H.positive (hs hn)) |
| 737 | |
| 738 | /-- Full free-variable equality, including the complement of the annular |
| 739 | cells, derived from primitive field coherence and primitive support. -/ |
| 740 | theorem BandCoherence.source_eq |
| 741 | {D : ParticularWaveAssembly.AssemblyData PhysicalParticularWave.Parameter} |
| 742 | {h Q Qr : ℝ} {hQ : 0 < Q} {hQr : 0 < Qr} {i gap n : ℕ} |
| 743 | (H : BandCoherence D h hQ hQr i gap n) |
| 744 | (hn : PositiveSupport D.carrierBlock D.gaussianInput D.aliasInput n) |
| 745 | (hr : PositiveSupport D.carrierBlock D.gaussianInput D.aliasInput D.reference.band) (j : ℤ) : |
| 746 | ParticularWaveAssembly.residualSource D.context D.state D.carrierBlock |
| 747 | D.gaussianInput D.aliasInput j n = transportedResidualSource D h Q Qr gap j := by |
| 748 | funext x |
| 749 | by_cases hx : x ∈ positiveLift |
| 750 | · exact H.source_on j hx |
| 751 | · rw [hn.source_zero D.context D.state j hx, transportedResidualSource_apply D h hQ hQr] |
| 752 | have hyr : (parameterChange h Q Qr x.1, coverPower gap x.2) ∉ positiveLift := by |
| 753 | intro hy |
| 754 | apply hx |
| 755 | exact (mul_pos_iff_of_pos_left (ratioPower_pos hQ hQr (1/2))).mp hy |
| 756 | rw [referenceSource, hr.source_zero D.context D.state j hyr, smul_zero] |
| 757 | |
| 758 | /-- The actual target-source Volterra solve is the coherently transported |
| 759 | one; no equality of outputs is supplied as an assumption. -/ |
| 760 | theorem BandCoherence.residualBandAmplitude_eq |
| 761 | {D : ParticularWaveAssembly.AssemblyData PhysicalParticularWave.Parameter} |
| 762 | {h Q Qr : ℝ} {hQ : 0 < Q} {hQr : 0 < Qr} {i gap n : ℕ} |
| 763 | (H : BandCoherence D h hQ hQr i gap n) |
| 764 | (hn : PositiveSupport D.carrierBlock D.gaussianInput D.aliasInput n) |
| 765 | (hr : PositiveSupport D.carrierBlock D.gaussianInput D.aliasInput D.reference.band) |
| 766 | (K : ℝ) (j : ℤ) : |
| 767 | residualBandAmplitude D h hQ hQr gap K j n = bandAmplitude D h hQ hQr gap K j := |
| 768 | PhysicalParticularWave.residualBandAmplitude_eq D h hQ hQr gap K j n (H.source_eq hn hr j) |
| 769 | |
| 770 | theorem BandCoherence.residualBandPressure_eq |
| 771 | {D : ParticularWaveAssembly.AssemblyData PhysicalParticularWave.Parameter} |
| 772 | {h Q Qr : ℝ} {hQ : 0 < Q} {hQr : 0 < Qr} {i gap n : ℕ} |
| 773 | (H : BandCoherence D h hQ hQr i gap n) |
| 774 | (hn : PositiveSupport D.carrierBlock D.gaussianInput D.aliasInput n) |
| 775 | (hr : PositiveSupport D.carrierBlock D.gaussianInput D.aliasInput D.reference.band) |
| 776 | (K : ℝ) (j : ℤ) : |
| 777 | residualBandPressure D h hQ hQr gap K j n = bandPressure D h hQ hQr gap K j := |
| 778 | PhysicalParticularWave.residualBandPressure_eq D h hQ hQr gap K j n (H.source_eq hn hr j) |
| 779 | |
| 780 | /-! ## A lift-coherence invariant preserved by actual state addition -/ |
| 781 | |
| 782 | def ScalarOn (U : Set D) (e : D ≃L[ℝ] E) (a : ℝ) (f : D → ℝ) (g : E → ℝ) : Prop := |
| 783 | ∀ x ∈ U, f x = a * g (e x) |
| 784 | |
| 785 | namespace ScalarOn |
| 786 | |
| 787 | theorem reweight {U : Set D} {e : D ≃L[ℝ] E} {a b : ℝ} {f : D → ℝ} {g : E → ℝ} |
| 788 | (hf : ScalarOn U e a f g) (hab : a = b) : ScalarOn U e b f g := hab ▸ hf |
| 789 | |
| 790 | theorem add {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} {f v : D → ℝ} {g w : E → ℝ} |
| 791 | (hf : ScalarOn U e a f g) (hv : ScalarOn U e a v w) : ScalarOn U e a (f+v) (g+w) := by |
| 792 | intro x hx |
| 793 | change f x + v x = a * (g (e x) + w (e x)) |
| 794 | rw [hf x hx, hv x hx, mul_add] |
| 795 | |
| 796 | theorem sub {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} {f v : D → ℝ} {g w : E → ℝ} |
| 797 | (hf : ScalarOn U e a f g) (hv : ScalarOn U e a v w) : ScalarOn U e a (f-v) (g-w) := by |
| 798 | intro x hx |
| 799 | change f x - v x = a * (g (e x) - w (e x)) |
| 800 | rw [hf x hx, hv x hx, mul_sub] |
| 801 | |
| 802 | theorem mul {U : Set D} {e : D ≃L[ℝ] E} {a b : ℝ} {f v : D → ℝ} {g w : E → ℝ} |
| 803 | (hf : ScalarOn U e a f g) (hv : ScalarOn U e b v w) : ScalarOn U e (a*b) (f*v) (g*w) := by |
| 804 | intro x hx |
| 805 | change f x * v x = (a*b) * (g (e x) * w (e x)) |
| 806 | rw [hf x hx, hv x hx] |
| 807 | ring |
| 808 | |
| 809 | theorem smul {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} {f : D → ℝ} {g : E → ℝ} |
| 810 | (hf : ScalarOn U e a f g) (b : ℝ) : ScalarOn U e a (b • f) (b • g) := by |
| 811 | intro x hx |
| 812 | change b * f x = a * (b * g (e x)) |
| 813 | rw [hf x hx] |
| 814 | ring |
| 815 | |
| 816 | theorem along {U : Set D} (hU : IsOpen U) {e : D ≃L[ℝ] E} {a b : ℝ} |
| 817 | {f : D → ℝ} {g : E → ℝ} {V : D → D} {W : E → E} |
| 818 | (hf : ScalarOn U e a f g) (hV : ∀ x ∈ U, e (V x) = b • W (e x)) : |
| 819 | ScalarOn U e (a*b) (HarmonicCalculus.along V f) (HarmonicCalculus.along W g) := by |
| 820 | intro x hx |
| 821 | have he : f =ᶠ[𝓝 x] (fun y => a • g (e y)) := by |
| 822 | filter_upwards [hU.mem_nhds hx] with y hy |
| 823 | exact hf y hy |
| 824 | change (fderiv ℝ f x) (V x) = _ |
| 825 | rw [he.fderiv_eq] |
| 826 | exact along_pull e a b V W g x (hV x hx) |
| 827 | |
| 828 | end ScalarOn |
| 829 | |
| 830 | structure TripleOn (U : Set D) (e : D ≃L[ℝ] E) (a : ℝ) |
| 831 | (f : MeanIncrementBounds.Triple D) (g : MeanIncrementBounds.Triple E) (n nr : ℕ) : Prop where |
| 832 | radial : ScalarOn U e a (f.radial n) (g.radial nr) |
| 833 | angular : ScalarOn U e a (f.angular n) (g.angular nr) |
| 834 | axial : ScalarOn U e a (f.axial n) (g.axial nr) |
| 835 | |
| 836 | theorem TripleOn.updated {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 837 | {f v : MeanIncrementBounds.Triple D} {g w : MeanIncrementBounds.Triple E} {n nr : ℕ} |
| 838 | (hf : TripleOn U e a f g n nr) (hv : TripleOn U e a v w n nr) : |
| 839 | TripleOn U e a (MeanIncrementBounds.updated f v) (MeanIncrementBounds.updated g w) n nr := |
| 840 | ⟨hf.radial.add hv.radial, hf.angular.add hv.angular, hf.axial.add hv.axial⟩ |
| 841 | |
| 842 | /-- A full free-lift invariant on the actual state fields. It is stronger |
| 843 | than graph-only physical representation and is closed under addition. -/ |
| 844 | structure StateOn (U : Set D) (e : D ≃L[ℝ] E) (c l : ℝ) |
| 845 | (s : CorrectionState.State D) (r : CorrectionState.State E) (n nr : ℕ) : Prop where |
| 846 | mean : TripleOn U e c s.mean r.mean n nr |
| 847 | pressure : ScalarOn U e (c*c) (s.pressure n) (r.pressure nr) |
| 848 | oscillation : ∀ x ∈ U, ∀ theta i, s.oscillation n (x,theta) i = |
| 849 | c * r.oscillation nr (e x,theta) i |
| 850 | oscillatoryPressure : ∀ x ∈ U, ∀ theta, s.oscillatoryPressure n (x,theta) = |
| 851 | (c*c) * r.oscillatoryPressure nr (e x,theta) |
| 852 | baseError : ∀ x ∈ U, ∀ theta i, s.errors.base n (x,theta) i = |
| 853 | (c*c*l) * r.errors.base nr (e x,theta) i |
| 854 | gaussian : ∀ x ∈ U, ∀ theta i, s.errors.gaussian n (x,theta) i = |
| 855 | (c*c*l) * r.errors.gaussian nr (e x,theta) i |
| 856 | aliasError : ∀ x ∈ U, ∀ theta i, s.errors.aliasError n (x,theta) i = |
| 857 | (c*c*l) * r.errors.aliasError nr (e x,theta) i |
| 858 | |
| 859 | theorem StateOn.addIncrement {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 860 | {s v : CorrectionState.State D} {r w : CorrectionState.State E} {n nr : ℕ} |
| 861 | (hs : StateOn U e c l s r n nr) (hv : StateOn U e c l v w n nr) : |
| 862 | StateOn U e c l |
| 863 | (s.addIncrement v.mean v.pressure v.oscillation v.oscillatoryPressure v.errors) |
| 864 | (r.addIncrement w.mean w.pressure w.oscillation w.oscillatoryPressure w.errors) n nr := by |
| 865 | refine ⟨hs.mean.updated hv.mean, hs.pressure.add hv.pressure, ?_, ?_, ?_, ?_, ?_⟩ |
| 866 | · intro x hx theta i |
| 867 | change s.oscillation n (x,theta) i + v.oscillation n (x,theta) i = _ |
| 868 | rw [hs.oscillation x hx theta i, hv.oscillation x hx theta i] |
| 869 | exact (mul_add _ _ _).symm |
| 870 | · intro x hx theta |
| 871 | change s.oscillatoryPressure n (x,theta) + v.oscillatoryPressure n (x,theta) = _ |
| 872 | rw [hs.oscillatoryPressure x hx theta, hv.oscillatoryPressure x hx theta] |
| 873 | exact (mul_add _ _ _).symm |
| 874 | · intro x hx theta i |
| 875 | change s.errors.base n (x,theta) i + v.errors.base n (x,theta) i = _ |
| 876 | rw [hs.baseError x hx theta i, hv.baseError x hx theta i] |
| 877 | exact (mul_add _ _ _).symm |
| 878 | · intro x hx theta i |
| 879 | change s.errors.gaussian n (x,theta) i + v.errors.gaussian n (x,theta) i = _ |
| 880 | rw [hs.gaussian x hx theta i, hv.gaussian x hx theta i] |
| 881 | exact (mul_add _ _ _).symm |
| 882 | · intro x hx theta i |
| 883 | change s.errors.aliasError n (x,theta) i + v.errors.aliasError n (x,theta) i = _ |
| 884 | rw [hs.aliasError x hx theta i, hv.aliasError x hx theta i] |
| 885 | exact (mul_add _ _ _).symm |
| 886 | |
| 887 | theorem StateOn.covariance {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 888 | {s : CorrectionState.State D} {r : CorrectionState.State E} {n nr : ℕ} |
| 889 | (H : StateOn U e c l s r n nr) (i j : Fin 3) : |
| 890 | ScalarOn U e (c*c) (s.covariance i j n) (r.covariance i j nr) := by |
| 891 | intro x hx |
| 892 | simp only [CorrectionState.State.covariance, CorrectionState.bilinearCovariance, |
| 893 | CorrectionState.angularAverage] |
| 894 | have he : (fun theta => s.oscillation n (x,theta) i * s.oscillation n (x,theta) j) = |
| 895 | fun theta => (c*c) * (r.oscillation nr (e x,theta) i * r.oscillation nr (e x,theta) j) := by |
| 896 | funext theta |
| 897 | rw [H.oscillation x hx theta i, H.oscillation x hx theta j] |
| 898 | ring |
| 899 | rw [he, intervalIntegral.integral_const_mul] |
| 900 | ring |
| 901 | |
| 902 | theorem dr_eq_along (C : CorrectionState.Context D) (f : MeanIncrementBounds.Field D) |
| 903 | (n : ℕ) (x : D) : C.operators.dr f n x = |
| 904 | HarmonicCalculus.along (HarmonicResidual.contextFrame C n).radial (f n) x := by |
| 905 | simp only [MeanIncrementBounds.Operators.dr, WeightedClasses.graphDerivative, |
| 906 | HarmonicResidual.contextFrame, HarmonicCalculus.along, map_add, map_smul, smul_eq_mul] |
| 907 | ring |
| 908 | |
| 909 | theorem dz_eq_along (C : CorrectionState.Context D) (f : MeanIncrementBounds.Field D) |
| 910 | (n : ℕ) (x : D) : C.operators.dz f n x = |
| 911 | HarmonicCalculus.along (HarmonicResidual.contextFrame C n).axial (f n) x := by |
| 912 | simp only [MeanIncrementBounds.Operators.dz, HarmonicResidual.contextFrame, |
| 913 | HarmonicCalculus.along, map_smul, smul_eq_mul] |
| 914 | |
| 915 | theorem time_eq_along (C : CorrectionState.Context D) (f : MeanIncrementBounds.Field D) |
| 916 | (n : ℕ) (x : D) : C.operators.time f n x = |
| 917 | HarmonicCalculus.along (HarmonicResidual.contextFrame C n).time (f n) x := by |
| 918 | simp only [MeanIncrementBounds.Operators.time, MeanIncrementBounds.Operators.slowTime, |
| 919 | MeanIncrementBounds.Operators.fastTime, Pi.add_apply, HarmonicResidual.contextFrame, |
| 920 | HarmonicCalculus.along, map_sub, map_smul, smul_eq_mul] |
| 921 | ring |
| 922 | |
| 923 | namespace FrameOn |
| 924 | |
| 925 | variable {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 926 | {C : CorrectionState.Context D} {Cr : CorrectionState.Context E} {n nr : ℕ} |
| 927 | (H : FrameOn U e c l (HarmonicResidual.contextFrame C n) (HarmonicResidual.contextFrame Cr nr)) |
| 928 | |
| 929 | include H |
| 930 | |
| 931 | theorem scalarDr (hU : IsOpen U) {a : ℝ} {f : MeanIncrementBounds.Field D} |
| 932 | {g : MeanIncrementBounds.Field E} (hf : ScalarOn U e a (f n) (g nr)) : |
| 933 | ScalarOn U e (a*l) (C.operators.dr f n) (Cr.operators.dr g nr) := by |
| 934 | intro x hx |
| 935 | simpa only [dr_eq_along] using hf.along hU H.radial x hx |
| 936 | |
| 937 | theorem scalarDz (hU : IsOpen U) {a : ℝ} {f : MeanIncrementBounds.Field D} |
| 938 | {g : MeanIncrementBounds.Field E} (hf : ScalarOn U e a (f n) (g nr)) : |
| 939 | ScalarOn U e (a*l) (C.operators.dz f n) (Cr.operators.dz g nr) := by |
| 940 | intro x hx |
| 941 | simpa only [dz_eq_along] using hf.along hU H.axial x hx |
| 942 | |
| 943 | theorem scalarTime (hU : IsOpen U) {a : ℝ} {f : MeanIncrementBounds.Field D} |
| 944 | {g : MeanIncrementBounds.Field E} (hf : ScalarOn U e a (f n) (g nr)) : |
| 945 | ScalarOn U e (a*(c*l)) (C.operators.time f n) (Cr.operators.time g nr) := by |
| 946 | intro x hx |
| 947 | simpa only [time_eq_along] using hf.along hU H.time x hx |
| 948 | |
| 949 | theorem scalarInvRadius (hl : l ≠ 0) : |
| 950 | ScalarOn U e l (C.operators.invRadius n) (Cr.operators.invRadius nr) := by |
| 951 | intro x hx |
| 952 | have he := H.inverseRadius hl 0 x hx |
| 953 | simp only [constantCoefficient, AddMonoidAlgebra.coeff_single, Finsupp.single_eq_same, Complex.real_smul, |
| 954 | ← Complex.ofReal_mul, Complex.ofReal_inj] at he |
| 955 | exact he |
| 956 | |
| 957 | theorem scalarRadialDiv (hU : IsOpen U) (hl : l ≠ 0) {a : ℝ} |
| 958 | {f : MeanIncrementBounds.Field D} {g : MeanIncrementBounds.Field E} |
| 959 | (hf : ScalarOn U e a (f n) (g nr)) (b : ℝ) : |
| 960 | ScalarOn U e (a*l) (C.operators.radialDiv b f n) (Cr.operators.radialDiv b g nr) := by |
| 961 | have hprod := ((H.scalarInvRadius hl).mul hf).reweight (mul_comm l a) |
| 962 | exact (H.scalarDr hU hf).add (hprod.smul b) |
| 963 | |
| 964 | theorem scalarViscosity (hU : IsOpen U) (hl : l ≠ 0) {a : ℝ} |
| 965 | {f : MeanIncrementBounds.Field D} {g : MeanIncrementBounds.Field E} |
| 966 | (hf : ScalarOn U e a (f n) (g nr)) (b : ℝ) : |
| 967 | ScalarOn U e (a*c*l) (C.operators.viscosity b f n) (Cr.operators.viscosity b g nr) := by |
| 968 | have hrr := (H.scalarDr hU (H.scalarDr hU hf)).reweight (b := a*(l*l)) (by ring) |
| 969 | have hr := ((H.scalarInvRadius hl).mul (H.scalarDr hU hf)).reweight (b := a*(l*l)) (by ring) |
| 970 | have hzz := (H.scalarDz hU (H.scalarDz hU hf)).reweight (b := a*(l*l)) (by ring) |
| 971 | have hi := ((H.scalarInvRadius hl).mul ((H.scalarInvRadius hl).mul hf)).reweight |
| 972 | (b := a*(l*l)) (by ring) |
| 973 | have hsum := ((hrr.add hr).add hzz).sub (hi.smul b) |
| 974 | intro x hx |
| 975 | simp only [MeanIncrementBounds.Operators.viscosity] |
| 976 | have he := hsum x hx |
| 977 | simp only [Pi.add_apply, Pi.sub_apply, Pi.mul_apply, Pi.smul_apply, smul_eq_mul] at he |
| 978 | rw [he] |
| 979 | have hvis : C.operators.epsilon n * l = c * Cr.operators.epsilon nr := H.viscosity |
| 980 | calc |
| 981 | _ = a*l*(C.operators.epsilon n*l) * |
| 982 | (Cr.operators.dr (Cr.operators.dr g) nr (e x) + |
| 983 | Cr.operators.invRadius nr (e x) * Cr.operators.dr g nr (e x) + |
| 984 | Cr.operators.dz (Cr.operators.dz g) nr (e x) - |
| 985 | b*(Cr.operators.invRadius nr (e x)*(Cr.operators.invRadius nr (e x)*g nr (e x)))) := by ring |
| 986 | _ = _ := by rw [hvis]; ring |
| 987 | |
| 988 | end FrameOn |
| 989 | |
| 990 | namespace TripleOn |
| 991 | |
| 992 | variable {U : Set D} {e : D ≃L[ℝ] E} {c : ℝ} {n nr : ℕ} |
| 993 | {b m : MeanIncrementBounds.Triple D} {br mr : MeanIncrementBounds.Triple E} |
| 994 | |
| 995 | theorem thetaRadial (hb : TripleOn U e c b br n nr) (hm : TripleOn U e c m mr n nr) : |
| 996 | ScalarOn U e (c*c) (MeanIncrementBounds.thetaRadial b m n) (MeanIncrementBounds.thetaRadial br mr nr) := |
| 997 | ((hb.radial.mul hm.angular).add (hm.radial.mul hb.angular)).add (hm.radial.mul hm.angular) |
| 998 | |
| 999 | theorem thetaAxial (hb : TripleOn U e c b br n nr) (hm : TripleOn U e c m mr n nr) : |
| 1000 | ScalarOn U e (c*c) (MeanIncrementBounds.thetaAxial b m n) (MeanIncrementBounds.thetaAxial br mr nr) := |
| 1001 | ((hb.axial.mul hm.angular).add (hb.angular.mul hm.axial)).add (hm.axial.mul hm.angular) |
| 1002 | |
| 1003 | theorem axialRadial (hb : TripleOn U e c b br n nr) (hm : TripleOn U e c m mr n nr) : |
| 1004 | ScalarOn U e (c*c) (MeanIncrementBounds.axialRadial b m n) (MeanIncrementBounds.axialRadial br mr nr) := |
| 1005 | ((hb.radial.mul hm.axial).add (hm.radial.mul hb.axial)).add (hm.radial.mul hm.axial) |
| 1006 | |
| 1007 | theorem axialAxial (hb : TripleOn U e c b br n nr) (hm : TripleOn U e c m mr n nr) : |
| 1008 | ScalarOn U e (c*c) (MeanIncrementBounds.axialAxial b m n) (MeanIncrementBounds.axialAxial br mr nr) := |
| 1009 | ((hb.axial.mul hm.axial).smul 2).add (hm.axial.mul hm.axial) |
| 1010 | |
| 1011 | theorem radialRadial (hb : TripleOn U e c b br n nr) (hm : TripleOn U e c m mr n nr) : |
| 1012 | ScalarOn U e (c*c) (MeanIncrementBounds.radialRadial b m n) (MeanIncrementBounds.radialRadial br mr nr) := |
| 1013 | ((hb.radial.mul hm.radial).smul 2).add (hm.radial.mul hm.radial) |
| 1014 | |
| 1015 | theorem radialAngular (hb : TripleOn U e c b br n nr) (hm : TripleOn U e c m mr n nr) : |
| 1016 | ScalarOn U e (c*c) (MeanIncrementBounds.radialAngular b m n) (MeanIncrementBounds.radialAngular br mr nr) := |
| 1017 | ((hb.angular.mul hm.angular).smul 2).add (hm.angular.mul hm.angular) |
| 1018 | |
| 1019 | theorem complexValue (H : TripleOn U e c b br n nr) (x : D) (hx : x ∈ U) : |
| 1020 | (![(b.radial n x : ℂ), (b.angular n x : ℂ), (b.axial n x : ℂ)] : ComplexVector) = |
| 1021 | c • ![(br.radial nr (e x) : ℂ), (br.angular nr (e x) : ℂ), (br.axial nr (e x) : ℂ)] := by |
| 1022 | ext i |
| 1023 | fin_cases i <;> simp [H.radial x hx, H.angular x hx, H.axial x hx, Complex.real_smul] |
| 1024 | |
| 1025 | end TripleOn |
| 1026 | |
| 1027 | /-- Context coherence includes the actual virtual stress fields, not just |
| 1028 | the velocity carried by a state. -/ |
| 1029 | structure ContextOn (U : Set D) (e : D ≃L[ℝ] E) (c l : ℝ) |
| 1030 | (C : CorrectionState.Context D) (Cr : CorrectionState.Context E) (n nr : ℕ) : Prop where |
| 1031 | frame : FrameOn U e c l (HarmonicResidual.contextFrame C n) (HarmonicResidual.contextFrame Cr nr) |
| 1032 | base : TripleOn U e c C.base Cr.base n nr |
| 1033 | virtualTheta : ScalarOn U e (c*c) (C.virtualTheta n) (Cr.virtualTheta nr) |
| 1034 | virtualAxial : ScalarOn U e (c*c) (C.virtualAxial n) (Cr.virtualAxial nr) |
| 1035 | |
| 1036 | namespace StateOn |
| 1037 | |
| 1038 | variable {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 1039 | {C : CorrectionState.Context D} {Cr : CorrectionState.Context E} |
| 1040 | {s : CorrectionState.State D} {r : CorrectionState.State E} {n nr : ℕ} |
| 1041 | (H : StateOn U e c l s r n nr) (G : ContextOn U e c l C Cr n nr) |
| 1042 | |
| 1043 | include H G |
| 1044 | |
| 1045 | /-- Naturality of the genuine angular mean residual, including the |
| 1046 | recomputed covariance and virtual stress divergence. -/ |
| 1047 | theorem thetaResidual (hU : IsOpen U) (hl : l ≠ 0) : |
| 1048 | ScalarOn U e (c*c*l) (s.thetaResidual C n) (r.thetaResidual Cr nr) := by |
| 1049 | have ht := (G.frame.scalarTime hU H.mean.angular).reweight (b := c*c*l) (by ring) |
| 1050 | have hr := G.frame.scalarRadialDiv hU hl |
| 1051 | (f := MeanIncrementBounds.thetaRadial C.base s.mean + s.covariance 0 1) |
| 1052 | (g := MeanIncrementBounds.thetaRadial Cr.base r.mean + r.covariance 0 1) |
| 1053 | ((G.base.thetaRadial H.mean).add (H.covariance 0 1)) 2 |
| 1054 | have hz := G.frame.scalarDz hU |
| 1055 | (f := MeanIncrementBounds.thetaAxial C.base s.mean + s.covariance 2 1) |
| 1056 | (g := MeanIncrementBounds.thetaAxial Cr.base r.mean + r.covariance 2 1) |
| 1057 | ((G.base.thetaAxial H.mean).add (H.covariance 2 1)) |
| 1058 | have hv := G.frame.scalarViscosity hU hl H.mean.angular 1 |
| 1059 | have hs := G.frame.scalarRadialDiv hU hl G.virtualTheta 2 |
| 1060 | exact (((ht.add hr).add hz).sub hv).sub hs |
| 1061 | |
| 1062 | /-- Naturality of the genuine axial mean residual, with pressure retained. -/ |
| 1063 | theorem axialResidual (hU : IsOpen U) (hl : l ≠ 0) : |
| 1064 | ScalarOn U e (c*c*l) (s.axialResidual C n) (r.axialResidual Cr nr) := by |
| 1065 | have ht := (G.frame.scalarTime hU H.mean.axial).reweight (b := c*c*l) (by ring) |
| 1066 | have hr := G.frame.scalarRadialDiv hU hl |
| 1067 | (f := MeanIncrementBounds.axialRadial C.base s.mean + s.covariance 0 2) |
| 1068 | (g := MeanIncrementBounds.axialRadial Cr.base r.mean + r.covariance 0 2) |
| 1069 | ((G.base.axialRadial H.mean).add (H.covariance 0 2)) 1 |
| 1070 | have hz := G.frame.scalarDz hU |
| 1071 | (f := MeanIncrementBounds.axialAxial C.base s.mean + s.covariance 2 2 + s.pressure) |
| 1072 | (g := MeanIncrementBounds.axialAxial Cr.base r.mean + r.covariance 2 2 + r.pressure) |
| 1073 | (((G.base.axialAxial H.mean).add (H.covariance 2 2)).add H.pressure) |
| 1074 | have hv := G.frame.scalarViscosity hU hl H.mean.axial 0 |
| 1075 | have hs := G.frame.scalarRadialDiv hU hl G.virtualAxial 1 |
| 1076 | exact (((ht.add hr).add hz).sub hv).sub hs |
| 1077 | |
| 1078 | theorem gr (hU : IsOpen U) (hl : l ≠ 0) : |
| 1079 | ScalarOn U e (c*c*l) (s.gr C n) (r.gr Cr nr) := by |
| 1080 | have ht := (G.frame.scalarTime hU H.mean.radial).reweight (b := c*c*l) (by ring) |
| 1081 | have hr := G.frame.scalarRadialDiv hU hl |
| 1082 | (f := MeanIncrementBounds.radialRadial C.base s.mean + s.covariance 0 0) |
| 1083 | (g := MeanIncrementBounds.radialRadial Cr.base r.mean + r.covariance 0 0) |
| 1084 | ((G.base.radialRadial H.mean).add (H.covariance 0 0)) 1 |
| 1085 | have hz := G.frame.scalarDz hU |
| 1086 | (f := MeanIncrementBounds.axialRadial C.base s.mean + s.covariance 2 0) |
| 1087 | (g := MeanIncrementBounds.axialRadial Cr.base r.mean + r.covariance 2 0) |
| 1088 | ((G.base.axialRadial H.mean).add (H.covariance 2 0)) |
| 1089 | have ha := ((G.frame.scalarInvRadius hl).mul |
| 1090 | ((G.base.radialAngular H.mean).add (H.covariance 1 1))).reweight (b := c*c*l) (by ring) |
| 1091 | have hv := G.frame.scalarViscosity hU hl H.mean.radial 1 |
| 1092 | have he := ((((ht.add hr).add hz).sub ha).sub hv).smul (-1) |
| 1093 | simp only [neg_one_smul] at he |
| 1094 | exact he |
| 1095 | |
| 1096 | theorem radialResidual (hU : IsOpen U) (hl : l ≠ 0) : |
| 1097 | ScalarOn U e (c*c*l) (s.radialResidual C n) (r.radialResidual Cr nr) := |
| 1098 | (G.frame.scalarDr hU H.pressure).sub (H.gr G hU hl) |
| 1099 | |
| 1100 | theorem reducedMeanResidual (hU : IsOpen U) (hl : l ≠ 0) (i : Fin 3) : |
| 1101 | ScalarOn U e (c*c*l) (fun x => s.reducedMeanResidual C n x i) |
| 1102 | (fun x => r.reducedMeanResidual Cr nr x i) := by |
| 1103 | fin_cases i |
| 1104 | · exact H.radialResidual G hU hl |
| 1105 | · exact H.thetaResidual G hU hl |
| 1106 | · exact H.axialResidual G hU hl |
| 1107 | |
| 1108 | theorem source (hU : IsOpen U) (hl : l ≠ 0) |
| 1109 | {b : CorrectionState.HarmonicBlock D} {br : CorrectionState.HarmonicBlock E} |
| 1110 | {ga al : HarmonicResidual.BlockCoefficients D} {gar alr : HarmonicResidual.BlockCoefficients E} |
| 1111 | (hb : BlockFieldsOn U e c l b br ga al gar alr n nr) (j : ℤ) {x : D} (hx : x ∈ U) : |
| 1112 | ParticularWaveAssembly.residualSource C s b ga al j n x = |
| 1113 | (c*c*l) • ParticularWaveAssembly.residualSource Cr r br gar alr j nr (e x) := |
| 1114 | residualSource_naturality hU hl G.frame G.base.complexValue H.mean.complexValue hb j hx |
| 1115 | |
| 1116 | end StateOn |
| 1117 | |
| 1118 | theorem angularAverage_on {U : Set D} {e : D ≃L[ℝ] E} {a : ℝ} |
| 1119 | {f : CorrectionState.OscillatoryScalar D} {g : CorrectionState.OscillatoryScalar E} {n nr : ℕ} |
| 1120 | (hf : ∀ x ∈ U, ∀ theta, f n (x,theta) = a * g nr (e x,theta)) : |
| 1121 | ScalarOn U e a (CorrectionState.angularAverage f n) (CorrectionState.angularAverage g nr) := by |
| 1122 | intro x hx |
| 1123 | unfold CorrectionState.angularAverage |
| 1124 | rw [show (fun theta => f n (x,theta)) = (fun theta => a*g nr (e x,theta)) from funext (hf x hx), |
| 1125 | intervalIntegral.integral_const_mul] |
| 1126 | ring |
| 1127 | |
| 1128 | theorem StateOn.meanBaseError {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 1129 | {s : CorrectionState.State D} {r : CorrectionState.State E} {n nr : ℕ} |
| 1130 | (H : StateOn U e c l s r n nr) (i : Fin 3) : |
| 1131 | ScalarOn U e (c*c*l) (fun x => s.meanBaseError n x i) (fun x => r.meanBaseError nr x i) := |
| 1132 | angularAverage_on (fun x hx theta => H.baseError x hx theta i) |
| 1133 | |
| 1134 | theorem StateOn.meanExcluded {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 1135 | {s : CorrectionState.State D} {r : CorrectionState.State E} {n nr : ℕ} |
| 1136 | (H : StateOn U e c l s r n nr) (i : Fin 3) : |
| 1137 | ScalarOn U e (c*c*l) (fun x => s.meanExcluded n x i) (fun x => r.meanExcluded nr x i) := by |
| 1138 | apply angularAverage_on |
| 1139 | intro x hx theta |
| 1140 | simp only [CorrectionState.ExcludedErrors.total, Pi.add_apply, |
| 1141 | H.baseError x hx theta i, H.gaussian x hx theta i, H.aliasError x hx theta i] |
| 1142 | ring |
| 1143 | |
| 1144 | theorem StateOn.meanResidual {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 1145 | {C : CorrectionState.Context D} {Cr : CorrectionState.Context E} |
| 1146 | {s : CorrectionState.State D} {r : CorrectionState.State E} {n nr : ℕ} |
| 1147 | (H : StateOn U e c l s r n nr) (G : ContextOn U e c l C Cr n nr) |
| 1148 | (hU : IsOpen U) (hl : l ≠ 0) (i : Fin 3) : |
| 1149 | ScalarOn U e (c*c*l) (fun x => s.meanResidual C n x i) (fun x => r.meanResidual Cr nr x i) := |
| 1150 | (H.reducedMeanResidual G hU hl i).add (H.meanBaseError i) |
| 1151 | |
| 1152 | theorem StateOn.meanGoodResidual {U : Set D} {e : D ≃L[ℝ] E} {c l : ℝ} |
| 1153 | {C : CorrectionState.Context D} {Cr : CorrectionState.Context E} |
| 1154 | {s : CorrectionState.State D} {r : CorrectionState.State E} {n nr : ℕ} |
| 1155 | (H : StateOn U e c l s r n nr) (G : ContextOn U e c l C Cr n nr) |
| 1156 | (hU : IsOpen U) (hl : l ≠ 0) (i : Fin 3) : |
| 1157 | ScalarOn U e (c*c*l) (fun x => s.meanGoodResidual C n x i) (fun x => r.meanGoodResidual Cr nr x i) := |
| 1158 | (H.meanResidual G hU hl i).sub (H.meanExcluded i) |
| 1159 | |
| 1160 | /-! ## Literal reference views of one state -/ |
| 1161 | |
| 1162 | /-- The state is stored once on the reference lift. Band values are |
| 1163 | constructed by pullback, rather than chosen independently. -/ |
| 1164 | noncomputable def stateView (e : ℕ → D ≃L[ℝ] E) (c l : ℕ → ℝ) |
| 1165 | (r : CorrectionState.State E) (nr : ℕ) : CorrectionState.State D where |
| 1166 | mean := |
| 1167 | { radial := fun n x => c n * r.mean.radial nr (e n x) |
| 1168 | angular := fun n x => c n * r.mean.angular nr (e n x) |
| 1169 | axial := fun n x => c n * r.mean.axial nr (e n x) } |
| 1170 | pressure n x := (c n*c n) * r.pressure nr (e n x) |
| 1171 | oscillation n x i := c n * r.oscillation nr (e n x.1,x.2) i |
| 1172 | oscillatoryPressure n x := (c n*c n) * r.oscillatoryPressure nr (e n x.1,x.2) |
| 1173 | errors := |
| 1174 | { base := fun n x i => (c n*c n*l n) * r.errors.base nr (e n x.1,x.2) i |
| 1175 | gaussian := fun n x i => (c n*c n*l n) * r.errors.gaussian nr (e n x.1,x.2) i |
| 1176 | aliasError := fun n x i => (c n*c n*l n) * r.errors.aliasError nr (e n x.1,x.2) i } |
| 1177 | |
| 1178 | theorem stateView_coherent (e : ℕ → D ≃L[ℝ] E) (c l : ℕ → ℝ) |
| 1179 | (r : CorrectionState.State E) (nr n : ℕ) (U : Set D) : |
| 1180 | StateOn U (e n) (c n) (l n) (stateView e c l r nr) r n nr := by |
| 1181 | constructor |
| 1182 | · exact ⟨fun _ _ => rfl, fun _ _ => rfl, fun _ _ => rfl⟩ |
| 1183 | · intro x hx; rfl |
| 1184 | · intro x hx theta i; rfl |
| 1185 | · intro x hx theta; rfl |
| 1186 | · intro x hx theta i; rfl |
| 1187 | · intro x hx theta i; rfl |
| 1188 | · intro x hx theta i; rfl |
| 1189 | |
| 1190 | /-- Pullback commutes with the actual additive state update. -/ |
| 1191 | theorem stateView_addIncrement (e : ℕ → D ≃L[ℝ] E) (c l : ℕ → ℝ) |
| 1192 | (r w : CorrectionState.State E) (nr : ℕ) : |
| 1193 | stateView e c l |
| 1194 | (r.addIncrement w.mean w.pressure w.oscillation w.oscillatoryPressure w.errors) nr = |
| 1195 | (stateView e c l r nr).addIncrement (stateView e c l w nr).mean |
| 1196 | (stateView e c l w nr).pressure (stateView e c l w nr).oscillation |
| 1197 | (stateView e c l w nr).oscillatoryPressure (stateView e c l w nr).errors := by |
| 1198 | cases r |
| 1199 | cases w |
| 1200 | simp only [stateView, CorrectionState.State.addIncrement, MeanIncrementBounds.updated, |
| 1201 | CorrectionState.ExcludedErrors.add, Pi.add_apply, mul_add] |
| 1202 | rfl |
| 1203 | |
| 1204 | end NavierStokes.PhysicalResidualNaturality |