File size: 9,551 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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.Fourier
import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.NoWrap
import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.SquareWeights
import Mathlib.Algebra.Polynomial.Degree.Lemmas
namespace OAI
/-!
# Exact finite Fourier projection and square filtering
The `5 * M`-term Fourier average is applied to an arbitrary branch coefficient.
The label bounds eliminate modular wrap. The weights on the three tensor legs
then give a nonnegative square degree on every surviving branch. Taking the
constant coefficient retains exactly the branches with `g = h` and `u = v`.
The finite-family statements permit arbitrary coefficients and arbitrary
repetitions of labels; they use only linearity of the Fourier projection and
coefficient extraction, without assumptions on an ambient tensor.
-/
open scoped BigOperators
namespace MatrixMultiplication.AuxiliarySeparation
/-- A normalized finite Fourier average of one branch coefficient. -/
noncomputable def finiteFourierCoefficient (ζ : ℂ) (L : ℕ) (e : ℤ) (c : ℂ) : ℂ :=
(L : ℂ)⁻¹ * ∑ r ∈ Finset.range L, ζ ^ ((r : ℤ) * e) * c
/-- The Fourier average is a scalar support indicator, for every coefficient. -/
theorem finiteFourierCoefficient_eq_ite {ζ : ℂ} {L : ℕ}
(hL : L ≠ 0) (hζ : IsPrimitiveRoot ζ L) (e : ℤ) (c : ℂ) :
finiteFourierCoefficient ζ L e c = if (L : ℤ) ∣ e then c else 0 := by
unfold finiteFourierCoefficient
rw [← Finset.sum_mul, ← mul_assoc, normalized_sum_zpow_primitive_root hL hζ]
split_ifs <;> simp
/-- Averaging a finite family of branches agrees with averaging each branch. -/
theorem finiteFourierCoefficient_sum {ι : Type*} (s : Finset ι)
(ζ : ℂ) (L : ℕ) (e : ι → ℤ) (c : ι → ℂ) :
(L : ℂ)⁻¹ * (∑ r ∈ Finset.range L, ∑ i ∈ s, ζ ^ ((r : ℤ) * e i) * c i) =
∑ i ∈ s, finiteFourierCoefficient ζ L (e i) (c i) := by
rw [Finset.sum_comm, Finset.mul_sum]
rfl
/-- Exactly `5 * M` phases select the integer support equation. -/
theorem fiveMFourierCoefficient_eq_ite {ζ : ℂ} {M : ℕ} {g h u v : ℤ}
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M)
(hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) :
finiteFourierCoefficient ζ (5 * M) (phase g h u v) c =
if phase g h u v = 0 then c else 0 := by
rw [finiteFourierCoefficient_eq_ite (by omega) hζ]
have hnoWrap := fourierPhase_dvd_iff_eq_zero (M := (M : ℤ))
(by omega) hh hg hu hv
simp only [phase, Nat.cast_mul, Nat.cast_ofNat, hnoWrap]
rfl
/-- A projected branch, recorded as an ordinary polynomial after Fourier averaging. -/
noncomputable def projectedBranchPolynomial (ζ : ℂ) (M : ℕ)
(g h u v : ℤ) (c : ℂ) : Polynomial ℂ :=
Polynomial.monomial (totalDegree g h u v)
(finiteFourierCoefficient ζ (5 * M) (phase g h u v) c)
/-- The surviving polynomial weight is the square `(g - h)^2`. -/
theorem projectedBranchPolynomial_eq_ite {ζ : ℂ} {M : ℕ} {g h u v : ℤ}
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M)
(hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) :
projectedBranchPolynomial ζ M g h u v c =
if phase g h u v = 0 then Polynomial.monomial ((g - h) ^ 2).toNat c else 0 := by
unfold projectedBranchPolynomial
rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv]
split_ifs with hp
· rw [totalDegree, totalWeight_eq_sq_of_phase_eq_zero hp]
· simp
/-- A coefficient occurs exactly on the Fourier support at its integer total weight. -/
theorem projectedBranchPolynomial_coeff {ζ : ℂ} {M n : ℕ} {g h u v : ℤ}
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M)
(hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) :
(projectedBranchPolynomial ζ M g h u v c).coeff n =
if phase g h u v = 0 ∧ totalWeight g h u v = (n : ℤ) then c else 0 := by
unfold projectedBranchPolynomial
rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv]
by_cases hp : phase g h u v = 0
· have hd : totalDegree g h u v = n ↔ totalWeight g h u v = (n : ℤ) := by
have hcast := totalDegree_cast_of_phase_eq_zero hp
omega
simp only [hp, ↓reduceIte, Polynomial.coeff_monomial, hd, true_and]
· simp [hp]
/-- Each projected branch has no polynomial coefficient above `(M - 1)^2`. -/
theorem projectedBranchPolynomial_coeff_eq_zero_of_lt
{ζ : ℂ} {M n : ℕ} {g h u v : ℤ}
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M)
(hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M)
(hn : (M - 1) ^ 2 < n) (c : ℂ) :
(projectedBranchPolynomial ζ M g h u v c).coeff n = 0 := by
unfold projectedBranchPolynomial
rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv]
split_ifs with hp
· have hd := totalDegree_le_of_labels hg hh hp
exact Polynomial.coeff_monomial_of_ne c (by omega)
· simp
/-- Constant coefficient extraction is the exact square filter, with no restriction
on the original complex coefficient. -/
theorem projectedBranchPolynomial_coeff_zero {ζ : ℂ} {M : ℕ} {g h u v : ℤ}
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M)
(hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) :
(projectedBranchPolynomial ζ M g h u v c).coeff 0 =
if g = h ∧ u = v then c else 0 := by
unfold projectedBranchPolynomial
rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv]
by_cases hp : phase g h u v = 0
· simp only [hp, ↓reduceIte, Polynomial.coeff_monomial,
totalDegree_eq_zero_iff_of_phase_eq_zero hp]
· have hlabels : ¬ (g = h ∧ u = v) := by
rintro ⟨rfl, rfl⟩
exact hp (by simp [phase])
simp [hp, hlabels]
/-- Apply the finite Fourier projection and square weights branch by branch. -/
noncomputable def projectedPolynomial {ι : Type*} (s : Finset ι)
(ζ : ℂ) (M : ℕ) (g h u v : ι → ℤ) (c : ι → ℂ) : Polynomial ℂ :=
∑ i ∈ s, projectedBranchPolynomial ζ M (g i) (h i) (u i) (v i) (c i)
/-- Every coefficient of the projected polynomial has the exact integer support. -/
theorem projectedPolynomial_coeff {ι : Type*} (s : Finset ι)
{ζ : ℂ} {M n : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ)
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M)
(hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M) :
(projectedPolynomial s ζ M g h u v c).coeff n =
∑ i ∈ s, if phase (g i) (h i) (u i) (v i) = 0 ∧
totalWeight (g i) (h i) (u i) (v i) = (n : ℤ) then c i else 0 := by
classical
unfold projectedPolynomial
simp only [Polynomial.finsetSum_coeff]
apply Finset.sum_congr rfl
intro i hi
exact projectedBranchPolynomial_coeff hM hζ (hg i hi) (hh i hi)
(hu i hi) (hv i hi) (c i)
/-- Exact finite filtering for an arbitrary finite family of branch coefficients. -/
theorem projectedPolynomial_coeff_zero {ι : Type*} (s : Finset ι)
{ζ : ℂ} {M : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ)
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M)
(hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M) :
(projectedPolynomial s ζ M g h u v c).coeff 0 =
∑ i ∈ s, if g i = h i ∧ u i = v i then c i else 0 := by
classical
unfold projectedPolynomial
simp only [Polynomial.finsetSum_coeff]
apply Finset.sum_congr rfl
intro i hi
exact projectedBranchPolynomial_coeff_zero hM hζ (hg i hi) (hh i hi)
(hu i hi) (hv i hi) (c i)
/-- The finite projected polynomial has support only in degrees at most `(M - 1)^2`. -/
theorem projectedPolynomial_coeff_eq_zero_of_lt {ι : Type*} (s : Finset ι)
{ζ : ℂ} {M n : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ)
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M)
(hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M)
(hn : (M - 1) ^ 2 < n) :
(projectedPolynomial s ζ M g h u v c).coeff n = 0 := by
classical
unfold projectedPolynomial
simp only [Polynomial.finsetSum_coeff]
apply Finset.sum_eq_zero
intro i hi
exact projectedBranchPolynomial_coeff_eq_zero_of_lt hM hζ (hg i hi) (hh i hi)
(hu i hi) (hv i hi) hn (c i)
/-- The degree bound is independent of the number or values of the coefficients. -/
theorem projectedPolynomial_natDegree_le {ι : Type*} (s : Finset ι)
{ζ : ℂ} {M : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ)
(hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M))
(hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M)
(hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M) :
(projectedPolynomial s ζ M g h u v c).natDegree ≤ (M - 1) ^ 2 := by
rw [Polynomial.natDegree_le_iff_coeff_eq_zero]
intro n hn
exact projectedPolynomial_coeff_eq_zero_of_lt s g h u v c hM hζ hg hh hu hv hn
end MatrixMultiplication.AuxiliarySeparation
end OAI
|