cfahlgren1/math / lean /OAI /Computability /VertexCover /PCP /PoweringMoment.lean
cfahlgren1's picture
download
raw
4.02 kB
import Mathlib
namespace OAI
noncomputable section
namespace UniqueGames.Foundations.PCP.PoweringMoment
open scoped BigOperators
def bit (p : Prop) : ℝ := by
classical
exact if p then 1 else 0
def hits {I Ω : Type*} [Fintype I] (E : I → Ω → Prop) (ω : Ω) : ℝ :=
∑ i, bit (E i ω)
def mean {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : ℝ := Finset.univ.expect f
theorem bit_nonneg (p : Prop) : 0 ≤ bit p := by
classical
by_cases hp : p <;> simp [bit, hp]
theorem bit_sq (p : Prop) : bit p ^ 2 = bit p := by
classical
by_cases hp : p <;> simp [bit, hp]
theorem bit_mul (p q : Prop) : bit p * bit q = bit (p ∧ q) := by
classical
by_cases hp : p <;> by_cases hq : q <;> simp [bit, hp, hq]
theorem bit_mono {p q : Prop} (hpq : p → q) : bit p ≤ bit q := by
classical
by_cases hp : p
· simp [bit, hp, hpq hp]
· have hz : bit p = 0 := by simp [bit, hp]
rw [hz]
exact bit_nonneg q
theorem hits_nonneg {I Ω : Type*} [Fintype I] (E : I → Ω → Prop) (ω : Ω) :
0 ≤ hits E ω := Finset.sum_nonneg (fun i _ => bit_nonneg (E i ω))
theorem mean_nonneg {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) (hf : ∀ ω, 0 ≤ f ω) :
0 ≤ mean f := Finset.expect_nonneg (fun ω _ => hf ω)
theorem mean_hits {I Ω : Type*} [Fintype I] [Fintype Ω] (E : I → Ω → Prop) :
mean (hits E) = ∑ i, mean (fun ω => bit (E i ω)) := by
exact Finset.expect_sum_comm _ _ _
theorem second_moment_eq {I Ω : Type*} [Fintype I] [Fintype Ω]
(E : I → Ω → Prop) :
mean (fun ω => hits E ω ^ 2) =
∑ i, ∑ j, mean (fun ω => bit (E i ω ∧ E j ω)) := by
simp only [hits, pow_two, Finset.sum_mul, Finset.mul_sum, bit_mul,
mean, Finset.expect_sum_comm]
exact Finset.sum_comm
theorem mean_witness_sq_le {I Ω : Type*} [Fintype I] [Fintype Ω]
(E W : I → Ω → Prop) (reject : Ω → Prop)
(hWE : ∀ i ω, W i ω → E i ω)
(hWR : ∀ i ω, W i ω → reject ω) :
mean (hits W) ^ 2 ≤
mean (fun ω => bit (reject ω)) * mean (fun ω => hits E ω ^ 2) := by
classical
have hNH (ω : Ω) : hits W ω ≤ hits E ω :=
Finset.sum_le_sum (fun i _ => bit_mono (hWE i ω))
have hzero (ω : Ω) (hr : ¬ reject ω) : hits W ω = 0 := by
apply Finset.sum_eq_zero
intro i _
have hw : ¬ W i ω := fun h => hr (hWR i ω h)
simp [bit, hw]
have hsupport (ω : Ω) : bit (reject ω) * hits W ω = hits W ω := by
by_cases hr : reject ω
· simp [bit, hr]
· rw [hzero ω hr]
simp
have hCS := Finset.expect_mul_sq_le_sq_mul_sq Finset.univ
(fun ω => bit (reject ω)) (hits W)
have hsquares : mean (fun ω => hits W ω ^ 2) ≤ mean (fun ω => hits E ω ^ 2) := by
apply Finset.expect_le_expect
intro ω _
simpa only [pow_two] using
(mul_le_mul (hNH ω) (hNH ω) (hits_nonneg W ω) (hits_nonneg E ω))
calc
_ ≤ mean (fun ω => bit (reject ω)) * mean (fun ω => hits W ω ^ 2) := by
simpa only [mean, hsupport, bit_sq] using hCS
_ ≤ _ := mul_le_mul_of_nonneg_left hsquares
(mean_nonneg _ (fun ω => bit_nonneg (reject ω)))
theorem rejection_lower_bound {I Ω : Type*} [Fintype I] [Fintype Ω]
(E W : I → Ω → Prop) (reject : Ω → Prop)
(hWE : ∀ i ω, W i ω → E i ω)
(hWR : ∀ i ω, W i ω → reject ω)
(a b : ℝ) (ha : 0 < a) (hb : 0 < b)
(hfirst : a ≤ mean (hits W))
(hsecond : mean (fun ω => hits E ω ^ 2) ≤ b) :
a ^ 2 / b ≤ mean (fun ω => bit (reject ω)) := by
have hN : 0 ≤ mean (hits W) := mean_nonneg _ (hits_nonneg W)
have hρ : 0 ≤ mean (fun ω => bit (reject ω)) :=
mean_nonneg _ (fun ω => bit_nonneg (reject ω))
have haSq : a ^ 2 ≤ mean (hits W) ^ 2 := by
simpa only [pow_two] using mul_le_mul hfirst hfirst ha.le hN
have hCS := mean_witness_sq_le E W reject hWE hWR
apply (div_le_iff₀ hb).2
exact haSq.trans (hCS.trans (mul_le_mul_of_nonneg_left hsecond hρ))
end UniqueGames.Foundations.PCP.PoweringMoment
end
end OAI

Xet Storage Details

Size:
4.02 kB
·
Xet hash:
9d48c713c704454a87ff2c626ef67ff626c250c262721ab42224a765806dd10d

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