math / data /lean /OAI /Combinatorics /GotsmanLinial /CubeOperators.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
4.79 kB
import OAI.Combinatorics.GotsmanLinial.CoordinateMultipliers
import OAI.Combinatorics.GotsmanLinial.HilbertSchmidt
import Mathlib.InformationTheory.Hamming
import Mathlib.Tactic
namespace OAI
/-!
# Coordinate commutators and Hamming-distance energy
The coordinate sign matrices are the actual diagonal operators of the Boolean
cube. The identities here turn their Hilbert--Schmidt and entry estimates into
the energy estimates used by the edge-recovery argument.
-/
open scoped BigOperators
namespace LeanBlast.GotsmanLinial
variable {n : β„•}
/-- In the point basis, a coordinate commutator records the difference of the
two endpoint signs. -/
theorem coordinate_commutator_apply
(M : Matrix (Cube n) (Cube n) β„‚) (i : Fin n) (x y : Cube n) :
(M * coordinateSignMatrix i - coordinateSignMatrix i * M) x y =
(((cubeCoord y i - cubeCoord x i : ℝ) : β„‚)) * M x y := by
simp only [coordinateSignMatrix, signMatrix, Matrix.sub_apply,
Matrix.mul_diagonal, Matrix.diagonal_mul, Complex.ofReal_sub]
ring
/-- Squaring a coordinate difference gives four exactly on the coordinates
where the Boolean endpoints differ. -/
theorem coordinate_commutator_sq_norm
(M : Matrix (Cube n) (Cube n) β„‚) (i : Fin n) (x y : Cube n) :
β€–(M * coordinateSignMatrix i - coordinateSignMatrix i * M) x yβ€– ^ 2 =
(if x i β‰  y i then (4 : ℝ) else 0) * β€–M x yβ€– ^ 2 := by
rw [coordinate_commutator_apply, norm_mul, mul_pow]
congr 1
cases hx : x i <;> cases hy : y i <;> norm_num [cubeCoord, hx, hy]
/-- Summing the squared entries over coordinates counts Hamming distance. -/
theorem sum_coordinate_commutator_sq_norm
(M : Matrix (Cube n) (Cube n) β„‚) (x y : Cube n) :
(βˆ‘ i : Fin n,
β€–(M * coordinateSignMatrix i - coordinateSignMatrix i * M) x yβ€– ^ 2) =
4 * (hammingDist x y : ℝ) * β€–M x yβ€– ^ 2 := by
classical
simp_rw [coordinate_commutator_sq_norm, ite_mul, zero_mul]
calc
(βˆ‘ i : Fin n, if x i β‰  y i then 4 * β€–M x yβ€– ^ 2 else 0) =
βˆ‘ i ∈ Finset.univ.filter (fun i => x i β‰  y i), 4 * β€–M x yβ€– ^ 2 := by
rw [Finset.sum_filter]
_ = (hammingDist x y : ℝ) * (4 * β€–M x yβ€– ^ 2) := by
simp [hammingDist, nsmul_eq_mul]
_ = 4 * (hammingDist x y : ℝ) * β€–M x yβ€– ^ 2 := by ring
/-- The total coordinate-commutator energy is four times the distance-weighted
entry energy. -/
theorem sum_hsNormSq_coordinate_commutator
(M : Matrix (Cube n) (Cube n) β„‚) :
(βˆ‘ i : Fin n, hsNormSq (M * coordinateSignMatrix i - coordinateSignMatrix i * M)) =
4 * βˆ‘ x : Cube n, βˆ‘ y : Cube n, (hammingDist x y : ℝ) * β€–M x yβ€– ^ 2 := by
classical
simp only [hsNormSq]
calc
(βˆ‘ i : Fin n, βˆ‘ x : Cube n, βˆ‘ y : Cube n,
β€–(M * coordinateSignMatrix i - coordinateSignMatrix i * M) x yβ€– ^ 2) =
βˆ‘ x : Cube n, βˆ‘ y : Cube n, βˆ‘ i : Fin n,
β€–(M * coordinateSignMatrix i - coordinateSignMatrix i * M) x yβ€– ^ 2 := by
rw [Finset.sum_comm]
exact Finset.sum_congr rfl fun _ _ => Finset.sum_comm
_ = βˆ‘ x : Cube n, βˆ‘ y : Cube n,
4 * (hammingDist x y : ℝ) * β€–M x yβ€– ^ 2 := by
simp_rw [sum_coordinate_commutator_sq_norm]
_ = 4 * βˆ‘ x : Cube n, βˆ‘ y : Cube n,
(hammingDist x y : ℝ) * β€–M x yβ€– ^ 2 := by
simp only [Finset.mul_sum, mul_assoc]
/-- A uniform coordinate-commutator Hilbert--Schmidt bound gives the distance
energy inequality for the actual cube matrix. -/
theorem distance_energy_le_of_coordinate_commutator_bound
(M : Matrix (Cube n) (Cube n) β„‚)
(hbound : βˆ€ i : Fin n,
hsNormSq (M * coordinateSignMatrix i - coordinateSignMatrix i * M) ≀ (2 : ℝ) ^ n) :
(βˆ‘ x : Cube n, βˆ‘ y : Cube n, (hammingDist x y : ℝ) * β€–M x yβ€– ^ 2) ≀
(n : ℝ) * (2 : ℝ) ^ n / 4 := by
have h := Finset.sum_le_sum (fun i (_ : i ∈ (Finset.univ : Finset (Fin n))) => hbound i)
rw [sum_hsNormSq_coordinate_commutator] at h
simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at h
linarith
/-- A coordinate at which distinct endpoints differ turns an entrywise
commutator estimate into the edge-entry cap `1/4`. -/
theorem off_diagonal_sq_norm_le_quarter_of_commutator_bound
(M : Matrix (Cube n) (Cube n) β„‚)
(hbound : βˆ€ (i : Fin n) (x y : Cube n),
β€–(M * coordinateSignMatrix i - coordinateSignMatrix i * M) x yβ€– ^ 2 ≀ 1)
(x y : Cube n) (hxy : x β‰  y) : β€–M x yβ€– ^ 2 ≀ (1 : ℝ) / 4 := by
classical
obtain ⟨i, hi⟩ : βˆƒ i : Fin n, x i β‰  y i := by
by_contra h
apply hxy
funext i
exact not_not.mp (not_exists.mp h i)
have h := hbound i x y
rw [coordinate_commutator_sq_norm, ite_eq_left hi] at h
linarith
end LeanBlast.GotsmanLinial
end OAI