import LinkedTower.S13 import LinkedTower.Spinor import LinkedTower.Hopf import LinkedTower.Tower import LinkedTower.Links import F02NavierStokes.LinearAlgebra3D import Mathlib.Analysis.SpecialFunctions.Exp /-! # Invertible Physical S¹³ Carrier, SU(2)/U(7) Frame Links, Mixed Itô Law, and Stereographic Inversion Formalizes Section 3 (`prop:carrier-inverse`, `prop:mixed-ito`, `eq:sp-spin`--`eq:sp-magnitude`) and the ESM3 stereographic complement identities (`SI2`--`SI14`) of F02, **directly reusing** Paul Cooper's existing `LinkedTower` Lean library: - `LinkedTower.Spinor.frame` & `complex_frame_special_unitary` -> exact `M(h)` and `U(7)` transition matrix `T_{αβ} = diag(M(h_{αβ}), I₅)` (`eq:sp-unitary`). - `LinkedTower.Links.moving_covariant_velocity` & `gauge_composition` -> exact mode connection transformation `Γ_β = T⁻¹ Γ_α T + T⁻¹ dT` (`eq:sp-mode-connection`). - `LinkedTower.Hopf` & `LinkedTower.Tower` -> unit-quaternion spin lifts, `Ad_q` rotations, signed spin distinctness (`q ≠ -q`), and reconstruction invariance `e_β Ad_{q_β} = e_α Ad_{q_α}`. - `LinkedTower.S13` -> exact bridge connecting nonnegative-`ψ` states of the 7-complex-mode carrier to `LinkedTower.S13.encode` / `decode`, plus concrete instantiation of `LinkedTower.S13.Frame` for reseeding `j_new = j Ad_h`. -/ namespace F02NavierStokes.PhysicalCarrierS13 open scoped Matrix BigOperators Quaternion open Matrix LinkedTower.Hopf LinkedTower.Spinor LinkedTower.Tower LinkedTower.Links open F02NavierStokes.LinearAlgebra3D noncomputable section /-! ## 1. Explicit orthonormal basis T₁..T₅ of Sym₀(ℝ³) (`Section 3.1`) -/ /-- The five explicit orthonormal traceless symmetric 3×3 matrices from `manuscript.tex` lines 309--311: `diag(1,-1,0)/√2`, `diag(1,1,-2)/√6`, and the three symmetric off-diagonals divided by `√2`. -/ def Tbasis : Fin 5 → Mat3 | ⟨0, _⟩ => (1 / Real.sqrt 2) • !![1, 0, 0; 0, -1, 0; 0, 0, 0] | ⟨1, _⟩ => (1 / Real.sqrt 6) • !![1, 0, 0; 0, 1, 0; 0, 0, -2] | ⟨2, _⟩ => (1 / Real.sqrt 2) • !![0, 1, 0; 1, 0, 0; 0, 0, 0] | ⟨3, _⟩ => (1 / Real.sqrt 2) • !![0, 0, 1; 0, 0, 0; 1, 0, 0] | ⟨4, _⟩ => (1 / Real.sqrt 2) • !![0, 0, 0; 0, 0, 1; 0, 1, 0] theorem Tbasis_sym (a : Fin 5) : (Tbasis a)ᵀ = Tbasis a := by fin_cases a <;> ext i j <;> fin_cases i <;> fin_cases j <;> simp [Tbasis] theorem Tbasis_trace (a : Fin 5) : (Tbasis a).trace = 0 := by fin_cases a <;> (simp [Tbasis, Matrix.trace, Matrix.diag, Fin.sum_univ_three]; try ring) theorem Tbasis_orthonormal (a b : Fin 5) : hsInner (Tbasis a) (Tbasis b) = if a = b then 1 else 0 := by have h2 : Real.sqrt 2 ^ 2 = 2 := Real.sq_sqrt (by norm_num) have h6 : Real.sqrt 6 ^ 2 = 6 := Real.sq_sqrt (by norm_num) have h2ne : Real.sqrt 2 ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr (by norm_num)) have h6ne : Real.sqrt 6 ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr (by norm_num)) fin_cases a <;> fin_cases b <;> simp only [hsInner_eq_sum, Tbasis, Fin.sum_univ_three, Matrix.smul_apply, Matrix.of_apply, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.head_cons, Matrix.tail_cons, smul_eq_mul, Fin.mk.injEq] all_goals norm_num try field_simp [h2ne, h6ne] try nlinarith [h2, h6] /-- Reconstruct a traceless symmetric 3×3 tensor from its five real coordinates. -/ def reconstructL (ℓ : Fin 5 → ℝ) : Mat3 := ∑ a : Fin 5, ℓ a • Tbasis a theorem reconstructL_sym (ℓ : Fin 5 → ℝ) : (reconstructL ℓ)ᵀ = reconstructL ℓ := by simp only [reconstructL, Matrix.transpose_sum, Matrix.transpose_smul, Tbasis_sym] theorem reconstructL_trace (ℓ : Fin 5 → ℝ) : (reconstructL ℓ).trace = 0 := by simp [reconstructL, Matrix.trace_sum, Matrix.trace_smul, Tbasis_trace] theorem reconstructL_hsInner (ℓ₁ ℓ₂ : Fin 5 → ℝ) : hsInner (reconstructL ℓ₁) (reconstructL ℓ₂) = ∑ a : Fin 5, ℓ₁ a * ℓ₂ a := by have hbil : ∀ (A B : Fin 5 → Mat3), hsInner (∑ a, A a) (∑ b, B b) = ∑ a, ∑ b, hsInner (A a) (B b) := by intro A B simp only [hsInner, Matrix.transpose_sum, Finset.sum_mul, Finset.mul_sum, Matrix.trace_sum] exact Finset.sum_comm rw [reconstructL, reconstructL, hbil] apply Finset.sum_congr rfl intro a _ have hsc : ∀ b : Fin 5, hsInner (ℓ₁ a • Tbasis a) (ℓ₂ b • Tbasis b) = ℓ₁ a * ℓ₂ b * hsInner (Tbasis a) (Tbasis b) := by intro b simp only [hsInner, Matrix.transpose_smul, Matrix.smul_mul, Matrix.mul_smul, Matrix.trace_smul, smul_eq_mul] ring simp only [hsc, Tbasis_orthonormal, mul_ite, mul_one, mul_zero, Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte] theorem reconstructL_hsNormSq (ℓ : Fin 5 → ℝ) : hsNormSq (reconstructL ℓ) = LinkedTower.S13.sqNorm ℓ := by rw [hsNormSq, reconstructL_hsInner] simp [LinkedTower.S13.sqNorm, pow_two] theorem reconstructL_extract (ℓ : Fin 5 → ℝ) (a : Fin 5) : hsInner (Tbasis a) (reconstructL ℓ) = ℓ a := by have h := reconstructL_hsInner (fun i => if i = a then 1 else 0) ℓ have h1 : reconstructL (fun i => if i = a then 1 else 0) = Tbasis a := by simp [reconstructL] rw [h1] at h simpa using h /-! ## 2. Quaternions as ℂ² and exact U(7) transition via `LinkedTower.Spinor.frame` -/ /-- Identify `q = χ₁ + i_ℍ χ₂` with `(χ₁, χ₂) ∈ ℂ²` where `ℂ` is the right complex plane `ℂ_{k_ℍ}` (`manuscript.tex` lines 307, 317: `i_ℍ k_ℍ = -j_ℍ`). -/ def quatToC2 (q : Q) : ℂ × ℂ := (⟨q.re, q.imK⟩, ⟨q.imI, -q.imJ⟩) /-- Inverse of `quatToC2`. -/ def c2ToQuat (χ : ℂ × ℂ) : Q := ⟨χ.1.re, χ.2.re, -χ.2.im, χ.1.im⟩ theorem c2ToQuat_quatToC2 (q : Q) : c2ToQuat (quatToC2 q) = q := by ext <;> simp [c2ToQuat, quatToC2] theorem quatToC2_c2ToQuat (χ : ℂ × ℂ) : quatToC2 (c2ToQuat χ) = χ := by apply Prod.ext <;> apply Complex.ext <;> simp [c2ToQuat, quatToC2] theorem quatToC2_normSq (q : Q) : Complex.normSq (quatToC2 q).1 + Complex.normSq (quatToC2 q).2 = Quaternion.normSq q := by simp [quatToC2, Complex.normSq_apply, Quaternion.normSq_def'] ring /-- Left quaternion multiplication `h * q` acts on `(χ₁, χ₂)ᵀ ∈ ℂ²` by the exact matrix `LinkedTower.Spinor.frame h₁ h₂ = !![h₁, -conj h₂; h₂, conj h₁]` (`eq:sp-unitary`). -/ theorem quatToC2_mul (h q : Q) : let hχ := quatToC2 h let qχ := quatToC2 q let M := LinkedTower.Spinor.frame hχ.1 hχ.2 ![(quatToC2 (h * q)).1, (quatToC2 (h * q)).2] = M *ᵥ ![qχ.1, qχ.2] := by ext i fin_cases i · apply Complex.ext <;> simp [quatToC2, LinkedTower.Spinor.frame, mulVec, dotProduct, Fin.sum_univ_two] <;> ring · apply Complex.ext <;> simp [quatToC2, LinkedTower.Spinor.frame, mulVec, dotProduct, Fin.sum_univ_two] <;> ring /-- Exact 7×7 block-diagonal transition matrix `T_{αβ} = diag(M(h), I₅)` (`eq:sp-unitary`), constructed directly from `LinkedTower.Spinor.frame`. -/ def Tmatrix (h : Q) : Matrix (Fin 7) (Fin 7) ℂ := let hχ := quatToC2 h let M := LinkedTower.Spinor.frame hχ.1 hχ.2 Matrix.of fun i j => if hi : i.val < 2 then if hj : j.val < 2 then M ⟨i.val, hi⟩ ⟨j.val, hj⟩ else 0 else if i = j then 1 else 0 /-- `Tmatrix h` is unitary (`T* T = I₇` and `T T* = I₇`) for every unit quaternion `h`, directly proved from `LinkedTower.Spinor.complex_frame_special_unitary`. -/ theorem Tmatrix_unitary (h : Q) (hh : Quaternion.normSq h = 1) : (Tmatrix h)ᴴ * Tmatrix h = 1 ∧ Tmatrix h * (Tmatrix h)ᴴ = 1 := by have hnorm : Complex.normSq (quatToC2 h).1 + Complex.normSq (quatToC2 h).2 = 1 := by rw [quatToC2_normSq, hh] set M := LinkedTower.Spinor.frame (quatToC2 h).1 (quatToC2 h).2 obtain ⟨hL, hR, _⟩ := LinkedTower.Spinor.complex_frame_special_unitary (quatToC2 h).1 (quatToC2 h).2 hnorm have hT_lt : ∀ (i j : Fin 7) (hi : i.val < 2) (hj : j.val < 2), Tmatrix h i j = M ⟨i.val, hi⟩ ⟨j.val, hj⟩ := fun i j hi hj => by simp only [Tmatrix, M, Matrix.of_apply, hi, hj, ↓reduceDIte] have hT_lt_ge : ∀ (i j : Fin 7), i.val < 2 → ¬j.val < 2 → Tmatrix h i j = 0 := fun i j hi hj => by simp only [Tmatrix, Matrix.of_apply, hi, hj, ↓reduceDIte] have hT_ge : ∀ (i j : Fin 7), ¬i.val < 2 → Tmatrix h i j = if i = j then 1 else 0 := fun i j hi => by simp only [Tmatrix, Matrix.of_apply, hi, ↓reduceDIte] have hsum7 : ∀ f : Fin 7 → ℂ, (∑ k : Fin 7, f k) = f 0 + f 1 + f 2 + f 3 + f 4 + f 5 + f 6 := by intro f simp [Fin.sum_univ_succ] ring constructor · ext i j rw [Matrix.mul_apply, Matrix.one_apply] simp only [Matrix.conjTranspose_apply] by_cases hi : i.val < 2 <;> by_cases hj : j.val < 2 · rw [hsum7] have hz : ∀ k : Fin 7, ¬k.val < 2 → star (Tmatrix h k i) * Tmatrix h k j = 0 := by intro k hk have hki : k ≠ i := fun heq => hk (heq ▸ hi) simp [hT_ge k i hk, hki] rw [hz 2 (by decide), hz 3 (by decide), hz 4 (by decide), hz 5 (by decide), hz 6 (by decide)] simp only [add_zero] rw [hT_lt 0 i (by decide) hi, hT_lt 0 j (by decide) hj, hT_lt 1 i (by decide) hi, hT_lt 1 j (by decide) hj] have hMij := congrArg (fun A : Matrix (Fin 2) (Fin 2) ℂ => A ⟨i.val, hi⟩ ⟨j.val, hj⟩) hL simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, Fin.sum_univ_two, Matrix.one_apply, Fin.ext_iff] at hMij ⊢ exact hMij · have hij : i ≠ j := fun heq => hj (heq ▸ hi) simp only [hij, ↓reduceIte] apply Finset.sum_eq_zero; intro k _ by_cases hk : k.val < 2 · simp [hT_lt_ge k j hk hj] · have hki : k ≠ i := fun heq => hk (heq ▸ hi) simp [hT_ge k i hk, hki] · have hij : i ≠ j := fun heq => hi (heq.symm ▸ hj) simp only [hij, ↓reduceIte] apply Finset.sum_eq_zero; intro k _ by_cases hk : k.val < 2 · simp [hT_lt_ge k i hk hi] · have hkj : k ≠ j := fun heq => hk (heq ▸ hj) simp [hT_ge k j hk, hkj] · have hterm : ∀ k : Fin 7, star (Tmatrix h k i) * Tmatrix h k j = if k = i then (if k = j then 1 else 0) else 0 := by intro k by_cases hk : k.val < 2 · have hki : k ≠ i := fun heq => hi (heq ▸ hk) simp [hT_lt_ge k i hk hi, hki] · rw [hT_ge k i hk, hT_ge k j hk] by_cases hki : k = i <;> simp [hki] simp_rw [hterm] simp [Finset.sum_ite_eq'] · ext i j rw [Matrix.mul_apply, Matrix.one_apply] simp only [Matrix.conjTranspose_apply] by_cases hi : i.val < 2 <;> by_cases hj : j.val < 2 · rw [hsum7] have hz : ∀ k : Fin 7, ¬k.val < 2 → Tmatrix h i k * star (Tmatrix h j k) = 0 := by intro k hk simp [hT_lt_ge i k hi hk] rw [hz 2 (by decide), hz 3 (by decide), hz 4 (by decide), hz 5 (by decide), hz 6 (by decide)] simp only [add_zero] rw [hT_lt i 0 hi (by decide), hT_lt j 0 hj (by decide), hT_lt i 1 hi (by decide), hT_lt j 1 hj (by decide)] have hMij := congrArg (fun A : Matrix (Fin 2) (Fin 2) ℂ => A ⟨i.val, hi⟩ ⟨j.val, hj⟩) hR simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, Fin.sum_univ_two, Matrix.one_apply, Fin.ext_iff] at hMij ⊢ exact hMij · have hij : i ≠ j := fun heq => hj (heq ▸ hi) simp only [hij, ↓reduceIte] apply Finset.sum_eq_zero; intro k _ by_cases hk : k.val < 2 · have hjk : j ≠ k := fun heq => hj (heq ▸ hk) simp [hT_ge j k hj, hjk] · simp [hT_lt_ge i k hi hk] · have hij : i ≠ j := fun heq => hi (heq.symm ▸ hj) simp only [hij, ↓reduceIte] apply Finset.sum_eq_zero; intro k _ by_cases hk : k.val < 2 · have hik : i ≠ k := fun heq => hi (heq ▸ hk) simp [hT_ge i k hi, hik] · simp [hT_lt_ge j k hj hk] · have hterm : ∀ k : Fin 7, Tmatrix h i k * star (Tmatrix h j k) = if i = k then (if j = k then 1 else 0) else 0 := by intro k rw [hT_ge i k hi, hT_ge j k hj] by_cases hik : i = k <;> simp [hik] simp_rw [hterm] rw [Finset.sum_eq_single i] · by_cases hji : j = i · subst hji; simp · simp [hji, Ne.symm hji] · intro k _ hki; simp [Ne.symm hki] · intro hi_mem; exact absurd (Finset.mem_univ i) hi_mem /-- Mode connection transformation (`eq:sp-mode-connection`, lines 365--371): directly reuses `LinkedTower.Links.moving_covariant_velocity` and `gauge_composition`. -/ theorem mode_connection_covariant (T Ti dT Γ X dX : Matrix (Fin 7) (Fin 7) ℂ) (hinv : T * Ti = 1) : LinkedTower.Links.movedVelocity Ti dT X dX + LinkedTower.Links.gauge T Ti dT Γ * (Ti * X) = Ti * (dX + Γ * X) := LinkedTower.Links.moving_covariant_velocity T Ti dT Γ X dX hinv theorem mode_connection_cocycle (T₁ Ti₁ dT₁ T₂ Ti₂ dT₂ Γ : Matrix (Fin 7) (Fin 7) ℂ) (h1 : Ti₁ * T₁ = 1) : LinkedTower.Links.gauge T₂ Ti₂ dT₂ (LinkedTower.Links.gauge T₁ Ti₁ dT₁ Γ) = LinkedTower.Links.gauge (T₁ * T₂) (Ti₂ * Ti₁) (dT₁ * T₂ + T₁ * dT₂) Γ := LinkedTower.Links.gauge_composition T₁ Ti₁ dT₁ T₂ Ti₂ dT₂ Γ h1 /-! ## 3. Full 7-complex-mode Physical S¹³ Carrier (`prop:carrier-inverse`) -/ /-- Lifted physical payload `(q_α, ℓ₁..ℓ₅, v₁..v₃, ψ)` with signed attenuation `ψ ∈ ℝ`. -/ @[ext] structure PhysPayload where q : Q ℓ : Fin 5 → ℝ v : Vec3 ψ : ℝ /-- Admissibility: `q` is a unit quaternion (`|q|² = 1`); `ψ` is arbitrary real. -/ def PhysAdmissible (p : PhysPayload) : Prop := Quaternion.normSq p.q = 1 /-- Raw seven-mode complex vector `X_α ∈ ℂ⁷` (`eq:sp-packing`). -/ def packRaw (p : PhysPayload) : Fin 7 → ℂ := let χ := quatToC2 p.q ![χ.1, χ.2, ⟨p.ℓ 0, p.v 0⟩, ⟨p.ℓ 1, p.v 1⟩, ⟨p.ℓ 2, p.v 2⟩, ⟨p.ℓ 3, p.ψ⟩, ⟨p.ℓ 4, 1⟩] /-- Retained squared scale `Λ² = 2 + ‖L‖_HS² + |v|² + ψ²` (`eq:sp-packing`). -/ def rawNormSq (p : PhysPayload) : ℝ := 2 + LinkedTower.S13.sqNorm p.ℓ + vecSqNorm p.v + p.ψ ^ 2 /-- Retained positive scale `Λ = √(Λ²) ≥ √2`. -/ def rawNorm (p : PhysPayload) : ℝ := Real.sqrt (rawNormSq p) /-- Normalized 7-mode carrier `z_α = X_α / Λ ∈ S¹³ ⊂ ℂ⁷` (`eq:sp-packing`). -/ def encode7 (p : PhysPayload) : Fin 7 → ℂ := fun i => packRaw p i / (rawNorm p : ℂ) /-- Exact 12-dimensional physical submanifold `Σ ⊂ S¹³` (`eq:sp-image`). -/ def InPhysImage (z : Fin 7 → ℂ) : Prop := (∑ i : Fin 7, Complex.normSq (z i) = 1) ∧ 0 < (z 6).im ∧ Complex.normSq (z 0) + Complex.normSq (z 1) = ((z 6).im) ^ 2 /-- Explicit smooth inverse on `Σ` (`eq:sp-inverse`): zero division by `ρ` or `|v|`. -/ def decode7 (z : Fin 7 → ℂ) : PhysPayload := let Λ : ℝ := 1 / (z 6).im { q := c2ToQuat ((Λ : ℂ) * z 0, (Λ : ℂ) * z 1) ℓ := ![Λ * (z 2).re, Λ * (z 3).re, Λ * (z 4).re, Λ * (z 5).re, Λ * (z 6).re] v := ![Λ * (z 2).im, Λ * (z 3).im, Λ * (z 4).im] ψ := Λ * (z 5).im } theorem rawNormSq_ge_two (p : PhysPayload) : 2 ≤ rawNormSq p := by have h1 := LinkedTower.S13.sqNorm_nonneg p.ℓ have h2 := vecSqNorm_nonneg p.v have h3 := sq_nonneg p.ψ dsimp [rawNormSq] linarith theorem rawNorm_pos (p : PhysPayload) : 0 < rawNorm p := Real.sqrt_pos.mpr (by linarith [rawNormSq_ge_two p]) theorem rawNorm_ge_sqrt_two (p : PhysPayload) : Real.sqrt 2 ≤ rawNorm p := Real.sqrt_le_sqrt (rawNormSq_ge_two p) theorem rawNorm_sq (p : PhysPayload) : (rawNorm p) ^ 2 = rawNormSq p := Real.sq_sqrt (by linarith [rawNormSq_ge_two p]) theorem packRaw_normSq (p : PhysPayload) (hp : PhysAdmissible p) : ∑ i : Fin 7, Complex.normSq (packRaw p i) = rawNormSq p := by have hq : Complex.normSq (quatToC2 p.q).1 + Complex.normSq (quatToC2 p.q).2 = 1 := by rw [quatToC2_normSq, hp] have hsum7 : ∀ f : Fin 7 → ℝ, (∑ i : Fin 7, f i) = f 0 + f 1 + f 2 + f 3 + f 4 + f 5 + f 6 := by intro f; simp [Fin.sum_univ_succ]; ring rw [hsum7] simp only [packRaw, rawNormSq, LinkedTower.S13.sqNorm, vecSqNorm, Fin.sum_univ_five, Fin.sum_univ_three, pow_two] change Complex.normSq (quatToC2 p.q).1 + Complex.normSq (quatToC2 p.q).2 + (p.ℓ 0 * p.ℓ 0 + p.v 0 * p.v 0) + (p.ℓ 1 * p.ℓ 1 + p.v 1 * p.v 1) + (p.ℓ 2 * p.ℓ 2 + p.v 2 * p.v 2) + (p.ℓ 3 * p.ℓ 3 + p.ψ * p.ψ) + (p.ℓ 4 * p.ℓ 4 + 1 * 1) = 2 + (p.ℓ 0 * p.ℓ 0 + p.ℓ 1 * p.ℓ 1 + p.ℓ 2 * p.ℓ 2 + p.ℓ 3 * p.ℓ 3 + p.ℓ 4 * p.ℓ 4) + (p.v 0 * p.v 0 + p.v 1 * p.v 1 + p.v 2 * p.v 2) + p.ψ * p.ψ linarith [hq] /-- `encode7` lands inside the exact 12-dimensional submanifold `Σ ⊂ S¹³`. -/ theorem encode7_inPhysImage (p : PhysPayload) (hp : PhysAdmissible p) : InPhysImage (encode7 p) := by have hΛpos : 0 < rawNorm p := rawNorm_pos p have hΛsq : (rawNorm p) ^ 2 = rawNormSq p := rawNorm_sq p have hdiv_normSq : ∀ w : ℂ, Complex.normSq (w / (rawNorm p : ℂ)) = Complex.normSq w / (rawNorm p) ^ 2 := by intro w rw [map_div₀, Complex.normSq_ofReal, pow_two] have him6 : (encode7 p 6).im = 1 / rawNorm p := by simp [encode7, packRaw, Complex.div_ofReal_im] refine ⟨?_, ?_, ?_⟩ · simp_rw [encode7, hdiv_normSq, ← Finset.sum_div, packRaw_normSq p hp, hΛsq] exact div_self (by linarith [rawNormSq_ge_two p]) · rw [him6]; exact one_div_pos.mpr hΛpos · rw [him6] simp_rw [encode7, hdiv_normSq, ← add_div] have hq : Complex.normSq (packRaw p 0) + Complex.normSq (packRaw p 1) = 1 := by simpa [packRaw] using (quatToC2_normSq p.q).trans hp rw [hq, one_div, one_div, inv_pow] /-- Left inverse `decode7 (encode7 p) = p`, regular everywhere including `ℓ = 0` and `v = 0` (`prop:carrier-inverse`). -/ theorem decode7_encode7 (p : PhysPayload) : decode7 (encode7 p) = p := by have hΛne : rawNorm p ≠ 0 := ne_of_gt (rawNorm_pos p) have him6 : (encode7 p 6).im = 1 / rawNorm p := by simp [encode7, packRaw, Complex.div_ofReal_im] have hΛrec : 1 / (encode7 p 6).im = rawNorm p := by rw [him6, one_div_one_div] have hq0 : ((1 / (encode7 p 6).im : ℝ) : ℂ) * encode7 p 0 = (quatToC2 p.q).1 := by rw [hΛrec, encode7, packRaw] simp [mul_div_cancel₀ _ (Complex.ofReal_ne_zero.mpr hΛne)] have hq1 : ((1 / (encode7 p 6).im : ℝ) : ℂ) * encode7 p 1 = (quatToC2 p.q).2 := by rw [hΛrec, encode7, packRaw] simp [mul_div_cancel₀ _ (Complex.ofReal_ne_zero.mpr hΛne)] have hq : (decode7 (encode7 p)).q = p.q := by dsimp only [decode7] rw [hq0, hq1, c2ToQuat_quatToC2] ext · exact congrArg QuaternionAlgebra.re hq · exact congrArg QuaternionAlgebra.imI hq · exact congrArg QuaternionAlgebra.imJ hq · exact congrArg QuaternionAlgebra.imK hq · rename_i i fin_cases i <;> simp [decode7, encode7, packRaw, mul_div_cancel₀ _ hΛne] · rename_i i fin_cases i <;> simp [decode7, encode7, packRaw, mul_div_cancel₀ _ hΛne] · simp [decode7, encode7, packRaw, mul_div_cancel₀ _ hΛne] /-- Decoding a point in `Σ` gives an admissible payload (`|q|² = 1`). -/ theorem decode7_admissible (z : Fin 7 → ℂ) (hz : InPhysImage z) : PhysAdmissible (decode7 z) := by rcases hz with ⟨_, him_pos, hspin⟩ have hne : (z 6).im ≠ 0 := ne_of_gt him_pos dsimp [PhysAdmissible, decode7] rw [← quatToC2_normSq, quatToC2_c2ToQuat] simp only [map_mul, Complex.normSq_ofReal] have h1 : (1 / (z 6).im) * (1 / (z 6).im) * Complex.normSq (z 0) + (1 / (z 6).im) * (1 / (z 6).im) * Complex.normSq (z 1) = (1 / (z 6).im) ^ 2 * (Complex.normSq (z 0) + Complex.normSq (z 1)) := by ring rw [h1, hspin] field_simp [hne] /-- Right inverse `encode7 (decode7 z) = z` for every `z ∈ Σ` (`prop:carrier-inverse`). -/ theorem encode7_decode7 (z : Fin 7 → ℂ) (hz : InPhysImage z) : encode7 (decode7 z) = z := by rcases hz with ⟨hsphere, him_pos, hspin⟩ have hne : (z 6).im ≠ 0 := ne_of_gt him_pos have hΛ : rawNorm (decode7 z) = 1 / (z 6).im := by have hsq : rawNormSq (decode7 z) = (1 / (z 6).im) ^ 2 := by have hadm := decode7_admissible z ⟨hsphere, him_pos, hspin⟩ rw [← packRaw_normSq (decode7 z) hadm] have hpack : ∀ i : Fin 7, packRaw (decode7 z) i = ((1 / (z 6).im : ℝ) : ℂ) * z i := by intro i fin_cases i · simp [packRaw, decode7, quatToC2_c2ToQuat] · simp [packRaw, decode7, quatToC2_c2ToQuat] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7, hne] simp_rw [hpack, map_mul, Complex.normSq_ofReal, ← Finset.mul_sum, hsphere, mul_one, pow_two] rw [rawNorm, hsq, Real.sqrt_sq (one_div_nonneg.mpr (le_of_lt him_pos))] funext i have hpack : packRaw (decode7 z) i = ((1 / (z 6).im : ℝ) : ℂ) * z i := by fin_cases i · simp [packRaw, decode7, quatToC2_c2ToQuat] · simp [packRaw, decode7, quatToC2_c2ToQuat] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7] · apply Complex.ext <;> simp [packRaw, decode7, hne] rw [encode7, hpack, hΛ] have hneC : (((1 / (z 6).im : ℝ) : ℂ)) ≠ 0 := Complex.ofReal_ne_zero.mpr (one_div_ne_zero hne) exact mul_div_cancel_left₀ (z i) hneC /-- Exact image characterization (`prop:carrier-inverse`): `z ∈ Σ ↔ ∃ p, PhysAdmissible p ∧ encode7 p = z`. -/ theorem exact_phys_image (z : Fin 7 → ℂ) : InPhysImage z ↔ ∃ p : PhysPayload, PhysAdmissible p ∧ encode7 p = z := by constructor · intro hz; exact ⟨decode7 z, decode7_admissible z hz, encode7_decode7 z hz⟩ · rintro ⟨p, hp, rfl⟩; exact encode7_inPhysImage p hp theorem encode7_injective : Function.Injective encode7 := by intro p₁ p₂ h have h' := congrArg decode7 h simpa only [decode7_encode7] using h' /-- Central spin sign is retained in `encode7`: flipping `q ↦ -q` produces a distinct point of `S¹³`, directly reusing `LinkedTower.Hopf.signed_quaternion_distinct`. -/ theorem encode7_spin_sign_distinct (p : PhysPayload) (hp : PhysAdmissible p) : encode7 { p with q := -p.q } ≠ encode7 p := by intro h have hp' := encode7_injective h have hq : -p.q = p.q := congrArg PhysPayload.q hp' exact LinkedTower.Hopf.signed_quaternion_distinct p.q hp hq.symm /-- Physical frame transition equivariance (`eq:sp-unitary`, `prop:carrier-inverse`): changing `q_β = h⁻¹ q_α = star h * q_α` acts on `X_α ∈ ℂ⁷` by `(Tmatrix h)ᴴ *ᵥ X_α`, preserving all five payload modes and physical reconstruction `Ad_q`. -/ theorem packRaw_frame_transition (h : Q) (p : PhysPayload) : packRaw { p with q := star h * p.q } = (Tmatrix h)ᴴ *ᵥ packRaw p := by have hstar : (Tmatrix h)ᴴ = Tmatrix (star h) := by ext i j rw [Matrix.conjTranspose_apply] by_cases hi : i.val < 2 <;> by_cases hj : j.val < 2 · simp only [Tmatrix, Matrix.of_apply, hi, hj, ↓reduceDIte] have h01i : i.val = 0 ∨ i.val = 1 := by omega have h01j : j.val = 0 ∨ j.val = 1 := by omega rcases h01i with hi0 | hi0 <;> rcases h01j with hj0 | hj0 <;> (apply Complex.ext <;> simp [hi0, hj0, LinkedTower.Spinor.frame, quatToC2]) · have hji : j ≠ i := fun heq => hj (heq ▸ hi) simp only [Tmatrix, Matrix.of_apply, hi, hj, hji, ↓reduceDIte, ↓reduceIte, star_zero] · have hij : i ≠ j := fun heq => hi (heq ▸ hj) simp only [Tmatrix, Matrix.of_apply, hi, hj, hij, ↓reduceDIte, ↓reduceIte, star_zero] · simp only [Tmatrix, Matrix.of_apply, hi, hj, ↓reduceDIte] by_cases hij : i = j <;> simp [hij, eq_comm] rw [hstar] have hmul := quatToC2_mul (star h) p.q funext i fin_cases i · have h0 := congrFun hmul 0 simp only [packRaw, Tmatrix, mulVec, dotProduct, Fin.sum_univ_succ, Fin.sum_univ_zero, Matrix.of_apply, Matrix.cons_val_zero, Matrix.cons_val_succ, Fin.isValue, Fin.val_zero, Fin.val_succ, Nat.reduceLT, ↓reduceDIte, add_zero] at h0 ⊢ simpa [mulVec, dotProduct, Fin.sum_univ_two] using h0 · have h1 := congrFun hmul 1 simp only [packRaw, Tmatrix, mulVec, dotProduct, Fin.sum_univ_succ, Fin.sum_univ_zero, Matrix.of_apply, Matrix.cons_val_zero, Matrix.cons_val_succ, Fin.isValue, Fin.val_zero, Fin.val_succ, Nat.reduceLT, ↓reduceDIte, add_zero] at h1 ⊢ simpa [mulVec, dotProduct, Fin.sum_univ_two] using h1 · simp [packRaw, Tmatrix, mulVec, dotProduct] · simp [packRaw, Tmatrix, mulVec, dotProduct] · simp [packRaw, Tmatrix, mulVec, dotProduct] · simp [packRaw, Tmatrix, mulVec, dotProduct] · simp [packRaw, Tmatrix, mulVec, dotProduct] /-- Reconstruction invariance under physical spin-frame transition (`prop:carrier-inverse` line 403): `Ad_{h} (Ad_{star h * q} v) = Ad_q v`, reusing `LinkedTower.Tower.adjoint` and `LinkedTower.Hopf.unit_mul_star`. -/ theorem reconstruction_frame_invariant (h q v : Q) (hh : Quaternion.normSq h = 1) : LinkedTower.Tower.adjoint h (LinkedTower.Tower.adjoint (star h * q) v) = LinkedTower.Tower.adjoint q v := by simp only [LinkedTower.Tower.adjoint, star_mul, star_star] calc h * (star h * q * v * (star q * h)) * star h = (h * star h) * q * v * star q * (h * star h) := by noncomm_ring _ = q * v * star q := by rw [LinkedTower.Hopf.unit_mul_star h hh, one_mul, mul_one] /-- Exact bridge linking nonnegative-`ψ` physical payloads to Paul's existing `LinkedTower.S13.encode` / `decode`! -/ def toLinkedTowerPayload (p : PhysPayload) : LinkedTower.S13.Payload where q := ![p.q.re, p.q.imI, p.q.imJ, p.q.imK] b := p.ℓ v := p.v alpha := p.ψ theorem toLinkedTower_admissible (p : PhysPayload) (hp : PhysAdmissible p) (hψ : 0 ≤ p.ψ) : LinkedTower.S13.Admissible (toLinkedTowerPayload p) := by refine ⟨?_, hψ⟩ dsimp only [PhysAdmissible] at hp simp only [toLinkedTowerPayload, LinkedTower.S13.sqNorm, Fin.sum_univ_four] change p.q.re ^ 2 + p.q.imI ^ 2 + p.q.imJ ^ 2 + p.q.imK ^ 2 = 1 have hq : Quaternion.normSq p.q = p.q.re ^ 2 + p.q.imI ^ 2 + p.q.imJ ^ 2 + p.q.imK ^ 2 := by simp [Quaternion.normSq_def', pow_two] linarith [hp, hq] theorem toLinkedTower_energy_eq (p : PhysPayload) : LinkedTower.S13.energy (toLinkedTowerPayload p) = rawNormSq p := by simp only [LinkedTower.S13.energy, toLinkedTowerPayload, rawNormSq, LinkedTower.S13.sqNorm, vecSqNorm] theorem toLinkedTower_anchor_eq (p : PhysPayload) : (LinkedTower.S13.encode (toLinkedTowerPayload p)).anchor = (encode7 p 6).im := by simp only [LinkedTower.S13.encode, LinkedTower.S13.rho, toLinkedTower_energy_eq, encode7, packRaw, rawNorm, Complex.div_ofReal_im] rfl /-! ## 4. Concrete instantiation of `LinkedTower.S13.Frame` for quaternion reseeding -/ /-- Orthogonal left/right quaternion multiplication as a norm-preserving linear map on `Fin 4 → ℝ`, instantiating the spin block of `LinkedTower.S13.Frame` (resolving the note in `LinkedTower/S13.lean` line 238). -/ def rightMulQuatLin (h : Q) : (Fin 4 → ℝ) →ₗ[ℝ] (Fin 4 → ℝ) where toFun x := let q : Q := ⟨x 0, x 1, x 2, x 3⟩ let r := q * h ![r.re, r.imI, r.imJ, r.imK] map_add' x y := by ext i; fin_cases i <;> simp <;> ring map_smul' c x := by ext i; fin_cases i <;> simp <;> ring theorem rightMulQuatLin_norm (h : Q) (hh : Quaternion.normSq h = 1) (x : Fin 4 → ℝ) : LinkedTower.S13.sqNorm (rightMulQuatLin h x) = LinkedTower.S13.sqNorm x := by let q : Q := ⟨x 0, x 1, x 2, x 3⟩ have hmul : Quaternion.normSq (q * h) = Quaternion.normSq q := by rw [map_mul, hh, mul_one] simp only [LinkedTower.S13.sqNorm, rightMulQuatLin, LinearMap.coe_mk, AddHom.coe_mk, Fin.sum_univ_four] change (q * h).re ^ 2 + (q * h).imI ^ 2 + (q * h).imJ ^ 2 + (q * h).imK ^ 2 = (x 0) ^ 2 + (x 1) ^ 2 + (x 2) ^ 2 + (x 3) ^ 2 have h1 : Quaternion.normSq (q * h) = (q * h).re ^ 2 + (q * h).imI ^ 2 + (q * h).imJ ^ 2 + (q * h).imK ^ 2 := by simp [Quaternion.normSq_def', pow_two] have h2 : Quaternion.normSq q = (x 0) ^ 2 + (x 1) ^ 2 + (x 2) ^ 2 + (x 3) ^ 2 := by simp [q, Quaternion.normSq_def', pow_two] linarith [hmul, h1, h2] /-- Orthogonal conjugation `L ↦ Rᵀ L R` expressed in the 5-dimensional traceless symmetric basis `T₁..T₅`, instantiating the stretch block of `LinkedTower.S13.Frame`. -/ def stretchConjLin (R : Mat3) : (Fin 5 → ℝ) →ₗ[ℝ] (Fin 5 → ℝ) where toFun b a := hsInner (Tbasis a) (Rᵀ * reconstructL b * R) map_add' b₁ b₂ := by funext a simp only [Pi.add_apply, reconstructL, Finset.sum_add_distrib, add_smul, Matrix.mul_add, Matrix.add_mul, hsInner, Matrix.trace_add] map_smul' c b := by funext a simp only [Pi.smul_apply, smul_eq_mul, RingHom.id_apply, reconstructL, ← Finset.smul_sum, mul_smul, Matrix.mul_smul, Matrix.smul_mul, hsInner, Matrix.trace_smul] /-- For an orthogonal matrix `R` (`Rᵀ R = R Rᵀ = 1`), `Rᵀ L R` stays in `span(T₁..T₅)` with identical Frobenius norm, proving `stretchConjLin R` is an exact isometry on `ℝ⁵`. -/ theorem mat3_sym0_expand (M : Mat3) (hSym : Mᵀ = M) (hTr : M.trace = 0) : reconstructL (fun a => hsInner (Tbasis a) M) = M := by have h2 : Real.sqrt 2 ^ 2 = 2 := Real.sq_sqrt (by norm_num) have h6 : Real.sqrt 6 ^ 2 = 6 := Real.sq_sqrt (by norm_num) have h2i : (Real.sqrt 2)⁻¹ ^ 2 = 1 / 2 := by rw [inv_pow, h2]; ring have h6i : (Real.sqrt 6)⁻¹ ^ 2 = 1 / 6 := by rw [inv_pow, h6]; ring have h10 : M 1 0 = M 0 1 := by have h := congrArg (fun X : Mat3 => X 0 1) hSym; simpa using h have h20 : M 2 0 = M 0 2 := by have h := congrArg (fun X : Mat3 => X 0 2) hSym; simpa using h have h21 : M 2 1 = M 1 2 := by have h := congrArg (fun X : Mat3 => X 1 2) hSym; simpa using h have htr' : M 0 0 + M 1 1 + M 2 2 = 0 := by simpa [Matrix.trace, Matrix.diag, Fin.sum_univ_three] using hTr have hfin3 : ∀ k : Fin 3, k = 0 ∨ k = 1 ∨ k = 2 := by decide ext i j rcases hfin3 i with rfl | rfl | rfl <;> rcases hfin3 j with rfl | rfl | rfl <;> (simp only [reconstructL, hsInner_eq_sum, Tbasis, Fin.sum_univ_five, Fin.sum_univ_three, Matrix.sum_apply, Matrix.smul_apply, Matrix.of_apply, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.head_cons, Matrix.tail_cons, smul_eq_mul, h10, h20, h21, one_div]; ring_nf; simp only [h2i, h6i]; linarith [htr']) theorem stretchConjLin_norm (R : Mat3) (hRR : R * Rᵀ = 1) (b : Fin 5 → ℝ) : LinkedTower.S13.sqNorm (stretchConjLin R b) = LinkedTower.S13.sqNorm b := by let L := reconstructL b let M := Rᵀ * L * R have hMsym : Mᵀ = M := by calc (Rᵀ * L * R)ᵀ = Rᵀ * (Rᵀ * L)ᵀ := Matrix.transpose_mul _ _ _ = Rᵀ * (Lᵀ * Rᵀᵀ) := by rw [Matrix.transpose_mul] _ = Rᵀ * L * R := by rw [reconstructL_sym, Matrix.transpose_transpose, Matrix.mul_assoc] have hMtr : M.trace = 0 := by calc (Rᵀ * L * R).trace = (R * (Rᵀ * L)).trace := Matrix.trace_mul_comm _ _ _ = ((R * Rᵀ) * L).trace := by rw [Matrix.mul_assoc] _ = L.trace := by rw [hRR, Matrix.one_mul] _ = 0 := reconstructL_trace b have hexp : reconstructL (stretchConjLin R b) = M := mat3_sym0_expand M hMsym hMtr rw [← reconstructL_hsNormSq, hexp, ← reconstructL_hsNormSq] -- hsNormSq (Rᵀ * L * R) = hsNormSq L simp only [hsNormSq, hsInner, M, hMsym, reconstructL_sym] calc (Rᵀ * L * R * (Rᵀ * L * R)).trace = (Rᵀ * L * (R * Rᵀ) * L * R).trace := by simp only [Matrix.mul_assoc] _ = (Rᵀ * L * L * R).trace := by rw [hRR, Matrix.mul_one] _ = (R * (Rᵀ * L * L)).trace := Matrix.trace_mul_comm _ _ _ = ((R * Rᵀ) * (L * L)).trace := by simp only [Matrix.mul_assoc] _ = (L * L).trace := by rw [hRR, Matrix.one_mul] /-- Orthogonal matrix action on `ℝ³` as a norm-preserving linear map for `LinkedTower.S13.Frame`. -/ def sourceRotLin (R : Mat3) : Vec3 →ₗ[ℝ] Vec3 where toFun v := Rᵀ *ᵥ v map_add' x y := Matrix.mulVec_add _ x y map_smul' c x := Matrix.mulVec_smul _ c x theorem sourceRotLin_norm (R : Mat3) (hRR : R * Rᵀ = 1) (v : Vec3) : LinkedTower.S13.sqNorm (sourceRotLin R v) = LinkedTower.S13.sqNorm v := by have h : (Rᵀ *ᵥ v) ⬝ᵥ (Rᵀ *ᵥ v) = v ⬝ᵥ v := by calc (Rᵀ *ᵥ v) ⬝ᵥ (Rᵀ *ᵥ v) = v ⬝ᵥ (R *ᵥ (Rᵀ *ᵥ v)) := by rw [dotProduct_comm, Matrix.dotProduct_mulVec, ← Matrix.mulVec_transpose, Matrix.transpose_transpose, dotProduct_comm] _ = v ⬝ᵥ ((R * Rᵀ) *ᵥ v) := by rw [Matrix.mulVec_mulVec] _ = v ⬝ᵥ v := by rw [hRR, Matrix.one_mulVec] simpa [LinkedTower.S13.sqNorm, sourceRotLin, dotProduct, pow_two] using h /-- Concrete `LinkedTower.S13.Frame` instantiation for physical reseeding (`Section 3.1`, lines 416--426), directly plugging into `LinkedTower.S13.encode_rechart` and `decode_rechart`! -/ def concreteReseedingFrame (h : Q) (hh : Quaternion.normSq h = 1) (R : Mat3) (hRR : R * Rᵀ = 1) : LinkedTower.S13.Frame where spin := rightMulQuatLin h stretch := stretchConjLin R source := sourceRotLin R spin_norm := rightMulQuatLin_norm h hh stretch_norm := stretchConjLin_norm R hRR source_norm := sourceRotLin_norm R hRR /-! ## 5. Normalized Itô Law & Mixed Quadratic Covariation (`prop:mixed-ito`, `eq:sp-ito`) -/ section MixedIto variable {d m : ℕ} def dotN (x y : Fin d → ℝ) : ℝ := ∑ i : Fin d, x i * y i def sqNormN (x : Fin d → ℝ) : ℝ := ∑ i : Fin d, (x i) ^ 2 theorem dotN_self (x : Fin d → ℝ) : dotN x x = sqNormN x := by simp [dotN, sqNormN, pow_two] /-- Drift of `Λ = ‖X‖` in `eq:sp-ito`. -/ def itoDriftLambda (ν Λ : ℝ) (z A : Fin d → ℝ) (G : Fin m → Fin d → ℝ) : ℝ := dotN z A + (ν / Λ) * ∑ j : Fin m, (sqNormN (G j) - (dotN z (G j)) ^ 2) /-- Drift of `z = X / Λ` in `eq:sp-ito`. -/ def itoDriftZ (ν Λ : ℝ) (z A : Fin d → ℝ) (G : Fin m → Fin d → ℝ) : Fin d → ℝ := fun i => (A i - z i * dotN z A) / Λ + (ν / Λ ^ 2) * ∑ j : Fin m, (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i) /-- Mixed quadratic covariation rate `d[Λ, z] / ds` in `eq:scv-normalization-covariation`. -/ def itoMixedBracket (ν Λ : ℝ) (z : Fin d → ℝ) (G : Fin m → Fin d → ℝ) : Fin d → ℝ := fun i => (2 * ν / Λ) * ∑ j : Fin m, (dotN z (G j) * G j i - (dotN z (G j)) ^ 2 * z i) /-- Noise coefficient of `Λ` in `eq:sp-ito` (with factor `√(2ν)` factored out). -/ def itoNoiseLambda (z : Fin d → ℝ) (G : Fin m → Fin d → ℝ) (j : Fin m) : ℝ := dotN z (G j) /-- Noise coefficient of `z` in `eq:sp-ito` (with factor `√(2ν)` factored out). -/ def itoNoiseZ (Λ : ℝ) (z : Fin d → ℝ) (G : Fin m → Fin d → ℝ) (j : Fin m) : Fin d → ℝ := fun i => (G j i - dotN z (G j) * z i) / Λ /-- Exact drift reconstruction (`prop:mixed-ito`): `z dΛ + Λ dz + d[Λ, z]` has drift equal to the exact raw drift `A`, with all Hessian and bracket terms canceling identically. -/ theorem ito_drift_reconstruct (ν Λ : ℝ) (hΛ : Λ ≠ 0) (z A : Fin d → ℝ) (G : Fin m → Fin d → ℝ) : (fun i => itoDriftLambda ν Λ z A G * z i + Λ * itoDriftZ ν Λ z A G i + itoMixedBracket ν Λ z G i) = A := by funext i simp only [itoDriftLambda, itoDriftZ, itoMixedBracket] have hsum : (ν / Λ) * (∑ j : Fin m, (sqNormN (G j) - (dotN z (G j)) ^ 2)) * z i + Λ * ((ν / Λ ^ 2) * ∑ j : Fin m, (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i)) + (2 * ν / Λ) * ∑ j : Fin m, (dotN z (G j) * G j i - (dotN z (G j)) ^ 2 * z i) = 0 := by have hpull1 : (∑ j : Fin m, (sqNormN (G j) - (dotN z (G j)) ^ 2)) * z i = ∑ j : Fin m, (sqNormN (G j) * z i - (dotN z (G j)) ^ 2 * z i) := by rw [Finset.sum_mul] apply Finset.sum_congr rfl; intro j _; ring have hpull2 : Λ * (ν / Λ ^ 2) = ν / Λ := by field_simp [hΛ] have hpull3 : (2 * ν / Λ) * ∑ j : Fin m, (dotN z (G j) * G j i - (dotN z (G j)) ^ 2 * z i) = (ν / Λ) * ∑ j : Fin m, (2 * dotN z (G j) * G j i - 2 * (dotN z (G j)) ^ 2 * z i) := by rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl; intro j _; ring rw [mul_assoc, hpull1, ← mul_assoc, hpull2, hpull3] rw [← mul_add, ← mul_add, ← Finset.sum_add_distrib, ← Finset.sum_add_distrib] have hz : ∑ j : Fin m, ((sqNormN (G j) * z i - (dotN z (G j)) ^ 2 * z i) + (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i) + (2 * dotN z (G j) * G j i - 2 * (dotN z (G j)) ^ 2 * z i)) = 0 := by apply Finset.sum_eq_zero; intro j _; ring rw [hz, mul_zero] have hlin : dotN z A * z i + Λ * ((A i - z i * dotN z A) / Λ) = A i := by field_simp [hΛ]; ring linarith /-- Exact noise reconstruction (`prop:mixed-ito`): `z dΛ + Λ dz` has noise column `j` equal to the raw noise column `G j`. -/ theorem ito_noise_reconstruct (Λ : ℝ) (hΛ : Λ ≠ 0) (z : Fin d → ℝ) (G : Fin m → Fin d → ℝ) (j : Fin m) : (fun i => itoNoiseLambda z G j * z i + Λ * itoNoiseZ Λ z G j i) = G j := by funext i simp only [itoNoiseLambda, itoNoiseZ] field_simp [hΛ] ring /-- Exact sphere-norm preservation (`prop:mixed-ito`): on `‖z‖² = 1`, the Itô drift of `‖z‖²`, namely `2 ⟨z, driftZ⟩ + 2ν ∑_j ‖noiseZ_j‖²`, vanishes identically. -/ theorem ito_sphere_norm_preserved (ν Λ : ℝ) (z A : Fin d → ℝ) (hz : sqNormN z = 1) (G : Fin m → Fin d → ℝ) : 2 * dotN z (itoDriftZ ν Λ z A G) + 2 * ν * ∑ j : Fin m, sqNormN (itoNoiseZ Λ z G j) = 0 := by have h1 : dotN z (fun i => (A i - z i * dotN z A) / Λ) = 0 := by change ∑ i : Fin d, z i * ((A i - z i * dotN z A) / Λ) = 0 have hstep : ∀ i : Fin d, z i * ((A i - z i * dotN z A) / Λ) = ((z i * A i) - (z i) ^ 2 * dotN z A) / Λ := fun i => by ring simp_rw [hstep, ← Finset.sum_div, Finset.sum_sub_distrib, ← Finset.sum_mul] have hda : (∑ i : Fin d, z i * A i) = dotN z A := rfl have hsz : (∑ i : Fin d, (z i) ^ 2) = sqNormN z := rfl rw [hda, hsz, hz, one_mul, sub_self, zero_div] have h2 : dotN z (fun i => (ν / Λ ^ 2) * ∑ j : Fin m, (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i)) = (ν / Λ ^ 2) * ∑ j : Fin m, (-(sqNormN (G j) - (dotN z (G j)) ^ 2)) := by change ∑ i : Fin d, z i * ((ν / Λ ^ 2) * ∑ j : Fin m, (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i)) = _ trans ((ν / Λ ^ 2) * ∑ j : Fin m, ∑ i : Fin d, z i * (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i)) · rw [Finset.mul_sum] trans (∑ i : Fin d, ∑ j : Fin m, (ν / Λ ^ 2) * (z i * (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i))) · apply Finset.sum_congr rfl; intro i _ rw [← mul_assoc, mul_comm (z i), mul_assoc, Finset.mul_sum, Finset.mul_sum] · rw [Finset.sum_comm] apply Finset.sum_congr rfl; intro j _ rw [Finset.mul_sum] · congr 1 apply Finset.sum_congr rfl; intro j _ have hstep : ∀ i : Fin d, z i * (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i) = (-2 * dotN z (G j)) * (z i * G j i) - sqNormN (G j) * (z i) ^ 2 + (3 * (dotN z (G j)) ^ 2) * (z i) ^ 2 := fun i => by ring simp_rw [hstep, Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] have hdg : (∑ i : Fin d, z i * G j i) = dotN z (G j) := rfl have hsz : (∑ i : Fin d, (z i) ^ 2) = sqNormN z := rfl rw [hdg, hsz, hz]; ring have h3 : ∀ j : Fin m, sqNormN (itoNoiseZ Λ z G j) = (sqNormN (G j) - (dotN z (G j)) ^ 2) / Λ ^ 2 := by intro j dsimp only [sqNormN, itoNoiseZ] have hstep : ∀ i : Fin d, ((G j i - dotN z (G j) * z i) / Λ) ^ 2 = ((G j i) ^ 2 - (2 * dotN z (G j)) * (z i * G j i) + (dotN z (G j)) ^ 2 * (z i) ^ 2) / Λ ^ 2 := fun i => by ring simp_rw [hstep, ← Finset.sum_div, Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] have hdot : (∑ i : Fin d, z i * G j i) = dotN z (G j) := rfl have hsqz : (∑ i : Fin d, (z i) ^ 2) = sqNormN z := rfl have hsqg : (∑ i : Fin d, (G j i) ^ 2) = sqNormN (G j) := rfl rw [hdot, hsqz, hsqg, hz]; ring have hsplit : dotN z (itoDriftZ ν Λ z A G) = dotN z (fun i => (A i - z i * dotN z A) / Λ) + dotN z (fun i => (ν / Λ ^ 2) * ∑ j : Fin m, (-2 * dotN z (G j) * G j i - sqNormN (G j) * z i + 3 * (dotN z (G j)) ^ 2 * z i)) := by simp only [dotN, itoDriftZ, mul_add, Finset.sum_add_distrib] rw [hsplit, h1, zero_add, h2] simp_rw [h3, ← Finset.sum_div] rw [Finset.sum_neg_distrib] ring end MixedIto /-! ## 6. ESM3 Stereographic Complement / Sphere Inversion (`SI2`--`SI14`) -/ section StereographicInversion variable {d : ℕ} /-- Stereographic projection from south pole `v = x / (Λ + 1)` and north pole `u = x / (Λ - 1)`, where `Λ = √(1 + ‖x‖²) > 1` (`check_sphere_stereographic.py`). -/ def stereoSouth (x : Fin d → ℝ) (Λ : ℝ) : Fin d → ℝ := fun i => x i / (Λ + 1) def stereoNorth (x : Fin d → ℝ) (Λ : ℝ) : Fin d → ℝ := fun i => x i / (Λ - 1) def sphereInv (v : Fin d → ℝ) : Fin d → ℝ := fun i => v i / sqNormN v def stereoDecode (v : Fin d → ℝ) : Fin d → ℝ := fun i => 2 * v i / (1 - sqNormN v) theorem stereo_involution_and_decode (x : Fin d → ℝ) (Λ : ℝ) (hΛsq : Λ ^ 2 = 1 + sqNormN x) (hΛgt : 1 < Λ) : let v := stereoSouth x Λ let u := stereoNorth x Λ sphereInv v = u ∧ sphereInv u = v ∧ stereoDecode v = x := by intro v u have hLp : Λ + 1 ≠ 0 := by linarith have hLm : Λ - 1 ≠ 0 := by linarith have hxsq : sqNormN x = (Λ - 1) * (Λ + 1) := by nlinarith have hvsq : sqNormN v = (Λ - 1) / (Λ + 1) := by have h1 : sqNormN v = sqNormN x / (Λ + 1) ^ 2 := by simp only [v, stereoSouth, sqNormN, div_pow, ← Finset.sum_div] rw [h1, hxsq]; field_simp [hLp] have husq : sqNormN u = (Λ + 1) / (Λ - 1) := by have h1 : sqNormN u = sqNormN x / (Λ - 1) ^ 2 := by simp only [u, stereoNorth, sqNormN, div_pow, ← Finset.sum_div] rw [h1, hxsq]; field_simp [hLm] refine ⟨?_, ?_, ?_⟩ · funext i simp only [sphereInv, v, u, stereoSouth, stereoNorth, hvsq] field_simp [hLp, hLm] · funext i simp only [sphereInv, v, u, stereoSouth, stereoNorth, husq] field_simp [hLp, hLm] · funext i simp only [stereoDecode, v, stereoSouth, hvsq] have hden : 1 - (Λ - 1) / (Λ + 1) = 2 / (Λ + 1) := by field_simp [hLp]; ring rw [hden] field_simp [hLp] /-! ## 7. Single-path magnitude (`eq:sp-magnitude`) -/ /-- Rotation `Q ∈ O(3)` cancels in single-path squared magnitude (`eq:sp-magnitude`, line 521): for `Z = e^ψ Q U v`, `|Z|² = e^{2ψ} ⟨v, U² v⟩`. -/ theorem single_path_magnitude (ψ : ℝ) (Q U : Mat3) (v : Vec3) (hQ : Qᵀ * Q = 1) (hUsym : Uᵀ = U) : vecSqNorm (Real.exp ψ • ((Q * U) *ᵥ v)) = Real.exp (2 * ψ) * (v ⬝ᵥ ((U * U) *ᵥ v)) := by have hexp : Real.exp (2 * ψ) = Real.exp ψ * Real.exp ψ := by rw [two_mul, Real.exp_add] rw [vecSqNorm_eq_dotProduct, hexp] have h1 : (Real.exp ψ • ((Q * U) *ᵥ v)) ⬝ᵥ (Real.exp ψ • ((Q * U) *ᵥ v)) = (Real.exp ψ * Real.exp ψ) * (((Q * U) *ᵥ v) ⬝ᵥ ((Q * U) *ᵥ v)) := by simp only [dotProduct_smul, smul_dotProduct, smul_eq_mul]; ring rw [h1] congr 1 calc ((Q * U) *ᵥ v) ⬝ᵥ ((Q * U) *ᵥ v) = v ⬝ᵥ ((Q * U)ᵀ *ᵥ ((Q * U) *ᵥ v)) := by rw [dotProduct_comm, Matrix.dotProduct_mulVec, ← Matrix.mulVec_transpose, dotProduct_comm] _ = v ⬝ᵥ (((Q * U)ᵀ * (Q * U)) *ᵥ v) := by rw [Matrix.mulVec_mulVec] _ = v ⬝ᵥ ((Uᵀ * (Qᵀ * Q) * U) *ᵥ v) := by rw [Matrix.transpose_mul]; simp only [Matrix.mul_assoc] _ = v ⬝ᵥ ((U * U) *ᵥ v) := by rw [hQ, hUsym, Matrix.mul_one] end StereographicInversion end end F02NavierStokes.PhysicalCarrierS13