math / data /lean /OAI /Computability /PerfectCompleteness /Algebra /TensorAffineHeavyWitness.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
8.06 kB
import OAI.Computability.PerfectCompleteness.Algebra.AffineLinearHeavyWitness
import OAI.Computability.PerfectCompleteness.Algebra.BilinearGramCompressionLemmas
import OAI.Computability.PerfectCompleteness.Algebra.TensorBucketEvaluationLemmas
import OAI.Computability.PerfectCompleteness.Algebra.TensorSliceDimension
import OAI.Computability.PerfectCompleteness.Foundations.OutputAnnihilator
import OAI.Computability.PerfectCompleteness.Sampling.OwnLawHeavyList
namespace OAI
section
namespace PerfectCompleteness.TensorAffineHeavyWitness
open scoped TensorProduct Classical
open QuarterBalance (F2)
open UniqueGamesTheorem.Foundations.Games
noncomputable section
variable {β„“ : Nat} {H : Type*} [AddCommGroup H] [Module F2 H]
[Finite H] [FiniteDimensional F2 H]
local instance dualFintype {V : Type*} [AddCommGroup V] [Module F2 V] [Fintype V] :
Fintype (Module.Dual F2 V) :=
Fintype.ofInjective (fun f : Module.Dual F2 V => (f : V β†’ F2)) DFunLike.coe_injective
def heavyList (W : Submodule F2 (Fin β„“ β†’ F2))
(ΞΌ : FiniteDistribution (W βŠ—[F2] H)) (G : (W βŠ—[F2] H) β†’ (Fin β„“ β†’ F2))
(Ο„ : ℝ) (Οƒ : Module.Dual F2 (Fin β„“ β†’ F2)) :
Finset (Module.Dual F2 (W βŠ—[F2] H)) :=
OwnLawHeavyList.heavyList ΞΌ (fun X => QuarterBalance.sign (Οƒ (G X))) Ο„
omit [FiniteDimensional F2 H] in
theorem heavyList_card_le (W : Submodule F2 (Fin β„“ β†’ F2))
(ΞΌ : FiniteDistribution (W βŠ—[F2] H)) (G : (W βŠ—[F2] H) β†’ (Fin β„“ β†’ F2))
(Ο„ biasBound : ℝ) (hΟ„ : 0 < Ο„) (hbiasBound : 0 ≀ biasBound) (hsmall : biasBound ≀ Ο„ ^ 2 / 2)
(hbias : βˆ€ Ξ¦ : Module.Dual F2 (W βŠ—[F2] H), Ξ¦ β‰  0 β†’
|ΞΌ.expectation (fun X => QuarterBalance.sign (Ξ¦ X))| ≀ biasBound)
(Οƒ : Module.Dual F2 (Fin β„“ β†’ F2)) :
((heavyList W ΞΌ G Ο„ Οƒ).card : ℝ) ≀ 2 / Ο„ ^ 2 := by
apply OwnLawHeavyList.heavyList_card_le ΞΌ _ Ο„ biasBound hΟ„ hbiasBound hsmall
Β· intro X
exact (OwnLawHeavyList.character_sq Οƒ (G X)).le
Β· exact hbias
def conditionalMatch (W : Submodule F2 (Fin β„“ β†’ F2))
(ΞΌ : FiniteDistribution (W βŠ—[F2] H)) (G : (W βŠ—[F2] H) β†’ (Fin β„“ β†’ F2))
(Q : Submodule F2 (Module.Dual F2 H)) (target : Q β†’β‚—[F2] W)
(z : Module.Dual F2 H) (offset : Fin β„“ β†’ F2) : ℝ :=
AffineLinearHeavyWitness.conditionalMatch ΞΌ (TensorRestriction.restrictionMap Q)
target G (TensorBucketEvaluation.tensorOutputLinear W z) offset
theorem exists_heavy_candidate (W : Submodule F2 (Fin β„“ β†’ F2))
(ΞΌ : FiniteDistribution (W βŠ—[F2] H)) (G : (W βŠ—[F2] H) β†’ (Fin β„“ β†’ F2))
(ρ hβ‚€ biasBound : ℝ) (hρ : 0 < ρ) (hhβ‚€ : 0 < hβ‚€) (hbiasBound : 0 ≀ biasBound)
(hsmall : biasBound ≀ hβ‚€ / 2)
(hbias : βˆ€ Ξ¦ : Module.Dual F2 (W βŠ—[F2] H), Ξ¦ β‰  0 β†’
|ΞΌ.expectation (fun X => QuarterBalance.sign (Ξ¦ X))| ≀ biasBound)
(hexcluded : 1 / (2 : ℝ) ^ Module.finrank F2 W < ρ / 8)
(Q : Submodule F2 (Module.Dual F2 H))
(hsize : hβ‚€ ≀ 1 / (2 : ℝ) ^ Module.finrank F2 (Q β†’β‚—[F2] W))
(target : Q β†’β‚—[F2] W) (z : Module.Dual F2 H) (offset : Fin β„“ β†’ F2)
(hmatch : ρ ≀ conditionalMatch W ΞΌ G Q target z offset) :
βˆƒ Οƒ : Module.Dual F2 (Fin β„“ β†’ F2), Οƒ.comp W.subtype β‰  0 ∧
βˆƒ Ξ¦ ∈ heavyList W ΞΌ G (ρ * hβ‚€ / 4) Οƒ,
βˆ€ w : W, Οƒ w = 1 β†’ TensorCosetEvaluation.scalarRestriction Ξ¦ w - z ∈ Q := by
let : Module.Free F2 (Q β†’β‚—[F2] W) := Module.Free.of_divisionRing F2 (Q β†’β‚—[F2] W)
let : Fintype (Module.Dual F2 (W βŠ—[F2] H)) :=
Fintype.ofInjective (fun functional : Module.Dual F2 (W βŠ—[F2] H) =>
(functional : (W βŠ—[F2] H) β†’ F2)) DFunLike.coe_injective
let b := Module.finBasis F2 (Q β†’β‚—[F2] W)
let c := Module.finBasis F2 (Fin β„“ β†’ F2)
have hsize' : hβ‚€ ≀ 1 / (Fintype.card
(Fin (Module.finrank F2 (Q β†’β‚—[F2] W)) β†’ Bool) : ℝ) := by
simpa only [Fintype.card_fun, Fintype.card_bool, Fintype.card_fin,
Nat.cast_pow, Nat.cast_ofNat] using hsize
have hbad : ((OutputAnnihilator.bad W).card : ℝ) /
Fintype.card (Module.Dual F2 (Fin β„“ β†’ F2)) < ρ / 8 := by
rw [OutputAnnihilator.bad_fraction]
exact hexcluded
unfold conditionalMatch at hmatch
have candidateBasis :=
AffineLinearHeavyWitness.exists_heavy_in_dual_coset
(U := W βŠ—[F2] H) (V := Q β†’β‚—[F2] W) (K := Fin β„“ β†’ F2) ΞΌ b c
have candidateRestriction := candidateBasis
(TensorRestriction.restrictionMap Q)
(TensorRestriction.restrictionMap_surjective (W := W) Q)
have candidateData := candidateRestriction
target G (TensorBucketEvaluation.tensorOutputLinear W z) offset
(OutputAnnihilator.bad W) ρ hβ‚€ biasBound
have candidateBounds := candidateData hρ hhβ‚€ hsize' hbiasBound hsmall hbias hbad
have candidateWitness := candidateBounds hmatch
obtain βŸ¨Οƒ, hΟƒ, ψ, hψ, hheavy⟩ := candidateWitness
refine βŸ¨Οƒ, (OutputAnnihilator.not_mem_bad_iff W Οƒ).mp hΟƒ,
Οƒ.comp (TensorBucketEvaluation.tensorOutputLinear W z) + ψ, ?_, ?_⟩
Β· simp only [heavyList, OwnLawHeavyList.heavyList, SmallBias.heavySet,
Finset.mem_filter, Finset.mem_univ, true_and] at hheavy ⊒
simpa only [OwnLawHeavyList.character, BinaryDualCoordinates.character] using hheavy
Β· intro w hw
have hψ' : TensorCosetEvaluation.scalarRestriction ψ w ∈ Q :=
TensorCosetEvaluation.scalarRestriction_mem_of_vanishes Q ψ
(TensorRestriction.dualImage_vanishes Q ψ hψ) w
rw [TensorTargetCharacter.comp_tensorOutputLinear,
TensorCosetEvaluation.scalarRestriction_add,
TensorCosetEvaluation.scalarRestriction_pure]
have hw' : (Οƒ.comp W.subtype) w = 1 := hw
rw [hw', one_smul, add_sub_cancel_left]
exact hψ'
theorem lemma53 (W : Submodule F2 (Fin β„“ β†’ F2))
(ΞΌ : FiniteDistribution (W βŠ—[F2] H)) (G : (W βŠ—[F2] H) β†’ (Fin β„“ β†’ F2))
(r : Nat) (hcodim : Module.finrank F2 ((Fin β„“ β†’ F2) β§Έ W) ≀ r)
(ρ biasBound : ℝ) (hρ : 0 < ρ) (hbiasBound : 0 ≀ biasBound)
(hgap : 1 / (2 : ℝ) ^ (β„“ - r) < ρ / 8)
(hsmall : biasBound ≀ min ((1 / (2 : ℝ) ^ (r * β„“)) / 2)
((ρ * (1 / (2 : ℝ) ^ (r * β„“)) / 4) ^ 2 / 2))
(hbias : βˆ€ Ξ¦ : Module.Dual F2 (W βŠ—[F2] H), Ξ¦ β‰  0 β†’
|ΞΌ.expectation (fun X => QuarterBalance.sign (Ξ¦ X))| ≀ biasBound) :
(βˆ€ Οƒ : Module.Dual F2 (Fin β„“ β†’ F2),
((heavyList W ΞΌ G (ρ * (1 / (2 : ℝ) ^ (r * β„“)) / 4) Οƒ).card : ℝ) ≀
2 / (ρ * (1 / (2 : ℝ) ^ (r * β„“)) / 4) ^ 2) ∧
βˆ€ (Q : Submodule F2 (Module.Dual F2 H)), Module.finrank F2 Q ≀ r β†’
βˆ€ (target : Q β†’β‚—[F2] W) (z : Module.Dual F2 H) (offset : Fin β„“ β†’ F2),
ρ ≀ conditionalMatch W ΞΌ G Q target z offset β†’
βˆƒ Οƒ : Module.Dual F2 (Fin β„“ β†’ F2), Οƒ.comp W.subtype β‰  0 ∧
βˆƒ Ξ¦ ∈ heavyList W ΞΌ G (ρ * (1 / (2 : ℝ) ^ (r * β„“)) / 4) Οƒ,
βˆ€ w : W, Οƒ w = 1 β†’
TensorCosetEvaluation.scalarRestriction Φ w - z ∈ Q := by
have hhβ‚€ : 0 < 1 / (2 : ℝ) ^ (r * β„“) := by positivity
have hΟ„ : 0 < ρ * (1 / (2 : ℝ) ^ (r * β„“)) / 4 := by positivity
have hsmall' := le_min_iff.mp hsmall
constructor
Β· intro Οƒ
exact heavyList_card_le W ΞΌ G _ biasBound hΟ„ hbiasBound hsmall'.2 hbias Οƒ
Β· intro Q hQ target z offset hmatch
have hexcluded : 1 / (2 : ℝ) ^ Module.finrank F2 W < ρ / 8 := by
rw [← OutputAnnihilator.bad_fraction W]
apply OutputAnnihilator.bad_fraction_lt_of_codim_le W r ρ hcodim
simpa only [Module.finrank_fin_fun] using hgap
have hsize : 1 / (2 : ℝ) ^ (r * β„“) ≀
1 / (2 : ℝ) ^ Module.finrank F2 (Q β†’β‚—[F2] W) := by
simpa only [TensorSliceDimension.mask_card, Nat.cast_pow, Nat.cast_ofNat] using
TensorSliceDimension.reciprocal_equation_mask_card_ge W Q hQ
exact exists_heavy_candidate W ΞΌ G ρ _ biasBound hρ hhβ‚€ hbiasBound hsmall'.1 hbias hexcluded
Q hsize target z offset hmatch
end
end PerfectCompleteness.TensorAffineHeavyWitness
end
end OAI