Download data/lean/OAI/Computability/DirectedFeedback/Games/FinalParameters.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 34.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DirectedFeedback/Games/FinalParameters.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/DirectedFeedback/Games/FinalParameters.lean
-
curl -L -o FinalParameters.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DirectedFeedback/Games/FinalParameters.lean
34.2 kB
| import Mathlib | |
| import OAI.Computability.DirectedFeedback.Games.ActualAdviceStochasticBridge | |
| namespace OAI | |
| namespace DFVSGames.Integration.FinalParameters | |
| open DFVSGames.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] | |
| 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 | |
| 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ΞΎΞ³β© | |
| 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 DFVSGames.Integration.FinalParameters | |
| namespace DFVSGames.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] | |
| 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 | |
| noncomputable def stabilityError (g : Data C) : β := | |
| Finset.univ.expect (failureIndicator g) | |
| 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 | |
| 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 | |
| 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 β€ Ξ½ | |
| def StableNonlinearDispersion : Prop := | |
| β ΞΆ Ξ½ : β, 0 < ΞΆ β ΞΆ < 1 β 0 < Ξ½ β Ξ½ < 1 β | |
| β r : Nat, 1 β€ r β§ | |
| β s : Nat, r β€ s β | |
| β g : Data (DFVSGames.Integration.BinaryLinear.Vector s), Satisfies g ΞΆ Ξ½ r | |
| end DFVSGames.Gadget.ActualGadget | |
| namespace DFVSGames.Reduction.ActualSource | |
| open DFVSGames.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 | |
| 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) := DFVSGames.Integration.BinaryLinear.Vector s | |
| abbrev Ambient (s d : Nat) := Alphabet s Γ DFVSGames.Integration.BinaryLinear.Vector d | |
| def alphabetEmbedding (s d : Nat) : Alphabet s ββ[F2] Ambient s d := | |
| LinearMap.inl F2 (Alphabet s) (DFVSGames.Integration.BinaryLinear.Vector d) | |
| @[simp] theorem alphabetEmbedding_apply (s d : Nat) (c : Alphabet s) : | |
| alphabetEmbedding s d c = (c, 0) := rfl | |
| 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] DFVSGames.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 DFVSGames.Reduction.ActualSource | |
| namespace DFVSGames.Integration.SplitGadget | |
| open BinaryLinear | |
| variable {R : Type} [AddCommGroup R] [Module F2 R] [FiniteDimensional F2 R] | |
| 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 DFVSGames.Gadget.ActualGadget (Data stabilityError failureIndicator kernelError Satisfies) | |
| open DFVSGames.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 | |
| 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) | |
| 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] | |
| 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] | |
| 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 | |
| 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] | |
| 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β© | |
| 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 DFVSGames.Integration.SplitGadget | |
| namespace DFVSGames.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 | |
| 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 | |
| theorem kernelProbability_real {s d : Nat} | |
| (g : DFVSGames.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 : DFVSGames.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 DFVSGames.Integration.RealBounds | |
| namespace DFVSGames.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 DFVSGames.Soundness.ActualMapComparison | |
| namespace DFVSGames.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 DFVSGames.Soundness.ActualMapComparison | |
| namespace DFVSGames.Soundness.RawTargetLaw | |
| open scoped BigOperators | |
| open DFVSGames.Integration.BinaryLinear (F2) | |
| open DFVSGames.Reduction | |
| open PartnerProjection PartnerMapCoordinates RawPartnerTarget | |
| 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) | |
| 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] | |
| 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 DFVSGames.Soundness.RawTargetLaw | |
| namespace DFVSGames.Soundness.UniformPartition | |
| open scoped BigOperators | |
| noncomputable section | |
| def mean {Ξ© : Type} [Fintype Ξ©] (g : Ξ© β β) : β := | |
| (β Ο, g Ο) / Fintype.card Ξ© | |
| theorem mean_equiv {Ξ© Ξ : Type} [Fintype Ξ©] [Fintype Ξ] | |
| (e : Ξ© β Ξ) (g : Ξ β β) : mean (fun Ο => g (e Ο)) = mean g := by | |
| unfold mean | |
| rw [e.sum_comp, Fintype.card_congr e] | |
| def fiberSum {Ξ© H : Type} [Fintype Ξ©] [DecidableEq H] | |
| (f : Ξ© β H) (h : H) (g : Ξ© β β) : β := | |
| β Ο, if f Ο = h then g Ο else 0 | |
| def fiberSize {Ξ© H : Type} [Fintype Ξ©] [DecidableEq H] | |
| (f : Ξ© β H) (h : H) : β := fiberSum f h (fun _ => 1) | |
| theorem fiberSize_eq_card {Ξ© H : Type} [Fintype Ξ©] [DecidableEq H] | |
| (f : Ξ© β H) (h : H) : | |
| fiberSize f h = ((Finset.univ.filter (fun Ο => f Ο = h)).card : β) := by | |
| classical | |
| unfold fiberSize fiberSum | |
| rw [β Finset.sum_filter] | |
| simp | |
| theorem sum_fiberSum {Ξ© H : Type} [Fintype Ξ©] [Fintype H] [DecidableEq H] | |
| (f : Ξ© β H) (g : Ξ© β β) : | |
| (β h, fiberSum f h g) = β Ο, g Ο := by | |
| unfold fiberSum | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro Ο _ | |
| simp | |
| theorem fiberSize_mul {Ξ© H : Type} [Fintype Ξ©] [DecidableEq H] | |
| (f : Ξ© β H) (b : H β β) (h : H) : | |
| fiberSize f h * b h = fiberSum f h (fun Ο => b (f Ο)) := by | |
| unfold fiberSize fiberSum | |
| rw [Finset.sum_mul] | |
| apply Finset.sum_congr rfl | |
| intro Ο _ | |
| by_cases hΟ : f Ο = h <;> simp [hΟ] | |
| theorem fiberSize_pos {Ξ© H : Type} [Fintype Ξ©] [DecidableEq H] | |
| (f : Ξ© β H) (h : H) (hh : β Ο, f Ο = h) : 0 < fiberSize f h := by | |
| classical | |
| obtain β¨Ο, hΟβ© := hh | |
| rw [fiberSize_eq_card] | |
| have hc : 0 < (Finset.univ.filter (fun Ο => f Ο = h)).card := | |
| Finset.card_pos.mpr β¨Ο, by simp [hΟ]β© | |
| exact_mod_cast hc | |
| theorem fiberSize_mul_conditional {Ξ© H : Type} [Fintype Ξ©] [DecidableEq H] | |
| (f : Ξ© β H) (g : Ξ© β β) (h : H) : | |
| fiberSize f h * (fiberSum f h g / fiberSize f h) = fiberSum f h g := by | |
| classical | |
| by_cases hh : β Ο, f Ο = h | |
| Β· have hn : fiberSize f h β 0 := ne_of_gt (fiberSize_pos f h hh) | |
| field_simp [hn] | |
| Β· have hz : β Ο, f Ο β h := fun Ο hΟ => hh β¨Ο, hΟβ© | |
| simp [fiberSize, fiberSum, hz] | |
| theorem total_mean {Ξ© H : Type} [Fintype Ξ©] [Fintype H] [DecidableEq H] | |
| (f : Ξ© β H) (g : Ξ© β β) : | |
| mean g = mean (fun Ο => fiberSum f (f Ο) g / fiberSize f (f Ο)) := by | |
| let b : H β β := fun h => fiberSum f h g / fiberSize f h | |
| change mean g = mean (fun Ο => b (f Ο)) | |
| unfold mean | |
| apply congrArg (fun x : β => x / (Fintype.card Ξ© : β)) | |
| calc | |
| (β Ο, g Ο) = β h, fiberSum f h g := (sum_fiberSum f g).symm | |
| _ = β h, fiberSize f h * b h := by | |
| apply Finset.sum_congr rfl | |
| intro h _ | |
| exact (fiberSize_mul_conditional f g h).symm | |
| _ = β h, fiberSum f h (fun Ο => b (f Ο)) := by | |
| apply Finset.sum_congr rfl | |
| intro h _ | |
| exact fiberSize_mul f b h | |
| _ = β Ο, b (f Ο) := sum_fiberSum f (fun Ο => b (f Ο)) | |
| theorem mean_mono {Ξ© : Type} [Fintype Ξ©] {g g' : Ξ© β β} | |
| (h : β Ο, g Ο β€ g' Ο) : mean g β€ mean g' := by | |
| exact div_le_div_of_nonneg_right (Finset.sum_le_sum (fun Ο _ => h Ο)) (Nat.cast_nonneg _) | |
| theorem mean_le_partition_bound {Ξ© H : Type} | |
| [Fintype Ξ©] [Fintype H] [DecidableEq H] | |
| (f : Ξ© β H) (g : Ξ© β β) (bound : H β β) | |
| (hlocal : β h, (β Ο, f Ο = h) β | |
| fiberSum f h g / fiberSize f h β€ bound h) : | |
| mean g β€ mean (fun Ο => bound (f Ο)) := by | |
| calc | |
| mean g = mean (fun Ο => fiberSum f (f Ο) g / fiberSize f (f Ο)) := total_mean f g | |
| _ β€ mean (fun Ο => bound (f Ο)) := mean_mono (fun Ο => hlocal (f Ο) β¨Ο,rflβ©) | |
| theorem fiber_conditional_eq_subtype_mean {Ξ© H : Type} | |
| [Fintype Ξ©] [DecidableEq H] (f : Ξ© β H) (h : H) (g : Ξ© β β) : | |
| fiberSum f h g / fiberSize f h = | |
| mean (fun Ο : {Ο // f Ο = h} => g Ο.val) := by | |
| classical | |
| simp only [fiberSum, fiberSize, mean] | |
| congr 1 | |
| Β· rw [β Finset.sum_filter] | |
| exact Finset.sum_subtype _ (fun Ο => by simp) g | |
| Β· rw [β Finset.sum_filter] | |
| simp [Fintype.card_subtype] | |
| end | |
| end DFVSGames.Soundness.UniformPartition | |
| end OAI | |