cfahlgren1/math / lean /OAI /Computability /VertexCover /PCP /CayleySpectral.lean
cfahlgren1's picture
download
raw
9.35 kB
import Mathlib
import OAI.Computability.VertexCover.Fourier.Walsh
import OAI.Computability.VertexCover.PCP.SpectralReturn
namespace OAI
noncomputable section
namespace UniqueGames.Foundations.PCP.CayleySpectral
open scoped BigOperators
open Finset
open UniqueGames.Foundations.Hastad
open PoweringWalks
variable {I D : Type*}
def zeroFrequency : Cube I := fun _ => false
theorem cubeXor_cancel_right (x y : Cube I) :
cubeXor (cubeXor x y) y = x := by
funext i
cases hx : x i <;> cases hy : y i <;> simp [cubeXor, hx, hy]
theorem cubeXor_assoc (x y z : Cube I) :
cubeXor (cubeXor x y) z = cubeXor x (cubeXor y z) := by
funext i
cases hx : x i <;> cases hy : y i <;> cases hz : z i <;>
simp [cubeXor, hx, hy, hz]
@[simp] theorem cubeXor_zeroFrequency (x : Cube I) :
cubeXor x zeroFrequency = x := by
funext i
cases hx : x i <;> simp [cubeXor, zeroFrequency, hx]
def xorTranslation (y : Cube I) : Cube I ≃ Cube I where
toFun x := cubeXor x y
invFun x := cubeXor x y
left_inv x := cubeXor_cancel_right x y
right_inv x := cubeXor_cancel_right x y
def rotate (g : D → Cube I) (p : Cube I × D) : Cube I × D :=
(cubeXor p.1 (g p.2), p.2)
theorem rotate_involutive (g : D → Cube I) : Function.Involutive (rotate g) := by
rintro ⟨x, d⟩
change (cubeXor (cubeXor x (g d)) (g d), d) = (x, d)
rw [cubeXor_cancel_right]
def cayleyGraph (g : D → Cube I) : PortGraph (Cube I) D where
rot :=
{ toFun := rotate g
invFun := rotate g
left_inv := rotate_involutive g
right_inv := rotate_involutive g }
rot_involutive := rotate_involutive g
@[simp] theorem cayleyGraph_rot (g : D → Cube I) (x : Cube I) (d : D) :
(cayleyGraph g).rot (x, d) = (cubeXor x (g d), d) := rfl
def splitPortWord (n : Nat) : (Fin (n + 1) → D) ≃ D × (Fin n → D) where
toFun p := (p 0, fun j => p j.succ)
invFun z := Fin.cases z.1 z.2
left_inv p := by
funext j
exact Fin.cases rfl (fun _ => rfl) j
right_inv z := rfl
def powerGenerators (g : D → Cube I) : (n : Nat) → (Fin n → D) → Cube I
| 0, _ => zeroFrequency
| n + 1, p => cubeXor (g (p 0)) (powerGenerators g n (fun j => p j.succ))
theorem wordEnd_eq_powerGenerators (g : D → Cube I) (n : Nat)
(x : Cube I) (p : Fin n → D) :
wordEnd (cayleyGraph g) n x p = cubeXor x (powerGenerators g n p) := by
induction n generalizing x with
| zero => simp [wordEnd, powerGenerators]
| succ n ih =>
change wordEnd (cayleyGraph g) n (cubeXor x (g (p 0))) (fun j => p j.succ) =
cubeXor x (cubeXor (g (p 0)) (powerGenerators g n (fun j => p j.succ)))
rw [ih, cubeXor_assoc]
variable [Fintype I] [DecidableEq I] [Fintype D]
def cayleyAverage (g : D → Cube I) (f : Cube I → ℝ) (x : Cube I) : ℝ :=
𝔼 d, f ((cayleyGraph g).rot (x, d)).1
def eigenvalue (g : D → Cube I) (s : Cube I) : ℝ :=
𝔼 d, walsh s (g d)
omit [Fintype I] [DecidableEq I] in
@[simp] theorem averagingOperator_cayleyGraph (g : D → Cube I) (f : Cube I → ℝ) :
SpectralReturn.averagingOperator (cayleyGraph g) f = cayleyAverage g f := rfl
@[simp] theorem coefficient_zeroFrequency (f : Cube I → ℝ) :
coefficient f zeroFrequency = 𝔼 x, f x := by
simp [coefficient, zeroFrequency, walsh, bitSign]
theorem coefficient_xorTranslation (f : Cube I → ℝ) (s v : Cube I) :
coefficient (fun x => f (cubeXor x v)) s = walsh s v * coefficient f s := by
calc
coefficient (fun x => f (cubeXor x v)) s =
𝔼 x, f x * walsh s (cubeXor x v) := by
unfold coefficient
apply Fintype.expect_equiv (xorTranslation v)
intro x
change f (cubeXor x v) * walsh s x =
f (cubeXor x v) * walsh s (cubeXor (cubeXor x v) v)
rw [cubeXor_cancel_right]
_ = 𝔼 x, (f x * walsh s x) * walsh s v := by
apply Finset.expect_congr rfl
intro x _
rw [walsh_xor]
ring
_ = coefficient f s * walsh s v := by
rw [← Finset.expect_mul]
rfl
_ = walsh s v * coefficient f s := mul_comm _ _
theorem cayleyAverage_walsh (g : D → Cube I) (s x : Cube I) :
cayleyAverage g (walsh s) x = eigenvalue g s * walsh s x := by
unfold cayleyAverage
simp only [cayleyGraph_rot, walsh_xor]
rw [← Finset.mul_expect]
rw [mul_comm]
rfl
theorem coefficient_cayleyAverage (g : D → Cube I) (f : Cube I → ℝ) (s : Cube I) :
coefficient (cayleyAverage g f) s = eigenvalue g s * coefficient f s := by
calc
coefficient (cayleyAverage g f) s =
𝔼 x, 𝔼 d, f (cubeXor x (g d)) * walsh s x := by
unfold coefficient cayleyAverage
simp only [cayleyGraph_rot, Finset.expect_mul]
_ = 𝔼 d, 𝔼 x, f (cubeXor x (g d)) * walsh s x := by
rw [Finset.expect_comm]
_ = 𝔼 d, walsh s (g d) * coefficient f s := by
apply Finset.expect_congr rfl
intro d _
exact coefficient_xorTranslation f s (g d)
_ = eigenvalue g s * coefficient f s := by
rw [← Finset.expect_mul]
rfl
theorem eigenvalue_powerGenerators (g : D → Cube I) (n : Nat) (s : Cube I) :
eigenvalue (powerGenerators g n) s = eigenvalue g s ^ n := by
induction n with
| zero =>
let : Nonempty (Fin 0 → D) := ⟨fun i => Fin.elim0 i⟩
simp [eigenvalue, powerGenerators, zeroFrequency, walsh, bitSign]
| succ n ih =>
calc
eigenvalue (powerGenerators g (n + 1)) s =
𝔼 z : D × (Fin n → D),
walsh s (cubeXor (g z.1) (powerGenerators g n z.2)) := by
unfold eigenvalue
apply Fintype.expect_equiv (splitPortWord n)
intro p
rfl
_ = 𝔼 d, 𝔼 p : Fin n → D,
walsh s (cubeXor (g d) (powerGenerators g n p)) := by
exact SpectralReturn.mean_prod _
_ = eigenvalue g s * eigenvalue (powerGenerators g n) s := by
simp_rw [walsh_xor, ← Finset.mul_expect]
rw [← Finset.expect_mul]
rfl
_ = eigenvalue g s ^ (n + 1) := by
rw [ih, pow_succ, mul_comm]
theorem power_port_card (n : Nat) :
Fintype.card (Fin n → D) = Fintype.card D ^ n := by
simp only [Fintype.card_fun, Fintype.card_fin]
theorem seven_power_port_card :
Fintype.card (Fin 7 → Fin (2 ^ 16)) = (2 ^ 16) ^ 7 := by
simp only [Fintype.card_fun, Fintype.card_fin]
theorem cayley_energy_contraction (g : D → Cube I) (lambda : ℝ) (_hlambda : 0 ≤ lambda)
(hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ lambda)
(f : Cube I → ℝ) (hmean : (𝔼 x, f x) = 0) :
(𝔼 x, cayleyAverage g f x ^ 2) ≤ lambda ^ 2 * (𝔼 x, f x ^ 2) := by
classical
have hzero : coefficient f zeroFrequency = 0 := by
rw [coefficient_zeroFrequency]
exact hmean
calc
(𝔼 x, cayleyAverage g f x ^ 2) =
∑ s, coefficient (cayleyAverage g f) s ^ 2 := (walsh_parseval _).symm
_ = ∑ s, (eigenvalue g s * coefficient f s) ^ 2 := by
simp only [coefficient_cayleyAverage]
_ ≤ ∑ s, lambda ^ 2 * coefficient f s ^ 2 := by
apply Finset.sum_le_sum
intro s _
by_cases hs : s = zeroFrequency
· subst s
simp [hzero]
· have hb := hbias s hs
have hlo : -lambda ≤ eigenvalue g s := (abs_le.mp hb).1
have hhi : eigenvalue g s ≤ lambda := (abs_le.mp hb).2
have hprod : 0 ≤ (lambda - eigenvalue g s) * (lambda + eigenvalue g s) :=
mul_nonneg (sub_nonneg.mpr hhi) (by linarith)
have hsq : eigenvalue g s ^ 2 ≤ lambda ^ 2 := by nlinarith
calc
(eigenvalue g s * coefficient f s) ^ 2 =
eigenvalue g s ^ 2 * coefficient f s ^ 2 := by rw [mul_pow]
_ ≤ lambda ^ 2 * coefficient f s ^ 2 :=
mul_le_mul_of_nonneg_right hsq (sq_nonneg _)
_ = lambda ^ 2 * (𝔼 x, f x ^ 2) := by
rw [← Finset.mul_sum, walsh_parseval]
theorem cayley_spectralCertificate (g : D → Cube I) (lambda : ℝ)
(hlambda : 0 ≤ lambda) (hlambdaone : lambda < 1)
(hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ lambda) :
SpectralReturn.SpectralCertificate (cayleyGraph g) lambda where
nonnegative := hlambda
lt_one := hlambdaone
contraction := by
intro f hf
change (𝔼 x, cayleyAverage g f x ^ 2) ≤ lambda ^ 2 * (𝔼 x, f x ^ 2)
exact cayley_energy_contraction g lambda hlambda hbias f hf
theorem power_eigenvalue_bound (g : D → Cube I) (lambda : ℝ) (hlambda : 0 ≤ lambda)
(hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ lambda)
(n : Nat) (s : Cube I) (hs : s ≠ zeroFrequency) :
|eigenvalue (powerGenerators g n) s| ≤ lambda ^ n := by
rw [eigenvalue_powerGenerators, abs_pow]
induction n with
| zero => simp
| succ n ih =>
rw [pow_succ, pow_succ]
exact mul_le_mul ih (hbias s hs) (abs_nonneg _) (pow_nonneg hlambda _)
theorem sevenStep_halfCertificate (g : D → Cube I)
(hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ (1 / 2 : ℝ)) :
SpectralReturn.SpectralCertificate (cayleyGraph (powerGenerators g 7))
((1 / 2 : ℝ) ^ 7) := by
apply cayley_spectralCertificate
· norm_num
· norm_num
· intro s hs
exact power_eigenvalue_bound g (1 / 2) (by norm_num) hbias 7 s hs
end UniqueGames.Foundations.PCP.CayleySpectral
end
end OAI

Xet Storage Details

Size:
9.35 kB
·
Xet hash:
d9d2110773a319120c7161725718716f3c4fc427e42b1146276c14d3de7760cc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.