math / data /lean /OAI /Computability /UniqueGames /Decoding /PrivateStrategyLemmas.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
22.6 kB
import OAI.Computability.UniqueGames.Analysis.ParityLemmas
import OAI.Computability.UniqueGames.Decoding.AdviceFibersLemmas
import OAI.Computability.UniqueGames.Foundations.SamplingLemmas
import OAI.Computability.UniqueGames.Games.FinishBoundsLemmas
namespace OAI
section
/-!
# Actual private response laws for Fourier decoding
The right response law has only its row-fiber table, the inclusion of its hidden
kernel, a first-bit map, and an actual fallback answer as arguments. In
particular it has no column slice or witness. Zero-mass invalid frequencies
are repaired to the fallback so that the response type always consists of
actual answers. Witness data occur only in the success analysis.
-/
noncomputable section
namespace UniqueGamesTheorem.Decoder.PrivateStrategy
attribute [local instance] Classical.propDecidable
open PrivateFourier
open UniqueGamesTheorem.Fourier.MatrixCharacters
open UniqueGamesTheorem.Foundations.Games
open scoped BigOperators Classical
section Candidates
variable {E E' : Type*} [AddCommGroup E] [Module F2 E]
[AddCommGroup E'] [Module F2 E'] [Fintype E]
def candidates (Z : Submodule F2 E) (z : E) (Ο„ : E β†’β‚—[F2] F2) : Finset E :=
Finset.univ.filter fun v => v - z ∈ Z ∧ Ο„ v = 1
theorem mem_candidates (Z : Submodule F2 E) (z v : E) (Ο„ : E β†’β‚—[F2] F2) :
v ∈ candidates Z z Ο„ ↔ v - z ∈ Z ∧ Ο„ v = 1 := by simp [candidates]
theorem candidates_nonempty (Z : Submodule F2 E) (z : E)
(Ο„ : E β†’β‚—[F2] F2) (hz : Ο„ z = 1) : (candidates Z z Ο„).Nonempty := by
exact ⟨z, (mem_candidates Z z z Ο„).2 ⟨by simp, hz⟩⟩
theorem candidates_card_le (Z : Submodule F2 E) [Fintype Z] (z : E)
(Ο„ : E β†’β‚—[F2] F2) : (candidates Z z Ο„).card ≀ Fintype.card Z := by
let f : {v // v ∈ candidates Z z Ο„} β†’ Z := fun v =>
⟨v.1 - z, ((mem_candidates Z z v.1 Ο„).1 v.2).1⟩
have hf : Function.Injective f := by
intro x y h
apply Subtype.ext
have he := congrArg Subtype.val h
change x.val - z = y.val - z at he
exact sub_left_injective he
simpa using Fintype.card_le_of_injective f hf
theorem candidates_card_le_pow (Z : Submodule F2 E) [Fintype Z]
[FiniteDimensional F2 Z] (z : E) (Ο„ : E β†’β‚—[F2] F2)
(r : β„•) (hr : Module.finrank F2 Z ≀ r) :
(candidates Z z Ο„).card ≀ 2 ^ r := by
have hc : Fintype.card Z = 2 ^ Module.finrank F2 Z := by
simpa [F2, UniqueGamesTheorem.Integration.BinaryLinear.F2, ZMod.card] using
Module.card_fintype (Module.finBasis F2 Z)
calc
_ ≀ Fintype.card Z := candidates_card_le Z z Ο„
_ = 2 ^ Module.finrank F2 Z := hc
_ ≀ 2 ^ r := Nat.pow_le_pow_right (by decide : 0 < 2) hr
/-- First-bit preservation converts a projected coset member into an actual
answer in the left candidate set. -/
theorem candidate_preimage (Z : Submodule F2 E) (z : E)
(Ο€ : E β†’β‚—[F2] E') (Ο„ : E β†’β‚—[F2] F2) (Ο„' : E' β†’β‚—[F2] F2)
(hΟ„ : Ο„'.comp Ο€ = Ο„) (y : E') (hy : y - Ο€ z ∈ Z.map Ο€)
(hybit : Ο„' y = 1) : βˆƒ v ∈ candidates Z z Ο„, Ο€ v = y := by
obtain ⟨w, hw, hwΟ€βŸ© := Submodule.mem_map.mp hy
have heq : Ο€ (z + w) = y := by
rw [map_add, hwΟ€]
rw [add_comm, sub_add_cancel]
refine ⟨z + w, (mem_candidates Z z (z + w) Ο„).2 ⟨?_, ?_⟩, heq⟩
Β· simpa only [add_sub_cancel_left] using hw
Β· rw [← hΟ„, LinearMap.comp_apply, heq, hybit]
end Candidates
section RightRule
variable {E H K : Type*}
variable [AddCommGroup E] [Module F2 E] [AddCommGroup H] [Module F2 H]
variable [AddCommGroup K] [Module F2 K]
variable [FiniteDimensional F2 E] [FiniteDimensional F2 H]
variable [Fintype (E β†’β‚—[F2] H)] [Fintype (H β†’β‚—[F2] E)]
variable [Fintype (K β†’β‚—[F2] F2)]
omit [FiniteDimensional F2 H] in
theorem exists_unit (Οƒ : H β†’β‚—[F2] F2) (hne : Οƒ β‰  0) : βˆƒ h, Οƒ h = 1 := by
have hn : βˆƒ h, Οƒ h β‰  0 := by
by_contra hh
apply hne
ext h
by_contra hh'
exact hh ⟨h, hh'⟩
obtain ⟨h, hh⟩ := hn
exact ⟨h, (UniqueGamesTheorem.Integration.BinaryLinear.scalar_cases _).resolve_left hh⟩
def chooseUnit (Οƒ : H β†’β‚—[F2] F2) (hne : Οƒ β‰  0) : H :=
Classical.choose (exists_unit Οƒ hne)
omit [FiniteDimensional F2 H] in
theorem chooseUnit_spec (Οƒ : H β†’β‚—[F2] F2) (hne : Οƒ β‰  0) :
Οƒ (chooseUnit Οƒ hne) = 1 := Classical.choose_spec (exists_unit Οƒ hne)
abbrev ActualAnswer (Ο„ : E β†’β‚—[F2] F2) := {v : E // Ο„ v = 1}
/-- The uniform output character followed by its actual Fourier frequency. -/
def privateSeedLaw (F : (E β†’β‚—[F2] H) β†’ K) :
FiniteDistribution ((K β†’β‚—[F2] F2) Γ— (H β†’β‚—[F2] E)) where
weight p := frequencyWeight (tableSign F p.1) p.2 /
(Fintype.card (K β†’β‚—[F2] F2) : ℝ)
nonnegative p := div_nonneg (frequencyWeight_nonneg _ _) (Nat.cast_nonneg _)
normalized := by
rw [Fintype.sum_prod_type]
simp_rw [← Finset.sum_div, tableSign_frequencyWeight_sum]
simp [Fintype.card_ne_zero]
theorem privateSeedLaw_expectation (F : (E β†’β‚—[F2] H) β†’ K)
(g : ((K β†’β‚—[F2] F2) Γ— (H β†’β‚—[F2] E)) β†’ ℝ) :
(privateSeedLaw F).expectation g =
𝔼 Οƒ : K β†’β‚—[F2] F2, βˆ‘ Ξ¦ : H β†’β‚—[F2] E,
frequencyWeight (tableSign F Οƒ) Ξ¦ * g (Οƒ, Ξ¦) := by
simp only [FiniteDistribution.expectation, privateSeedLaw, Fintype.sum_prod_type,
Fintype.expect_eq_sum_div_card]
simp_rw [div_mul_eq_mul_div, ← Finset.sum_div]
/-- The decoder receives no left witness. The first-bit repair affects only
zero-mass frequencies when the table is folded. -/
def privateOutput (ΞΉ : H β†’β‚—[F2] K) (Ο„ : E β†’β‚—[F2] F2)
(fallback : ActualAnswer Ο„) (p : (K β†’β‚—[F2] F2) Γ— (H β†’β‚—[F2] E)) :
ActualAnswer Ο„ :=
if hn : p.1.comp ΞΉ = 0 then fallback else
let v := p.2 (chooseUnit (p.1.comp ΞΉ) hn)
if hv : Ο„ v = 1 then ⟨v, hv⟩ else fallback
omit [FiniteDimensional F2 E] [Fintype (H β†’β‚—[F2] E)] [Fintype (K β†’β‚—[F2] F2)] in
theorem privateOutput_eq_contraction (F : (E β†’β‚—[F2] H) β†’ K)
(ΞΉ : H β†’β‚—[F2] K) (Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„)
(folded : βˆ€ N h, F (N + Ο„.smulRight h) = F N + ΞΉ h)
(Οƒ : K β†’β‚—[F2] F2) (Ξ¦ : H β†’β‚—[F2] E)
(hn : Οƒ.comp ΞΉ β‰  0) (hp : 0 < frequencyWeight (tableSign F Οƒ) Ξ¦) :
(privateOutput ΞΉ Ο„ fallback (Οƒ, Ξ¦)).1 = Ξ¦ (chooseUnit (Οƒ.comp ΞΉ) hn) := by
have hunit : Οƒ (ΞΉ (chooseUnit (Οƒ.comp ΞΉ) hn)) = 1 := chooseUnit_spec (Οƒ.comp ΞΉ) hn
have hfold := tableSign_antifold F ΞΉ Ο„ Οƒ (chooseUnit (Οƒ.comp ΞΉ) hn)
(fun N => folded N _) hunit
have hbit := positive_frequency_first_bit (tableSign F Οƒ) Ο„
(chooseUnit (Οƒ.comp ΞΉ) hn) Ξ¦ hfold hp
simp [privateOutput, hn, hbit]
/-- This is an actual finite distribution on actual answers, for every visible
row table. The sampler's normalization is Parseval, not a hypothesis. -/
def privateLaw [Fintype E] (F : (E β†’β‚—[F2] H) β†’ K)
(ΞΉ : H β†’β‚—[F2] K) (Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„) :
FiniteDistribution (ActualAnswer Ο„) :=
(privateSeedLaw F).pushforward (privateOutput ΞΉ Ο„ fallback)
theorem privateLaw_expectation [Fintype E] (F : (E β†’β‚—[F2] H) β†’ K)
(ΞΉ : H β†’β‚—[F2] K) (Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„)
(g : ActualAnswer Ο„ β†’ ℝ) :
(privateLaw F ΞΉ Ο„ fallback).expectation g =
𝔼 Οƒ : K β†’β‚—[F2] F2, βˆ‘ Ξ¦ : H β†’β‚—[F2] E,
frequencyWeight (tableSign F Οƒ) Ξ¦ * g (privateOutput ΞΉ Ο„ fallback (Οƒ, Ξ¦)) := by
rw [privateLaw, FiniteDistribution.expectation_pushforward, privateSeedLaw_expectation]
end RightRule
section LeftRule
variable {E : Type*} [AddCommGroup E] [Module F2 E] [Fintype E]
/-- The left rule is uniform on its own chosen affine-answer candidates. -/
def candidateLaw (Z : Submodule F2 E) (z : E) (Ο„ : E β†’β‚—[F2] F2)
(hz : Ο„ z = 1) : FiniteDistribution (ActualAnswer Ο„) := by
letI : Nonempty {v // v ∈ candidates Z z Ο„} :=
⟨⟨z, (mem_candidates Z z z Ο„).2 ⟨by simp, hz⟩⟩⟩
exact (FiniteDistribution.uniform {v // v ∈ candidates Z z Ο„}).pushforward
(fun v => ⟨v.1, ((mem_candidates Z z v.1 Ο„).1 v.2).2⟩)
theorem candidateLaw_expectation (Z : Submodule F2 E) (z : E)
(Ο„ : E β†’β‚—[F2] F2) (hz : Ο„ z = 1) (g : E β†’ ℝ) :
(candidateLaw Z z Ο„ hz).expectation (fun v => g v.1) =
𝔼 v ∈ candidates Z z Ο„, g v := by
let : Nonempty {v // v ∈ candidates Z z Ο„} :=
⟨⟨z, (mem_candidates Z z z Ο„).2 ⟨by simp, hz⟩⟩⟩
unfold candidateLaw
rw [FiniteDistribution.expectation_pushforward, FiniteDistribution.expectation_uniform,
Finset.expect_eq_sum_div_card]
simp only [Fintype.card_coe, Finset.sum_coe_sort]
end LeftRule
section ConditionalAgreement
variable {U E H K : Type*}
variable [AddCommGroup U] [Module F2 U] [Fintype U]
variable [AddCommGroup E] [Module F2 E] [Fintype E]
variable [AddCommGroup H] [Module F2 H]
variable [AddCommGroup K] [Module F2 K]
variable [FiniteDimensional F2 E] [FiniteDimensional F2 H]
variable [Fintype (E β†’β‚—[F2] H)] [Fintype (H β†’β‚—[F2] E)]
variable [Fintype (K β†’β‚—[F2] F2)]
/-- Actual independent response-law success, with the literal projection test. -/
def conditionalAgreement (Z : Submodule F2 U) (z : U)
(Ο„U : U β†’β‚—[F2] F2) (hz : Ο„U z = 1) (Ο€ : U β†’β‚—[F2] E)
(F : (E β†’β‚—[F2] H) β†’ K) (ΞΉ : H β†’β‚—[F2] K)
(Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„) : ℝ :=
((candidateLaw Z z Ο„U hz).product (privateLaw F ΞΉ Ο„ fallback)).probability
(fun a => decide (Ο€ a.1.1 = a.2.1))
theorem conditionalAgreement_eq_sum (Z : Submodule F2 U) (z : U)
(Ο„U : U β†’β‚—[F2] F2) (hz : Ο„U z = 1) (Ο€ : U β†’β‚—[F2] E)
(F : (E β†’β‚—[F2] H) β†’ K) (ΞΉ : H β†’β‚—[F2] K)
(Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„) :
conditionalAgreement Z z Ο„U hz Ο€ F ΞΉ Ο„ fallback =
𝔼 Οƒ : K β†’β‚—[F2] F2, βˆ‘ Ξ¦ : H β†’β‚—[F2] E,
frequencyWeight (tableSign F Οƒ) Ξ¦ *
(𝔼 v ∈ candidates Z z Ο„U,
if Ο€ v = (privateOutput ΞΉ Ο„ fallback (Οƒ, Ξ¦)).1 then (1 : ℝ) else 0) := by
unfold conditionalAgreement
have hp (ΞΌ : FiniteDistribution (ActualAnswer Ο„U Γ— ActualAnswer Ο„)) :
ΞΌ.probability (fun a => decide (Ο€ a.1.1 = a.2.1)) =
ΞΌ.expectation (fun a => if Ο€ a.1.1 = a.2.1 then (1 : ℝ) else 0) := by
simp [FiniteDistribution.probability, FiniteDistribution.expectation, mul_ite]
rw [hp, FiniteDistribution.expectation_product]
simp_rw [privateLaw_expectation]
rw [candidateLaw_expectation Z z Ο„U hz (fun v =>
𝔼 Οƒ : K β†’β‚—[F2] F2, βˆ‘ Ξ¦ : H β†’β‚—[F2] E,
frequencyWeight (tableSign F Οƒ) Ξ¦ *
(if Ο€ v = (privateOutput ΞΉ Ο„ fallback (Οƒ, Ξ¦)).1 then (1 : ℝ) else 0)),
Finset.expect_comm]
apply Finset.expect_congr rfl
intro Οƒ _
rw [Finset.expect_sum_comm]
apply Finset.sum_congr rfl
intro Ξ¦ _
exact (Finset.mul_expect _ _ _).symm
/-- The exact good Fourier mass in a witness coset; unlike the response law,
this analysis-only quantity is allowed to mention the witness. -/
def goodCosetMass (Q : Submodule F2 E) (z' : E)
(F : (E β†’β‚—[F2] H) β†’ K) (ΞΉ : H β†’β‚—[F2] K) : ℝ :=
𝔼 Οƒ : K β†’β‚—[F2] F2, if Οƒ.comp ΞΉ β‰  0 then
βˆ‘ Ξ¦ ∈ frequencyCoset Q.mkQ ((Οƒ.comp ΞΉ).smulRight z'),
frequencyWeight (tableSign F Οƒ) Ξ¦ else 0
omit [Fintype E] [FiniteDimensional F2 E] [FiniteDimensional F2 H] in
theorem goodCosetMass_nonneg (Q : Submodule F2 E) (z' : E)
(F : (E β†’β‚—[F2] H) β†’ K) (ΞΉ : H β†’β‚—[F2] K) :
0 ≀ goodCosetMass Q z' F ΞΉ := by
apply Finset.expect_nonneg
intro Οƒ _
split
Β· exact Finset.sum_nonneg fun _ _ => frequencyWeight_nonneg _ _
Β· exact le_rfl
omit [Fintype E] [FiniteDimensional F2 E] [Fintype (K β†’β‚—[F2] F2)] in
/-- A good sampled frequency has a valid left preimage. Neither decoder is
given the proof or the witness used here. -/
theorem good_frequency_preimage (Z : Submodule F2 U) (z : U)
(Ο„U : U β†’β‚—[F2] F2) (Ο€ : U β†’β‚—[F2] E)
(F : (E β†’β‚—[F2] H) β†’ K) (ΞΉ : H β†’β‚—[F2] K)
(Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„)
(hΟ„ : Ο„.comp Ο€ = Ο„U)
(folded : βˆ€ N h, F (N + Ο„.smulRight h) = F N + ΞΉ h)
(Οƒ : K β†’β‚—[F2] F2) (Ξ¦ : H β†’β‚—[F2] E)
(hn : Οƒ.comp ΞΉ β‰  0)
(hc : Ξ¦ ∈ frequencyCoset (Z.map Ο€).mkQ ((Οƒ.comp ΞΉ).smulRight (Ο€ z)))
(hp : 0 < frequencyWeight (tableSign F Οƒ) Ξ¦) :
βˆƒ v ∈ candidates Z z Ο„U, Ο€ v = (privateOutput ΞΉ Ο„ fallback (Οƒ, Ξ¦)).1 := by
have hout := privateOutput_eq_contraction F ΞΉ Ο„ fallback folded Οƒ Ξ¦ hn hp
apply candidate_preimage Z z Ο€ Ο„U Ο„ hΟ„
Β· rw [hout]
apply contraction_mem_target_coset (Z.map Ο€) (Οƒ.comp ΞΉ) (Ο€ z) Ξ¦
(chooseUnit (Οƒ.comp ΞΉ) hn) (chooseUnit_spec _ _)
simpa [frequencyCoset] using hc
Β· exact (privateOutput ΞΉ Ο„ fallback (Οƒ, Ξ¦)).2
/-- The actual independent policies agree with at least the good Fourier mass
divided by the number of left candidates. -/
theorem conditionalAgreement_ge_mass_div_card (Z : Submodule F2 U) (z : U)
(Ο„U : U β†’β‚—[F2] F2) (hz : Ο„U z = 1) (Ο€ : U β†’β‚—[F2] E)
(F : (E β†’β‚—[F2] H) β†’ K) (ΞΉ : H β†’β‚—[F2] K)
(Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„)
(hΟ„ : Ο„.comp Ο€ = Ο„U)
(folded : βˆ€ N h, F (N + Ο„.smulRight h) = F N + ΞΉ h) :
goodCosetMass (Z.map Ο€) (Ο€ z) F ΞΉ / (candidates Z z Ο„U).card ≀
conditionalAgreement Z z Ο„U hz Ο€ F ΞΉ Ο„ fallback := by
rw [goodCosetMass, Finset.expect_div, conditionalAgreement_eq_sum]
apply Finset.expect_le_expect
intro Οƒ _
have hi := independent_agreement_lower (candidates Z z Ο„U) Ο€
(fun Ξ¦ => (privateOutput ΞΉ Ο„ fallback (Οƒ, Ξ¦)).1)
(frequencyWeight (tableSign F Οƒ))
(fun Ξ¦ => Οƒ.comp ΞΉ β‰  0 ∧
Ξ¦ ∈ frequencyCoset (Z.map Ο€).mkQ ((Οƒ.comp ΞΉ).smulRight (Ο€ z)))
(frequencyWeight_nonneg _)
(fun Φ hΦ hp => good_frequency_preimage Z z τU π F ι τ fallback
hτ folded σ Φ hΦ.1 hΦ.2 hp)
by_cases hn : Οƒ.comp ΞΉ β‰  0
Β· simpa [hn, Finset.sum_filter] using hi
Β· simpa [hn] using hi
end ConditionalAgreement
section SliceBound
variable {E H K : Type*}
variable [AddCommGroup E] [Module F2 E] [Fintype E]
variable [AddCommGroup H] [Module F2 H] [Fintype H]
variable [AddCommGroup K] [Module F2 K]
variable [FiniteDimensional F2 E] [FiniteDimensional F2 H]
variable [Fintype (E β†’β‚—[F2] H)] [Fintype (H β†’β‚—[F2] E)]
variable [Fintype (K β†’β‚—[F2] F2)]
omit [Fintype E] in
/-- The actual transferred affine-slice agreement supplies the sampled good
Fourier mass, including removal of characters trivial on the hidden kernel. -/
theorem goodCosetMass_lower_from_slice (Q : Submodule F2 E)
[Fintype (H β†’β‚—[F2] Q)] [Fintype ((E β§Έ Q) β†’β‚—[F2] H)]
(Nβ‚€ : E β†’β‚—[F2] H) (F : (E β†’β‚—[F2] H) β†’ K)
(ΞΉ : H β†’β‚—[F2] K) (hΞΉ : Function.Injective ΞΉ) (z' : E) (b : K)
(Ξ± : ℝ) (hΞ± : 0 ≀ Ξ±) (β„“ r : β„•)
(hH : Module.finrank F2 H ≀ β„“) (hQ : Module.finrank F2 Q ≀ r)
(hsmall : 1 / (Fintype.card H : ℝ) ≀ Ξ± / 8)
(hagreement : Ξ± / 4 ≀ 𝔼 A : (E β§Έ Q) β†’β‚—[F2] H,
if F (Nβ‚€ + A.comp Q.mkQ) = b + ΞΉ ((Nβ‚€ + A.comp Q.mkQ) z')
then (1 : ℝ) else 0) :
(Ξ± / 8) ^ 2 / (2 : ℝ) ^ (β„“ * r) ≀ goodCosetMass Q z' F ΞΉ := by
let good : (K β†’β‚—[F2] F2) β†’ Prop := fun Οƒ => Οƒ.comp ΞΉ β‰  0
let : DecidablePred good := fun _ => Classical.propDecidable _
let C : (K β†’β‚—[F2] F2) β†’ ℝ := fun Οƒ =>
sliceCorrelation Q.mkQ Nβ‚€ (tableSign F Οƒ) ((Οƒ.comp ΞΉ).smulRight z')
let mass : (K β†’β‚—[F2] F2) β†’ ℝ := fun Οƒ =>
βˆ‘ Ξ¦ ∈ frequencyCoset Q.mkQ ((Οƒ.comp ΞΉ).smulRight z'),
frequencyWeight (tableSign F Οƒ) Ξ¦
have habs : Ξ± / 4 ≀ 𝔼 Οƒ : K β†’β‚—[F2] F2, |C Οƒ| :=
hagreement.trans (agreement_le_average_abs_correlation Q.mkQ Nβ‚€ F ΞΉ z' b)
have hbad : (𝔼 Οƒ : K β†’β‚—[F2] F2,
if good Οƒ then (0 : ℝ) else 1) ≀ Ξ± / 8 := by
have ht := trivial_restriction_probability ΞΉ hΞΉ
have heq : (𝔼 Οƒ : K β†’β‚—[F2] F2,
if good Οƒ then (0 : ℝ) else 1) = 1 / (Fintype.card H : ℝ) := by
calc
_ = 𝔼 Οƒ : K β†’β‚—[F2] F2, if Οƒ.comp ΞΉ = 0 then (1 : ℝ) else 0 := by
apply Finset.expect_congr rfl
intro Οƒ _
by_cases hn : Οƒ.comp ΞΉ = 0 <;> simp [good, hn]
_ = _ := ht
exact heq.le.trans hsmall
have hselected : Ξ± / 8 ≀ 𝔼 Οƒ : K β†’β‚—[F2] F2,
if good Οƒ then |C Οƒ| else 0 := by
have hh := remove_bad_characters C good (Ξ± / 4) (Ξ± / 8)
(fun Οƒ => sliceCorrelation_tableSign_abs_le_one Q.mkQ Nβ‚€ F Οƒ
((Οƒ.comp ΞΉ).smulRight z')) habs hbad
linarith
have hbound := average_coset_mass_lower C mass good
((2 : ℝ) ^ (β„“ * r)) (Ξ± / 8) (by positivity) (by positivity) hselected
(by
intro Οƒ _
have hcs := sliceCorrelation_sq_le_coset_mass Q.mkQ Nβ‚€ (tableSign F Οƒ)
((Οƒ.comp ΞΉ).smulRight z')
have hc : ((frequencyCoset Q.mkQ ((Οƒ.comp ΞΉ).smulRight z')).card : ℝ) ≀
(2 : ℝ) ^ (β„“ * r) := by
exact_mod_cast frequencyCoset_card_le Q ((Οƒ.comp ΞΉ).smulRight z') β„“ r hH hQ
exact hcs.trans (mul_le_mul_of_nonneg_right hc
(Finset.sum_nonneg fun _ _ => frequencyWeight_nonneg _ _)))
calc
_ ≀ 𝔼 Οƒ : K β†’β‚—[F2] F2, if good Οƒ then mass Οƒ else 0 := hbound
_ = goodCosetMass Q z' F ΞΉ := by
unfold goodCosetMass
apply Finset.expect_congr rfl
intro Οƒ _
by_cases hn : Οƒ.comp ΞΉ = 0 <;> simp [good, mass, hn]
end SliceBound
section FinalConditionalBound
variable {U E H K : Type*}
variable [AddCommGroup U] [Module F2 U] [Fintype U]
variable [AddCommGroup E] [Module F2 E] [Fintype E]
variable [AddCommGroup H] [Module F2 H] [Fintype H]
variable [AddCommGroup K] [Module F2 K]
variable [FiniteDimensional F2 U] [FiniteDimensional F2 E] [FiniteDimensional F2 H]
variable [Fintype (E β†’β‚—[F2] H)] [Fintype (H β†’β‚—[F2] E)]
variable [Fintype (K β†’β‚—[F2] F2)]
theorem conditionalAgreement_from_slice (Z : Submodule F2 U) [Fintype Z]
(z : U) (Ο„U : U β†’β‚—[F2] F2) (hz : Ο„U z = 1) (Ο€ : U β†’β‚—[F2] E)
[Fintype (H β†’β‚—[F2] Z.map Ο€)] [Fintype ((E β§Έ Z.map Ο€) β†’β‚—[F2] H)]
(Nβ‚€ : E β†’β‚—[F2] H) (F : (E β†’β‚—[F2] H) β†’ K)
(ΞΉ : H β†’β‚—[F2] K) (hΞΉ : Function.Injective ΞΉ)
(Ο„ : E β†’β‚—[F2] F2) (fallback : ActualAnswer Ο„) (hΟ„ : Ο„.comp Ο€ = Ο„U)
(folded : βˆ€ N h, F (N + Ο„.smulRight h) = F N + ΞΉ h)
(b : K) (Ξ± : ℝ) (hΞ± : 0 ≀ Ξ±) (β„“ r : β„•)
(hH : Module.finrank F2 H ≀ β„“) (hZ : Module.finrank F2 Z ≀ r)
(hsmall : 1 / (Fintype.card H : ℝ) ≀ Ξ± / 8)
(hagreement : Ξ± / 4 ≀ 𝔼 A : (E β§Έ Z.map Ο€) β†’β‚—[F2] H,
if F (Nβ‚€ + A.comp (Z.map Ο€).mkQ) =
b + ΞΉ ((Nβ‚€ + A.comp (Z.map Ο€).mkQ) (Ο€ z)) then (1 : ℝ) else 0) :
(Ξ± / 8) ^ 2 / (2 : ℝ) ^ (β„“ * r) / (2 : ℝ) ^ r ≀
conditionalAgreement Z z Ο„U hz Ο€ F ΞΉ Ο„ fallback := by
have hQ : Module.finrank F2 (Z.map Ο€) ≀ r :=
(Submodule.finrank_map_le Ο€ Z).trans hZ
have hmass := goodCosetMass_lower_from_slice (Z.map Ο€) Nβ‚€ F ΞΉ hΞΉ (Ο€ z) b
Ξ± hΞ± β„“ r hH hQ hsmall hagreement
have hcard : ((candidates Z z Ο„U).card : ℝ) ≀ (2 : ℝ) ^ r := by
exact_mod_cast candidates_card_le_pow Z z Ο„U r hZ
have hcardpos : (0 : ℝ) < (candidates Z z Ο„U).card :=
Nat.cast_pos.mpr (Finset.card_pos.mpr (candidates_nonempty Z z Ο„U hz))
calc
_ ≀ goodCosetMass (Z.map Ο€) (Ο€ z) F ΞΉ / (2 : ℝ) ^ r :=
div_le_div_of_nonneg_right hmass (by positivity)
_ ≀ goodCosetMass (Z.map Ο€) (Ο€ z) F ΞΉ / (candidates Z z Ο„U).card :=
div_le_div_of_nonneg_left (goodCosetMass_nonneg _ _ _ _) hcardpos hcard
_ ≀ _ := conditionalAgreement_ge_mass_div_card Z z Ο„U hz Ο€ F ΞΉ Ο„ fallback hΟ„ folded
end FinalConditionalBound
end UniqueGamesTheorem.Decoder.PrivateStrategy
end
end
section
/-!
The surrogate perturbation fixes the complementary table exactly. Splitting
the actual uniform matrix law therefore expresses surrogate acceptance as the
mean of the uniform shortcode tests on the `(U,T)` fibers, including zero
perturbation factors. This supplies the sampling identification needed before
applying the inverse theorem to the many useful fibers.
-/
namespace UniqueGamesTheorem.Decoder.SurrogateFibers
open UniqueGamesTheorem.Integration.BinaryLinear
open UniqueGamesTheorem.Fourier
open PositiveMultiplier
open scoped BigOperators
noncomputable section
variable {E K W C : Type*}
variable [AddCommGroup E] [Module F2 E]
variable [AddCommGroup K] [Module F2 K] [Fintype K]
variable [AddCommGroup W] [Module F2 W] [Fintype W]
variable [Fintype (E β†’β‚—[F2] F2)]
variable [Fintype (E β†’β‚—[F2] K)] [Fintype (E β†’β‚—[F2] W)]
variable [Fintype (E β†’β‚—[F2] K Γ— W)]
/-- Uniform shortcode sampling; neither nonzero-factor conditioning nor
rank-one-matrix-uniform sampling is substituted for its two independent factors. -/
def shortcodeAcceptance (f : (E β†’β‚—[F2] K) β†’ C) : ℝ := by
classical
exact 𝔼 M, 𝔼 a : K, 𝔼 l : E β†’β‚—[F2] F2,
if f M = f (M + l.smulRight a) then (1 : ℝ) else 0
omit [Fintype K] [Fintype W] [Fintype (E β†’β‚—[F2] F2)]
[Fintype (E β†’β‚—[F2] K)] [Fintype (E β†’β‚—[F2] W)] [Fintype (E β†’β‚—[F2] K Γ— W)] in
theorem product_perturbation (M : E β†’β‚—[F2] K) (T : E β†’β‚—[F2] W)
(l : E β†’β‚—[F2] F2) (a : K) :
M.prod T + l.smulRight ((LinearMap.inl F2 K W) a) =
(M + l.smulRight a).prod T := by
ext x <;> simp
theorem surrogate_acceptance_eq_fiber_average
(label : (E β†’β‚—[F2] K Γ— W) β†’ C) :
equalityAcceptance (subspaceLaw (LinearMap.inl F2 K W)) label =
𝔼 T : E β†’β‚—[F2] W,
shortcodeAcceptance (fun M : E β†’β‚—[F2] K => label (M.prod T)) := by
classical
have hsampling : equalityAcceptance (subspaceLaw (LinearMap.inl F2 K W)) label =
𝔼 X : E β†’β‚—[F2] K Γ— W, 𝔼 a : K, 𝔼 l : E β†’β‚—[F2] F2,
if label X = label (X + l.smulRight ((LinearMap.inl F2 K W) a)) then
(1 : ℝ) else 0 := by
unfold equalityAcceptance
apply Finset.expect_congr rfl
intro X _
rw [subspaceLaw_sum, Fintype.expect_eq_sum_div_card]
ring
rw [hsampling, SplitMaps.expect_codomain_product, Finset.expect_comm]
apply Finset.expect_congr rfl
intro T _
unfold shortcodeAcceptance
apply Finset.expect_congr rfl
intro M _
apply Finset.expect_congr rfl
intro a _
apply Finset.expect_congr rfl
intro l _
rw [product_perturbation]
end
end UniqueGamesTheorem.Decoder.SurrogateFibers
end
end OAI