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.SquaredPartition |
| 2 | import NavierStokes.TorusAverages |
| 3 | import NavierStokes.PhaseCalculus |
| 4 | import NavierStokes.ParametricODE |
| 5 | import NavierStokes.PhaseEstimates |
| 6 | |
| 7 | /-! |
| 8 | # Leading covariance of actual partitioned, separated slot fields |
| 9 | |
| 10 | The fields are periodized native pulse components times actual angular cosines. |
| 11 | The off-diagonal label products vanish by the constructed rational slots, not |
| 12 | by an independence assumption about their angular frequencies. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | |
| 17 | namespace NavierStokes.PartitionedCovariance |
| 18 | |
| 19 | open Set Function Filter MeasureTheory Matrix |
| 20 | open scoped BigOperators Topology ContDiff |
| 21 | |
| 22 | abbrev Plane := TorusInverse.Plane |
| 23 | abbrev Vec2 := SmoothCovariance.Vec2 |
| 24 | abbrev Mat2 := SmoothCovariance.Mat2 |
| 25 | |
| 26 | noncomputable def cutoff (r : ℝ) : ℝ → ℝ := SquaredPartition.gridMask r 0 |
| 27 | |
| 28 | theorem cutoff_continuous (r : ℝ) : Continuous (cutoff r) := |
| 29 | (SquaredPartition.gridMask_smooth r 0).continuous |
| 30 | |
| 31 | theorem cutoff_compact {r : ℝ} (hr : 0 < r) : HasCompactSupport (cutoff r) := |
| 32 | SquaredPartition.gridMask_compactSupport r hr 0 |
| 33 | |
| 34 | theorem cutoff_support {r : ℝ} (hr : 0 < r) : support (cutoff r) = Ioo (-r) r := by |
| 35 | simpa [cutoff] using SquaredPartition.gridMask_support r hr (0 : ℤ) |
| 36 | |
| 37 | theorem cutoff_sq_integral_pos {r : ℝ} (hr : 0 < r) : 0 < ∫ ξ : ℝ, cutoff r ξ ^ 2 := by |
| 38 | have hc : HasCompactSupport (fun ξ => cutoff r ξ ^ 2) := by |
| 39 | apply (cutoff_compact hr).mono |
| 40 | intro ξ hξ hz |
| 41 | exact hξ (by simp [hz]) |
| 42 | have hi : Integrable (fun ξ => cutoff r ξ ^ 2) := |
| 43 | ((cutoff_continuous r).pow 2).integrable_of_hasCompactSupport hc |
| 44 | apply (integral_pos_iff_support_of_nonneg (fun ξ => sq_nonneg (cutoff r ξ)) hi).mpr |
| 45 | have hs : support (fun ξ => cutoff r ξ ^ 2) = Ioo (-r) r := by |
| 46 | ext ξ |
| 47 | rw [← cutoff_support hr] |
| 48 | simp only [mem_support, ne_eq, pow_eq_zero_iff (by norm_num : (2 : ℕ) ≠ 0)] |
| 49 | rw [hs] |
| 50 | exact isOpen_Ioo.measure_pos volume (nonempty_Ioo.mpr (by linarith)) |
| 51 | |
| 52 | noncomputable def nativePrefactor (vr vt : Plane) (r : ℝ) : ℝ := |
| 53 | (|vr.1 * vt.2 - vr.2 * vt.1| / 2) * ∫ ξ : ℝ, cutoff r ξ ^ 2 |
| 54 | |
| 55 | theorem nativePrefactor_pos {vr vt : Plane} {r : ℝ} |
| 56 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (hr : 0 < r) : |
| 57 | 0 < nativePrefactor vr vt r := |
| 58 | mul_pos (div_pos (abs_pos.mpr hdet) (by norm_num)) (cutoff_sq_integral_pos hr) |
| 59 | |
| 60 | /-- The actual scalar radial and two tangent pulse components. All analytic |
| 61 | hypotheses concern these functions, not their covariance integrals. -/ |
| 62 | structure Pulse where |
| 63 | ψ : ℝ → ℝ |
| 64 | x : ℝ → ℝ |
| 65 | t : ℝ → Vec2 |
| 66 | ψ_continuous : Continuous ψ |
| 67 | x_continuous : Continuous x |
| 68 | t_continuous : Continuous t |
| 69 | ψ_compact : HasCompactSupport ψ |
| 70 | |
| 71 | noncomputable def Pulse.column (P : Pulse) (ci : ℝ) : Vec2 := |
| 72 | PulseCovariance.actualColumn ci P.ψ P.x P.t |
| 73 | |
| 74 | noncomputable def Pulse.radialProfile (P : Pulse) (r : ℝ) (z : Plane) : ℝ := |
| 75 | cutoff r z.1 * P.ψ z.2 * P.x z.2 |
| 76 | |
| 77 | noncomputable def Pulse.tangentProfile (P : Pulse) (r : ℝ) (i : Fin 2) (z : Plane) : ℝ := |
| 78 | cutoff r z.1 * P.ψ z.2 * P.t z.2 i |
| 79 | |
| 80 | noncomputable def nativePulse (vr vt center : Plane) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) |
| 81 | (ci r : ℝ) (f : Plane → ℝ) : Plane → ℝ := |
| 82 | TorusAverages.nativeField (TorusAverages.slotChart vr vt hdet) center |
| 83 | (TorusAverages.transverseStretch ci r f) |
| 84 | |
| 85 | noncomputable def covered (n : ℕ) (f : Plane → ℝ) (Y : Plane) : ℝ := |
| 86 | TorusAverages.periodize f (TorusAverages.covering^[n] Y) |
| 87 | |
| 88 | noncomputable def wave (amplitude : ℝ) (n : ℕ) (f : Plane → ℝ) (mode : ℤ) |
| 89 | (phase : Plane → ℝ) (Y : Plane) (θ : ℝ) : ℝ := |
| 90 | amplitude * covered n f Y * Real.cos ((mode : ℝ) * θ + phase Y) |
| 91 | |
| 92 | noncomputable def doubleAverage (f : Plane → ℝ → ℝ) : ℝ := |
| 93 | TorusAverages.squareAverage (fun Y => SmoothLoop.angularMean (f Y)) |
| 94 | |
| 95 | theorem doubleAverage_const_mul (a : ℝ) (f : Plane → ℝ → ℝ) : |
| 96 | doubleAverage (fun Y θ => a * f Y θ) = a * doubleAverage f := by |
| 97 | simp only [doubleAverage, SmoothLoop.angularMean_const_mul] |
| 98 | exact TorusAverages.squareAverage_const_mul a _ |
| 99 | |
| 100 | theorem nativePulse_mul (vr vt center : Plane) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) |
| 101 | (ci r : ℝ) (f g : Plane → ℝ) : |
| 102 | (fun Y => nativePulse vr vt center hdet ci r f Y * nativePulse vr vt center hdet ci r g Y) = |
| 103 | nativePulse vr vt center hdet ci r (fun z => f z * g z) := rfl |
| 104 | |
| 105 | theorem Pulse.profile_product (P : Pulse) (r : ℝ) (i : Fin 2) : |
| 106 | (fun z => P.radialProfile r z * P.tangentProfile r i z) = |
| 107 | TorusAverages.pulseProfile (cutoff r) P.ψ P.x P.t i := by |
| 108 | funext z |
| 109 | unfold Pulse.radialProfile Pulse.tangentProfile TorusAverages.pulseProfile |
| 110 | ring |
| 111 | |
| 112 | /-- This evaluates the covariance of the two actual periodized velocity |
| 113 | components. Slot injectivity removes all cross-copy terms before averaging. -/ |
| 114 | theorem Pulse.wave_covariance (P : Pulse) (vr vt center : Plane) |
| 115 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (ci r : ℝ) (hci : 0 < ci) (hr : 0 < r) |
| 116 | (S : Set Plane) (hS : InjOn TorusAverages.quotientPoint S) |
| 117 | (hR : support (nativePulse vr vt center hdet ci r (P.radialProfile r)) ⊆ S) |
| 118 | (hT : ∀ i, support (nativePulse vr vt center hdet ci r (P.tangentProfile r i)) ⊆ S) |
| 119 | (a : ℝ) (n : ℕ) (phase : Plane → ℝ) (mode : ℤ) (hmode : mode ≠ 0) (i : Fin 2) : |
| 120 | doubleAverage (fun Y θ => |
| 121 | wave a n (nativePulse vr vt center hdet ci r (P.radialProfile r)) mode phase Y θ * |
| 122 | wave a n (nativePulse vr vt center hdet ci r (P.tangentProfile r i)) mode phase Y θ) = |
| 123 | a ^ 2 * nativePrefactor vr vt r * P.column ci i := by |
| 124 | have hp (Y : Plane) : |
| 125 | covered n (nativePulse vr vt center hdet ci r (P.radialProfile r)) Y * |
| 126 | covered n (nativePulse vr vt center hdet ci r (P.tangentProfile r i)) Y = |
| 127 | covered n (nativePulse vr vt center hdet ci r |
| 128 | (TorusAverages.pulseProfile (cutoff r) P.ψ P.x P.t i)) Y := by |
| 129 | unfold covered |
| 130 | rw [TorusAverages.periodize_mul_of_injective_support hS hR (hT i), nativePulse_mul, |
| 131 | P.profile_product] |
| 132 | have heq : (fun Y θ => |
| 133 | wave a n (nativePulse vr vt center hdet ci r (P.radialProfile r)) mode phase Y θ * |
| 134 | wave a n (nativePulse vr vt center hdet ci r (P.tangentProfile r i)) mode phase Y θ) = |
| 135 | fun Y θ => a ^ 2 * (covered n (nativePulse vr vt center hdet ci r |
| 136 | (TorusAverages.pulseProfile (cutoff r) P.ψ P.x P.t i)) Y * |
| 137 | Real.cos ((mode : ℝ) * θ + phase Y) ^ 2) := by |
| 138 | funext Y θ |
| 139 | unfold wave |
| 140 | rw [show (a * covered n (nativePulse vr vt center hdet ci r (P.radialProfile r)) Y * |
| 141 | Real.cos ((mode : ℝ) * θ + phase Y)) * |
| 142 | (a * covered n (nativePulse vr vt center hdet ci r (P.tangentProfile r i)) Y * |
| 143 | Real.cos ((mode : ℝ) * θ + phase Y)) = a ^ 2 * |
| 144 | (covered n (nativePulse vr vt center hdet ci r (P.radialProfile r)) Y * |
| 145 | covered n (nativePulse vr vt center hdet ci r (P.tangentProfile r i)) Y * |
| 146 | Real.cos ((mode : ℝ) * θ + phase Y) ^ 2) by ring] |
| 147 | rw [hp] |
| 148 | rw [heq, doubleAverage_const_mul] |
| 149 | have havg := TorusAverages.primary_covariance_average vr vt center hdet ci r hci |
| 150 | (cutoff_continuous r) P.ψ_continuous P.x_continuous P.t_continuous |
| 151 | (cutoff_compact hr) P.ψ_compact i n phase mode hmode |
| 152 | change a ^ 2 * doubleAverage _ = _ |
| 153 | change doubleAverage _ = nativePrefactor vr vt r * P.column ci i at havg |
| 154 | calc |
| 155 | _ = a ^ 2 * (nativePrefactor vr vt r * P.column ci i) := |
| 156 | congrArg (fun z : ℝ => a ^ 2 * z) havg |
| 157 | _ = _ := by ring |
| 158 | |
| 159 | /-- The free angular phase used above includes the manuscript's actual (26). |
| 160 | The integer frequency is the actual nonzero rounded product `k*p`. -/ |
| 161 | theorem cosine_actual_phase (k ε p pz x0 : ℝ) (F G : PhaseCalculus.Slow → ℝ) |
| 162 | (s : PhaseCalculus.Slow) (v : Plane → ℝ) (mode : ℤ) (hmode : k * p = (mode : ℝ)) |
| 163 | (Y : Plane) (θ : ℝ) : |
| 164 | Real.cos (k * PhaseCalculus.phase ε p pz x0 F G (s, θ, v Y)) = |
| 165 | Real.cos ((mode : ℝ) * θ + k * ((pz / ε) * s.2.1 + x0 * s.1 - |
| 166 | v Y * (p * F s + pz * G s))) := by |
| 167 | congr 1 |
| 168 | unfold PhaseCalculus.phase |
| 169 | rw [← hmode] |
| 170 | ring |
| 171 | |
| 172 | /-! ## The actual rational slot system and vanishing cross-label products -/ |
| 173 | |
| 174 | theorem cover_power_eq_iterate (n : ℕ) (Y : Plane) : |
| 175 | (SlotGeometry.cover ^ n) Y = TorusAverages.covering^[n] Y := by |
| 176 | induction n with |
| 177 | | zero => rfl |
| 178 | | succ n ih => |
| 179 | rw [pow_succ', _root_.mul_apply_eq_comp, ih, Function.iterate_succ_apply'] |
| 180 | simp only [SlotGeometry.cover_apply, TorusAverages.covering] |
| 181 | |
| 182 | theorem torusEq_lattice_add (k : TorusInverse.Frequency) (z : Plane) : |
| 183 | SlotGeometry.torusEq z (TorusAverages.latticePoint k + z) := by |
| 184 | refine ⟨⟨-k.1, ?_⟩, ⟨-k.2, ?_⟩⟩ <;> |
| 185 | simp [TorusAverages.latticePoint] |
| 186 | |
| 187 | theorem quotient_eq_torusEq {x y : Plane} |
| 188 | (h : TorusAverages.quotientPoint x = TorusAverages.quotientPoint y) : |
| 189 | SlotGeometry.torusEq x y := by |
| 190 | have h1 : ((x.1 - y.1 : ℝ) : UnitAddCircle) = 0 := by |
| 191 | rw [AddCircle.coe_sub] |
| 192 | exact sub_eq_zero.mpr (congrArg Prod.fst h) |
| 193 | have h2 : ((x.2 - y.2 : ℝ) : UnitAddCircle) = 0 := by |
| 194 | rw [AddCircle.coe_sub] |
| 195 | exact sub_eq_zero.mpr (congrArg Prod.snd h) |
| 196 | obtain ⟨a, ha⟩ := (AddCircle.coe_eq_zero_iff (1 : ℝ)).mp h1 |
| 197 | obtain ⟨b, hb⟩ := (AddCircle.coe_eq_zero_iff (1 : ℝ)).mp h2 |
| 198 | refine ⟨⟨a, ?_⟩, ⟨b, ?_⟩⟩ |
| 199 | · simpa only [zsmul_eq_mul, mul_one, Prod.fst_sub] using ha |
| 200 | · simpa only [zsmul_eq_mul, mul_one, Prod.snd_sub] using hb |
| 201 | |
| 202 | theorem covered_support {f : Plane → ℝ} {S : Set Plane} (hf : support f ⊆ S) (n : ℕ) : |
| 203 | support (covered n f) ⊆ SlotGeometry.liftedSupport n S := by |
| 204 | intro Y hY |
| 205 | have hsome : ∃ k : TorusInverse.Frequency, |
| 206 | f (TorusAverages.latticePoint k + TorusAverages.covering^[n] Y) ≠ 0 := by |
| 207 | by_contra hnone |
| 208 | push Not at hnone |
| 209 | exact hY (by simp [covered, TorusAverages.periodize, hnone]) |
| 210 | obtain ⟨k, hk⟩ := hsome |
| 211 | refine ⟨TorusAverages.latticePoint k + TorusAverages.covering^[n] Y, hf hk, ?_⟩ |
| 212 | rw [cover_power_eq_iterate] |
| 213 | exact torusEq_lattice_add k _ |
| 214 | |
| 215 | noncomputable def slotCenter (h : ℝ) (L : SlotColoring.Label) : Plane := |
| 216 | SlotGeometry.center (Fintype.card SlotColoring.Palette) (SlotColoring.nativeGap h) |
| 217 | (SlotColoring.color L) |
| 218 | |
| 219 | noncomputable def slotSet (h r : ℝ) (vr vt : Plane) (L : SlotColoring.Label) : Set Plane := |
| 220 | SlotGeometry.orientedRectangle (slotCenter h L) vr vt (2 * r) |
| 221 | |
| 222 | /-- All separation and quotient-injectivity fields below are constructed by |
| 223 | `exists_slotSystem` from the explicit rational centers. -/ |
| 224 | structure SlotSystem (D h : ℝ) (vr vt : Plane) where |
| 225 | radius : ℝ |
| 226 | radius_pos : 0 < radius |
| 227 | injective : ∀ L, InjOn TorusAverages.quotientPoint (slotSet h radius vr vt L) |
| 228 | disjoint : ∀ L M, SlotColoring.Adj D L M → |
| 229 | Disjoint |
| 230 | (SlotGeometry.liftedSupport (SlotColoring.nativeIndex h L.1) (slotSet h radius vr vt L)) |
| 231 | (SlotGeometry.liftedSupport (SlotColoring.nativeIndex h M.1) (slotSet h radius vr vt M)) |
| 232 | |
| 233 | theorem exists_slotSystem (D h : ℝ) (hh : 0 ≤ h) (vr vt : Plane) : |
| 234 | Nonempty (SlotSystem D h vr vt) := by |
| 235 | obtain ⟨r, hr, hsep, hinj⟩ := SlotGeometry.exists_oriented_slots |
| 236 | (Fintype.card SlotColoring.Palette) (SlotColoring.nativeGap h) vr vt |
| 237 | refine ⟨⟨r, hr, ?_, ?_⟩⟩ |
| 238 | · intro L x hx y hy hxy |
| 239 | exact hinj 0 (Nat.zero_le _) (SlotColoring.color L) x hx y hy |
| 240 | (by simpa using quotient_eq_torusEq hxy) |
| 241 | · intro L M hLM |
| 242 | have hc := SlotColoring.color_proper D hLM |
| 243 | have hd := SlotColoring.nativeIndex_gap h hh hLM.left_positive hLM.right_positive |
| 244 | hLM.left_level_le hLM.right_level_le |
| 245 | rcases le_total (SlotColoring.nativeIndex h L.1) (SlotColoring.nativeIndex h M.1) with hle | hle |
| 246 | · have he := hsep (SlotColoring.nativeIndex h L.1) |
| 247 | (SlotColoring.nativeIndex h M.1 - SlotColoring.nativeIndex h L.1) |
| 248 | (by omega) (SlotColoring.color L) (SlotColoring.color M) (Or.inr hc) |
| 249 | have hsum : SlotColoring.nativeIndex h L.1 + |
| 250 | (SlotColoring.nativeIndex h M.1 - SlotColoring.nativeIndex h L.1) = |
| 251 | SlotColoring.nativeIndex h M.1 := by omega |
| 252 | simpa only [hsum, slotSet, slotCenter] using he |
| 253 | · have he := hsep (SlotColoring.nativeIndex h M.1) |
| 254 | (SlotColoring.nativeIndex h L.1 - SlotColoring.nativeIndex h M.1) |
| 255 | (by omega) (SlotColoring.color M) (SlotColoring.color L) (Or.inr hc.symm) |
| 256 | have hsum : SlotColoring.nativeIndex h M.1 + |
| 257 | (SlotColoring.nativeIndex h L.1 - SlotColoring.nativeIndex h M.1) = |
| 258 | SlotColoring.nativeIndex h L.1 := by omega |
| 259 | simpa only [hsum, slotSet, slotCenter] using he.symm |
| 260 | |
| 261 | /-- The native cutoffs fit inside the padded rectangles used by the slot |
| 262 | construction. Only support of the actual transverse cutoff is required. -/ |
| 263 | theorem native_cutoff_support (vr vt center : Plane) |
| 264 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) {ci r : ℝ} (hci : 0 < ci) (hr : 0 < r) |
| 265 | {ψ f : ℝ → ℝ} (hψ : support ψ ⊆ Icc 0 (2 * r / ci)) : |
| 266 | support (nativePulse vr vt center hdet ci r (fun z => cutoff r z.1 * ψ z.2 * f z.2)) ⊆ |
| 267 | SlotGeometry.orientedRectangle center vr vt (2 * r) := by |
| 268 | intro z hz |
| 269 | let w := (TorusAverages.slotChart vr vt hdet).symm (z - center) |
| 270 | let v := (w.2 + r) / ci |
| 271 | have hp : (cutoff r w.1 * ψ v) * f v ≠ 0 := hz |
| 272 | have hχ := (mul_ne_zero_iff.mp (mul_ne_zero_iff.mp hp).1).1 |
| 273 | have hψv := hψ (mul_ne_zero_iff.mp (mul_ne_zero_iff.mp hp).1).2 |
| 274 | have hξ : |w.1| ≤ 2 * r := by |
| 275 | have hm : w.1 ∈ support (cutoff r) := hχ |
| 276 | rw [cutoff_support hr] at hm |
| 277 | rw [abs_le] |
| 278 | constructor <;> linarith [hm.1, hm.2] |
| 279 | have hη : |w.2| ≤ 2 * r := by |
| 280 | have hl : 0 ≤ w.2 + r := by simpa only [zero_mul] using (le_div_iff₀ hci).mp hψv.1 |
| 281 | have hu : w.2 + r ≤ 2 * r := (div_le_div_iff_of_pos_right hci).mp hψv.2 |
| 282 | rw [abs_le] |
| 283 | constructor <;> linarith |
| 284 | refine ⟨w.1, w.2, hξ, hη, ?_⟩ |
| 285 | have hw := (TorusAverages.slotChart vr vt hdet).apply_symm_apply (z - center) |
| 286 | change TorusAverages.slotChart vr vt hdet w = z - center at hw |
| 287 | rw [TorusAverages.slotChart_apply] at hw |
| 288 | calc |
| 289 | z = center + (z - center) := by abel |
| 290 | _ = center + w.1 • vr + w.2 • vt := by |
| 291 | rw [← hw] |
| 292 | abel |
| 293 | |
| 294 | noncomputable def physicalMask (D : ℝ) (L : SlotColoring.Label) (q : ℝ) (x : SlotColoring.Position) : ℝ := |
| 295 | SquaredPartition.dyadicMask (L.1 : ℤ) q * SquaredPartition.physicalSlowMask D L.1 L.2.1 x |
| 296 | |
| 297 | theorem masks_force_adjacency {D q : ℝ} {x : SlotColoring.Position} {L M : SlotColoring.Label} |
| 298 | (hq : 0 < q) (hL : 1 ≤ L.1) (hM : 1 ≤ M.1) (hne : L ≠ M) |
| 299 | (hmL : physicalMask D L q x ≠ 0) (hmM : physicalMask D M q x ≠ 0) : |
| 300 | SlotColoring.Adj D L M := by |
| 301 | obtain ⟨hdL, hsL⟩ := mul_ne_zero_iff.mp hmL |
| 302 | obtain ⟨hdM, hsM⟩ := mul_ne_zero_iff.mp hmM |
| 303 | have hl : SquaredPartition.logCoordinate q ∈ support (SquaredPartition.lineMask (L.1 : ℤ)) := by |
| 304 | rwa [SquaredPartition.dyadicMask_eq_line _ hq] at hdL |
| 305 | have hm : SquaredPartition.logCoordinate q ∈ support (SquaredPartition.lineMask (M.1 : ℤ)) := by |
| 306 | rwa [SquaredPartition.dyadicMask_eq_line _ hq] at hdM |
| 307 | rw [SquaredPartition.lineMask_support] at hl hm |
| 308 | simp only [Int.cast_natCast] at hl hm |
| 309 | have hLM : L.1 ≤ M.1 + 4 := by |
| 310 | have he : (L.1 : ℝ) ≤ (M.1 : ℝ) + 4 := by |
| 311 | linarith [hl.1, hm.2] |
| 312 | exact_mod_cast he |
| 313 | have hML : M.1 ≤ L.1 + 4 := by |
| 314 | have he : (M.1 : ℝ) ≤ (L.1 : ℝ) + 4 := by |
| 315 | linarith [hm.1, hl.2] |
| 316 | exact_mod_cast he |
| 317 | exact ⟨hL, hM, hne, hLM, hML, x, |
| 318 | SquaredPartition.physicalSlowMask_tsupport_subset_physicalBox D hL L.2.1 L.2.2 |
| 319 | (subset_tsupport _ hsL), |
| 320 | SquaredPartition.physicalSlowMask_tsupport_subset_physicalBox D hM M.2.1 M.2.2 |
| 321 | (subset_tsupport _ hsM)⟩ |
| 322 | |
| 323 | theorem SlotSystem.cross_product_zero {D h : ℝ} {vr vt : Plane} (sys : SlotSystem D h vr vt) |
| 324 | {L M : SlotColoring.Label} (hL : 1 ≤ L.1) (hM : 1 ≤ M.1) (hne : L ≠ M) |
| 325 | {f g : Plane → ℝ} (hf : support f ⊆ slotSet h sys.radius vr vt L) |
| 326 | (hg : support g ⊆ slotSet h sys.radius vr vt M) {q : ℝ} (hq : 0 < q) |
| 327 | (x : SlotColoring.Position) (Y : Plane) : |
| 328 | (physicalMask D L q x * covered (SlotColoring.nativeIndex h L.1) f Y) * |
| 329 | (physicalMask D M q x * covered (SlotColoring.nativeIndex h M.1) g Y) = 0 := by |
| 330 | by_cases hmL : physicalMask D L q x = 0 |
| 331 | · simp [hmL] |
| 332 | by_cases hmM : physicalMask D M q x = 0 |
| 333 | · simp [hmM] |
| 334 | have hdis := sys.disjoint L M (masks_force_adjacency hq hL hM hne hmL hmM) |
| 335 | by_cases hfY : covered (SlotColoring.nativeIndex h L.1) f Y = 0 |
| 336 | · simp [hfY] |
| 337 | have hgY : covered (SlotColoring.nativeIndex h M.1) g Y = 0 := by |
| 338 | by_contra hneY |
| 339 | exact Set.disjoint_left.mp hdis (covered_support hf _ hfY) (covered_support hg _ hneY) |
| 340 | simp [hgY] |
| 341 | |
| 342 | /-! ## Actual pulse columns and the positive inverse solve -/ |
| 343 | |
| 344 | noncomputable def tangentExtension {r a A b B c₀ s₀ slope E : ℝ} |
| 345 | (P : PulseCovariance.TangentPulse r a A b B c₀ s₀ slope E) : ℝ → Vec2 := |
| 346 | ParametricODE.extend (sq_nonneg r) |
| 347 | ⟨fun v => P.tangent v, continuous_pi fun i => (P.tangent_continuous i).domRestrict⟩ |
| 348 | |
| 349 | theorem tangentExtension_continuous {r a A b B c₀ s₀ slope E : ℝ} |
| 350 | (P : PulseCovariance.TangentPulse r a A b B c₀ s₀ slope E) : |
| 351 | Continuous (tangentExtension P) := ParametricODE.continuous_extend _ _ |
| 352 | |
| 353 | theorem tangentExtension_eq {r a A b B c₀ s₀ slope E : ℝ} |
| 354 | (P : PulseCovariance.TangentPulse r a A b B c₀ s₀ slope E) {v : ℝ} (hv : v ∈ Icc 0 (r ^ 2)) : |
| 355 | tangentExtension P v = P.tangent v := |
| 356 | ParametricODE.extend_coe (sq_nonneg r) _ ⟨v, hv⟩ |
| 357 | |
| 358 | noncomputable def ofTangentPulse {r a A b B c₀ s₀ slope E : ℝ} |
| 359 | (P : PulseCovariance.TangentPulse r a A b B c₀ s₀ slope E) : Pulse where |
| 360 | ψ := P.cutoff |
| 361 | x := P.component |
| 362 | t := tangentExtension P |
| 363 | ψ_continuous := P.bounds.cutoff_continuous |
| 364 | x_continuous := P.bounds.component_continuous |
| 365 | t_continuous := tangentExtension_continuous P |
| 366 | ψ_compact := P.bounds.cutoff_compact |
| 367 | |
| 368 | theorem cutoff_zero_outside_slot {r a A b B c₀ s₀ slope E : ℝ} |
| 369 | (P : PulseCovariance.TangentPulse r a A b B c₀ s₀ slope E) {v : ℝ} |
| 370 | (hv : v ∉ Icc 0 (r ^ 2)) : P.cutoff v = 0 := by |
| 371 | apply P.bounds.cutoff_zero |
| 372 | intro hmid |
| 373 | apply hv |
| 374 | constructor <;> nlinarith [hmid.1, hmid.2, sq_nonneg r] |
| 375 | |
| 376 | /-- Clamping the tangent component outside the pulse interval changes neither |
| 377 | the cut-off velocity nor its actual covariance column. -/ |
| 378 | theorem ofTangentPulse_column {r a A b B c₀ s₀ slope E : ℝ} |
| 379 | (P : PulseCovariance.TangentPulse r a A b B c₀ s₀ slope E) (ci : ℝ) : |
| 380 | (ofTangentPulse P).column ci = |
| 381 | PulseCovariance.actualColumn ci P.cutoff P.component P.tangent := by |
| 382 | funext i |
| 383 | unfold Pulse.column PulseCovariance.actualColumn |
| 384 | apply congrArg (fun z : ℝ => ci * z) |
| 385 | apply integral_congr_ae |
| 386 | filter_upwards [] with v |
| 387 | by_cases hv : v ∈ Icc 0 (r ^ 2) |
| 388 | · change P.cutoff v ^ 2 * P.component v * tangentExtension P v i = _ |
| 389 | rw [tangentExtension_eq P hv] |
| 390 | · simp [ofTangentPulse, cutoff_zero_outside_slot P hv] |
| 391 | |
| 392 | theorem ofTangentPulse_fits {r a A b B c₀ s₀ slope E ci r0 : ℝ} |
| 393 | (P : PulseCovariance.TangentPulse r a A b B c₀ s₀ slope E) |
| 394 | (hci : 0 < ci) (hfit : ci * r ^ 2 = 2 * r0) : |
| 395 | support (ofTangentPulse P).ψ ⊆ Icc 0 (2 * r0 / ci) := by |
| 396 | intro v hv |
| 397 | have hin : v ∈ Icc 0 (r ^ 2) := by |
| 398 | by_contra hout |
| 399 | exact hv (cutoff_zero_outside_slot P hout) |
| 400 | have he : 2 * r0 / ci = r ^ 2 := by rw [← hfit]; field_simp |
| 401 | rwa [he] |
| 402 | |
| 403 | noncomputable def pairMatrix (vr vt : Plane) (r : ℝ) (ci : Vec2) (P : Fin 2 → Pulse) : Mat2 := |
| 404 | fun i j => nativePrefactor vr vt r * (P j).column (ci j) i |
| 405 | |
| 406 | theorem pairMatrix_of_actual_pulses {r a A b B c₀ u E : ℝ} |
| 407 | (P : PulseCovariance.SignedPulsePair r a A b B c₀ u E) |
| 408 | (vr vt : Plane) (r0 : ℝ) (ci : Vec2) : |
| 409 | pairMatrix vr vt r0 ci (fun j => ofTangentPulse (P j)) = |
| 410 | PulseCovariance.actualMatrix P (fun j => nativePrefactor vr vt r0 * ci j) := by |
| 411 | ext i j |
| 412 | change nativePrefactor vr vt r0 * (ofTangentPulse (P j)).column (ci j) i = _ |
| 413 | rw [ofTangentPulse_column] |
| 414 | unfold PulseCovariance.actualMatrix PulseCovariance.actualColumn |
| 415 | ring |
| 416 | |
| 417 | theorem pairMatrix_strictCone_of_actual {r a A b B c₀ u E r0 : ℝ} |
| 418 | (P : PulseCovariance.SignedPulsePair r a A b B c₀ u E) |
| 419 | {vr vt : Plane} (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (hr0 : 0 < r0) |
| 420 | {ci : Vec2} (hci : ∀ j, 0 < ci j) {T : Vec2} |
| 421 | (hcone : SmoothCovariance.StrictCone (PulseCovariance.normalizedMatrix P) T) : |
| 422 | SmoothCovariance.StrictCone (pairMatrix vr vt r0 ci (fun j => ofTangentPulse (P j))) T := by |
| 423 | rw [pairMatrix_of_actual_pulses] |
| 424 | apply (SmoothCovariance.weights_pos_iff _ _).mp |
| 425 | exact (PulseCovariance.actualMatrix_positive_of_normalized P |
| 426 | (fun j => mul_pos (nativePrefactor_pos hdet hr0) (hci j)) T |
| 427 | hcone.det_ne_zero hcone.weights_pos).2.1 |
| 428 | |
| 429 | noncomputable def amplitude (ε mask : ℝ) (H : Mat2) (T : Vec2) (j : Fin 2) : ℝ := |
| 430 | Real.sqrt ε * SmoothCovariance.amplitudes H T j * mask |
| 431 | |
| 432 | theorem amplitude_sq (ε mask : ℝ) (hε : 0 ≤ ε) (H : Mat2) (T : Vec2) (j : Fin 2) : |
| 433 | amplitude ε mask H T j ^ 2 = ε * mask ^ 2 * SmoothCovariance.amplitudes H T j ^ 2 := by |
| 434 | unfold amplitude |
| 435 | rw [mul_pow, mul_pow, Real.sq_sqrt hε] |
| 436 | ring |
| 437 | |
| 438 | theorem amplitudes_are_inverse_weights {H : Mat2} {T : Vec2} |
| 439 | (h : SmoothCovariance.StrictCone H T) (j : Fin 2) : |
| 440 | 0 < (H⁻¹.mulVec T) j ∧ SmoothCovariance.amplitudes H T j = Real.sqrt ((H⁻¹.mulVec T) j) := by |
| 441 | rw [SmoothCovariance.inverse_formula H T h.det_ne_zero] |
| 442 | exact ⟨h.weights_pos j, rfl⟩ |
| 443 | |
| 444 | theorem weighted_columns_reconstruct (ε mask : ℝ) (hε : 0 ≤ ε) {H : Mat2} {T : Vec2} |
| 445 | (hcone : SmoothCovariance.StrictCone H T) (i : Fin 2) : |
| 446 | (∑ j : Fin 2, amplitude ε mask H T j ^ 2 * H i j) = ε * mask ^ 2 * T i := by |
| 447 | have hrec := congrFun (SmoothCovariance.reconstruct_amplitudes hcone) i |
| 448 | simp only [Matrix.mulVec, dotProduct, Fin.sum_univ_two] at hrec |
| 449 | simp only [Fin.sum_univ_two, amplitude_sq ε mask hε] |
| 450 | calc |
| 451 | _ = ε * mask ^ 2 * (H i 0 * SmoothCovariance.amplitudes H T 0 ^ 2 + |
| 452 | H i 1 * SmoothCovariance.amplitudes H T 1 ^ 2) := by ring |
| 453 | _ = _ := by rw [hrec] |
| 454 | |
| 455 | /-! ## Finite sums of the actual velocity components -/ |
| 456 | |
| 457 | theorem angularMean_sum {ι : Type*} (s : Finset ι) (f : ι → ℝ → ℝ) |
| 458 | (hf : ∀ a ∈ s, Continuous (f a)) : |
| 459 | SmoothLoop.angularMean (fun θ => ∑ a ∈ s, f a θ) = |
| 460 | ∑ a ∈ s, SmoothLoop.angularMean (f a) := by |
| 461 | unfold SmoothLoop.angularMean |
| 462 | rw [intervalIntegral.integral_finsetSum (fun a ha => (hf a ha).intervalIntegrable _ _)] |
| 463 | exact Finset.sum_div _ _ _ |
| 464 | |
| 465 | theorem squareAverage_sum {ι : Type*} (s : Finset ι) (f : ι → Plane → ℝ) |
| 466 | (hf : ∀ a ∈ s, Continuous (f a)) : |
| 467 | TorusAverages.squareAverage (fun Y => ∑ a ∈ s, f a Y) = |
| 468 | ∑ a ∈ s, TorusAverages.squareAverage (f a) := by |
| 469 | have hsum := continuous_finsetSum s hf |
| 470 | rw [TorusAverages.squareAverage_eq_setIntegral hsum] |
| 471 | have hi (a) (ha : a ∈ s) : IntegrableOn (f a) TorusAverages.fundamentalSquare := by |
| 472 | exact ((hf a ha).continuousOn.integrableOn_compact |
| 473 | (isCompact_Icc.prod isCompact_Icc)).mono_set |
| 474 | (Set.prod_mono Ico_subset_Icc_self Ico_subset_Icc_self) |
| 475 | rw [MeasureTheory.integral_finsetSum s hi] |
| 476 | apply Finset.sum_congr rfl |
| 477 | intro a ha |
| 478 | exact (TorusAverages.squareAverage_eq_setIntegral (hf a ha)).symm |
| 479 | |
| 480 | theorem doubleAverage_sum {ι : Type*} (s : Finset ι) (f : ι → Plane → ℝ → ℝ) |
| 481 | (hθ : ∀ a ∈ s, ∀ Y, Continuous (f a Y)) |
| 482 | (hY : ∀ a ∈ s, Continuous (fun Y => SmoothLoop.angularMean (f a Y))) : |
| 483 | doubleAverage (fun Y θ => ∑ a ∈ s, f a Y θ) = ∑ a ∈ s, doubleAverage (f a) := by |
| 484 | unfold doubleAverage |
| 485 | simp_rw [angularMean_sum s _ (fun a ha => hθ a ha _)] |
| 486 | exact squareAverage_sum s _ hY |
| 487 | |
| 488 | theorem sum_product_diagonal {ι : Type*} (s : Finset ι) (f g : ι → ℝ) |
| 489 | (hcross : ∀ a ∈ s, ∀ b ∈ s, a ≠ b → f a * g b = 0) : |
| 490 | (∑ a ∈ s, f a) * (∑ a ∈ s, g a) = ∑ a ∈ s, f a * g a := by |
| 491 | classical |
| 492 | rw [Finset.sum_mul] |
| 493 | apply Finset.sum_congr rfl |
| 494 | intro a ha |
| 495 | rw [Finset.mul_sum, Finset.sum_eq_single a] |
| 496 | · intro b hb hba |
| 497 | exact hcross a ha b hb hba.symm |
| 498 | · exact fun h => (h ha).elim |
| 499 | |
| 500 | theorem Pulse.radialProfile_continuous (P : Pulse) (r : ℝ) : Continuous (P.radialProfile r) := |
| 501 | ((cutoff_continuous r).comp continuous_fst).mul |
| 502 | (P.ψ_continuous.comp continuous_snd) |>.mul (P.x_continuous.comp continuous_snd) |
| 503 | |
| 504 | theorem Pulse.tangentProfile_continuous (P : Pulse) (r : ℝ) (i : Fin 2) : |
| 505 | Continuous (P.tangentProfile r i) := |
| 506 | (((cutoff_continuous r).comp continuous_fst).mul |
| 507 | (P.ψ_continuous.comp continuous_snd)).mul |
| 508 | (((continuous_apply i).comp P.t_continuous).comp continuous_snd) |
| 509 | |
| 510 | theorem Pulse.radialProfile_compact (P : Pulse) {r : ℝ} (hr : 0 < r) : |
| 511 | HasCompactSupport (P.radialProfile r) := by |
| 512 | have h := TorusAverages.productProfile_hasCompactSupport (cutoff_compact hr) |
| 513 | (P.ψ_compact.mul_right (f' := P.x)) |
| 514 | change HasCompactSupport (fun z : Plane => cutoff r z.1 * P.ψ z.2 * P.x z.2) |
| 515 | simpa only [Pi.mul_apply, mul_assoc] using h |
| 516 | |
| 517 | theorem Pulse.tangentProfile_compact (P : Pulse) {r : ℝ} (hr : 0 < r) (i : Fin 2) : |
| 518 | HasCompactSupport (P.tangentProfile r i) := by |
| 519 | have h := TorusAverages.productProfile_hasCompactSupport (cutoff_compact hr) |
| 520 | (P.ψ_compact.mul_right (f' := fun v => P.t v i)) |
| 521 | change HasCompactSupport (fun z : Plane => cutoff r z.1 * P.ψ z.2 * P.t z.2 i) |
| 522 | simpa only [Pi.mul_apply, mul_assoc] using h |
| 523 | |
| 524 | theorem nativePulse_continuous (vr vt center : Plane) |
| 525 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) {ci r : ℝ} (hci : ci ≠ 0) |
| 526 | {f : Plane → ℝ} (hf : Continuous f) : Continuous (nativePulse vr vt center hdet ci r f) := |
| 527 | TorusAverages.nativeField_continuous _ _ (TorusAverages.transverseStretch_continuous ci r hci hf) |
| 528 | |
| 529 | theorem nativePulse_compact (vr vt center : Plane) |
| 530 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) {ci r : ℝ} (hci : ci ≠ 0) |
| 531 | {f : Plane → ℝ} (hf : HasCompactSupport f) : HasCompactSupport (nativePulse vr vt center hdet ci r f) := |
| 532 | TorusAverages.nativeField_hasCompactSupport _ _ (TorusAverages.transverseStretch_hasCompactSupport ci r hci hf) |
| 533 | |
| 534 | theorem covered_continuous {f : Plane → ℝ} (hf : Continuous f) (hc : HasCompactSupport f) (n : ℕ) : |
| 535 | Continuous (covered n f) := |
| 536 | (TorusAverages.periodize_continuous hf hc).comp (TorusAverages.covering_continuous.iterate n) |
| 537 | |
| 538 | theorem wave_continuous_theta (a : ℝ) (n : ℕ) (f : Plane → ℝ) (mode : ℤ) |
| 539 | (phase : Plane → ℝ) (Y : Plane) : Continuous (wave a n f mode phase Y) := |
| 540 | continuous_const.mul (Real.continuous_cos.comp ((continuous_const.mul continuous_id).add continuous_const)) |
| 541 | |
| 542 | theorem angularMean_wave_product (a : ℝ) (n : ℕ) (f g : Plane → ℝ) (mode : ℤ) |
| 543 | (hmode : mode ≠ 0) (phase : Plane → ℝ) (Y : Plane) : |
| 544 | SmoothLoop.angularMean (fun θ => wave a n f mode phase Y θ * wave a n g mode phase Y θ) = |
| 545 | (a ^ 2 * covered n f Y * covered n g Y) * (1 / 2) := by |
| 546 | have heq : (fun θ => wave a n f mode phase Y θ * wave a n g mode phase Y θ) = |
| 547 | fun θ => (a ^ 2 * covered n f Y * covered n g Y) * |
| 548 | Real.cos ((mode : ℝ) * θ + phase Y) ^ 2 := by |
| 549 | funext θ |
| 550 | unfold wave |
| 551 | ring |
| 552 | rw [heq, SmoothLoop.angularMean_const_mul, TorusAverages.angularMean_cos_sq_harmonic mode hmode] |
| 553 | |
| 554 | theorem angularMean_wave_product_continuous (a : ℝ) (n : ℕ) {f g : Plane → ℝ} |
| 555 | (hf : Continuous f) (hcf : HasCompactSupport f) (hg : Continuous g) (hcg : HasCompactSupport g) |
| 556 | (mode : ℤ) (hmode : mode ≠ 0) (phase : Plane → ℝ) : |
| 557 | Continuous (fun Y => SmoothLoop.angularMean |
| 558 | (fun θ => wave a n f mode phase Y θ * wave a n g mode phase Y θ)) := by |
| 559 | simp_rw [angularMean_wave_product a n f g mode hmode phase] |
| 560 | exact ((continuous_const.mul (covered_continuous hf hcf n)).mul |
| 561 | (covered_continuous hg hcg n)).mul continuous_const |
| 562 | |
| 563 | theorem SlotSystem.wave_cross_zero {D h : ℝ} {vr vt : Plane} (sys : SlotSystem D h vr vt) |
| 564 | {L M : SlotColoring.Label} (hL : 1 ≤ L.1) (hM : 1 ≤ M.1) (hne : L ≠ M) |
| 565 | {f g : Plane → ℝ} (hf : support f ⊆ slotSet h sys.radius vr vt L) |
| 566 | (hg : support g ⊆ slotSet h sys.radius vr vt M) {q : ℝ} (hq : 0 < q) |
| 567 | (x : SlotColoring.Position) (Y : Plane) (θ a b : ℝ) (modeL modeM : ℤ) |
| 568 | (phaseL phaseM : Plane → ℝ) : |
| 569 | wave (a * physicalMask D L q x) (SlotColoring.nativeIndex h L.1) f modeL phaseL Y θ * |
| 570 | wave (b * physicalMask D M q x) (SlotColoring.nativeIndex h M.1) g modeM phaseM Y θ = 0 := by |
| 571 | have hz := sys.cross_product_zero hL hM hne hf hg hq x Y |
| 572 | unfold wave |
| 573 | calc |
| 574 | _ = (a * b * Real.cos ((modeL : ℝ) * θ + phaseL Y) * |
| 575 | Real.cos ((modeM : ℝ) * θ + phaseM Y)) * |
| 576 | ((physicalMask D L q x * covered (SlotColoring.nativeIndex h L.1) f Y) * |
| 577 | (physicalMask D M q x * covered (SlotColoring.nativeIndex h M.1) g Y)) := by ring |
| 578 | _ = 0 := by rw [hz, mul_zero] |
| 579 | |
| 580 | abbrev UnsignedLabel := ℕ × SlotColoring.Grid |
| 581 | |
| 582 | noncomputable def signedLabel (U : UnsignedLabel) (j : Fin 2) : SlotColoring.Label := |
| 583 | (U.1, U.2, if j = 0 then false else true) |
| 584 | |
| 585 | theorem signedLabel_injective (U : UnsignedLabel) : Function.Injective (signedLabel U) := by |
| 586 | intro i j hij |
| 587 | fin_cases i <;> fin_cases j <;> simp_all [signedLabel] |
| 588 | |
| 589 | noncomputable def mask (D : ℝ) (U : UnsignedLabel) (q : ℝ) (x : SlotColoring.Position) : ℝ := |
| 590 | physicalMask D (signedLabel U 0) q x |
| 591 | |
| 592 | theorem physicalMask_signedLabel (D : ℝ) (U : UnsignedLabel) (j : Fin 2) (q : ℝ) |
| 593 | (x : SlotColoring.Position) : physicalMask D (signedLabel U j) q x = mask D U q x := rfl |
| 594 | |
| 595 | structure PairData {D h : ℝ} {vr vt : Plane} (sys : SlotSystem D h vr vt) (U : UnsignedLabel) where |
| 596 | pulses : Fin 2 → Pulse |
| 597 | ci : Vec2 |
| 598 | ci_pos : ∀ j, 0 < ci j |
| 599 | fits : ∀ j, support (pulses j).ψ ⊆ Icc 0 (2 * sys.radius / ci j) |
| 600 | modes : Fin 2 → ℤ |
| 601 | modes_ne : ∀ j, modes j ≠ 0 |
| 602 | phases : Fin 2 → Plane → ℝ |
| 603 | |
| 604 | noncomputable def PairData.matrix {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} {U : UnsignedLabel} |
| 605 | (P : PairData sys U) : Mat2 := pairMatrix vr vt sys.radius P.ci P.pulses |
| 606 | |
| 607 | noncomputable def PairData.rawRadial {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} {U : UnsignedLabel} |
| 608 | (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j : Fin 2) : Plane → ℝ := |
| 609 | nativePulse vr vt (slotCenter h (signedLabel U j)) hdet (P.ci j) sys.radius |
| 610 | ((P.pulses j).radialProfile sys.radius) |
| 611 | |
| 612 | noncomputable def PairData.rawTangent {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} {U : UnsignedLabel} |
| 613 | (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j i : Fin 2) : Plane → ℝ := |
| 614 | nativePulse vr vt (slotCenter h (signedLabel U j)) hdet (P.ci j) sys.radius |
| 615 | ((P.pulses j).tangentProfile sys.radius i) |
| 616 | |
| 617 | theorem PairData.rawRadial_support {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 618 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j : Fin 2) : |
| 619 | support (P.rawRadial hdet j) ⊆ slotSet h sys.radius vr vt (signedLabel U j) := |
| 620 | native_cutoff_support vr vt _ hdet (P.ci_pos j) sys.radius_pos (P.fits j) |
| 621 | |
| 622 | theorem PairData.rawTangent_support {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 623 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j i : Fin 2) : |
| 624 | support (P.rawTangent hdet j i) ⊆ slotSet h sys.radius vr vt (signedLabel U j) := |
| 625 | native_cutoff_support vr vt (slotCenter h (signedLabel U j)) hdet |
| 626 | (ψ := (P.pulses j).ψ) (f := fun v => (P.pulses j).t v i) |
| 627 | (P.ci_pos j) sys.radius_pos (P.fits j) |
| 628 | |
| 629 | theorem PairData.rawRadial_continuous {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 630 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j : Fin 2) : |
| 631 | Continuous (P.rawRadial hdet j) := |
| 632 | nativePulse_continuous vr vt _ hdet (P.ci_pos j).ne' ((P.pulses j).radialProfile_continuous _) |
| 633 | |
| 634 | theorem PairData.rawTangent_continuous {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 635 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j i : Fin 2) : |
| 636 | Continuous (P.rawTangent hdet j i) := |
| 637 | nativePulse_continuous vr vt _ hdet (P.ci_pos j).ne' ((P.pulses j).tangentProfile_continuous _ i) |
| 638 | |
| 639 | theorem PairData.rawRadial_compact {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 640 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j : Fin 2) : |
| 641 | HasCompactSupport (P.rawRadial hdet j) := |
| 642 | nativePulse_compact vr vt _ hdet (P.ci_pos j).ne' ((P.pulses j).radialProfile_compact sys.radius_pos) |
| 643 | |
| 644 | theorem PairData.rawTangent_compact {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 645 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (j i : Fin 2) : |
| 646 | HasCompactSupport (P.rawTangent hdet j i) := |
| 647 | nativePulse_compact vr vt _ hdet (P.ci_pos j).ne' ((P.pulses j).tangentProfile_compact sys.radius_pos i) |
| 648 | |
| 649 | /-- A finite family with the actual physical masks and actual slot supports. |
| 650 | All cross terms vanish pointwise, regardless of repeated angular modes. -/ |
| 651 | theorem SlotSystem.finite_wave_covariance {ι : Type*} {D h : ℝ} {vr vt : Plane} |
| 652 | (sys : SlotSystem D h vr vt) (s : Finset ι) (label : ι → SlotColoring.Label) |
| 653 | (hlabel : Set.InjOn label (s : Set ι)) (hlevel : ∀ a ∈ s, 1 ≤ (label a).1) |
| 654 | (f g : ι → Plane → ℝ) |
| 655 | (hf : ∀ a ∈ s, support (f a) ⊆ slotSet h sys.radius vr vt (label a)) |
| 656 | (hg : ∀ a ∈ s, support (g a) ⊆ slotSet h sys.radius vr vt (label a)) |
| 657 | (hfc : ∀ a ∈ s, Continuous (f a)) (hfs : ∀ a ∈ s, HasCompactSupport (f a)) |
| 658 | (hgc : ∀ a ∈ s, Continuous (g a)) (hgs : ∀ a ∈ s, HasCompactSupport (g a)) |
| 659 | (mode : ι → ℤ) (hmode : ∀ a ∈ s, mode a ≠ 0) (phase : ι → Plane → ℝ) (scale : ι → ℝ) |
| 660 | {q : ℝ} (hq : 0 < q) (x : SlotColoring.Position) : |
| 661 | doubleAverage (fun Y θ => |
| 662 | (∑ a ∈ s, wave (scale a * physicalMask D (label a) q x) |
| 663 | (SlotColoring.nativeIndex h (label a).1) (f a) (mode a) (phase a) Y θ) * |
| 664 | (∑ a ∈ s, wave (scale a * physicalMask D (label a) q x) |
| 665 | (SlotColoring.nativeIndex h (label a).1) (g a) (mode a) (phase a) Y θ)) = |
| 666 | ∑ a ∈ s, doubleAverage (fun Y θ => |
| 667 | wave (scale a * physicalMask D (label a) q x) |
| 668 | (SlotColoring.nativeIndex h (label a).1) (f a) (mode a) (phase a) Y θ * |
| 669 | wave (scale a * physicalMask D (label a) q x) |
| 670 | (SlotColoring.nativeIndex h (label a).1) (g a) (mode a) (phase a) Y θ) := by |
| 671 | have heq : (fun Y θ => |
| 672 | (∑ a ∈ s, wave (scale a * physicalMask D (label a) q x) |
| 673 | (SlotColoring.nativeIndex h (label a).1) (f a) (mode a) (phase a) Y θ) * |
| 674 | (∑ a ∈ s, wave (scale a * physicalMask D (label a) q x) |
| 675 | (SlotColoring.nativeIndex h (label a).1) (g a) (mode a) (phase a) Y θ)) = |
| 676 | fun Y θ => ∑ a ∈ s, |
| 677 | wave (scale a * physicalMask D (label a) q x) |
| 678 | (SlotColoring.nativeIndex h (label a).1) (f a) (mode a) (phase a) Y θ * |
| 679 | wave (scale a * physicalMask D (label a) q x) |
| 680 | (SlotColoring.nativeIndex h (label a).1) (g a) (mode a) (phase a) Y θ := by |
| 681 | funext Y θ |
| 682 | apply sum_product_diagonal |
| 683 | intro a ha b hb hab |
| 684 | exact sys.wave_cross_zero (hlevel a ha) (hlevel b hb) |
| 685 | (fun he => hab (hlabel ha hb he)) (hf a ha) (hg b hb) hq x Y θ |
| 686 | (scale a) (scale b) (mode a) (mode b) (phase a) (phase b) |
| 687 | rw [heq] |
| 688 | apply doubleAverage_sum |
| 689 | · intro a ha Y |
| 690 | exact (wave_continuous_theta _ _ _ _ _ _).mul (wave_continuous_theta _ _ _ _ _ _) |
| 691 | · intro a ha |
| 692 | exact angularMean_wave_product_continuous _ _ (hfc a ha) (hfs a ha) (hgc a ha) (hgs a ha) |
| 693 | (mode a) (hmode a ha) (phase a) |
| 694 | |
| 695 | noncomputable def PairData.radialWave {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} {U : UnsignedLabel} |
| 696 | (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) |
| 697 | (outer ε : ℝ) (T : Vec2) (q : ℝ) (x : SlotColoring.Position) (j : Fin 2) : Plane → ℝ → ℝ := |
| 698 | wave (outer * amplitude ε (mask D U q x) P.matrix T j) |
| 699 | (SlotColoring.nativeIndex h U.1) (P.rawRadial hdet j) (P.modes j) (P.phases j) |
| 700 | |
| 701 | noncomputable def PairData.tangentWave {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} {U : UnsignedLabel} |
| 702 | (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) |
| 703 | (outer ε : ℝ) (T : Vec2) (q : ℝ) (x : SlotColoring.Position) (j i : Fin 2) : Plane → ℝ → ℝ := |
| 704 | wave (outer * amplitude ε (mask D U q x) P.matrix T j) |
| 705 | (SlotColoring.nativeIndex h U.1) (P.rawTangent hdet j i) (P.modes j) (P.phases j) |
| 706 | |
| 707 | theorem PairData.diagonal_covariance {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 708 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) |
| 709 | (outer ε : ℝ) (T : Vec2) (q : ℝ) (x : SlotColoring.Position) (j i : Fin 2) : |
| 710 | doubleAverage (fun Y θ => P.radialWave hdet outer ε T q x j Y θ * |
| 711 | P.tangentWave hdet outer ε T q x j i Y θ) = |
| 712 | (outer * amplitude ε (mask D U q x) P.matrix T j) ^ 2 * P.matrix i j := by |
| 713 | have h := (P.pulses j).wave_covariance vr vt (slotCenter h (signedLabel U j)) hdet |
| 714 | (P.ci j) sys.radius (P.ci_pos j) sys.radius_pos |
| 715 | (slotSet h sys.radius vr vt (signedLabel U j)) (sys.injective _) |
| 716 | (P.rawRadial_support hdet j) (fun i => P.rawTangent_support hdet j i) |
| 717 | (outer * amplitude ε (mask D U q x) P.matrix T j) |
| 718 | (SlotColoring.nativeIndex h U.1) (P.phases j) (P.modes j) (P.modes_ne j) i |
| 719 | simpa only [PairData.radialWave, PairData.tangentWave, PairData.rawRadial, PairData.rawTangent, |
| 720 | PairData.matrix, pairMatrix, mul_assoc] using h |
| 721 | |
| 722 | theorem PairData.diagonal_pair_reconstruct {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} |
| 723 | {U : UnsignedLabel} (P : PairData sys U) (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) |
| 724 | (outer ε : ℝ) (hε : 0 ≤ ε) {T : Vec2} (hcone : SmoothCovariance.StrictCone P.matrix T) |
| 725 | (q : ℝ) (x : SlotColoring.Position) (i : Fin 2) : |
| 726 | (∑ j : Fin 2, doubleAverage (fun Y θ => P.radialWave hdet outer ε T q x j Y θ * |
| 727 | P.tangentWave hdet outer ε T q x j i Y θ)) = |
| 728 | outer ^ 2 * ε * mask D U q x ^ 2 * T i := by |
| 729 | simp_rw [P.diagonal_covariance, mul_pow] |
| 730 | simp_rw [mul_assoc] |
| 731 | rw [← Finset.mul_sum, weighted_columns_reconstruct ε (mask D U q x) hε hcone i] |
| 732 | ring |
| 733 | |
| 734 | /-! ## The actual physical partition and the physical covariance scale -/ |
| 735 | |
| 736 | theorem mask_locallyFinite (D : ℝ) : |
| 737 | LocallyFinite fun U : UnsignedLabel => |
| 738 | support (fun z : Ioi (0 : ℝ) × SlotColoring.Position => mask D U z.1 z.2) := by |
| 739 | have hn : LocallyFinite fun n : ℕ => |
| 740 | support (fun q : Ioi (0 : ℝ) => SquaredPartition.dyadicMask (n : ℤ) q) := |
| 741 | SquaredPartition.dyadicMask_locallyFinite.comp_injective Int.ofNat_injective |
| 742 | have ho := hn.preimage_continuous |
| 743 | (continuous_fst : Continuous (Prod.fst : Ioi (0 : ℝ) × SlotColoring.Position → Ioi (0 : ℝ))) |
| 744 | have hi (n : ℕ) : LocallyFinite fun k : SlotColoring.Grid => |
| 745 | (Prod.snd : Ioi (0 : ℝ) × SlotColoring.Position → SlotColoring.Position) ⁻¹' |
| 746 | support (SquaredPartition.physicalSlowMask D n k) := |
| 747 | (SquaredPartition.physicalSlowMask_locallyFinite D n).preimage_continuous continuous_snd |
| 748 | have hh := SquaredPartition.locallyFinite_pair_inter ho hi |
| 749 | convert! hh using 1 |
| 750 | funext U |
| 751 | ext z |
| 752 | simp only [mem_support, mask, physicalMask, signedLabel, mul_ne_zero_iff, mem_inter_iff, mem_preimage] |
| 753 | |
| 754 | noncomputable def tailLabel (N : ℕ) (U : UnsignedLabel) : UnsignedLabel := (U.1 + N, U.2) |
| 755 | |
| 756 | theorem tailLabel_injective (N : ℕ) : Function.Injective (tailLabel N) := by |
| 757 | intro U V h |
| 758 | apply Prod.ext |
| 759 | · exact Nat.add_right_cancel (congrArg Prod.fst h) |
| 760 | · simpa only [tailLabel] using congrArg (fun z : UnsignedLabel => z.2) h |
| 761 | |
| 762 | theorem finite_active_masks (D : ℝ) (N : ℕ) {q : ℝ} (hq : 0 < q) (x : SlotColoring.Position) : |
| 763 | (support (fun U : UnsignedLabel => mask D (tailLabel N U) q x)).Finite := |
| 764 | ((mask_locallyFinite D).point_finite (⟨q, hq⟩, x)).preimage (tailLabel_injective N).injOn |
| 765 | |
| 766 | theorem physical_mask_tail_sum_sq (D : ℝ) (N : ℕ) {q : ℝ} (hq : 0 < q) |
| 767 | (hqN : q ≤ ChartScales.Q N) (x : SlotColoring.Position) : |
| 768 | (∑ᶠ U : UnsignedLabel, mask D (tailLabel N U) q x ^ 2) = 1 := by |
| 769 | have hf : (support (fun U : UnsignedLabel => mask D (tailLabel N U) q x ^ 2)).Finite := by |
| 770 | apply (finite_active_masks D N hq x).subset |
| 771 | intro U hU hz |
| 772 | exact hU (by simp [hz]) |
| 773 | rw [SquaredPartition.finsum_pair_eq hf] |
| 774 | have hrow (n : ℕ) : |
| 775 | (∑ᶠ k : SlotColoring.Grid, mask D (tailLabel N (n, k)) q x ^ 2) = |
| 776 | SquaredPartition.dyadicMask ((n + N : ℕ) : ℤ) q ^ 2 := by |
| 777 | have hk : (support (fun k : SlotColoring.Grid => |
| 778 | SquaredPartition.physicalSlowMask D (n + N) k x ^ 2)).Finite := by |
| 779 | apply ((SquaredPartition.physicalSlowMask_locallyFinite D (n + N)).point_finite x).subset |
| 780 | intro k hk hz |
| 781 | exact hk (by simp [hz]) |
| 782 | simp only [mask, physicalMask, signedLabel, tailLabel, mul_pow] |
| 783 | rw [← mul_finsum _ _, SquaredPartition.physicalSlowMask_sum_sq, mul_one] |
| 784 | simp_rw [hrow] |
| 785 | exact SquaredPartition.dyadicMask_tail_sum_sq N hq hqN |
| 786 | |
| 787 | noncomputable def velocityExponent (h : ℝ) : ℝ := 1 / 2 + h |
| 788 | |
| 789 | /-- The exact scalar change from chart covariance to physical covariance. |
| 790 | The chart target contains `(Q/q)^(A+1/2)` and `A=1/2+h`. -/ |
| 791 | theorem physical_scale_identity {Q q : ℝ} (hQ : 0 < Q) (hq : 0 < q) (h : ℝ) : |
| 792 | (Q ^ (-velocityExponent h)) ^ 2 * Q ^ h * |
| 793 | (Q / q) ^ (velocityExponent h + 1 / 2) = q ^ (-velocityExponent h - 1 / 2) := by |
| 794 | rw [← Real.rpow_mul_natCast hQ.le, Real.div_rpow hQ.le hq.le] |
| 795 | rw [← Real.rpow_add hQ] |
| 796 | rw [← mul_div_assoc, ← Real.rpow_add hQ] |
| 797 | norm_num only [Nat.cast_ofNat] |
| 798 | have he : (-velocityExponent h * (2 : ℝ) + h) + (velocityExponent h + 1 / 2) = 0 := by |
| 799 | unfold velocityExponent |
| 800 | ring |
| 801 | rw [he, Real.rpow_zero, one_div, ← Real.rpow_neg hq.le] |
| 802 | congr 1 |
| 803 | ring |
| 804 | |
| 805 | theorem physical_viscosity_scale {Q : ℝ} (hQ : 0 < Q) (h : ℝ) : |
| 806 | (Q ^ (-velocityExponent h)) ^ 2 * Q ^ h = Q ^ (-2 * velocityExponent h) * Q ^ h := by |
| 807 | rw [← Real.rpow_mul_natCast hQ.le] |
| 808 | congr 2 |
| 809 | ring |
| 810 | |
| 811 | noncomputable def constructedSlotSystem (D h : ℝ) (hh : 0 ≤ h) (vr vt : Plane) : SlotSystem D h vr vt := |
| 812 | Classical.choice (exists_slotSystem D h hh vr vt) |
| 813 | |
| 814 | noncomputable def signedTailLabel (N : ℕ) (a : UnsignedLabel × Fin 2) : SlotColoring.Label := |
| 815 | signedLabel (tailLabel N a.1) a.2 |
| 816 | |
| 817 | theorem signedTailLabel_injective (N : ℕ) : Function.Injective (signedTailLabel N) := by |
| 818 | intro a b hab |
| 819 | have hu : a.1 = b.1 := by |
| 820 | apply tailLabel_injective N |
| 821 | apply Prod.ext |
| 822 | · simpa only [signedTailLabel, signedLabel] using |
| 823 | congrArg (fun L : SlotColoring.Label => L.1) hab |
| 824 | · simpa only [signedTailLabel, signedLabel] using |
| 825 | congrArg (fun L : SlotColoring.Label => L.2.1) hab |
| 826 | apply Prod.ext hu |
| 827 | apply signedLabel_injective (tailLabel N b.1) |
| 828 | simpa only [signedTailLabel, hu] using hab |
| 829 | |
| 830 | /-- The complete finite-active-label formula, including both signs and every |
| 831 | cross-label product. No pairwise distinction of angular frequencies is used. -/ |
| 832 | theorem finite_pair_covariance {D h : ℝ} {vr vt : Plane} (sys : SlotSystem D h vr vt) |
| 833 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (N : ℕ) (hN : 1 ≤ N) |
| 834 | (P : (U : UnsignedLabel) → PairData sys (tailLabel N U)) |
| 835 | (outer ε : UnsignedLabel → ℝ) (T : UnsignedLabel → Vec2) (F : Finset UnsignedLabel) |
| 836 | (hε : ∀ U ∈ F, 0 ≤ ε U) (hcone : ∀ U ∈ F, SmoothCovariance.StrictCone (P U).matrix (T U)) |
| 837 | {q : ℝ} (hq : 0 < q) (x : SlotColoring.Position) (i : Fin 2) : |
| 838 | doubleAverage (fun Y θ => |
| 839 | (∑ a ∈ F.product (Finset.univ : Finset (Fin 2)), |
| 840 | (P a.1).radialWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 Y θ) * |
| 841 | (∑ a ∈ F.product (Finset.univ : Finset (Fin 2)), |
| 842 | (P a.1).tangentWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 i Y θ)) = |
| 843 | ∑ U ∈ F, outer U ^ 2 * ε U * mask D (tailLabel N U) q x ^ 2 * T U i := by |
| 844 | let s := F.product (Finset.univ : Finset (Fin 2)) |
| 845 | have havg := sys.finite_wave_covariance s (signedTailLabel N) |
| 846 | (signedTailLabel_injective N).injOn |
| 847 | (fun a _ => by change 1 ≤ a.1.1 + N; omega) |
| 848 | (fun a => (P a.1).rawRadial hdet a.2) |
| 849 | (fun a => (P a.1).rawTangent hdet a.2 i) |
| 850 | (fun a _ => (P a.1).rawRadial_support hdet a.2) |
| 851 | (fun a _ => (P a.1).rawTangent_support hdet a.2 i) |
| 852 | (fun a _ => (P a.1).rawRadial_continuous hdet a.2) |
| 853 | (fun a _ => (P a.1).rawRadial_compact hdet a.2) |
| 854 | (fun a _ => (P a.1).rawTangent_continuous hdet a.2 i) |
| 855 | (fun a _ => (P a.1).rawTangent_compact hdet a.2 i) |
| 856 | (fun a => (P a.1).modes a.2) (fun a _ => (P a.1).modes_ne a.2) |
| 857 | (fun a => (P a.1).phases a.2) |
| 858 | (fun a => outer a.1 * Real.sqrt (ε a.1) * SmoothCovariance.amplitudes (P a.1).matrix (T a.1) a.2) |
| 859 | hq x |
| 860 | have hdiag : doubleAverage (fun Y θ => |
| 861 | (∑ a ∈ s, (P a.1).radialWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 Y θ) * |
| 862 | (∑ a ∈ s, (P a.1).tangentWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 i Y θ)) = |
| 863 | ∑ a ∈ s, doubleAverage (fun Y θ => |
| 864 | (P a.1).radialWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 Y θ * |
| 865 | (P a.1).tangentWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 i Y θ) := by |
| 866 | simpa only [PairData.radialWave, PairData.tangentWave, amplitude, signedTailLabel, |
| 867 | physicalMask_signedLabel, signedLabel, physicalMask, mask, mul_assoc] using havg |
| 868 | change doubleAverage _ = _ |
| 869 | rw [hdiag] |
| 870 | apply (Finset.sum_product F Finset.univ _).trans |
| 871 | apply Finset.sum_congr rfl |
| 872 | intro U hU |
| 873 | exact (P U).diagonal_pair_reconstruct hdet (outer U) (ε U) (hε U hU) (hcone U hU) q x i |
| 874 | |
| 875 | noncomputable def assembledRadial {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} {N : ℕ} |
| 876 | (P : (U : UnsignedLabel) → PairData sys (tailLabel N U)) |
| 877 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (outer ε : UnsignedLabel → ℝ) |
| 878 | (T : UnsignedLabel → Vec2) (q : ℝ) (x : SlotColoring.Position) (Y : Plane) (θ : ℝ) : ℝ := |
| 879 | ∑ᶠ a : UnsignedLabel × Fin 2, (P a.1).radialWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 Y θ |
| 880 | |
| 881 | noncomputable def assembledTangent {D h : ℝ} {vr vt : Plane} {sys : SlotSystem D h vr vt} {N : ℕ} |
| 882 | (P : (U : UnsignedLabel) → PairData sys (tailLabel N U)) |
| 883 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (outer ε : UnsignedLabel → ℝ) |
| 884 | (T : UnsignedLabel → Vec2) (q : ℝ) (x : SlotColoring.Position) (i : Fin 2) (Y : Plane) (θ : ℝ) : ℝ := |
| 885 | ∑ᶠ a : UnsignedLabel × Fin 2, (P a.1).tangentWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 i Y θ |
| 886 | |
| 887 | /-- At a fixed positive physical point the same finite active set works for |
| 888 | every auxiliary point and angle. Thus no limit/interchange assumption enters |
| 889 | the assembled covariance formula. -/ |
| 890 | theorem assembled_covariance {D h : ℝ} {vr vt : Plane} (sys : SlotSystem D h vr vt) |
| 891 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (N : ℕ) (hN : 1 ≤ N) |
| 892 | (P : (U : UnsignedLabel) → PairData sys (tailLabel N U)) |
| 893 | (outer ε : UnsignedLabel → ℝ) (T : UnsignedLabel → Vec2) |
| 894 | {q : ℝ} (hq : 0 < q) (x : SlotColoring.Position) |
| 895 | (hε : ∀ U, mask D (tailLabel N U) q x ≠ 0 → 0 ≤ ε U) |
| 896 | (hcone : ∀ U, mask D (tailLabel N U) q x ≠ 0 → |
| 897 | SmoothCovariance.StrictCone (P U).matrix (T U)) (i : Fin 2) : |
| 898 | doubleAverage (fun Y θ => assembledRadial P hdet outer ε T q x Y θ * |
| 899 | assembledTangent P hdet outer ε T q x i Y θ) = |
| 900 | ∑ᶠ U : UnsignedLabel, outer U ^ 2 * ε U * mask D (tailLabel N U) q x ^ 2 * T U i := by |
| 901 | classical |
| 902 | have hf := finite_active_masks D N hq x |
| 903 | let F := hf.toFinset |
| 904 | have hzero (U : UnsignedLabel) (hU : U ∉ F) : mask D (tailLabel N U) q x = 0 := by |
| 905 | by_contra hm |
| 906 | exact hU (hf.mem_toFinset.mpr hm) |
| 907 | have hr (Y : Plane) (θ : ℝ) : assembledRadial P hdet outer ε T q x Y θ = |
| 908 | ∑ a ∈ F.product (Finset.univ : Finset (Fin 2)), |
| 909 | (P a.1).radialWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 Y θ := by |
| 910 | apply finsum_eq_sum_of_support_subset |
| 911 | intro a ha |
| 912 | apply Finset.mem_product.mpr |
| 913 | refine ⟨?_, Finset.mem_univ _⟩ |
| 914 | by_contra hn |
| 915 | exact ha (by simp [PairData.radialWave, amplitude, wave, hzero a.1 hn]) |
| 916 | have ht (Y : Plane) (θ : ℝ) : assembledTangent P hdet outer ε T q x i Y θ = |
| 917 | ∑ a ∈ F.product (Finset.univ : Finset (Fin 2)), |
| 918 | (P a.1).tangentWave hdet (outer a.1) (ε a.1) (T a.1) q x a.2 i Y θ := by |
| 919 | apply finsum_eq_sum_of_support_subset |
| 920 | intro a ha |
| 921 | apply Finset.mem_product.mpr |
| 922 | refine ⟨?_, Finset.mem_univ _⟩ |
| 923 | by_contra hn |
| 924 | exact ha (by simp [PairData.tangentWave, amplitude, wave, hzero a.1 hn]) |
| 925 | simp_rw [hr, ht] |
| 926 | rw [finite_pair_covariance sys hdet N hN P outer ε T F |
| 927 | (fun U hU => hε U (hf.mem_toFinset.mp hU)) (fun U hU => hcone U (hf.mem_toFinset.mp hU)) hq x i] |
| 928 | symm |
| 929 | apply finsum_eq_sum_of_support_subset |
| 930 | intro U hU |
| 931 | by_contra hn |
| 932 | exact hU (by simp [hzero U hn]) |
| 933 | |
| 934 | noncomputable def physicalOuter (h : ℝ) (N : ℕ) (U : UnsignedLabel) : ℝ := |
| 935 | ChartScales.Q (U.1 + N) ^ (-velocityExponent h) |
| 936 | |
| 937 | noncomputable def physicalViscosity (h : ℝ) (N : ℕ) (U : UnsignedLabel) : ℝ := |
| 938 | ChartScales.epsilon h (U.1 + N) |
| 939 | |
| 940 | noncomputable def chartTarget (h q : ℝ) (N : ℕ) (T0 : Vec2) (U : UnsignedLabel) : Vec2 := |
| 941 | (ChartScales.Q (U.1 + N) / q) ^ (velocityExponent h + 1 / 2) • T0 |
| 942 | |
| 943 | /-- Exact leading radial/tangential physical covariance of the assembled |
| 944 | primary velocities. The matrix entries are the actual native pulse integrals, |
| 945 | the masks are the constructed physical partitions, and the cross terms vanish |
| 946 | by the constructed padded slots. -/ |
| 947 | theorem physical_primary_covariance {D h : ℝ} {vr vt : Plane} (sys : SlotSystem D h vr vt) |
| 948 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) (N : ℕ) (hN : 1 ≤ N) |
| 949 | (P : (U : UnsignedLabel) → PairData sys (tailLabel N U)) |
| 950 | {q : ℝ} (hq : 0 < q) (hqN : q ≤ ChartScales.Q N) (x : SlotColoring.Position) (T0 : Vec2) |
| 951 | (hcone : ∀ U, mask D (tailLabel N U) q x ≠ 0 → |
| 952 | SmoothCovariance.StrictCone (P U).matrix (chartTarget h q N T0 U)) (i : Fin 2) : |
| 953 | doubleAverage (fun Y θ => |
| 954 | assembledRadial P hdet (physicalOuter h N) (physicalViscosity h N) (chartTarget h q N T0) q x Y θ * |
| 955 | assembledTangent P hdet (physicalOuter h N) (physicalViscosity h N) (chartTarget h q N T0) q x i Y θ) = |
| 956 | q ^ (-velocityExponent h - 1 / 2) * T0 i := by |
| 957 | rw [assembled_covariance sys hdet N hN P (physicalOuter h N) (physicalViscosity h N) |
| 958 | (chartTarget h q N T0) hq x (fun U _ => (ChartScales.epsilon_pos h (U.1 + N)).le) hcone i] |
| 959 | have heq (U : UnsignedLabel) : physicalOuter h N U ^ 2 * physicalViscosity h N U * |
| 960 | mask D (tailLabel N U) q x ^ 2 * chartTarget h q N T0 U i = |
| 961 | mask D (tailLabel N U) q x ^ 2 * (q ^ (-velocityExponent h - 1 / 2) * T0 i) := by |
| 962 | unfold physicalOuter physicalViscosity chartTarget ChartScales.epsilon |
| 963 | simp only [Pi.smul_apply, smul_eq_mul] |
| 964 | calc |
| 965 | _ = mask D (tailLabel N U) q x ^ 2 * |
| 966 | ((ChartScales.Q (U.1 + N) ^ (-velocityExponent h)) ^ 2 * |
| 967 | ChartScales.Q (U.1 + N) ^ h * |
| 968 | (ChartScales.Q (U.1 + N) / q) ^ (velocityExponent h + 1 / 2)) * T0 i := by ring |
| 969 | _ = _ := by rw [physical_scale_identity (ChartScales.Q_pos _) hq h]; ring |
| 970 | simp_rw [heq] |
| 971 | have hf : (support (fun U : UnsignedLabel => mask D (tailLabel N U) q x ^ 2)).Finite := by |
| 972 | apply (finite_active_masks D N hq x).subset |
| 973 | intro U hU hz |
| 974 | exact hU (by simp [hz]) |
| 975 | rw [← finsum_mul _ _, physical_mask_tail_sum_sq D N hq hqN x, one_mul] |
| 976 | |
| 977 | /-! ## Instantiation by the actual pulse and rounding interfaces -/ |
| 978 | |
| 979 | noncomputable def PairData.ofSignedPulses {D h : ℝ} {vr vt : Plane} (sys : SlotSystem D h vr vt) |
| 980 | (U : UnsignedLabel) {r a A b B c₀ u E : ℝ} |
| 981 | (pulses : PulseCovariance.SignedPulsePair r a A b B c₀ u E) |
| 982 | (ci : Vec2) (hci : ∀ j, 0 < ci j) (hfit : ∀ j, ci j * r ^ 2 = 2 * sys.radius) |
| 983 | (modes : Fin 2 → ℤ) (hmodes : ∀ j, modes j ≠ 0) (phases : Fin 2 → Plane → ℝ) : PairData sys U where |
| 984 | pulses := fun j => ofTangentPulse (pulses j) |
| 985 | ci := ci |
| 986 | ci_pos := hci |
| 987 | fits := fun j => ofTangentPulse_fits (pulses j) (hci j) (hfit j) |
| 988 | modes := modes |
| 989 | modes_ne := hmodes |
| 990 | phases := phases |
| 991 | |
| 992 | /-- A compact strict-cone family yields one slot-length threshold for positive |
| 993 | inverse weights of the actual integrated columns, including the native Haar |
| 994 | and cosine prefactor. No model-column equality is assumed. -/ |
| 995 | theorem compact_actual_pair_strictCone |
| 996 | {X : Type*} [TopologicalSpace X] {K : Set X} (hK : IsCompact K) |
| 997 | {c₀ u m t : X → ℝ} (hc₀ : ContinuousOn c₀ K) (hu : ContinuousOn u K) |
| 998 | (hm : ContinuousOn m K) (ht : ContinuousOn t K) |
| 999 | (hc₀neg : ∀ p ∈ K, c₀ p < 0) (hupos : ∀ p ∈ K, 0 < u p) |
| 1000 | (hcone : ∀ p ∈ K, |Covariance.normalMagnitude (c₀ p) (u p) * t p| < u p * m p) |
| 1001 | {a A b B E : ℝ} (hE : 0 ≤ E) {vr vt : Plane} |
| 1002 | (hdet : vr.1 * vt.2 - vr.2 * vt.1 ≠ 0) {r0 : ℝ} (hr0 : 0 < r0) : |
| 1003 | ∃ R : ℝ, 1 ≤ R ∧ ∀ p ∈ K, ∀ r : ℝ, R ≤ r → |
| 1004 | ∀ pulses : PulseCovariance.SignedPulsePair r a A b B (c₀ p) (u p) E, |
| 1005 | ∀ ci : Vec2, (∀ j, 0 < ci j) → |
| 1006 | SmoothCovariance.StrictCone |
| 1007 | (pairMatrix vr vt r0 ci (fun j => ofTangentPulse (pulses j))) (Covariance.target (m p) (t p)) := by |
| 1008 | obtain ⟨R, hR, hpositive⟩ := PulseCovariance.compact_actual_positive_inverse_of_scalar_cone |
| 1009 | hK hc₀ hu hm ht hc₀neg hupos hcone hE |
| 1010 | refine ⟨R, hR, ?_⟩ |
| 1011 | intro p hp r hr pulses ci hci |
| 1012 | rw [pairMatrix_of_actual_pulses] |
| 1013 | apply (SmoothCovariance.weights_pos_iff _ _).mp |
| 1014 | exact (hpositive p hp r hr pulses (fun j => nativePrefactor vr vt r0 * ci j) |
| 1015 | (fun j => mul_pos (nativePrefactor_pos hdet hr0) (hci j))).2.1 |
| 1016 | |
| 1017 | noncomputable def roundedPhaseRemainder (k ε target pz x0 : ℝ) (F G : PhaseCalculus.Slow → ℝ) |
| 1018 | (s : PhaseCalculus.Slow) (v : Plane → ℝ) (Y : Plane) : ℝ := |
| 1019 | k * ((pz / ε) * s.2.1 + x0 * s.1 - |
| 1020 | v Y * (PhaseEstimates.roundedFrequency k target * F s + pz * G s)) |
| 1021 | |
| 1022 | theorem cosine_rounded_phase (k ε target pz x0 : ℝ) (hk : k ≠ 0) |
| 1023 | (F G : PhaseCalculus.Slow → ℝ) (s : PhaseCalculus.Slow) (v : Plane → ℝ) (Y : Plane) (θ : ℝ) : |
| 1024 | Real.cos (k * PhaseCalculus.phase ε (PhaseEstimates.roundedFrequency k target) pz x0 F G |
| 1025 | (s, θ, v Y)) = |
| 1026 | Real.cos ((PhaseEstimates.nonzeroRound (k * target) : ℝ) * θ + |
| 1027 | roundedPhaseRemainder k ε target pz x0 F G s v Y) := |
| 1028 | cosine_actual_phase k ε _ pz x0 F G s v _ (PhaseEstimates.roundedFrequency_integer hk target) Y θ |
| 1029 | |
| 1030 | theorem rounded_phase_cos_sq_mean (k ε target pz x0 : ℝ) (hk : k ≠ 0) |
| 1031 | (F G : PhaseCalculus.Slow → ℝ) (s : PhaseCalculus.Slow) (v : Plane → ℝ) (Y : Plane) : |
| 1032 | SmoothLoop.angularMean (fun θ => |
| 1033 | Real.cos (k * PhaseCalculus.phase ε (PhaseEstimates.roundedFrequency k target) pz x0 F G |
| 1034 | (s, θ, v Y)) ^ 2) = 1 / 2 := by |
| 1035 | simp_rw [cosine_rounded_phase k ε target pz x0 hk F G s v Y] |
| 1036 | exact TorusAverages.angularMean_cos_sq_harmonic _ (PhaseEstimates.nonzeroRound_ne_zero _) _ |
| 1037 | |
| 1038 | theorem actual_carrier_ne_zero (h : ℝ) (n : ℕ) : (ChartScales.carrier h n : ℝ) ≠ 0 := |
| 1039 | (Scaling.carrier_frequency_pos (ChartScales.epsilon_pos h n)).ne' |
| 1040 | |
| 1041 | theorem actual_carrier_cos_sq_mean (h : ℝ) (n : ℕ) (target pz x0 : ℝ) |
| 1042 | (F G : PhaseCalculus.Slow → ℝ) (s : PhaseCalculus.Slow) (v : Plane → ℝ) (Y : Plane) : |
| 1043 | SmoothLoop.angularMean (fun θ => |
| 1044 | Real.cos ((ChartScales.carrier h n : ℝ) * PhaseCalculus.phase (ChartScales.epsilon h n) |
| 1045 | (PhaseEstimates.roundedFrequency (ChartScales.carrier h n : ℝ) target) pz x0 F G |
| 1046 | (s, θ, v Y)) ^ 2) = 1 / 2 := |
| 1047 | rounded_phase_cos_sq_mean _ _ target pz x0 (actual_carrier_ne_zero h n) F G s v Y |
| 1048 | |
| 1049 | end NavierStokes.PartitionedCovariance |