math / data /lean /OAI /Computability /MaxCut /Games /FinalParameters.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
33.9 kB
import Mathlib
import OAI.Computability.MaxCut.PCP.Folding
import OAI.Computability.MaxCut.Games.Deletion
import OAI.Computability.MaxCut.Games.ActualAdviceStochasticBridge
import OAI.Computability.MaxCut.PCP.RepetitionUpper
namespace OAI
/-! Existence of the finite numerical choices in Section 4.1. All errors and
search tests here are rational, including the fourth-power test in (4.1). -/
namespace MaxCutGames.Integration.FinalParameters
open MaxCutGames.Soundness.RepetitionUpper
def rho (r s : Nat) : β„š := (1 / 2 : β„š) ^ (s - (r + 1))
def levelConstant (r : Nat) : β„š := (r + 1 : β„š) * 2 ^ (30 * r ^ 2)
def alpha (Ξ΄ : β„š) (s : Nat) : β„š := Ξ΄ / (8 * (2 : β„š) ^ s * 2 ^ (s ^ 2))
def beta (r s : Nat) : β„š := rho r s / 2 * (1 / 2 : β„š) ^ (r * s)
def theta (Ξ΄ : β„š) (r s : Nat) : β„š := alpha Ξ΄ s * beta r s
def repetitionRate : β„š := 1 - 1 / (100000 * 192 ^ 3)
theorem levelConstant_pos (r : Nat) : 0 < levelConstant r := by
unfold levelConstant
positivity
theorem rho_pos (r s : Nat) : 0 < rho r s := by
unfold rho
positivity
theorem theta_pos {Ξ΄ : β„š} (hΞ΄ : 0 < Ξ΄) (r s : Nat) : 0 < theta Ξ΄ r s := by
unfold theta alpha beta
have := rho_pos r s
positivity
theorem repetitionRate_bounds : 0 ≀ repetitionRate ∧ repetitionRate < 1 := by
norm_num [repetitionRate]
/-- Selecting the exponent as a multiple of four supplies an exact rational
fourth root. No approximation of a real root enters the parameter search. -/
theorem exists_symbol_dimension (r : Nat) {Ξ΄ : β„š} (hΞ΄ : 0 < Ξ΄) :
βˆƒ s : Nat, r + 1 < s ∧ βˆƒ u : β„š,
0 < u ∧ u ^ 4 = rho r s ∧ levelConstant r * u ≀ Ξ΄ / 8 := by
have hA := levelConstant_pos r
have ht : 0 < Ξ΄ / (8 * levelConstant r) := by positivity
obtain ⟨n, hn, hsmall⟩ := exists_power_lt (1 / 2 : β„š)
(Ξ΄ / (8 * levelConstant r)) (by norm_num) (by norm_num) ht
refine ⟨r + 1 + 4 * n, by omega, (1 / 2 : β„š) ^ n, by positivity, ?_, ?_⟩
Β· unfold rho
rw [Nat.add_sub_cancel_left, ← pow_mul]
congr 1
omega
Β· have hbound : (1 / 2 : β„š) ^ n * (8 * levelConstant r) < Ξ΄ :=
(lt_div_iffβ‚€ (by positivity)).mp hsmall
linarith
/-- The repetition length is chosen first; the comparison dimension is then
large enough for both the subset experiment and its squared error bound. -/
theorem exists_repetition_and_dimension (L q : Nat) {ΞΈ : β„š}
(hΞΈ : 0 < ΞΈ) (hq : 0 < q) :
βˆƒ t k : Nat, 0 < t ∧ t ≀ k ∧
(1 - zeroProbability L * (1 - repetitionRate)) ^ t < decoderThreshold θ q ∧
16 * (t : β„š) ^ 2 * 2 ^ (t * L) ≀ (k : β„š) * ΞΈ ^ 2 := by
obtain ⟨t, ht, hrep⟩ := exists_repetition_length L q repetitionRate θ
repetitionRate_bounds.1 repetitionRate_bounds.2 hΞΈ hq
let B : β„š := 16 * (t : β„š) ^ 2 * 2 ^ (t * L)
obtain ⟨n, hn, hlarge⟩ := exists_pos_nat_gt (B / θ ^ 2)
refine ⟨t, t + n, ht, by omega, hrep, ?_⟩
have hnlarge : B < (n : β„š) * ΞΈ ^ 2 :=
(div_lt_iffβ‚€ (by positivity)).mp hlarge
have ht0 : 0 ≀ (t : β„š) * ΞΈ ^ 2 := by positivity
dsimp [B] at hnlarge
simp only [Nat.cast_add]
nlinarith
def gamma (Ξ΅ : β„š) (k : Nat) : β„š := Ξ΅ / (4 * (k : β„š))
theorem gamma_bounds {Ξ΅ : β„š} {k : Nat}
(hΞ΅ : 0 < Ξ΅) (hΞ΅half : Ξ΅ < 1 / 2) (hk : 0 < k) :
0 < gamma Ρ k ∧ gamma Ρ k < 1 / 8 := by
have hk1 : (1 : β„š) ≀ k := by exact_mod_cast (show 1 ≀ k by omega)
unfold gamma
constructor
Β· positivity
Β· apply (div_lt_iffβ‚€ (by positivity)).2
linarith
theorem exists_source_error {Ξ³ : β„š} (hΞ³ : 0 < Ξ³) :
βˆƒ n : Nat, 0 < n ∧ 0 < (1 / 2 : β„š) ^ n ∧
(1 / 2 : β„š) ^ n ≀ 1 / 16 ∧ (1 / 2 : β„š) ^ n ≀ Ξ³ / 4 := by
have hm : 0 < min (1 / 16 : β„š) (Ξ³ / 4) := by positivity
obtain ⟨n, hn, hs⟩ := exists_power_lt (1 / 2 : β„š)
(min (1 / 16 : β„š) (Ξ³ / 4)) (by norm_num) (by norm_num) hm
exact ⟨n, hn, by positivity, le_of_lt (lt_min_iff.mp hs).1,
le_of_lt (lt_min_iff.mp hs).2⟩
theorem exists_parameters (r : Nat) {Ξ΅ Ξ΄ : β„š}
(hΞ΅ : 0 < Ξ΅) (hΞ΅half : Ξ΅ < 1 / 2) (hΞ΄ : 0 < Ξ΄) :
βˆƒ s : Nat, r + 1 < s ∧ βˆƒ u : β„š,
0 < u ∧ u ^ 4 = rho r s ∧ levelConstant r * u ≀ Ξ΄ / 8 ∧
βˆ€ L : Nat, βˆƒ t k n : Nat,
0 < t ∧ t ≀ k ∧
(1 - zeroProbability L * (1 - repetitionRate)) ^ t <
decoderThreshold (theta δ r s) (2 ^ s) ∧
16 * (t : β„š) ^ 2 * 2 ^ (t * L) ≀ (k : β„š) * (theta Ξ΄ r s) ^ 2 ∧
0 < gamma Ρ k ∧ gamma Ρ k < 1 / 8 ∧
0 < n ∧ 0 < (1 / 2 : β„š) ^ n ∧
(1 / 2 : β„š) ^ n ≀ 1 / 16 ∧
(1 / 2 : β„š) ^ n ≀ gamma Ξ΅ k / 4 := by
obtain ⟨s, hs, u, hu, hroot, hlevel⟩ := exists_symbol_dimension r hδ
refine ⟨s, hs, u, hu, hroot, hlevel, ?_⟩
intro L
obtain ⟨t, k, ht, htk, hrep, hcomp⟩ :=
exists_repetition_and_dimension L (2 ^ s) (theta_pos hΞ΄ r s) (by positivity)
have hk : 0 < k := lt_of_lt_of_le ht htk
have hΞ³ := gamma_bounds hΞ΅ hΞ΅half hk
obtain ⟨n, hn, hξ, hξ16, hξγ⟩ := exists_source_error hγ.1
exact ⟨t, k, n, ht, htk, hrep, hcomp, hγ.1, hγ.2, hn, hξ, hξ16, hξγ⟩
/-- The completeness budget uses the same comparison dimension as the other
parameters. This identity is exact, without rounding of rational errors. -/
theorem completeness_budget {Ξ΅ : β„š} {k : Nat} (hk : 0 < k) :
(k : β„š) * gamma Ξ΅ k + (Ξ΅ / 2) / 2 = Ξ΅ / 2 := by
have hk0 : (k : β„š) β‰  0 := by exact_mod_cast (Nat.ne_of_gt hk)
unfold gamma
field_simp
ring
end MaxCutGames.Integration.FinalParameters
/-! Actual finite binary-vector-space gadgets and their uniform experiments.
The existence statement is the target of the recursive construction, not an
assumed theorem. Noise is indexed by a nonempty finite type; repeated vector
values therefore keep their intended multiplicities. -/
namespace MaxCutGames.Gadget.ActualGadget
abbrev F2 := ZMod 2
structure Data (C : Type) [AddCommGroup C] [Module F2 C] where
Ambient : Type
[ambientAddCommGroup : AddCommGroup Ambient]
[ambientModule : Module F2 Ambient]
[ambientFintype : Fintype Ambient]
embed : C β†’β‚—[F2] Ambient
embed_injective : Function.Injective embed
f : Ambient β†’ C
equivariant : βˆ€ x c, f (x + embed c) = f x + c
NoiseIndex : Type
[noiseFintype : Fintype NoiseIndex]
[noiseNonempty : Nonempty NoiseIndex]
noise : NoiseIndex β†’ Ambient
attribute [instance] Data.ambientAddCommGroup Data.ambientModule Data.ambientFintype
attribute [instance] Data.noiseFintype Data.noiseNonempty
variable {C : Type} [AddCommGroup C] [Module F2 C]
/-- The actual output-change indicator before taking a finite average. -/
noncomputable def failureIndicator (g : Data C) (sample : g.Ambient Γ— g.NoiseIndex) : β„š := by
classical
exact if g.f (sample.1 + g.noise sample.2) = g.f sample.1 then 0 else 1
/-- Uniform ambient input, independently uniform noise-list index. -/
noncomputable def stabilityError (g : Data C) : β„š :=
Finset.univ.expect (failureIndicator g)
/-- The actual zero-image event for a linear map. -/
noncomputable def kernelIndicator (g : Data C) {P : Type}
[AddCommGroup P] [Module F2 P] (S : g.Ambient β†’β‚—[F2] P) (i : g.NoiseIndex) : β„š := by
classical
exact if S (g.noise i) = 0 then 1 else 0
noncomputable def kernelError (g : Data C) {P : Type}
[AddCommGroup P] [Module F2 P] (S : g.Ambient β†’β‚—[F2] P) : β„š :=
Finset.univ.expect (kernelIndicator g S)
theorem stabilityError_nonneg (g : Data C) : 0 ≀ stabilityError g := by
classical
apply Finset.expect_nonneg
intro sample _
unfold failureIndicator
split <;> decide
theorem stabilityError_le_one (g : Data C) : stabilityError g ≀ 1 := by
classical
apply Finset.expect_le Finset.univ_nonempty
intro sample _
unfold failureIndicator
split <;> decide
theorem kernelError_nonneg (g : Data C) {P : Type}
[AddCommGroup P] [Module F2 P] (S : g.Ambient β†’β‚—[F2] P) : 0 ≀ kernelError g S := by
classical
apply Finset.expect_nonneg
intro i _
unfold kernelIndicator
split <;> decide
theorem kernelError_le_one (g : Data C) {P : Type}
[AddCommGroup P] [Module F2 P] (S : g.Ambient β†’β‚—[F2] P) : kernelError g S ≀ 1 := by
classical
apply Finset.expect_le Finset.univ_nonempty
intro i _
unfold kernelIndicator
split <;> decide
/-- The actual identity leaf, with every symbol vector used once as noise. -/
def leaf (C : Type) [AddCommGroup C] [Module F2 C] [Fintype C] : Data C where
Ambient := C
embed := LinearMap.id
embed_injective := Function.injective_id
f := id
equivariant := by intro x c; rfl
NoiseIndex := C
noise := id
/-- The stability and dispersion claim of Theorem 3.4 for fixed errors and rank. -/
def Satisfies (g : Data C) (ΞΆ Ξ½ : β„š) (r : Nat) : Prop :=
stabilityError g ≀ ΞΆ ∧
βˆ€ (P : Type) [AddCommGroup P] [Module F2 P] (S : g.Ambient β†’β‚—[F2] P),
r ≀ Module.finrank F2 (S.comp g.embed).range β†’ kernelError g S ≀ Ξ½
/-- The actual mathematical existence target; no theorem asserts it yet. -/
def StableNonlinearDispersion : Prop :=
βˆ€ ΞΆ Ξ½ : β„š, 0 < ΞΆ β†’ ΞΆ < 1 β†’ 0 < Ξ½ β†’ Ξ½ < 1 β†’
βˆƒ r : Nat, 1 ≀ r ∧
βˆ€ s : Nat, r ≀ s β†’
βˆƒ g : Data (MaxCutGames.Integration.BinaryLinear.Vector s), Satisfies g ΞΆ Ξ½ r
end MaxCutGames.Gadget.ActualGadget
namespace MaxCutGames.Reduction.ActualSource
open MaxCutGames.Integration.BinaryLinear
structure Source where
Β«variablesΒ» : Nat
occurrences : Nat
nonempty : 0 < occurrences
equation : Fin occurrences β†’ CloneGap.Equation (Fin Β«variablesΒ»)
def Source.sourceList (S : Source) : List (CloneGap.Equation (Fin S.Β«variablesΒ»)) :=
List.ofFn S.equation
/-- Retain every list position as its own occurrence identifier. -/
def Source.ofList {n : Nat} (es : List (CloneGap.Equation (Fin n)))
(hne : es β‰  []) : Source where
Β«variablesΒ» := n
occurrences := es.length
nonempty := List.length_pos_iff.mpr hne
equation := es.get
@[simp] theorem Source.sourceList_ofList {n : Nat}
(es : List (CloneGap.Equation (Fin n))) (hne : es β‰  []) :
(Source.ofList es hne).sourceList = es := by
exact List.ofFn_getElem
@[simp] theorem Source.sourceList_length (S : Source) :
S.sourceList.length = S.occurrences := by simp [Source.sourceList]
theorem Source.sourceList_nonempty (S : Source) : S.sourceList β‰  [] := by
intro h
have hp := S.nonempty
have hn := S.sourceList_length
rw [h] at hn
simp only [List.length_nil] at hn
omega
instance sourceIndexNonempty (S : Source) : Nonempty (Fin S.occurrences) :=
⟨⟨0, S.nonempty⟩⟩
def Source.satisfied (S : Source) (A : Fin S.Β«variablesΒ» β†’ Bool)
(i : Fin S.occurrences) : Bool := CloneGap.satisfied (S.equation i) A
def Source.failure (S : Source) (A : Fin S.Β«variablesΒ» β†’ Bool) : β„š :=
Finset.univ.expect (fun i => if S.satisfied A i then (0 : β„š) else 1)
def Source.DistinctNames (S : Source) : Prop :=
βˆ€ i, (S.equation i).first β‰  (S.equation i).second ∧
(S.equation i).first β‰  (S.equation i).third ∧
(S.equation i).second β‰  (S.equation i).third
abbrev Alphabet (s : Nat) := MaxCutGames.Integration.BinaryLinear.Vector s
abbrev Ambient (s d : Nat) := Alphabet s Γ— MaxCutGames.Integration.BinaryLinear.Vector d
def alphabetEmbedding (s d : Nat) : Alphabet s β†’β‚—[F2] Ambient s d :=
LinearMap.inl F2 (Alphabet s) (MaxCutGames.Integration.BinaryLinear.Vector d)
@[simp] theorem alphabetEmbedding_apply (s d : Nat) (c : Alphabet s) :
alphabetEmbedding s d c = (c, 0) := rfl
/-- Noise indices retain multiplicity even if several indices have equal vectors. -/
structure SplitGadget (s d : Nat) where
f : Ambient s d β†’ Alphabet s
equivariant : βˆ€ (x : Ambient s d) (c : Alphabet s), f (x + (c, 0)) = f x + c
NoiseIndex : Type
noiseFintype : Fintype NoiseIndex
noiseNonempty : Nonempty NoiseIndex
noise : NoiseIndex β†’ Ambient s d
attribute [instance] SplitGadget.noiseFintype SplitGadget.noiseNonempty
def SplitGadget.stabilityError {s d : Nat} (g : SplitGadget s d) : β„š :=
Finset.univ.expect (fun xv : Ambient s d Γ— g.NoiseIndex =>
if g.f (xv.1 + g.noise xv.2) = g.f xv.1 then (0 : β„š) else 1)
def SplitGadget.kernelError {s d p : Nat} (g : SplitGadget s d)
(S : Ambient s d β†’β‚—[F2] MaxCutGames.Integration.BinaryLinear.Vector p) : β„š :=
Finset.univ.expect (fun i => if S (g.noise i) = 0 then (1 : β„š) else 0)
theorem SplitGadget.stabilityError_nonneg {s d : Nat} (g : SplitGadget s d) :
0 ≀ g.stabilityError := by
apply Finset.expect_nonneg
intro x _
split <;> norm_num
theorem SplitGadget.stabilityError_le_one {s d : Nat} (g : SplitGadget s d) :
g.stabilityError ≀ 1 := by
apply Finset.expect_le Finset.univ_nonempty
intro x _
split <;> norm_num
end MaxCutGames.Reduction.ActualSource
/-! Transport of actual gadgets to the split coordinate model used by the reduction. -/
namespace MaxCutGames.Integration.SplitGadget
open BinaryLinear
variable {R : Type} [AddCommGroup R] [Module F2 R] [FiniteDimensional F2 R]
/-- Any injective symbol embedding admits finite coordinates in which it is the
first summand. This is a theorem about the actual ambient vector space. -/
theorem exists_split_equiv {s : Nat} (e : Vector s β†’β‚—[F2] R)
(he : Function.Injective e) :
βˆƒ d : Nat, βˆƒ Ο† : R ≃ₗ[F2] (Vector s Γ— Vector d),
βˆ€ c, Ο† (e c) = (c, 0) := by
obtain ⟨U, hU⟩ := e.range.exists_isCompl
let er := LinearEquiv.ofInjective e he
let eu := (Module.finBasis F2 U).equivFun
let split := e.range.prodEquivOfIsCompl U hU
refine ⟨Module.finrank F2 U, split.symm.trans (er.symm.prodCongr eu), ?_⟩
intro c
change (er.symm.prodCongr eu) (split.symm (e c)) = (c, 0)
have hc : split.symm (e c) = (er c, 0) :=
e.range.prodEquivOfIsCompl_symm_apply_left U hU (er c)
rw [hc]
simp
open MaxCutGames.Gadget.ActualGadget (Data stabilityError failureIndicator kernelError Satisfies)
open MaxCutGames.Reduction.ActualSource
noncomputable def kernelProbability {s d : Nat} (g : SplitGadget s d)
{P : Type} [AddCommGroup P] [Module F2 P]
(S : Ambient s d β†’β‚—[F2] P) : β„š := by
classical
exact Finset.univ.expect (fun i => if S (g.noise i) = 0 then (1 : β„š) else 0)
theorem kernelProbability_eq_kernelError {s d p : Nat} (g : SplitGadget s d)
(S : Ambient s d β†’β‚—[F2] Vector p) :
kernelProbability g S = g.kernelError S := by
unfold kernelProbability SplitGadget.kernelError
congr 1
funext i
by_cases h : S (g.noise i) = 0 <;> simp_all
/-- Move all ambient vectors through a linear equivalence, retaining the same
noise indices and their multiplicities. -/
noncomputable def transport {s d : Nat} (g : Data (Vector s))
(Ο† : g.Ambient ≃ₗ[F2] Ambient s d)
(he : βˆ€ c, Ο† (g.embed c) = (c, 0)) : SplitGadget s d where
f x := g.f (Ο†.symm x)
equivariant x c := by
have hc : Ο†.symm (c, 0) = g.embed c := by rw [← he c]; simp
rw [map_add, hc]
exact g.equivariant (Ο†.symm x) c
NoiseIndex := g.NoiseIndex
noiseFintype := g.noiseFintype
noiseNonempty := g.noiseNonempty
noise i := Ο† (g.noise i)
/-- Uniform stability is invariant under the coordinate change. -/
theorem transport_stabilityError {s d : Nat} (g : Data (Vector s))
(Ο† : g.Ambient ≃ₗ[F2] Ambient s d)
(he : βˆ€ c, Ο† (g.embed c) = (c, 0)) :
(transport g Ο† he).stabilityError = stabilityError g := by
classical
apply Fintype.expect_equiv (Ο†.symm.toEquiv.prodCongr (Equiv.refl g.NoiseIndex))
intro x
simp [transport, failureIndicator, map_add]
/-- Every zero-image probability is invariant under the same coordinate change. -/
theorem transport_kernelError {s d p : Nat} (g : Data (Vector s))
(Ο† : g.Ambient ≃ₗ[F2] Ambient s d)
(he : βˆ€ c, Ο† (g.embed c) = (c, 0))
(S : Ambient s d β†’β‚—[F2] Vector p) :
(transport g Ο† he).kernelError S = kernelError g (S.comp Ο†.toLinearMap) := by
unfold SplitGadget.kernelError kernelError Gadget.ActualGadget.kernelIndicator
congr 1
funext i
by_cases h : S (Ο† (g.noise i)) = 0 <;> simp_all [transport]
/-- The restriction to the symbol space is exactly the same linear map. -/
theorem transport_symbol_map {s d : Nat} (g : Data (Vector s))
(Ο† : g.Ambient ≃ₗ[F2] Ambient s d)
(he : βˆ€ c, Ο† (g.embed c) = (c, 0))
{P : Type} [AddCommGroup P] [Module F2 P]
(S : Ambient s d β†’β‚—[F2] P) :
(S.comp Ο†.toLinearMap).comp g.embed = S.comp (alphabetEmbedding s d) := by
apply LinearMap.ext
intro c
change S (Ο† (g.embed c)) = S (c, 0)
rw [he]
theorem transport_kernelProbability {s d : Nat} (g : Data (Vector s))
(Ο† : g.Ambient ≃ₗ[F2] Ambient s d)
(he : βˆ€ c, Ο† (g.embed c) = (c, 0))
{P : Type} [AddCommGroup P] [Module F2 P]
(S : Ambient s d β†’β‚—[F2] P) :
kernelProbability (transport g Ο† he) S =
kernelError g (S.comp Ο†.toLinearMap) := by
rfl
/-- Both numerical gadget guarantees survive the coordinate change. -/
theorem transport_satisfies {s d : Nat} (g : Data (Vector s))
(Ο† : g.Ambient ≃ₗ[F2] Ambient s d)
(he : βˆ€ c, Ο† (g.embed c) = (c, 0))
{ΞΆ Ξ½ : β„š} {r : Nat} (hg : Satisfies g ΞΆ Ξ½ r) :
(transport g Ο† he).stabilityError ≀ ΞΆ ∧
βˆ€ p (S : Ambient s d β†’β‚—[F2] Vector p),
r ≀ Module.finrank F2 (S.comp (alphabetEmbedding s d)).range β†’
(transport g Ο† he).kernelError S ≀ Ξ½ := by
constructor
Β· rw [transport_stabilityError]
exact hg.1
Β· intro p S hS
rw [transport_kernelError g Ο† he S]
apply hg.2 (Vector p) (S.comp Ο†.toLinearMap)
rwa [transport_symbol_map g Ο† he S]
/-- Every actual gadget satisfying the quantitative guarantees has a split
coordinate representative with exactly those guarantees. -/
theorem exists_split_gadget {s : Nat} (g : Data (Vector s))
{ΞΆ Ξ½ : β„š} {r : Nat} (hg : Satisfies g ΞΆ Ξ½ r) :
βˆƒ d : Nat, βˆƒ h : SplitGadget s d,
h.stabilityError ≀ ΞΆ ∧
βˆ€ p (S : Ambient s d β†’β‚—[F2] Vector p),
r ≀ Module.finrank F2 (S.comp (alphabetEmbedding s d)).range β†’
h.kernelError S ≀ Ξ½ := by
obtain ⟨d, Ο†, he⟩ := exists_split_equiv g.embed g.embed_injective
exact ⟨d, transport g Ο† he, transport_satisfies g Ο† he hg⟩
/-- The coordinate representative preserves dispersion for every target,
including the question spaces used directly by the soundness analysis. -/
theorem exists_split_gadget_general {s : Nat} (g : Data (Vector s))
{ΞΆ Ξ½ : β„š} {r : Nat} (hg : Satisfies g ΞΆ Ξ½ r) :
βˆƒ d : Nat, βˆƒ h : SplitGadget s d,
h.stabilityError ≀ ΞΆ ∧
βˆ€ (P : Type) [AddCommGroup P] [Module F2 P]
(S : Ambient s d β†’β‚—[F2] P),
r ≀ Module.finrank F2 (S.comp (alphabetEmbedding s d)).range β†’
kernelProbability h S ≀ Ξ½ := by
obtain ⟨d, Ο†, he⟩ := exists_split_equiv g.embed g.embed_injective
refine ⟨d, transport g Ο† he, ?_, ?_⟩
Β· rw [transport_stabilityError]
exact hg.1
Β· intro P _ _ S hS
rw [transport_kernelProbability g Ο† he S]
apply hg.2 P (S.comp Ο†.toLinearMap)
rwa [transport_symbol_map g Ο† he S]
end MaxCutGames.Integration.SplitGadget
/-! Exact passage from the rational construction parameters and experiments to
the real inequalities used by the Fourier and soundness proofs. -/
namespace MaxCutGames.Integration.RealBounds
open BinaryLinear FinalParameters
theorem rho_eq_two_div_pow {r s : Nat} (hs : r + 1 ≀ s) :
rho r s = 2 / (2 : β„š) ^ (s - r) := by
have hn : s - r = (s - (r + 1)) + 1 := by omega
unfold rho
rw [hn, pow_succ, div_pow, one_pow]
field_simp
theorem rho_real_eq_two_div_pow {r s : Nat} (hs : r + 1 ≀ s) :
(rho r s : ℝ) = 2 / (2 : ℝ) ^ (s - r) := by
simpa using congrArg (fun q : β„š => (q : ℝ)) (rho_eq_two_div_pow hs)
theorem beta_eq_div (r s : Nat) :
beta r s = rho r s / (2 * (2 : β„š) ^ (r * s)) := by
unfold beta
rw [div_pow, one_pow]
ring
/-- The exact signal threshold used by selection, expressed in real scalars.
There is no loss between the rational parameter search and this product. -/
theorem theta_real_product (Ξ΄ : β„š) (r s : Nat) :
(theta Ξ΄ r s : ℝ) =
((Ξ΄ : ℝ) / (8 * (2 : ℝ) ^ s * 2 ^ (s * s))) *
((rho r s : ℝ) / (2 * (2 : ℝ) ^ (r * s))) := by
simp [theta, alpha, beta_eq_div, pow_two]
theorem fourth_root_as_rpow {u ρ : β„š} (hu : 0 < u) (hfour : u ^ 4 = ρ) :
(ρ : ℝ) ^ (1 / 4 : ℝ) = (u : ℝ) := by
have hpow : (u : ℝ) ^ 4 = (ρ : ℝ) := by exact_mod_cast hfour
have hu' : (0 : ℝ) ≀ u := by exact_mod_cast (le_of_lt hu)
rw [← hpow, one_div]
exact Real.pow_rpow_inv_natCast hu' (by decide : (4 : Nat) β‰  0)
theorem exists_symbol_dimension_real (r : Nat) {Ξ΄ : β„š} (hΞ΄ : 0 < Ξ΄) :
βˆƒ s : Nat, r + 1 < s ∧
(levelConstant r : ℝ) * (rho r s : ℝ) ^ (1 / 4 : ℝ) ≀ (Ξ΄ : ℝ) / 8 := by
obtain ⟨s, hs, u, hu, hfour, hbound⟩ := exists_symbol_dimension r hδ
refine ⟨s, hs, ?_⟩
rw [fourth_root_as_rpow hu hfour]
exact_mod_cast hbound
/-- Casting the finite experiment changes only its scalar values, retaining
the same noise indices and the same event. -/
theorem kernelProbability_real {s d : Nat}
(g : MaxCutGames.Reduction.ActualSource.SplitGadget s d)
{P : Type} [AddCommGroup P] [Module F2 P] [DecidableEq P]
(S : (Vector s Γ— Vector d) β†’β‚—[F2] P) :
(SplitGadget.kernelProbability g S : ℝ) =
Finset.univ.expect (fun i => if S (g.noise i) = 0 then (1 : ℝ) else 0) := by
classical
unfold SplitGadget.kernelProbability
simp only [Finset.expect_eq_sum_div_card, Rat.cast_div, Rat.cast_sum, Rat.cast_natCast]
congr 1
apply Finset.sum_congr rfl
intro i _
by_cases h : S (g.noise i) = 0 <;> simp [h]
theorem kernelProbability_real_le {s d : Nat}
(g : MaxCutGames.Reduction.ActualSource.SplitGadget s d)
{P : Type} [AddCommGroup P] [Module F2 P] [DecidableEq P]
(S : (Vector s Γ— Vector d) β†’β‚—[F2] P) {Ξ½ : β„š}
(h : SplitGadget.kernelProbability g S ≀ Ξ½) :
Finset.univ.expect (fun i => if S (g.noise i) = 0 then (1 : ℝ) else 0) ≀ (Ξ½ : ℝ) := by
classical
rw [← kernelProbability_real g S]
exact_mod_cast h
theorem comparison_square_budget {t k L : Nat} {ΞΈ : β„š} (hk : 0 < k)
(h : 16 * (t : β„š) ^ 2 * 2 ^ (t * L) ≀ (k : β„š) * ΞΈ ^ 2) :
((t : ℝ) ^ 2 / (k : ℝ)) * 2 ^ (t * L) ≀ ((ΞΈ : ℝ) / 4) ^ 2 := by
have hk' : (0 : ℝ) < k := by exact_mod_cast hk
have h' : 16 * (t : ℝ) ^ 2 * 2 ^ (t * L) ≀ (k : ℝ) * (ΞΈ : ℝ) ^ 2 := by
exact_mod_cast h
rw [div_mul_eq_mul_div, div_le_iffβ‚€ hk']
nlinarith
end MaxCutGames.Integration.RealBounds
/-! Lemma 6.3 for the actual independently sampled partner maps. -/
namespace MaxCutGames.Soundness.ActualMapComparison
open LinearMapDensity PartnerProjection PartnerSampling
theorem actual_partner_expectation_comparison {k t : β„•}
(hk : 0 < k) (htk : t ≀ k) (rhs : Fin k β†’ Bool)
{R : Type} [AddCommGroup R] [Module (ZMod 2) R] [FiniteDimensional (ZMod 2) R]
[Fintype (SourcePoint rhs β†’β‚—[ZMod 2] R)]
[βˆ€ p : Partner k t, Fintype (PartnerPoint rhs (active p) β†’β‚—[ZMod 2] R)]
(H : (SourcePoint rhs β†’β‚—[ZMod 2] R) β†’ ℝ) (hH : βˆ€ M, |H M| ≀ 1) :
|uniformMean (fun p : Partner k t =>
uniformMean (fun B : PartnerPoint rhs (active p) β†’β‚—[ZMod 2] R =>
H (B.comp (PartnerLinear.projection rhs (active p) (slots p))))) - uniformMean H| ≀
Real.sqrt (((t : ℝ)^2 / k) * (2 : ℝ)^(Module.finrank (ZMod 2) R * t)) := by
let : Nonempty (Partner k t) := partner_nonempty htk
have hsecond :
uniformMean (fun M : SourcePoint rhs β†’β‚—[ZMod 2] R =>
(mixtureDensity (kernel (t := t) rhs) M)^2) ≀
1 + ((t : ℝ)^2 / k) * (2 : ℝ)^(Module.finrank (ZMod 2) R * t) := by
rw [mixtureDensity_second_moment]
exact kernel_overlap_weight_le hk htk rhs (Module.finrank (ZMod 2) R)
have hc := ExpectationComparison.bounded_test_expectation_comparison
Finset.univ Finset.univ_nonempty (mixtureDensity (R := R) (kernel (t := t) rhs)) H
(((t : ℝ)^2 / k) * (2 : ℝ)^(Module.finrank (ZMod 2) R * t))
(mixtureDensity_mean (R := R) (kernel (t := t) rhs)) hsecond (fun M _ => hH M)
rw [mixture_pullback_uniformMean
(fun p : Partner k t => PartnerLinear.projection rhs (active p) (slots p))
(fun p => PartnerLinear.projection_surjective rhs (active p) (slots p)) H]
have hkernel : kernel (t := t) rhs =
(fun p : Partner k t => (PartnerLinear.projection rhs (active p) (slots p)).ker) := rfl
rw [hkernel] at hc
simpa only [uniformMean, mul_comm] using hc
theorem actual_partner_expectation_comparison_dimension {k t L : β„•}
(hk : 0 < k) (htk : t ≀ k) (rhs : Fin k β†’ Bool)
{R : Type} [AddCommGroup R] [Module (ZMod 2) R] [FiniteDimensional (ZMod 2) R]
[Fintype (SourcePoint rhs β†’β‚—[ZMod 2] R)]
[βˆ€ p : Partner k t, Fintype (PartnerPoint rhs (active p) β†’β‚—[ZMod 2] R)]
(H : (SourcePoint rhs β†’β‚—[ZMod 2] R) β†’ ℝ) (hH : βˆ€ M, |H M| ≀ 1)
(hm : Module.finrank (ZMod 2) R ≀ L) :
|uniformMean (fun p : Partner k t =>
uniformMean (fun B : PartnerPoint rhs (active p) β†’β‚—[ZMod 2] R =>
H (B.comp (PartnerLinear.projection rhs (active p) (slots p))))) - uniformMean H| ≀
Real.sqrt (((t : ℝ)^2 / k) * (2 : ℝ)^(t * L)) := by
have he : Module.finrank (ZMod 2) R * t ≀ t * L := by
simpa only [Nat.mul_comm] using Nat.mul_le_mul_right t hm
have hp : (2 : ℝ)^(Module.finrank (ZMod 2) R * t) ≀ (2 : ℝ)^(t*L) :=
pow_le_pow_rightβ‚€ (by norm_num) he
exact (actual_partner_expectation_comparison hk htk rhs H hH).trans
(Real.sqrt_le_sqrt (mul_le_mul_of_nonneg_left hp
(div_nonneg (sq_nonneg (t : ℝ)) (Nat.cast_nonneg k))))
theorem actual_partner_expectation_quarter {k t L : β„•} {ΞΈ : β„š}
(hk : 0 < k) (htk : t ≀ k) (rhs : Fin k β†’ Bool)
{R : Type} [AddCommGroup R] [Module (ZMod 2) R] [FiniteDimensional (ZMod 2) R]
[Fintype (SourcePoint rhs β†’β‚—[ZMod 2] R)]
[βˆ€ p : Partner k t, Fintype (PartnerPoint rhs (active p) β†’β‚—[ZMod 2] R)]
(H : (SourcePoint rhs β†’β‚—[ZMod 2] R) β†’ ℝ) (hH : βˆ€ M, |H M| ≀ 1)
(hm : Module.finrank (ZMod 2) R ≀ L) (hΞΈ : 0 ≀ ΞΈ)
(budget : 16 * (t : β„š)^2 * 2^(t*L) ≀ (k : β„š)*ΞΈ^2) :
|uniformMean (fun p : Partner k t =>
uniformMean (fun B : PartnerPoint rhs (active p) β†’β‚—[ZMod 2] R =>
H (B.comp (PartnerLinear.projection rhs (active p) (slots p))))) - uniformMean H| ≀
(ΞΈ : ℝ) / 4 :=
(actual_partner_expectation_comparison_dimension hk htk rhs H hH hm).trans
(ExpectationComparison.comparison_error_le_quarter _ _ (by exact_mod_cast hΞΈ)
(Integration.RealBounds.comparison_square_budget hk budget))
end MaxCutGames.Soundness.ActualMapComparison
namespace MaxCutGames.Soundness.ActualMapComparison
def sourcePrecomposeEquiv {A E R : Type}
[AddCommGroup A] [Module (ZMod 2) A] [AddCommGroup E] [Module (ZMod 2) E]
[AddCommGroup R] [Module (ZMod 2) R] (e : A ≃ₗ[ZMod 2] E) :
(E β†’β‚—[ZMod 2] R) ≃ (A β†’β‚—[ZMod 2] R) where
toFun M := M.comp e.toLinearMap
invFun M := M.comp e.symm.toLinearMap
left_inv M := by
apply LinearMap.ext
intro x
change M (e (e.symm x)) = M x
rw [e.apply_symm_apply]
right_inv M := by
apply LinearMap.ext
intro x
change M (e.symm (e x)) = M x
rw [e.symm_apply_apply]
theorem uniformMean_sourcePrecompose {A E R : Type}
[AddCommGroup A] [Module (ZMod 2) A] [AddCommGroup E] [Module (ZMod 2) E]
[AddCommGroup R] [Module (ZMod 2) R]
[Fintype (A β†’β‚—[ZMod 2] R)] [Fintype (E β†’β‚—[ZMod 2] R)]
(e : A ≃ₗ[ZMod 2] E) (H : (E β†’β‚—[ZMod 2] R) β†’ ℝ) :
LinearMapDensity.uniformMean (fun M : A β†’β‚—[ZMod 2] R =>
H (M.comp e.symm.toLinearMap)) = LinearMapDensity.uniformMean H := by
simpa only [LinearMapDensity.uniformMean] using
(Fintype.expect_equiv (sourcePrecomposeEquiv e).symm
(fun M : A β†’β‚—[ZMod 2] R => H (M.comp e.symm.toLinearMap)) H (fun _ => rfl))
theorem actual_partner_expectation_quarter_equiv {k t L : β„•} {ΞΈ : β„š}
(hk : 0 < k) (htk : t ≀ k) (rhs : Fin k β†’ Bool)
{R E : Type} [AddCommGroup R] [Module (ZMod 2) R] [FiniteDimensional (ZMod 2) R]
[AddCommGroup E] [Module (ZMod 2) E]
[Fintype (PartnerProjection.SourcePoint rhs β†’β‚—[ZMod 2] R)]
[Fintype (E β†’β‚—[ZMod 2] R)]
[βˆ€ p : PartnerSampling.Partner k t,
Fintype (PartnerProjection.PartnerPoint rhs (PartnerSampling.active p) β†’β‚—[ZMod 2] R)]
(e : PartnerProjection.SourcePoint rhs ≃ₗ[ZMod 2] E)
(H : (E β†’β‚—[ZMod 2] R) β†’ ℝ) (hH : βˆ€ M, |H M| ≀ 1)
(hm : Module.finrank (ZMod 2) R ≀ L) (hΞΈ : 0 ≀ ΞΈ)
(budget : 16 * (t : β„š)^2 * 2^(t*L) ≀ (k : β„š) * ΞΈ^2) :
|LinearMapDensity.uniformMean (fun p : PartnerSampling.Partner k t =>
LinearMapDensity.uniformMean (fun B :
PartnerProjection.PartnerPoint rhs (PartnerSampling.active p) β†’β‚—[ZMod 2] R =>
H (B.comp ((PartnerLinear.projection rhs (PartnerSampling.active p)
(PartnerSampling.slots p)).comp e.symm.toLinearMap)))) -
LinearMapDensity.uniformMean H| ≀ (ΞΈ : ℝ) / 4 := by
let Hcanon : (PartnerProjection.SourcePoint rhs β†’β‚—[ZMod 2] R) β†’ ℝ :=
fun M => H (M.comp e.symm.toLinearMap)
have hcanon := actual_partner_expectation_quarter hk htk rhs Hcanon
(fun M => hH (M.comp e.symm.toLinearMap)) hm hΞΈ budget
have hmean : LinearMapDensity.uniformMean Hcanon = LinearMapDensity.uniformMean H :=
uniformMean_sourcePrecompose e H
rw [hmean] at hcanon
simpa only [Hcanon, LinearMap.comp_assoc] using hcanon
end MaxCutGames.Soundness.ActualMapComparison
/-!
# Exact partner-map laws in shared raw target coordinates
Inactive positions do not use a retained slot. Replacing their slots leaves
both the concrete partner projection and the shared raw projection unchanged.
The row/column expectation identity below transports the two actual uniform
map samples through the target coordinate equivalence independently. It is an
exact identity for every observable of the pulled-back maps; it requires no
trace, character, or naturality hypotheses.
-/
namespace MaxCutGames.Soundness.RawTargetLaw
open scoped BigOperators
open MaxCutGames.Integration.BinaryLinear (F2)
open MaxCutGames.Reduction
open PartnerProjection PartnerMapCoordinates RawPartnerTarget
/-- The genuine partner projection reads retained slots only at active positions. -/
theorem partnerProjection_congr_slots {k : Nat} (rhs : Fin k β†’ Bool)
(J : Finset (Fin k)) (slot slot' : Fin k β†’ Slot)
(agree : βˆ€ j ∈ J, slot j = slot' j) :
PartnerLinear.projection rhs (activeOf J) slot =
PartnerLinear.projection rhs (activeOf J) slot' := by
apply PartnerFullSampling.projection_eq_of_slots_eq_on_active
intro j hj
exact agree j (by simpa [activeOf] using hj)
/-- The shared raw target also ignores every inactive retained-slot choice. -/
theorem rawProjection_congr_slots {k : Nat} (rhs : Fin k β†’ Bool)
(J : Finset (Fin k)) (slot slot' : Fin k β†’ Slot)
(agree : βˆ€ j ∈ J, slot j = slot' j) :
RawPartnerTarget.rawProjection rhs J slot =
RawPartnerTarget.rawProjection rhs J slot' := by
unfold RawPartnerTarget.rawProjection
rw [partnerProjection_congr_slots rhs J slot slot' agree]
theorem precompose_rawProjection {k : Nat} (rhs : Fin k β†’ Bool)
(J : Finset (Fin k)) (slot : Fin k β†’ Slot)
{R : Type} [AddCommGroup R] [Module F2 R]
(M : RawPoint J β†’β‚—[F2] R) :
(M.comp (pointEquiv rhs J).toLinearMap).comp
((PartnerLinear.projection rhs (activeOf J) slot).comp
(PartnerLinear.sourceLinearEquiv rhs).symm.toLinearMap) =
M.comp (RawPartnerTarget.rawProjection rhs J slot) := by
simp only [RawPartnerTarget.rawProjection, LinearMap.comp_assoc]
/-- Exact nested uniform expectations in partner versus raw coordinates.
Any finite enumerations of the four map spaces may be used. -/
theorem partner_row_column_expectation {k : Nat} (rhs : Fin k β†’ Bool)
(J : Finset (Fin k)) (slot : Fin k β†’ Slot)
{D C : Type} [AddCommGroup D] [Module F2 D] [AddCommGroup C] [Module F2 C]
[Fintype (PartnerPoint rhs (activeOf J) β†’β‚—[F2] D)]
[Fintype (PartnerPoint rhs (activeOf J) β†’β‚—[F2] C)]
[Fintype (RawPoint J β†’β‚—[F2] D)] [Fintype (RawPoint J β†’β‚—[F2] C)]
(H : (ActualHomogeneous.E k β†’β‚—[F2] D) β†’
(ActualHomogeneous.E k β†’β‚—[F2] C) β†’ ℝ) :
(𝔼 Z : PartnerPoint rhs (activeOf J) β†’β‚—[F2] D,
𝔼 X : PartnerPoint rhs (activeOf J) β†’β‚—[F2] C,
let pi := (PartnerLinear.projection rhs (activeOf J) slot).comp
(PartnerLinear.sourceLinearEquiv rhs).symm.toLinearMap
H (Z.comp pi) (X.comp pi)) =
(𝔼 Z : RawPoint J β†’β‚—[F2] D, 𝔼 X : RawPoint J β†’β‚—[F2] C,
H (Z.comp (RawPartnerTarget.rawProjection rhs J slot))
(X.comp (RawPartnerTarget.rawProjection rhs J slot))) := by
symm
apply Fintype.expect_equiv
(ActualMapComparison.sourcePrecomposeEquiv (R := D) (pointEquiv rhs J))
intro Z
apply Fintype.expect_equiv
(ActualMapComparison.sourcePrecomposeEquiv (R := C) (pointEquiv rhs J))
intro X
change H (Z.comp (RawPartnerTarget.rawProjection rhs J slot))
(X.comp (RawPartnerTarget.rawProjection rhs J slot)) =
H ((Z.comp (pointEquiv rhs J).toLinearMap).comp
((PartnerLinear.projection rhs (activeOf J) slot).comp
(PartnerLinear.sourceLinearEquiv rhs).symm.toLinearMap))
((X.comp (pointEquiv rhs J).toLinearMap).comp
((PartnerLinear.projection rhs (activeOf J) slot).comp
(PartnerLinear.sourceLinearEquiv rhs).symm.toLinearMap))
simp only [precompose_rawProjection]
end MaxCutGames.Soundness.RawTargetLaw
end OAI