File size: 7,372 Bytes
cdec422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic
import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.MultiplicativePower
import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexPairingMatrixTensor

namespace OAI

/-!
# Dot-product exponents of tensor characters

The power laws here follow from restriction monotonicity and tensor products.
They are not additional assumptions on a character. The three exponents refer
to the leg on which the corresponding dot product has dimension one.
-/

noncomputable section

open MatrixMultiplication.Foundation
open scoped BigOperators

namespace MatrixMultiplication.AuxiliarySeparation.Character

variable (χ : Character)

theorem value_pos {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z]
    {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : 0 < χ.value T :=
  lt_of_lt_of_le zero_lt_one (χ.one_le_value hT)

/-- Precomposing a character with a cyclic permutation gives a character. -/
def cyclicCharacter : Character where
  value T := χ.value (Tensor.cyclic T)
  nonneg T := χ.nonneg (Tensor.cyclic T)
  map_zero := χ.map_zero
  map_one := χ.map_one
  map_directSum T := by
    rw [Tensor.cyclic_directSum, χ.map_directSum]
  map_product T S := χ.map_product (Tensor.cyclic T) (Tensor.cyclic S)
  monotone T A B C := by
    have heq : Tensor.cyclic (Tensor.restrict A B C T) =
        Tensor.restrict B C A (Tensor.cyclic T) := by
      funext y z x
      simp only [Tensor.cyclic, Tensor.restrict]
      rw [Finset.sum_comm]
      apply Finset.sum_congr rfl
      intro j hj
      rw [Finset.sum_comm]
      apply Finset.sum_congr rfl
      intro k hk
      apply Finset.sum_congr rfl
      intro i hi
      ring
    rw [heq]
    exact χ.monotone (Tensor.cyclic T) B C A

@[simp] theorem cyclicCharacter_value {X Y Z : Type}
    [Fintype X] [Fintype Y] [Fintype Z] (T : Tensor ℂ X Y Z) :
    χ.cyclicCharacter.value T = χ.value (Tensor.cyclic T) := rfl

private theorem dotPairing_ne_zero {m : ℕ} (hm : 0 < m) :
    Tensor.dotPairing (K := ℂ) (Fin m) ≠ 0 := by
  intro h
  have hv := congrFun (congrFun (congrFun h ⟨0, hm⟩) ⟨0, hm⟩) ()
  simp [Tensor.dotPairing] at hv

private theorem dotPairing_rank (m : ℕ) :
    Tensor.RankAtMost (Tensor.dotPairing (K := ℂ) (Fin m)) m := by
  let a : Fin m → Fin m → ℂ := fun i j => if i = j then 1 else 0
  have heq : Tensor.dotPairing (K := ℂ) (Fin m) =
      fun x y z => ∑ i, Tensor.rankOne (a i) (a i) (fun _ : Unit => 1) x y z := by
    funext x y z
    simp [Tensor.dotPairing, Tensor.rankOne, a, mul_ite, eq_comm]
  rw [heq]
  simpa using Tensor.rankAtMost_sum_rankOne a a (fun (_ : Fin m) (_ : Unit) => (1 : ℂ))

theorem value_dotPairing_pos {m : ℕ} (hm : 0 < m) :
    0 < χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) :=
  χ.value_pos (dotPairing_ne_zero hm)

theorem value_dotPairing_le (m : ℕ) :
    χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) ≤ m :=
  χ.value_le_rank (dotPairing_rank m)

theorem value_dotPairing_mono {m n : ℕ} (hmn : m ≤ n) :
    χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) ≤
      χ.value (Tensor.dotPairing (K := ℂ) (Fin n)) := by
  have heq : Tensor.pullback (Fin.castLE hmn) (Fin.castLE hmn) id
      (Tensor.dotPairing (K := ℂ) (Fin n)) = Tensor.dotPairing (K := ℂ) (Fin m) := by
    funext x y z
    simp [Tensor.pullback, Tensor.dotPairing]
  rw [← heq]
  exact χ.value_pullback_le _ _ _ _

theorem value_dotPairing_mul (m n : ℕ) :
    χ.value (Tensor.dotPairing (K := ℂ) (Fin (m * n))) =
      χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) *
        χ.value (Tensor.dotPairing (K := ℂ) (Fin n)) := by
  have heq : Tensor.pullback finProdFinEquiv.symm finProdFinEquiv.symm
      (Equiv.prodUnique Unit Unit).symm
      (Tensor.product (Tensor.dotPairing (K := ℂ) (Fin m))
        (Tensor.dotPairing (K := ℂ) (Fin n))) =
      Tensor.dotPairing (K := ℂ) (Fin (m * n)) := by
    funext x y z
    simp only [Tensor.pullback, Tensor.product, Tensor.dotPairing,
      ite_zero_mul_ite_zero, one_mul, ← Prod.ext_iff, Equiv.apply_eq_iff_eq]
  rw [← heq, χ.value_reindex, χ.map_product]

/-- The exponent on dot products whose third leg has dimension one. -/
def pZ : ℝ :=
  Real.log (χ.value (Tensor.dotPairing (K := ℂ) (Fin 2))) / Real.log 2

/-- The exponent on dot products whose second leg has dimension one. -/
def pY : ℝ := χ.cyclicCharacter.pZ

/-- The exponent on dot products whose first leg has dimension one. -/
def pX : ℝ := χ.cyclicCharacter.cyclicCharacter.pZ

theorem pZ_nonneg : 0 ≤ χ.pZ := by
  apply div_nonneg _ (Real.log_nonneg (by norm_num))
  exact Real.log_nonneg (χ.one_le_value (dotPairing_ne_zero (by norm_num)))

theorem pZ_le_one : χ.pZ ≤ 1 := by
  apply (div_le_one (Real.log_pos (by norm_num))).2
  exact Real.log_le_log (χ.value_dotPairing_pos (by norm_num)) (χ.value_dotPairing_le 2)

theorem pY_nonneg : 0 ≤ χ.pY := χ.cyclicCharacter.pZ_nonneg
theorem pY_le_one : χ.pY ≤ 1 := χ.cyclicCharacter.pZ_le_one
theorem pX_nonneg : 0 ≤ χ.pX := χ.cyclicCharacter.cyclicCharacter.pZ_nonneg
theorem pX_le_one : χ.pX ≤ 1 := χ.cyclicCharacter.cyclicCharacter.pZ_le_one

theorem value_dotPairing {m : ℕ} (hm : 0 < m) :
    χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) = (m : ℝ) ^ χ.pZ := by
  apply positiveMultiplicative_eq_rpow
    (f := fun m => χ.value (Tensor.dotPairing (K := ℂ) (Fin m)))
    (fun n hn => χ.value_dotPairing_pos hn)
    (fun m n _ _ => χ.value_dotPairing_mul m n)
    (fun _ _ _ _ hmn => χ.value_dotPairing_mono hmn) hm

theorem value_cyclic_dotPairing {m : ℕ} (hm : 0 < m) :
    χ.value (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin m))) =
      (m : ℝ) ^ χ.pY :=
  χ.cyclicCharacter.value_dotPairing hm

theorem value_cyclic_cyclic_dotPairing {m : ℕ} (hm : 0 < m) :
    χ.value (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin m)))) =
      (m : ℝ) ^ χ.pX :=
  χ.cyclicCharacter.cyclicCharacter.value_dotPairing hm

/-- Exact factorization through the three oriented dot products. -/
theorem value_matrixCoefficients {a b c : ℕ} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) :
    χ.value (Tensor.matrixCoefficients (K := ℂ) (Fin a) (Fin b) (Fin c)) =
      (b : ℝ) ^ χ.pZ * (a : ℝ) ^ χ.pY * (c : ℝ) ^ χ.pX := by
  rw [← Tensor.pairingTriple_matrixCoefficients, χ.value_reindex]
  simp only [Tensor.pairingTriple, χ.map_product, χ.value_dotPairing hb,
    χ.value_cyclic_dotPairing ha, χ.value_cyclic_cyclic_dotPairing hc]

/-- The character of square matrix multiplication has exponent `pX + pY + pZ`. -/
theorem value_matrixCoefficients_square {m : ℕ} (hm : 0 < m) :
    χ.value (Tensor.matrixCoefficients (K := ℂ) (Fin m) (Fin m) (Fin m)) =
      (m : ℝ) ^ (χ.pX + χ.pY + χ.pZ) := by
  rw [χ.value_matrixCoefficients hm hm hm]
  have hm' : 0 < (m : ℝ) := Nat.cast_pos.mpr hm
  rw [Real.rpow_add hm', Real.rpow_add hm']
  ring

/-- The same power law in the matrix-tensor notation used for exact rank. -/
theorem value_matrixMultiplication {m : ℕ} (hm : 0 < m) :
    χ.value (Tensor.matrixMultiplication m m m) =
      (m : ℝ) ^ (χ.pX + χ.pY + χ.pZ) := by
  simpa only [Tensor.matrixMultiplication_eq_matrixCoefficients] using
    χ.value_matrixCoefficients_square hm

end MatrixMultiplication.AuxiliarySeparation.Character

end

end OAI