File size: 4,628 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
import Mathlib.Data.Int.Basic
import Mathlib.Tactic

namespace OAI

/-!+# The square weights in auxiliary separation

Sections 4.1–4.3 use the phase `u - v + 2 * (g - h)` to select monomials.
On a selected monomial, the three integer variable weights add to `(g - h)^2`.
Thus the surviving monomials have nonnegative total degree, although individual
variable weights may be negative. Their degree is zero precisely when the guess
`g` matches the sector `h` and the auxiliary labels agree.
-/

namespace MatrixMultiplication.AuxiliarySeparation

/-- The exponent occurring in the finite Fourier projection. -/
def phase (g h u v : ℤ) : ℤ := u - v + 2 * (g - h)

/-- Weight on the first tensor leg, which carries the guessed sector label. -/
def firstWeight (g : ℤ) : ℤ := g ^ 2

/-- Weight on the second tensor leg. -/
def secondWeight (h u : ℤ) : ℤ := h * u - h ^ 2

/-- Weight on the third tensor leg. -/
def thirdWeight (h v : ℤ) : ℤ := -(h * v)

/-- Total weight of a target monomial after the three independent substitutions. -/
def totalWeight (g h u v : ℤ) : ℤ :=
  firstWeight g + secondWeight h u + thirdWeight h v

theorem totalWeight_eq_square_add_phase (g h u v : ℤ) :
    totalWeight g h u v = (g - h) ^ 2 + h * phase g h u v := by
  unfold totalWeight firstWeight secondWeight thirdWeight phase
  ring

/-- The projection equation converts the total weight into a square. -/
theorem totalWeight_eq_sq_of_phase_eq_zero {g h u v : ℤ}
    (hphase : phase g h u v = 0) :
    totalWeight g h u v = (g - h) ^ 2 := by
  rw [totalWeight_eq_square_add_phase, hphase, mul_zero, add_zero]

theorem totalWeight_nonneg_of_phase_eq_zero {g h u v : ℤ}
    (hphase : phase g h u v = 0) : 0 ≤ totalWeight g h u v := by
  rw [totalWeight_eq_sq_of_phase_eq_zero hphase]
  exact sq_nonneg (g - h)

/-- On the Fourier support, precisely the correctly matched terms have weight zero. -/
theorem totalWeight_eq_zero_iff_of_phase_eq_zero {g h u v : ℤ}
    (hphase : phase g h u v = 0) :
    totalWeight g h u v = 0 ↔ g = h ∧ u = v := by
  rw [totalWeight_eq_sq_of_phase_eq_zero hphase, sq_eq_zero_iff]
  constructor
  · intro hzero
    have hgh : g = h := sub_eq_zero.mp hzero
    refine ⟨hgh, ?_⟩
    unfold phase at hphase
    omega
  · rintro ⟨hgh, _⟩
    exact sub_eq_zero.mpr hgh

theorem phase_and_totalWeight_eq_zero_iff (g h u v : ℤ) :
    (phase g h u v = 0 ∧ totalWeight g h u v = 0) ↔ g = h ∧ u = v := by
  constructor
  · rintro ⟨hphase, hweight⟩
    exact (totalWeight_eq_zero_iff_of_phase_eq_zero hphase).mp hweight
  · rintro ⟨rfl, rfl⟩
    simp [phase, totalWeight, firstWeight, secondWeight, thirdWeight]

theorem totalWeight_pos_iff_of_phase_eq_zero {g h u v : ℤ}
    (hphase : phase g h u v = 0) :
    0 < totalWeight g h u v ↔ g ≠ h := by
  rw [totalWeight_eq_sq_of_phase_eq_zero hphase, sq_pos_iff, sub_ne_zero]

/-- The degree bound in Section 4.3, for sector labels in `1, …, M`. -/
theorem totalWeight_le_of_labels {M g h u v : ℤ}
    (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M)
    (hphase : phase g h u v = 0) :
    totalWeight g h u v ≤ (M - 1) ^ 2 := by
  rw [totalWeight_eq_sq_of_phase_eq_zero hphase]
  have hprod : 0 ≤ ((M - 1) - (g - h)) * ((M - 1) + (g - h)) :=
    mul_nonneg (by omega) (by omega)
  nlinarith

/-- The polynomial degree attached to a surviving monomial. -/
def totalDegree (g h u v : ℤ) : ℕ := (totalWeight g h u v).toNat

theorem totalDegree_cast_of_phase_eq_zero {g h u v : ℤ}
    (hphase : phase g h u v = 0) :
    (totalDegree g h u v : ℤ) = totalWeight g h u v := by
  exact Int.toNat_of_nonneg (totalWeight_nonneg_of_phase_eq_zero hphase)

theorem totalDegree_eq_zero_iff_of_phase_eq_zero {g h u v : ℤ}
    (hphase : phase g h u v = 0) :
    totalDegree g h u v = 0 ↔ g = h ∧ u = v := by
  have hcast := totalDegree_cast_of_phase_eq_zero hphase
  have hzero : totalDegree g h u v = 0 ↔ totalWeight g h u v = 0 := by omega
  exact hzero.trans (totalWeight_eq_zero_iff_of_phase_eq_zero hphase)

theorem totalDegree_le_of_labels {M : ℕ} {g h u v : ℤ}
    (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M)
    (hphase : phase g h u v = 0) :
    totalDegree g h u v ≤ (M - 1) ^ 2 := by
  have hM : 1 ≤ M := by omega
  have hbound := totalWeight_le_of_labels hg hh hphase
  have hcast := totalDegree_cast_of_phase_eq_zero hphase
  have hsub : ((M - 1 : ℕ) : ℤ) = (M : ℤ) - 1 := by omega
  exact_mod_cast (show (totalDegree g h u v : ℤ) ≤ ((M - 1 : ℕ) : ℤ) ^ 2 by
    rw [hcast, hsub]
    exact hbound)

end MatrixMultiplication.AuxiliarySeparation

end OAI