cfahlgren1's picture
download
raw
10.5 kB
import Mathlib.Algebra.Field.ZMod
import Mathlib.LinearAlgebra.Pi
import OAI.Computability.PerfectCompleteness.Decoding.CollisionAveragingLemmas
import OAI.Computability.PerfectCompleteness.Sampling.DensityVariation
namespace OAI
namespace PerfectCompleteness.BilinearWitness
open scoped BigOperators
noncomputable section
variable {π•œ I H : Type*} [Field π•œ] [Fintype I] [DecidableEq I]
[AddCommGroup H] [Module π•œ H]
{V : I β†’ Type*} [βˆ€ i, AddCommGroup (V i)] [βˆ€ i, Module π•œ (V i)]
def assemble (f : (i : I) β†’ V i β†’β‚—[π•œ] H) (x : (i : I) β†’ V i) : H :=
βˆ‘ i, f i (x i)
omit [DecidableEq I] in
theorem exists_child_pair (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f)) (B : H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ)
(nonzero : B β‰  0) : βˆƒ i j, βˆƒ (x : V i) (y : V j), B (f i x) (f j y) β‰  0 := by
classical
by_contra h
push Not at h
apply nonzero
ext u v
obtain ⟨x, rfl⟩ := spans u
obtain ⟨y, rfl⟩ := spans v
simp only [assemble, map_sum, LinearMap.sum_apply]
simp only [h, Finset.sum_const_zero, LinearMap.zero_apply]
def Witness (f : (i : I) β†’ V i β†’β‚—[π•œ] H) (B : H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ) :=
{ w : (Ξ£ i : I, Ξ£ j : I, V i Γ— V j) // B (f w.1 w.2.2.1) (f w.2.1 w.2.2.2) β‰  0 }
def chooseWitness (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f)) (B : H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ)
(nonzero : B β‰  0) : Witness f B := by
classical
apply Classical.choice
obtain ⟨i, j, x, y, h⟩ := exists_child_pair f spans B nonzero
exact ⟨⟨⟨i, j, x, y⟩, h⟩⟩
def selected (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f)) (B : H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ) : Finset I := by
classical
exact if h : B = 0 then βˆ… else
{ (chooseWitness f spans B h).val.1, (chooseWitness f spans B h).val.2.1 }
theorem selected_card_le (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f)) (B : H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ) :
(selected f spans B).card ≀ 2 := by
classical
unfold selected
split
Β· simp
Β· exact (Finset.card_insert_le _ _).trans (by simp)
theorem marked_of_restriction_zero (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f)) (B : H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ)
(nonzero : B β‰  0) (mask : I β†’ Bool) (U : Submodule π•œ H)
(unchanged : βˆ€ i, mask i = false β†’ βˆ€ x, f i x ∈ U)
(vanishes : βˆ€ x ∈ U, βˆ€ y ∈ U, B x y = 0) :
βˆƒ i ∈ selected f spans B, mask i = true := by
classical
let w := chooseWitness f spans B nonzero
have hselect : selected f spans B = {w.val.1, w.val.2.1} := by
simp only [selected, dite_eq_right nonzero, w]
rw [hselect]
by_cases hi : mask w.val.1 = true
· exact ⟨w.val.1, by simp, hi⟩
by_cases hj : mask w.val.2.1 = true
· exact ⟨w.val.2.1, by simp, hj⟩
have hif : mask w.val.1 = false := Bool.eq_false_of_not_eq_true hi
have hjf : mask w.val.2.1 = false := Bool.eq_false_of_not_eq_true hj
exact False.elim (w.property (vanishes _ (unchanged _ hif _) _ (unchanged _ hjf _)))
end
end PerfectCompleteness.BilinearWitness
namespace PerfectCompleteness.BilinearProjection
open scoped BigOperators
open scoped Classical
open UniqueGamesTheorem.Foundations.Games
open PerfectCompleteness ProjectionPosterior AdaptiveProjection BilinearWitness
noncomputable section
variable {π•œ I H : Type*} [Field π•œ] [Fintype I] [DecidableEq I]
[AddCommGroup H] [Module π•œ H]
{V : I β†’ Type*} [βˆ€ i, AddCommGroup (V i)] [βˆ€ i, Module π•œ (V i)]
{Ξ© : I β†’ Type*} [βˆ€ i, Fintype (Ξ© i)]
theorem disagreement_probability (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f))
(Fβ‚€ F₁ : ((i : I) β†’ Ξ© i) β†’ (H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ))
(U : ((i : I) β†’ Ξ© i) β†’ (I β†’ Bool) β†’ Submodule π•œ H)
(unchanged : βˆ€ x mask i, mask i = false β†’ βˆ€ v, f i v ∈ U x mask)
(P : (i : I) β†’ FiniteDistribution (Ξ© i))
(q : (i : I) β†’ Ξ© i β†’ ℝ) (nonnegative : βˆ€ i x, 0 ≀ q i x)
(mean : βˆ€ i, (P i).expectation (q i) = 1)
(Ξ² : ℝ) (hΞ² : 0 ≀ Ξ²) (hΞ²' : Ξ² < 1)
(L : ℝ) (hL : 0 ≀ L) (bound : βˆ€ i x, q i x ≀ L) :
(forward P q nonnegative mean Ξ² hΞ² hΞ²').probability
(fun z => decide (Fβ‚€ z.2 β‰  F₁ z.2 ∧
βˆ€ v ∈ U z.2 z.1, βˆ€ w ∈ U z.2 z.1, Fβ‚€ z.2 v w = F₁ z.2 v w)) ≀
2 * (Ξ² * L / (1 - Ξ²)) := by
classical
let select := fun x => selected f spans (Fβ‚€ x - F₁ x)
have inclusion : βˆ€ z : (I β†’ Bool) Γ— ((i : I) β†’ Ξ© i),
decide (Fβ‚€ z.2 β‰  F₁ z.2 ∧
βˆ€ v ∈ U z.2 z.1, βˆ€ w ∈ U z.2 z.1, Fβ‚€ z.2 v w = F₁ z.2 v w) = true β†’
decide (βˆƒ i ∈ select z.2, z.1 i = true) = true := by
intro z hz
have h := of_decide_eq_true hz
apply decide_eq_true
apply marked_of_restriction_zero f spans (Fβ‚€ z.2 - F₁ z.2)
(sub_ne_zero.mpr h.1) z.1 (U z.2 z.1) (unchanged z.2 z.1)
intro v hv w hw
simpa only [LinearMap.sub_apply, sub_eq_zero] using h.2 v hv w hw
exact ((forward P q nonnegative mean Ξ² hΞ² hΞ²').probability_mono inclusion).trans
(by simpa only [Nat.cast_ofNat] using
(adaptive_selection P q nonnegative mean Ξ² hΞ² hΞ²' L hL bound select 2
(fun x => selected_card_le f spans (Fβ‚€ x - F₁ x))))
end
end PerfectCompleteness.BilinearProjection
namespace PerfectCompleteness.BilinearCollisionTransfer
open scoped BigOperators Classical
open UniqueGamesTheorem.Foundations.Games
open PerfectCompleteness ProjectionPosterior BilinearWitness
noncomputable section
theorem probability_le_add_of_imp {X : Type*} [Fintype X]
(ΞΌ : FiniteDistribution X) (p q r : X β†’ Bool)
(h : βˆ€ x, p x = true β†’ q x = true ∨ r x = true) :
ΞΌ.probability p ≀ ΞΌ.probability q + ΞΌ.probability r := by
simp only [FiniteDistribution.probability, ← Finset.sum_add_distrib]
apply Finset.sum_le_sum
intro x _
cases hp : p x <;> cases hq : q x <;> cases hr : r x <;>
simp only [Bool.false_eq_true, ite_false, ite_true, zero_add, add_zero]
all_goals first | exact ΞΌ.nonnegative x | linarith [ΞΌ.nonnegative x] |
exact False.elim (by simpa [hq, hr] using h x hp)
variable {π•œ I H : Type*} [Field π•œ] [Fintype I] [DecidableEq I]
[AddCommGroup H] [Module π•œ H]
{V : I β†’ Type*} [βˆ€ i, AddCommGroup (V i)] [βˆ€ i, Module π•œ (V i)]
{Ξ© : I β†’ Type*} [βˆ€ i, Fintype (Ξ© i)]
abbrev Form := H β†’β‚—[π•œ] H β†’β‚—[π•œ] π•œ
def fullCollision (a b : Option (Form (π•œ := π•œ) (H := H))) : Bool :=
decide (βˆƒ F, a = some F ∧ b = some F)
def restrictedCollision (a b : Option (Form (π•œ := π•œ) (H := H)))
(U : Submodule π•œ H) : Bool :=
decide (βˆƒ F G, a = some F ∧ b = some G ∧
βˆ€ v ∈ U, βˆ€ w ∈ U, F v w = G v w)
theorem collision_split (a b : Option (Form (π•œ := π•œ) (H := H)))
(U : Submodule π•œ H) (h : restrictedCollision a b U = true) :
fullCollision a b = true ∨
decide (a.getD 0 β‰  b.getD 0 ∧
βˆ€ v ∈ U, βˆ€ w ∈ U, a.getD 0 v w = b.getD 0 v w) = true := by
obtain ⟨F, G, ha, hb, heq⟩ := of_decide_eq_true h
subst a b
by_cases hFG : F = G
Β· left
apply decide_eq_true
exact ⟨F, rfl, congrArg some hFG.symm⟩
Β· right
simpa only [Option.getD_some, decide_eq_true_eq] using And.intro hFG heq
theorem restricted_le_full_add (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f))
(Fβ‚€ F₁ : ((i : I) β†’ Ξ© i) β†’ Option (Form (π•œ := π•œ) (H := H)))
(U : ((i : I) β†’ Ξ© i) β†’ (I β†’ Bool) β†’ Submodule π•œ H)
(unchanged : βˆ€ x mask i, mask i = false β†’ βˆ€ v, f i v ∈ U x mask)
(P : (i : I) β†’ FiniteDistribution (Ξ© i))
(q : (i : I) β†’ Ξ© i β†’ ℝ) (nonnegative : βˆ€ i x, 0 ≀ q i x)
(mean : βˆ€ i, (P i).expectation (q i) = 1)
(Ξ² : ℝ) (hΞ² : 0 ≀ Ξ²) (hΞ²' : Ξ² < 1)
(L : ℝ) (hL : 0 ≀ L) (bound : βˆ€ i x, q i x ≀ L) :
(forward P q nonnegative mean Ξ² hΞ² hΞ²').probability
(fun z => restrictedCollision (Fβ‚€ z.2) (F₁ z.2) (U z.2 z.1)) ≀
((forward P q nonnegative mean Ξ² hΞ² hΞ²').pushforward Prod.snd).probability
(fun x => fullCollision (Fβ‚€ x) (F₁ x)) + 2 * (Ξ² * L / (1 - Ξ²)) := by
have hsplit := probability_le_add_of_imp (forward P q nonnegative mean Ξ² hΞ² hΞ²')
(fun z => restrictedCollision (Fβ‚€ z.2) (F₁ z.2) (U z.2 z.1))
(fun z => fullCollision (Fβ‚€ z.2) (F₁ z.2))
(fun z => decide ((Fβ‚€ z.2).getD 0 β‰  (F₁ z.2).getD 0 ∧
βˆ€ v ∈ U z.2 z.1, βˆ€ w ∈ U z.2 z.1,
(Fβ‚€ z.2).getD 0 v w = (F₁ z.2).getD 0 v w))
(fun z => collision_split (Fβ‚€ z.2) (F₁ z.2) (U z.2 z.1))
have hbad := BilinearProjection.disagreement_probability f spans
(fun x => (Fβ‚€ x).getD 0) (fun x => (F₁ x).getD 0) U unchanged
P q nonnegative mean Ξ² hΞ² hΞ²' L hL bound
rw [FiniteDistribution.probability_pushforward]
exact hsplit.trans (add_le_add (le_refl _) hbad)
theorem full_collision_transfer (f : (i : I) β†’ V i β†’β‚—[π•œ] H)
(spans : Function.Surjective (assemble f))
(Fβ‚€ F₁ : ((i : I) β†’ Ξ© i) β†’ Option (Form (π•œ := π•œ) (H := H)))
(U : ((i : I) β†’ Ξ© i) β†’ (I β†’ Bool) β†’ Submodule π•œ H)
(unchanged : βˆ€ x mask i, mask i = false β†’ βˆ€ v, f i v ∈ U x mask)
(P : (i : I) β†’ FiniteDistribution (Ξ© i))
(q : (i : I) β†’ Ξ© i β†’ ℝ) (nonnegative : βˆ€ i x, 0 ≀ q i x)
(mean : βˆ€ i, (P i).expectation (q i) = 1)
(Ξ² : ℝ) (hΞ² : 0 ≀ Ξ²) (hΞ²' : Ξ² < 1)
(L : ℝ) (hL : 0 ≀ L) (bound : βˆ€ i x, q i x ≀ L)
(Ξ½ : FiniteDistribution ((i : I) β†’ Ξ© i)) :
(forward P q nonnegative mean Ξ² hΞ² hΞ²').probability
(fun z => restrictedCollision (Fβ‚€ z.2) (F₁ z.2) (U z.2 z.1)) -
2 * (Ξ² * L / (1 - Ξ²)) -
((forward P q nonnegative mean Ξ² hΞ² hΞ²').pushforward Prod.snd).totalVariation Ξ½ ≀
Ξ½.probability (fun x => fullCollision (Fβ‚€ x) (F₁ x)) := by
have h := restricted_le_full_add f spans Fβ‚€ F₁ U unchanged
P q nonnegative mean Ξ² hΞ² hΞ²' L hL bound
have htv := FiniteDistribution.probability_le_add_totalVariation
((forward P q nonnegative mean Ξ² hΞ² hΞ²').pushforward Prod.snd) Ξ½
(fun x => fullCollision (Fβ‚€ x) (F₁ x))
linarith
end
end PerfectCompleteness.BilinearCollisionTransfer
end OAI

Xet Storage Details

Size:
10.5 kB
Β·
Xet hash:
481085c1df35b78ce342ab808f66b1f239415793aa3b4f25ad0edf5df75da438

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