Offline · exact source
Exact Lean source

TensorFundamentalBranchingSlices

formalization/Cloning/TensorFundamentalBranchingSlices.lean

Source hash: 894fe4edf1958329877d0f8cf40af76d1c6696659d5b1e072e9b10c4c548bcee

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Cloning.TensorCartanFrame
2import Cloning.TensorCyclicSector
3import Mathlib.Data.Finset.Max
4 
5/-!+# Literal last-slot slices for fundamental tensor branching
6 
7These maps act on the actual physical tensor register. The generator formula
8contains the first-factor action and the single final-slot matrix unit.
9-/
10noncomputable section
11open scoped BigOperators InnerProductSpace
12namespace Cloning.TensorLie
13open Cloning.PCT
14set_option maxHeartbeats 800000
15set_option backward.isDefEq.respectTransparency false
16variable {n d : ℕ}
17 
18local instance (n d : ℕ) : FiniteDimensional ℂ (TensorRegister n (Fin d)) :=
19  (registerBasis (Fin n → Fin d)).toOrthonormalBasis.toBasis.finiteDimensional_of_finite
20 
21/-- Contraction of the last tensor slot against its actual computational basis. -/
22def lastSlice (r : Fin d) : TensorRegister (n + 1) (Fin d) →L[ℂ] TensorRegister n (Fin d) :=
23  LinearMap.toContinuousLinearMap {
24    toFun x := ⟨fun w => x (Fin.snoc w r), memℓp_gen (by
25      simp only [ENNReal.toReal_ofNat]; exact (hasSum_fintype _).summable)⟩
26    map_add' _ _ := by ext; rfl
27    map_smul' _ _ := by ext; rfl }
28 
29@[simp] theorem lastSlice_apply (r : Fin d) (x : TensorRegister (n + 1) (Fin d))
30    (w : Fin n → Fin d) : lastSlice r x w = x (Fin.snoc w r) := rfl
31 
32theorem lastSlice_ext {x y : TensorRegister (n + 1) (Fin d)}
33    (h : ∀ r : Fin d, lastSlice r x = lastSlice r y) : x = y := by
34  ext w
35  have he := congrArg (fun z : TensorRegister n (Fin d) => z (Fin.init w)) (h (w (Fin.last n)))
36  simpa only [lastSlice_apply, Fin.snoc_init_self] using he
37 
38theorem lastSlice_tensorJoin (r : Fin d) (x : TensorRegister n (Fin d))
39    (y : TensorRegister 1 (Fin d)) :
40    lastSlice r (tensorJoin x y) = y (fun _ => r) • x := by
41  ext w
42  have hl : (fun i : Fin n => (Fin.snoc w r : Fin (n + 1) → Fin d) (Fin.castAdd 1 i)) = w := by
43    funext i
44    exact Fin.snoc_castSucc (α := fun _ => Fin d) r w i
45  have hr : (fun i : Fin 1 => (Fin.snoc w r : Fin (n + 1) → Fin d) (Fin.natAdd n i)) = (fun _ => r) := by
46    funext i
47    fin_cases i
48    exact Fin.snoc_last (α := fun _ => Fin d) r w
49  simp only [lastSlice_apply, tensorJoin_apply, hl, hr, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul]
50  exact mul_comm _ _
51 
52/-- Every slice of the literal product subspace lies in its first factor. -/
53theorem lastSlice_mem_tensorProductSector (P : Submodule ℂ (TensorRegister n (Fin d)))
54    (Q : Submodule ℂ (TensorRegister 1 (Fin d)))
55    {x : TensorRegister (n + 1) (Fin d)} (hx : x ∈ tensorProductSector P Q) (r : Fin d) :
56    lastSlice r x ∈ P := by
57  induction hx using Submodule.span_induction with
58  | mem x hx =>
59      obtain ⟨u, hu, v, _, rfl⟩ := hx
60      rw [lastSlice_tensorJoin]
61      exact P.smul_mem _ hu
62  | zero => simp
63  | add x y hx hy ihx ihy => simpa only [map_add] using P.add_mem ihx ihy
64  | smul c x hx ih => simpa only [map_smul] using P.smul_mem c ih
65 
66/-- The exact physical matrix-unit action after last-slot contraction. -/
67theorem lastSlice_generator (r a b : Fin d) (x : TensorRegister (n + 1) (Fin d)) :
68    lastSlice r (collectiveGenerator (n + 1) a b x) =
69      collectiveGenerator n a b (lastSlice r x) + if r = a then lastSlice b x else 0 := by
70  ext w
71  simp only [lastSlice_apply, collectiveGenerator_apply, Fin.sum_univ_castSucc,
72    Fin.snoc_castSucc, Fin.snoc_last, ← Fin.snoc_update, Fin.update_snoc_last,
73    lp.coeFn_add, Pi.add_apply]
74  split_ifs <;> rfl
75 
76/-- A nonzero tensor has a largest nonzero last-slot slice. -/
77theorem exists_maximal_lastSlice (x : TensorRegister (n + 1) (Fin d)) (hx : x ≠ 0) :
78    ∃ r : Fin d, lastSlice r x ≠ 0 ∧ ∀ s, r < s → lastSlice s x = 0 := by
79  classical
80  let S : Finset (Fin d) := Finset.univ.filter (fun r => lastSlice r x ≠ 0)
81  have hS : S.Nonempty := by
82    by_contra hn
83    apply hx
84    apply lastSlice_ext
85    intro r
86    have hr : ¬ lastSlice r x ≠ 0 := by
87      intro hr
88      exact hn ⟨r, Finset.mem_filter.mpr ⟨Finset.mem_univ r, hr⟩⟩
89    simpa only [map_zero] using not_not.mp hr
90  obtain ⟨r, hr, hmax⟩ := Finset.exists_max_image S id hS
91  refine ⟨r, (Finset.mem_filter.mp hr).2, ?_⟩
92  intro s hrs
93  by_contra hs
94  have hle := hmax s (Finset.mem_filter.mpr ⟨Finset.mem_univ s, hs⟩)
95  exact (not_lt_of_ge hle) hrs
96 
97/-- The last nonzero slice of a highest tensor is in the first factor's
98highest line; this follows from the exact slice generator formula. -/
99theorem maximal_lastSlice_highest
100    (Ω : TensorRegister n (Fin d)) (hΩnorm : ‖Ω‖ = 1)
101    (hΩraise : ∀ a b, a < b → collectiveGenerator n a b Ω = 0)
102    (x : TensorRegister (n + 1) (Fin d))
103    (hx : x ∈ tensorProductSector (cyclicSector Ω) (⊤ : Submodule ℂ (TensorRegister 1 (Fin d))))
104    (hxraise : ∀ a b, a < b → collectiveGenerator (n + 1) a b x = 0)
105    (r : Fin d) (htail : ∀ s, r < s → lastSlice s x = 0) :
106    lastSlice r x = ⟪Ω, lastSlice r x⟫_ℂ • Ω := by
107  apply cyclicSector_raising_kernel Ω hΩnorm hΩraise
108    (lastSlice_mem_tensorProductSector _ _ hx r)
109  intro a b hab
110  have h := congrArg (lastSlice r) (hxraise a b hab)
111  rw [lastSlice_generator, map_zero] at h
112  by_cases hra : r = a
113  · subst a
114    simpa [htail b hab] using h
115  · simpa only [if_neg hra, add_zero] using h
116 
117end Cloning.TensorLie