cfahlgren1's picture
download
raw
3.82 kB
import Mathlib
import OAI.Computability.VertexCover.Fourier.ThreeBitTest
namespace OAI
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
namespace UniqueGames.Reduction.FiniteNoise
open scoped BigOperators
open UniqueGames.Foundations.Hastad (noiseWeight)
def realizedBit {D : Nat} (z : Fin D) : Bool := decide (z.val = 0)
def realizedNoise {A : Type*} {D : Nat} (z : A → Fin D) : A → Bool :=
fun a => realizedBit (z a)
theorem realizedBit_eq_true_iff {D : Nat} (positive : 0 < D) (z : Fin D) :
realizedBit z = true ↔ z = ⟨0, positive⟩ := by
simp [realizedBit, Fin.ext_iff]
theorem coordinate_fiber_sum {D : Nat} (positive : 0 < D) (b : Bool) :
(∑ z : Fin D, if realizedBit z = b then (D : ℝ)⁻¹ else 0) =
if b then (D : ℝ)⁻¹ else 1 - (D : ℝ)⁻¹ := by
have hd : (D : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt positive
have ht : (∑ z : Fin D, if realizedBit z = true then (D : ℝ)⁻¹ else 0) =
(D : ℝ)⁻¹ := by
simp_rw [realizedBit_eq_true_iff positive]
simp
have htotal :
(∑ z : Fin D, if realizedBit z = false then (D : ℝ)⁻¹ else 0) +
(∑ z : Fin D, if realizedBit z = true then (D : ℝ)⁻¹ else 0) = 1 := by
rw [← Finset.sum_add_distrib]
have he (z : Fin D) :
(if realizedBit z = false then (D : ℝ)⁻¹ else 0) +
(if realizedBit z = true then (D : ℝ)⁻¹ else 0) = (D : ℝ)⁻¹ := by
cases realizedBit z <;> simp
simp_rw [he]
simp [hd]
cases b <;> simp only [Bool.false_eq_true, ite_false, ite_true]
· linarith
· exact ht
variable {A : Type*} [Fintype A] [DecidableEq A]
theorem noiseWeight_eq_fiber_sum {D : Nat} (positive : 0 < D) (μ : A → Bool) :
noiseWeight ((D : ℝ)⁻¹) μ =
∑ z : A → Fin D,
∏ a, if realizedBit (z a) = μ a then (D : ℝ)⁻¹ else 0 := by
rw [← Fintype.prod_sum (fun (a : A) (z : Fin D) =>
if realizedBit z = μ a then (D : ℝ)⁻¹ else 0)]
unfold noiseWeight
apply Finset.prod_congr rfl
intro a _
exact (coordinate_fiber_sum positive (μ a)).symm
omit [DecidableEq A] in
theorem fiber_product_eq_indicator {D : Nat} (z : A → Fin D) (μ : A → Bool) :
(∏ a, if realizedBit (z a) = μ a then (D : ℝ)⁻¹ else 0) =
if realizedNoise z = μ then ((D : ℝ)⁻¹) ^ Fintype.card A else 0 := by
classical
by_cases h : realizedNoise z = μ
· rw [ite_eq_left h]
have ha (a : A) : realizedBit (z a) = μ a := congrFun h a
simp [ha]
· rw [ite_eq_right h]
obtain ⟨a, ha⟩ := Function.ne_iff.mp h
apply Finset.prod_eq_zero (Finset.mem_univ a)
exact ite_eq_right ha
theorem expect_realizedNoise {D : Nat} (positive : 0 < D) (H : (A → Bool) → ℝ) :
(𝔼 z : A → Fin D, H (realizedNoise z)) =
∑ μ : A → Bool, noiseWeight ((D : ℝ)⁻¹) μ * H μ := by
classical
symm
simp_rw [noiseWeight_eq_fiber_sum positive, Finset.sum_mul]
rw [Finset.sum_comm]
simp_rw [fiber_product_eq_indicator]
have he (z : A → Fin D) :
(∑ μ : A → Bool,
(if realizedNoise z = μ then ((D : ℝ)⁻¹) ^ Fintype.card A else 0) * H μ) =
((D : ℝ)⁻¹) ^ Fintype.card A * H (realizedNoise z) := by
simp [eq_comm]
simp_rw [he]
rw [Fintype.expect_eq_sum_div_card]
simp only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow]
rw [div_eq_mul_inv, inv_pow]
rw [← Finset.mul_sum]
exact mul_comm _ _
end UniqueGames.Reduction.FiniteNoise
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end OAI

Xet Storage Details

Size:
3.82 kB
·
Xet hash:
f1b01fc0f7fdd037d6107b5310d891d8037c7c59714e72305db85bc62d16c691

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