Download data/lean/OAI/Computability/DirectedFeedback/Probability/Mixture.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 36.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DirectedFeedback/Probability/Mixture.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/DirectedFeedback/Probability/Mixture.lean
-
curl -L -o Mixture.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DirectedFeedback/Probability/Mixture.lean
36.3 kB
| import Mathlib | |
| import OAI.Computability.DirectedFeedback.Games.ProductLaw | |
| namespace OAI | |
| namespace DFVSGames.Foundations.Games.FiniteDistribution | |
| open scoped BigOperators | |
| noncomputable section | |
| variable {Seed Ξ© : Type*} [Fintype Seed] [Fintype Ξ©] | |
| def mixture (seedLaw : FiniteDistribution Seed) | |
| (laws : Seed β FiniteDistribution Ξ©) : FiniteDistribution Ξ© where | |
| weight x := β seed, seedLaw.weight seed * (laws seed).weight x | |
| nonnegative x := Finset.sum_nonneg fun seed _ => | |
| mul_nonneg (seedLaw.nonnegative seed) ((laws seed).nonnegative x) | |
| normalized := by | |
| rw [Finset.sum_comm] | |
| simp_rw [β Finset.mul_sum, (laws _).normalized, mul_one] | |
| exact seedLaw.normalized | |
| theorem probability_mixture (seedLaw : FiniteDistribution Seed) | |
| (laws : Seed β FiniteDistribution Ξ©) (event : Ξ© β Bool) : | |
| (seedLaw.mixture laws).probability event = | |
| β seed, seedLaw.weight seed * (laws seed).probability event := by | |
| unfold probability mixture | |
| calc | |
| _ = β x, β seed, | |
| seedLaw.weight seed * (if event x then (laws seed).weight x else 0) := by | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| cases event x <;> simp | |
| _ = _ := by | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro seed _ | |
| rw [Finset.mul_sum] | |
| theorem probability_mixture_le (seedLaw : FiniteDistribution Seed) | |
| (laws : Seed β FiniteDistribution Ξ©) (event : Ξ© β Bool) (bound : β) | |
| (h : β seed, (laws seed).probability event β€ bound) : | |
| (seedLaw.mixture laws).probability event β€ bound := by | |
| rw [probability_mixture] | |
| calc | |
| _ β€ β seed, seedLaw.weight seed * bound := | |
| Finset.sum_le_sum fun seed _ => | |
| mul_le_mul_of_nonneg_left (h seed) (seedLaw.nonnegative seed) | |
| _ = bound := by rw [β Finset.sum_mul, seedLaw.normalized, one_mul] | |
| end | |
| end DFVSGames.Foundations.Games.FiniteDistribution | |
| namespace DFVSGames.Foundations.Games.FiniteDistribution | |
| open scoped BigOperators | |
| noncomputable section | |
| variable {A B C : Type*} [Fintype A] [Fintype B] [Fintype C] | |
| theorem weight_eq_probability_singleton [DecidableEq A] (ΞΌ : FiniteDistribution A) (a : A) : | |
| ΞΌ.weight a = ΞΌ.probability (fun x => decide (x = a)) := by | |
| classical | |
| simp [probability] | |
| theorem pushforward_comp (ΞΌ : FiniteDistribution A) (f : A β B) (g : B β C) : | |
| (ΞΌ.pushforward f).pushforward g = ΞΌ.pushforward (fun a => g (f a)) := by | |
| classical | |
| apply eq_of_weight_eq | |
| intro c | |
| rw [weight_eq_probability_singleton, weight_eq_probability_singleton] | |
| simp only [probability_pushforward] | |
| theorem transport_eq_pushforward (ΞΌ : FiniteDistribution A) (e : A β B) : | |
| ΞΌ.transport e = ΞΌ.pushforward e := by | |
| classical | |
| apply eq_of_weight_eq | |
| intro b | |
| rw [weight_eq_probability_singleton, weight_eq_probability_singleton, | |
| probability_transport, probability_pushforward] | |
| theorem expectation_pushforward (ΞΌ : FiniteDistribution A) (f : A β B) (h : B β β) : | |
| (ΞΌ.pushforward f).expectation h = ΞΌ.expectation (fun a => h (f a)) := by | |
| classical | |
| simp only [expectation, pushforward, Finset.sum_mul] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| simp [ite_mul] | |
| theorem pushforward_mixture (ΞΌ : FiniteDistribution A) (Ξ½ : A β FiniteDistribution B) | |
| (f : B β C) : | |
| (ΞΌ.mixture Ξ½).pushforward f = ΞΌ.mixture (fun a => (Ξ½ a).pushforward f) := by | |
| classical | |
| apply eq_of_weight_eq | |
| intro c | |
| rw [weight_eq_probability_singleton, weight_eq_probability_singleton] | |
| simp only [probability_pushforward, probability_mixture] | |
| end | |
| end DFVSGames.Foundations.Games.FiniteDistribution | |
| namespace DFVSGames.Clean | |
| open Foundations.Games | |
| open scoped BigOperators | |
| noncomputable section | |
| def bernoulli (p : β) (hpβ : 0 β€ p) (hpβ : p β€ 1) : | |
| FiniteDistribution Bool where | |
| weight b := if b then p else 1 - p | |
| nonnegative b := by cases b <;> simp [hpβ, sub_nonneg.mpr hpβ] | |
| normalized := by simp [] | |
| def maskCount {k : β} (mask : Fin k β Bool) : β := | |
| (Finset.univ.filter fun i => mask i = true).card | |
| theorem product_mask {k : β} (mask : Fin k β Bool) (Ο : β) : | |
| (β i, if mask i then Ο else 1) = Ο ^ maskCount mask := by | |
| classical | |
| simp [maskCount, Finset.prod_ite] | |
| theorem iid_product_moment {Ξ© : Type*} [Fintype Ξ©] | |
| (ΞΌ : FiniteDistribution Ξ©) (f : Ξ© β β) (k : β) : | |
| (ΞΌ.iid k).expectation (fun x => β i, f (x i)) = ΞΌ.expectation f ^ k := by | |
| classical | |
| unfold FiniteDistribution.expectation FiniteDistribution.iid | |
| rw [Fintype.sum_pow] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| rw [Finset.prod_mul_distrib] | |
| theorem bernoulli_mask_moment (p : β) (hpβ : 0 β€ p) (hpβ : p β€ 1) | |
| (k : β) (Ο : β) : | |
| ((bernoulli p hpβ hpβ).iid k).expectation (fun mask => Ο ^ maskCount mask) = | |
| (1 - p * (1 - Ο)) ^ k := by | |
| calc | |
| _ = ((bernoulli p hpβ hpβ).iid k).expectation | |
| (fun mask => β i, if mask i then Ο else 1) := | |
| FiniteDistribution.expectation_congr _ (fun mask => (product_mask mask Ο).symm) | |
| _ = ((bernoulli p hpβ hpβ).expectation (fun b => if b then Ο else 1)) ^ k := | |
| iid_product_moment (bernoulli p hpβ hpβ) (fun b : Bool => if b then Ο else 1) k | |
| _ = _ := by | |
| congr 1 | |
| simp [FiniteDistribution.expectation, bernoulli] | |
| ring | |
| variable {E : Type*} [Fintype E] [Nonempty E] | |
| def cleanProbability (Ξ² : β) (E : Type*) [Fintype E] : β := | |
| Ξ² / (Fintype.card E : β) | |
| omit [Nonempty E] in | |
| theorem cleanProbability_nonneg {Ξ² : β} (hΞ²β : 0 β€ Ξ²) : | |
| 0 β€ cleanProbability Ξ² E := | |
| div_nonneg hΞ²β (Nat.cast_nonneg _) | |
| theorem cleanProbability_le_one {Ξ² : β} (hΞ²β : Ξ² β€ 1) : | |
| cleanProbability Ξ² E β€ 1 := by | |
| have hc : (1 : β) β€ Fintype.card E := by | |
| exact_mod_cast Fintype.card_pos (Ξ± := E) | |
| apply (div_le_iffβ (lt_of_lt_of_le zero_lt_one hc)).mpr | |
| simpa using hΞ²β.trans hc | |
| def singletonSlopeLaw (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) : | |
| FiniteDistribution (Bool Γ E) := | |
| (bernoulli Ξ² hΞ²β hΞ²β).product (FiniteDistribution.uniform E) | |
| def cleanBit (origin : E) (sample : Bool Γ E) : Bool := by | |
| classical | |
| exact sample.1 && decide (sample.2 = origin) | |
| theorem clean_pushforward (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) (origin : E) : | |
| (singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).pushforward (cleanBit origin) = | |
| bernoulli (cleanProbability Ξ² E) | |
| (cleanProbability_nonneg hΞ²β) (cleanProbability_le_one hΞ²β) := by | |
| classical | |
| let ΞΌ := (singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).pushforward (cleanBit origin) | |
| have ht : ΞΌ.weight true = cleanProbability Ξ² E := by | |
| simp [ΞΌ, FiniteDistribution.pushforward, singletonSlopeLaw, | |
| FiniteDistribution.product, Fintype.sum_prod_type, | |
| bernoulli, cleanBit, FiniteDistribution.uniform, cleanProbability, div_eq_mul_inv] | |
| apply FiniteDistribution.eq_of_weight_eq | |
| intro b | |
| cases b with | |
| | false => | |
| change ΞΌ.weight false = 1 - cleanProbability Ξ² E | |
| have hn := ΞΌ.normalized | |
| simp only [Fintype.sum_bool] at hn | |
| linarith | |
| | true => exact ht | |
| theorem clean_mask_law (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (origin : E) (k : β) : | |
| ((singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).iid k).pushforward | |
| (fun sample i => cleanBit origin (sample i)) = | |
| (bernoulli (cleanProbability Ξ² E) | |
| (cleanProbability_nonneg hΞ²β) (cleanProbability_le_one hΞ²β)).iid k := by | |
| rw [β FiniteDistribution.iid_pushforward, clean_pushforward] | |
| theorem clean_mask_moment (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (origin : E) (k : β) (Ο : β) : | |
| ((singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).iid k).expectation | |
| (fun sample => Ο ^ maskCount (fun i => cleanBit origin (sample i))) = | |
| (1 - cleanProbability Ξ² E * (1 - Ο)) ^ k := by | |
| rw [β FiniteDistribution.expectation_pushforward | |
| ((singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).iid k) | |
| (fun sample i => cleanBit origin (sample i)) (fun mask => Ο ^ maskCount mask)] | |
| rw [clean_mask_law, bernoulli_mask_moment] | |
| theorem cleanProbability_ge_of_card_le {Ξ² : β} (hΞ²β : 0 β€ Ξ²) {N : β} | |
| (hcard : (Fintype.card E : β) β€ N) : | |
| Ξ² / N β€ cleanProbability Ξ² E := by | |
| exact div_le_div_of_nonneg_left hΞ²β | |
| (Nat.cast_pos.mpr Fintype.card_pos) hcard | |
| theorem cleanProbability_ge_dimension {Ξ² : β} (hΞ²β : 0 β€ Ξ²) (dimW rs : β) | |
| (hcard : Fintype.card E β€ 2 ^ (dimW + rs)) : | |
| Ξ² * (2 : β) ^ (-((dimW + rs : β) : β€)) β€ cleanProbability Ξ² E := by | |
| rw [zpow_neg, zpow_natCast, β div_eq_mul_inv] | |
| apply cleanProbability_ge_of_card_le hΞ²β | |
| exact_mod_cast hcard | |
| theorem mask_rate_antitone {p q Ο : β} (hpβ : 0 β€ p) (hpβ : p β€ 1) | |
| (hqp : q β€ p) (hΟβ : 0 β€ Ο) (hΟβ : Ο β€ 1) (k : β) : | |
| (1 - p * (1 - Ο)) ^ k β€ (1 - q * (1 - Ο)) ^ k := by | |
| have hl : 0 β€ 1 - p * (1 - Ο) := by | |
| nlinarith [mul_nonneg hpβ hΟβ] | |
| apply pow_le_pow_leftβ hl | |
| exact sub_le_sub_left (mul_le_mul_of_nonneg_right hqp (sub_nonneg.mpr hΟβ)) 1 | |
| theorem clean_mask_moment_le (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (origin : E) (k : β) {N : β} (hcard : (Fintype.card E : β) β€ N) : | |
| ((singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).iid k).expectation | |
| (fun sample => (1 - (1 : β) / 3600) ^ | |
| maskCount (fun i => cleanBit origin (sample i))) β€ | |
| (1 - (Ξ² / N) / 3600) ^ k := by | |
| rw [clean_mask_moment] | |
| have h := mask_rate_antitone (cleanProbability_nonneg (E := E) hΞ²β) | |
| (cleanProbability_le_one (E := E) hΞ²β) | |
| (cleanProbability_ge_of_card_le hΞ²β hcard) | |
| (Ο := 1 - (1 : β) / 3600) (by norm_num) (by norm_num) k | |
| convert h using 1 ; congr 1 ; ring | |
| theorem clean_mask_moment_le_dimension (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (origin : E) (k dimW rs : β) (hcard : Fintype.card E β€ 2 ^ (dimW + rs)) : | |
| ((singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).iid k).expectation | |
| (fun sample => (1 - (1 : β) / 3600) ^ | |
| maskCount (fun i => cleanBit origin (sample i))) β€ | |
| (1 - (Ξ² / (2 : β) ^ (dimW + rs)) / 3600) ^ k := by | |
| apply clean_mask_moment_le Ξ² hΞ²β hΞ²β origin k | |
| exact_mod_cast hcard | |
| theorem mask_rate_le_exp {x : β} (hx : x β€ 1) (k : β) : | |
| (1 - x) ^ k β€ Real.exp (-(k : β) * x) := by | |
| calc | |
| (1 - x) ^ k β€ Real.exp (-x) ^ k := | |
| pow_le_pow_leftβ (sub_nonneg.mpr hx) (Real.one_sub_le_exp_neg x) k | |
| _ = Real.exp (-(k : β) * x) := by | |
| rw [β Real.exp_nat_mul] | |
| congr 1 | |
| ring | |
| theorem clean_mask_moment_le_exp (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (origin : E) (k : β) {N : β} (hcard : (Fintype.card E : β) β€ N) : | |
| ((singletonSlopeLaw (E := E) Ξ² hΞ²β hΞ²β).iid k).expectation | |
| (fun sample => (1 - (1 : β) / 3600) ^ | |
| maskCount (fun i => cleanBit origin (sample i))) β€ | |
| Real.exp (-(k : β) * (Ξ² / N) / 3600) := by | |
| have hN : 1 β€ N := by | |
| have hc : (1 : β) β€ Fintype.card E := by | |
| exact_mod_cast Fintype.card_pos (Ξ± := E) | |
| exact hc.trans hcard | |
| have hq : Ξ² / N β€ 1 := (div_le_iffβ (by linarith)).mpr (by simpa using hΞ²β.trans hN) | |
| have hx : Ξ² / N / 3600 β€ 1 := (div_le_iffβ (by norm_num)).mpr (by linarith) | |
| have h := (clean_mask_moment_le Ξ² hΞ²β hΞ²β origin k hcard).trans | |
| (mask_rate_le_exp hx k) | |
| simpa only [mul_div_assoc] using h | |
| theorem cube_singleton_probability_nonneg (n : β) : 0 β€ (1 / (n : β)) ^ 2 := | |
| sq_nonneg _ | |
| theorem cube_singleton_probability_le_one {n : β} (hn : 1 β€ n) : | |
| (1 / (n : β)) ^ 2 β€ 1 := by | |
| have hn' : (1 : β) β€ n := by exact_mod_cast hn | |
| have hqβ : 0 β€ 1 / (n : β) := div_nonneg zero_le_one (Nat.cast_nonneg _) | |
| have hqβ : 1 / (n : β) β€ 1 := | |
| (div_le_iffβ (by linarith)).mpr (by simpa using hn') | |
| nlinarith [mul_nonneg hqβ (sub_nonneg.mpr hqβ)] | |
| theorem cube_mask_rate_le_exp {n : β} (hn : 1 β€ n) {N : β} (hN : 1 β€ N) : | |
| (1 - ((1 / (n : β)) ^ 2 / N) / 3600) ^ (n ^ 3) β€ | |
| Real.exp (-(n : β) / (3600 * N)) := by | |
| have hnβ : (n : β) β 0 := by | |
| have hn' : (1 : β) β€ n := by exact_mod_cast hn | |
| linarith | |
| have hNβ : N β 0 := by linarith | |
| have hq : (1 / (n : β)) ^ 2 / N β€ 1 := | |
| (div_le_iffβ (by linarith)).mpr | |
| (by simpa using (cube_singleton_probability_le_one hn).trans hN) | |
| have hx : (1 / (n : β)) ^ 2 / N / 3600 β€ 1 := | |
| (div_le_iffβ (by norm_num)).mpr (by linarith) | |
| have he : -((n ^ 3 : β) : β) * ((1 / (n : β)) ^ 2 / N / 3600) = | |
| -(n : β) / (3600 * N) := by | |
| simp only [Nat.cast_pow] | |
| field_simp [hnβ, hNβ] | |
| calc | |
| _ β€ Real.exp (-((n ^ 3 : β) : β) * ((1 / (n : β)) ^ 2 / N / 3600)) := | |
| mask_rate_le_exp hx (n ^ 3) | |
| _ = _ := congrArg Real.exp he | |
| theorem exists_cube_exponential_lt {N error : β} (hN : 0 < N) (herror : 0 < error) : | |
| β n : β, 1 β€ n β§ Real.exp (-(n : β) / (3600 * N)) < error := by | |
| let rate := Real.exp (-(1 / (3600 * N))) | |
| have hrateβ : 0 β€ rate := (Real.exp_pos _).le | |
| have hrateβ : rate < 1 := Real.exp_lt_one_iff.mpr | |
| (neg_lt_zero.mpr (one_div_pos.mpr (mul_pos (by norm_num) hN))) | |
| have ht := tendsto_pow_atTop_nhds_zero_of_lt_one hrateβ hrateβ | |
| obtain β¨m, hmβ© := (ht.eventually (gt_mem_nhds herror)).exists | |
| refine β¨m + 1, Nat.succ_le_succ (Nat.zero_le m), ?_β© | |
| have hp : rate ^ (m + 1) < error := | |
| lt_of_le_of_lt (by | |
| rw [pow_succ] | |
| exact mul_le_of_le_one_right (pow_nonneg hrateβ m) hrateβ.le) hm | |
| have he : Real.exp (-((m + 1 : β) : β) / (3600 * N)) = rate ^ (m + 1) := by | |
| rw [β Real.exp_nat_mul] | |
| congr 1 | |
| ring | |
| rwa [he] | |
| theorem exists_cube_mask_rate_lt {N error : β} (hN : 1 β€ N) (herror : 0 < error) : | |
| β n : β, 1 β€ n β§ | |
| (1 - ((1 / (n : β)) ^ 2 / N) / 3600) ^ (n ^ 3) < error := by | |
| obtain β¨n, hn, heβ© := exists_cube_exponential_lt (by linarith : 0 < N) herror | |
| exact β¨n, hn, (cube_mask_rate_le_exp hn hN).trans_lt heβ© | |
| end | |
| end DFVSGames.Clean | |
| namespace DFVSGames.Clean.Experiment | |
| open scoped BigOperators | |
| open Foundations.Games | |
| open Soundness | |
| open Soundness.ConditionalIncidences Soundness.ConditionalSimulation | |
| open Soundness.ConditionalGameLaw | |
| noncomputable section | |
| variable {R O N : Type} [Fintype R] [DecidableEq R] | |
| [Fintype O] [DecidableEq O] [Fintype N] [DecidableEq N] | |
| abbrev Coefficient (R : Type) := ZeroInformation.Bits R | |
| abbrev Additional (k : β) (R : Type) := Coefficient R Γ (Fin k β Coefficient R Γ Coefficient R) | |
| abbrev SparseSeed (k : β) (R : Type) := Fin k β Bool Γ Coefficient R | |
| def singletonSet {k : β} (seed : SparseSeed k R) : Finset (Fin k) := | |
| Finset.univ.filter fun i => (seed i).1 = true | |
| def coefficients {k : β} (extra : Additional k R) (seed : SparseSeed k R) : | |
| RawCoefficients (singletonSet seed) (Coefficient R) := | |
| fun slot => match slot with | |
| | none => extra.1 | |
| | some (.inl (i, j)) => if j = 0 then (extra.2 i.val).1 else (extra.2 i.val).2 | |
| | some (.inr i) => (seed i.val).2 | |
| omit [DecidableEq R] in | |
| theorem zeroSet_eq_cleanMask {k : β} (extra : Additional k R) (seed : SparseSeed k R) : | |
| zeroSet (singletonSet seed) (coefficients extra seed) = | |
| Finset.univ.filter (fun i => cleanBit (ZeroInformation.zero : Coefficient R) (seed i) = true) := by | |
| classical | |
| ext i | |
| rw [mem_zeroSet] | |
| simp [singletonSet, coefficients, cleanBit] | |
| intro _ | |
| rfl | |
| omit [DecidableEq R] in | |
| theorem zeroSet_card {k : β} (extra : Additional k R) (seed : SparseSeed k R) : | |
| (zeroSet (singletonSet seed) (coefficients extra seed)).card = | |
| maskCount (fun i => cleanBit (ZeroInformation.zero : Coefficient R) (seed i)) := by | |
| rw [zeroSet_eq_cleanMask] | |
| rfl | |
| abbrev LocalStrategies (k : β) (R O N : Type) := | |
| OuterStrategy (P := Fin k) (R := R) (O := O) (N := N) | |
| def success (k : β) (ΞΌ : FiniteDistribution (O Γ Fin 3)) | |
| (g : IncidenceExtraction.Incidence O N) | |
| (extraLaw : FiniteDistribution (Additional k R)) | |
| (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (strategy : Additional k R β SparseSeed k R β LocalStrategies k R O N) : β := | |
| extraLaw.expectation fun extra => | |
| ((singletonSlopeLaw (E := Coefficient R) Ξ² hΞ²β hΞ²β).iid k).expectation fun seed => | |
| UpperBound.fixedAdviceSuccess ΞΌ (singletonSet seed) g (coefficients extra seed) | |
| (strategy extra seed) | |
| private theorem expectation_mono_inline_Experiment {Ξ© : Type*} [Fintype Ξ©] | |
| (ΞΌ : FiniteDistribution Ξ©) {f g : Ξ© β β} (h : β x, f x β€ g x) : | |
| ΞΌ.expectation f β€ ΞΌ.expectation g := by | |
| unfold FiniteDistribution.expectation | |
| exact Finset.sum_le_sum fun x _ => mul_le_mul_of_nonneg_left (h x) (ΞΌ.nonnegative x) | |
| private theorem expectation_const_inline_Experiment {Ξ© : Type*} [Fintype Ξ©] | |
| (ΞΌ : FiniteDistribution Ξ©) (c : β) : ΞΌ.expectation (fun _ => c) = c := by | |
| rw [FiniteDistribution.expectation, β Finset.sum_mul, ΞΌ.normalized, one_mul] | |
| theorem success_le_of_repetition (k : β) (ΞΌ : FiniteDistribution (O Γ Fin 3)) | |
| (g : IncidenceExtraction.Incidence O N) | |
| (extraLaw : FiniteDistribution (Additional k R)) | |
| (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (strategy : Additional k R β SparseSeed k R β LocalStrategies k R O N) | |
| (distinct : β o i j, g.name o i = g.name o j β i = j) | |
| (Ο : β) | |
| (rate : β n, ((incidenceGame g (ΞΌ.pushforward (incidence g.name))).repetition n).value β€ Ο ^ n) : | |
| success k ΞΌ g extraLaw Ξ² hΞ²β hΞ²β strategy β€ | |
| (1 - (Ξ² / (Fintype.card (Coefficient R) : β)) * (1 - Ο)) ^ k := by | |
| unfold success | |
| calc | |
| _ β€ extraLaw.expectation (fun _ => | |
| (1 - (Ξ² / (Fintype.card (Coefficient R) : β)) * (1 - Ο)) ^ k) := by | |
| apply expectation_mono_inline_Experiment | |
| intro extra | |
| calc | |
| _ β€ ((singletonSlopeLaw (E := Coefficient R) Ξ² hΞ²β hΞ²β).iid k).expectation | |
| (fun seed => Ο ^ maskCount (fun i => cleanBit (ZeroInformation.zero : Coefficient R) (seed i))) := by | |
| apply expectation_mono_inline_Experiment | |
| intro seed | |
| have bound := (UpperBound.fixed_advice_success_le_repeated_value ΞΌ | |
| (singletonSet seed) g (coefficients extra seed) (strategy extra seed) distinct).trans (rate _) | |
| simpa only [zeroSet_card] using bound | |
| _ = _ := clean_mask_moment Ξ² hΞ²β hΞ²β (ZeroInformation.zero : Coefficient R) k Ο | |
| _ = _ := expectation_const_inline_Experiment _ _ | |
| theorem randomized_success_le_of_repetition {Seed : Type*} [Fintype Seed] | |
| (k : β) (ΞΌ : FiniteDistribution (O Γ Fin 3)) | |
| (g : IncidenceExtraction.Incidence O N) | |
| (extraLaw : FiniteDistribution (Additional k R)) | |
| (Ξ² : β) (hΞ²β : 0 β€ Ξ²) (hΞ²β : Ξ² β€ 1) | |
| (seedLaw : FiniteDistribution Seed) | |
| (strategy : Seed β Additional k R β SparseSeed k R β LocalStrategies k R O N) | |
| (distinct : β o i j, g.name o i = g.name o j β i = j) | |
| (Ο : β) | |
| (rate : β n, ((incidenceGame g (ΞΌ.pushforward (incidence g.name))).repetition n).value β€ Ο ^ n) : | |
| seedLaw.expectation (fun seed => success k ΞΌ g extraLaw Ξ² hΞ²β hΞ²β (strategy seed)) β€ | |
| (1 - (Ξ² / (Fintype.card (Coefficient R) : β)) * (1 - Ο)) ^ k := by | |
| calc | |
| _ β€ seedLaw.expectation (fun _ => | |
| (1 - (Ξ² / (Fintype.card (Coefficient R) : β)) * (1 - Ο)) ^ k) := | |
| expectation_mono_inline_Experiment _ (fun seed => | |
| success_le_of_repetition k ΞΌ g extraLaw Ξ² hΞ²β hΞ²β (strategy seed) distinct Ο rate) | |
| _ = _ := expectation_const_inline_Experiment _ _ | |
| end | |
| end DFVSGames.Clean.Experiment | |
| namespace DFVSGames.Soundness.SubsetIntersection | |
| open scoped BigOperators | |
| def subsets (k t : β) : Finset (Finset (Fin k)) := | |
| (Finset.univ : Finset (Fin k)).powersetCard t | |
| def uniformMean (k t : β) (f : Finset (Fin k) β β) : β := | |
| (β a β subsets k t, f a) / (subsets k t).card | |
| def independentMean (k t : β) (f : Finset (Fin k) β Finset (Fin k) β β) : β := | |
| uniformMean k t fun a => uniformMean k t fun b => f a b | |
| def memberIndicator {k : β} (i : Fin k) (a : Finset (Fin k)) : β := | |
| if i β a then 1 else 0 | |
| def overlapProbability (k t : β) : β := | |
| independentMean k t fun a b => if (a β© b).Nonempty then 1 else 0 | |
| theorem independentMean_eq_double_sum (k t : β) | |
| (f : Finset (Fin k) β Finset (Fin k) β β) : | |
| independentMean k t f = | |
| (β a β subsets k t, β b β subsets k t, f a b) / ((subsets k t).card : β)^2 := by | |
| unfold independentMean uniformMean | |
| simp only [div_eq_mul_inv, β Finset.sum_mul, pow_two, mul_inv_rev] | |
| ring | |
| theorem uniformMean_mul_left (k t : β) (c : β) (f : Finset (Fin k) β β) : | |
| uniformMean k t (fun a => c * f a) = c * uniformMean k t f := by | |
| unfold uniformMean | |
| rw [β Finset.mul_sum] | |
| ring | |
| theorem uniformMean_mul_right (k t : β) (c : β) (f : Finset (Fin k) β β) : | |
| uniformMean k t (fun a => f a * c) = uniformMean k t f * c := by | |
| unfold uniformMean | |
| rw [β Finset.sum_mul] | |
| ring | |
| theorem independentMean_product (k t : β) (f g : Finset (Fin k) β β) : | |
| independentMean k t (fun a b => f a * g b) = uniformMean k t f * uniformMean k t g := by | |
| simp only [independentMean, uniformMean_mul_left, uniformMean_mul_right] | |
| theorem subsets_card (k t : β) : (subsets k t).card = k.choose t := by | |
| simp [subsets] | |
| theorem subsets_nonempty {k t : β} (htk : t β€ k) : (subsets k t).Nonempty := by | |
| apply Finset.powersetCard_nonempty.mpr | |
| simpa using htk | |
| theorem subsets_card_ne_zero {k t : β} (htk : t β€ k) : | |
| ((subsets k t).card : β) β 0 := by | |
| exact_mod_cast (Finset.card_ne_zero.mpr (subsets_nonempty htk)) | |
| theorem count_containing {k t : β} (ht : 0 < t) (i : Fin k) : | |
| ((subsets k t).filter (fun a => i β a)).card = | |
| (k - 1).choose (t - 1) := by | |
| simpa [subsets] using | |
| (Finset.card_filter_powersetCard_subset ({i} : Finset (Fin k)) Finset.univ t | |
| (by simp) (by simpa using Nat.succ_le_of_lt ht)) | |
| theorem choose_predecessor_ratio {k t : β} (hk : 0 < k) (ht : 0 < t) (htk : t β€ k) : | |
| ((k - 1).choose (t - 1) : β) / k.choose t = (t : β) / k := by | |
| have hk0 : (k : β) β 0 := by exact_mod_cast (Nat.ne_of_gt hk) | |
| have hc0 : (k.choose t : β) β 0 := by exact_mod_cast (Nat.ne_of_gt (Nat.choose_pos htk)) | |
| have hrel : k * (k - 1).choose (t - 1) = k.choose t * t := by | |
| simpa [Nat.sub_add_cancel hk, Nat.sub_add_cancel ht] using | |
| (Nat.add_one_mul_choose_eq (k - 1) (t - 1)) | |
| apply (div_eq_div_iff hc0 hk0).2 | |
| exact_mod_cast (by simpa [Nat.mul_comm] using hrel) | |
| theorem inclusion_probability {k t : β} (hk : 0 < k) (htk : t β€ k) (i : Fin k) : | |
| uniformMean k t (memberIndicator i) = (t : β) / k := by | |
| by_cases ht : t = 0 | |
| Β· subst t | |
| simp [uniformMean, subsets, memberIndicator] | |
| Β· have htpos : 0 < t := Nat.pos_of_ne_zero ht | |
| unfold uniformMean memberIndicator | |
| rw [Finset.sum_boole, count_containing htpos i, subsets_card] | |
| exact choose_predecessor_ratio hk htpos htk | |
| theorem independent_inclusion_probability {k t : β} (hk : 0 < k) (htk : t β€ k) (i : Fin k) : | |
| independentMean k t (fun a b => memberIndicator i a * memberIndicator i b) = | |
| ((t : β) / k)^2 := by | |
| rw [independentMean_product, inclusion_probability hk htk] | |
| ring | |
| theorem uniformMean_congr {k t : β} {f g : Finset (Fin k) β β} | |
| (h : β a β subsets k t, f a = g a) : uniformMean k t f = uniformMean k t g := by | |
| unfold uniformMean | |
| rw [Finset.sum_congr rfl h] | |
| theorem uniformMean_const {k t : β} (htk : t β€ k) (c : β) : | |
| uniformMean k t (fun _ => c) = c := by | |
| have hn := subsets_card_ne_zero htk | |
| simp only [uniformMean, Finset.sum_const, nsmul_eq_mul] | |
| field_simp | |
| theorem uniformMean_finset_sum {k t : β} {Ξ± : Type*} (s : Finset Ξ±) | |
| (f : Ξ± β Finset (Fin k) β β) : | |
| uniformMean k t (fun a => β i β s, f i a) = | |
| β i β s, uniformMean k t (f i) := by | |
| unfold uniformMean | |
| rw [Finset.sum_comm] | |
| simp only [div_eq_mul_inv, Finset.sum_mul] | |
| theorem uniformMean_mono {k t : β} {f g : Finset (Fin k) β β} | |
| (h : β a β subsets k t, f a β€ g a) : uniformMean k t f β€ uniformMean k t g := by | |
| apply div_le_div_of_nonneg_right (Finset.sum_le_sum h) | |
| exact Nat.cast_nonneg _ | |
| theorem independentMean_mono {k t : β} {f g : Finset (Fin k) β Finset (Fin k) β β} | |
| (h : β a β subsets k t, β b β subsets k t, f a b β€ g a b) : | |
| independentMean k t f β€ independentMean k t g := by | |
| apply uniformMean_mono | |
| intro a ha | |
| apply uniformMean_mono | |
| exact h a ha | |
| theorem intersection_card_indicator {k : β} (a b : Finset (Fin k)) : | |
| ((a β© b).card : β) = β i β a, memberIndicator i b := by | |
| simp [memberIndicator] | |
| theorem expected_intersection_fixed {k t : β} (hk : 0 < k) (htk : t β€ k) | |
| (a : Finset (Fin k)) : | |
| uniformMean k t (fun b => ((a β© b).card : β)) = a.card * ((t : β) / k) := by | |
| simp_rw [intersection_card_indicator] | |
| rw [uniformMean_finset_sum] | |
| simp [inclusion_probability hk htk, nsmul_eq_mul] | |
| theorem expected_intersection {k t : β} (hk : 0 < k) (htk : t β€ k) : | |
| independentMean k t (fun a b => ((a β© b).card : β)) = (t : β)^2 / k := by | |
| unfold independentMean | |
| simp_rw [expected_intersection_fixed hk htk] | |
| calc | |
| uniformMean k t (fun a => a.card * ((t : β) / k)) = | |
| uniformMean k t (fun _ => (t : β) * ((t : β) / k)) := by | |
| apply uniformMean_congr | |
| intro a ha | |
| have hcard : a.card = t := (Finset.mem_powersetCard.mp ha).2 | |
| rw [hcard] | |
| _ = (t : β) * ((t : β) / k) := uniformMean_const htk _ | |
| _ = (t : β)^2 / k := by ring | |
| theorem nonempty_indicator_le_card {k : β} (a b : Finset (Fin k)) : | |
| (if (a β© b).Nonempty then (1 : β) else 0) β€ (a β© b).card := by | |
| split_ifs with h | |
| Β· exact_mod_cast (Finset.card_pos.mpr h) | |
| Β· exact Nat.cast_nonneg _ | |
| theorem overlap_probability_le {k t : β} (hk : 0 < k) (htk : t β€ k) : | |
| overlapProbability k t β€ (t : β)^2 / k := by | |
| calc | |
| overlapProbability k t β€ independentMean k t (fun a b => ((a β© b).card : β)) := | |
| independentMean_mono (fun a _ b _ => nonempty_indicator_le_card a b) | |
| _ = (t : β)^2 / k := expected_intersection hk htk | |
| end DFVSGames.Soundness.SubsetIntersection | |
| namespace DFVSGames.Soundness.PartnerSampling | |
| open scoped BigOperators | |
| open SubsetIntersection (subsets) | |
| abbrev ActiveSet (k t : β) := β₯(subsets k t) | |
| abbrev Partner (k t : β) := Ξ£ a : ActiveSet k t, (β₯a.val β Fin 3) | |
| theorem activeSet_card {k t : β} (a : ActiveSet k t) : a.val.card = t := | |
| (Finset.mem_powersetCard.mp a.property).2 | |
| theorem slotTuples_card {k t : β} (a : ActiveSet k t) : | |
| Fintype.card (β₯a.val β Fin 3) = 3 ^ t := by | |
| simp [activeSet_card a] | |
| theorem partner_card (k t : β) : | |
| Fintype.card (Partner k t) = (subsets k t).card * 3 ^ t := by | |
| rw [Fintype.card_sigma] | |
| simp only [slotTuples_card, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, | |
| Fintype.card_coe, Nat.cast_id] | |
| theorem partner_nonempty {k t : β} (htk : t β€ k) : Nonempty (Partner k t) := by | |
| obtain β¨a, haβ© := SubsetIntersection.subsets_nonempty htk | |
| exact β¨β¨β¨a, haβ©, fun _ => 0β©β© | |
| theorem uniformMean_real_cast (k t : β) (f : Finset (Fin k) β β) : | |
| (SubsetIntersection.uniformMean k t f : β) = | |
| (πΌ a β subsets k t, (f a : β)) := by | |
| rw [Finset.expect_eq_sum_div_card] | |
| simp [SubsetIntersection.uniformMean] | |
| theorem independentMean_real_cast (k t : β) | |
| (f : Finset (Fin k) β Finset (Fin k) β β) : | |
| (SubsetIntersection.independentMean k t f : β) = | |
| (πΌ a β subsets k t, πΌ b β subsets k t, (f a b : β)) := by | |
| simp only [SubsetIntersection.independentMean, uniformMean_real_cast] | |
| theorem subset_overlap_probability_le {k t : β} (hk : 0 < k) (htk : t β€ k) : | |
| (πΌ a β subsets k t, πΌ b β subsets k t, | |
| if (a β© b).Nonempty then (1 : β) else 0) β€ (t : β)^2 / k := by | |
| have h : (SubsetIntersection.overlapProbability k t : β) β€ (t : β)^2 / k := by | |
| have h := SubsetIntersection.overlap_probability_le hk htk | |
| have hh := (Rat.cast_le (K := β)).mpr h | |
| simpa using hh | |
| simpa only [SubsetIntersection.overlapProbability, independentMean_real_cast, | |
| apply_ite, Rat.cast_one, Rat.cast_zero] using h | |
| theorem activeSet_expect (k t : β) (f : Finset (Fin k) β β) : | |
| (πΌ a : ActiveSet k t, f a.val) = (πΌ a β subsets k t, f a) := by | |
| simp only [Finset.expect_eq_sum_div_card, Finset.card_univ, Fintype.card_coe, | |
| Finset.sum_coe_sort] | |
| theorem partner_expect_activeSet (k t : β) (f : ActiveSet k t β β) : | |
| (πΌ p : Partner k t, f p.1) = (πΌ a : ActiveSet k t, f a) := by | |
| have hsum : (β p : Partner k t, f p.1) = (3 : β)^t * β a : ActiveSet k t, f a := by | |
| rw [Fintype.sum_sigma] | |
| simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, slotTuples_card, | |
| Nat.cast_pow, Nat.cast_ofNat] | |
| rw [Finset.mul_sum] | |
| rw [Fintype.expect_eq_sum_div_card, Fintype.expect_eq_sum_div_card, hsum, partner_card] | |
| simp only [Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat, Fintype.card_coe] | |
| have hc : (3 : β)^t β 0 := pow_ne_zero _ (by norm_num) | |
| simpa only [mul_comm] using | |
| (mul_div_mul_left (β a : ActiveSet k t, f a) ((subsets k t).card : β) hc) | |
| theorem partner_expect_active (k t : β) (f : Finset (Fin k) β β) : | |
| (πΌ p : Partner k t, f p.1.val) = (πΌ a β subsets k t, f a) := by | |
| rw [partner_expect_activeSet k t (fun a => f a.val), activeSet_expect] | |
| theorem partner_pair_expect_active (k t : β) | |
| (f : Finset (Fin k) β Finset (Fin k) β β) : | |
| (πΌ p : Partner k t, πΌ q : Partner k t, f p.1.val q.1.val) = | |
| (πΌ a β subsets k t, πΌ b β subsets k t, f a b) := by | |
| calc | |
| _ = πΌ p : Partner k t, πΌ b β subsets k t, f p.1.val b := by | |
| apply Finset.expect_congr rfl | |
| intro p _ | |
| exact partner_expect_active k t (fun b => f p.1.val b) | |
| _ = _ := partner_expect_active k t (fun a => πΌ b β subsets k t, f a b) | |
| theorem partner_active_overlap_probability_le {k t : β} (hk : 0 < k) (htk : t β€ k) : | |
| (πΌ p : Partner k t, πΌ q : Partner k t, | |
| if (p.1.val β© q.1.val).Nonempty then (1 : β) else 0) β€ (t : β)^2 / k := by | |
| rw [partner_pair_expect_active k t (fun a b => if (a β© b).Nonempty then (1 : β) else 0)] | |
| exact subset_overlap_probability_le hk htk | |
| def active {k t : β} (p : Partner k t) (j : Fin k) : Bool := | |
| decide (j β p.1.val) | |
| def decodeSlot (i : Fin 3) : PartnerProjection.Slot := | |
| if i.val = 0 then .first else if i.val = 1 then .second else .third | |
| def slots {k t : β} (p : Partner k t) (j : Fin k) : PartnerProjection.Slot := | |
| if hj : j β p.1.val then decodeSlot (p.2 β¨j, hjβ©) else .first | |
| noncomputable def kernel {k t : β} (rhs : Fin k β Bool) (p : Partner k t) : | |
| Submodule (ZMod 2) (PartnerProjection.SourcePoint rhs) := | |
| (PartnerLinear.projection rhs (active p) (slots p)).ker | |
| def activeSubtypeEquiv {k t : β} (p : Partner k t) : | |
| PartnerLinear.Active (active p) β β₯p.1.val := | |
| Equiv.subtypeEquivRight (fun j => by simp [active]) | |
| theorem kernel_finrank {k t : β} (rhs : Fin k β Bool) (p : Partner k t) : | |
| Module.finrank (ZMod 2) (kernel rhs p) = t := by | |
| rw [kernel, PartnerLinear.projection_ker_finrank] | |
| calc | |
| Fintype.card (PartnerLinear.Active (active p)) = Fintype.card β₯p.1.val := | |
| Fintype.card_congr (activeSubtypeEquiv p) | |
| _ = t := by simpa using activeSet_card p.1 | |
| theorem kernel_inf_finrank_le {k t : β} (rhs : Fin k β Bool) (p q : Partner k t) : | |
| Module.finrank (ZMod 2) β₯(kernel rhs p β kernel rhs q : Submodule (ZMod 2) (PartnerProjection.SourcePoint rhs)) β€ t := by | |
| calc | |
| Module.finrank (ZMod 2) β₯(kernel rhs p β kernel rhs q : Submodule (ZMod 2) (PartnerProjection.SourcePoint rhs)) β€ | |
| Module.finrank (ZMod 2) (kernel rhs p) := Submodule.finrank_mono inf_le_left | |
| _ = t := kernel_finrank rhs p | |
| theorem kernel_inf_eq_bot_of_no_overlap {k t : β} | |
| (rhs : Fin k β Bool) (p q : Partner k t) | |
| (h : Β¬ (p.1.val β© q.1.val).Nonempty) : | |
| kernel rhs p β kernel rhs q = β₯ := by | |
| apply PartnerLinear.disjoint_projection_kernels | |
| rhs (active p) (slots p) (active q) (slots q) | |
| intro j hj | |
| have hp : j β p.1.val := by simpa [active] using hj | |
| have hq : j β q.1.val := by | |
| intro hq | |
| exact h β¨j, Finset.mem_inter.mpr β¨hp, hqβ©β© | |
| simp [active, hq] | |
| def activeOverlap {k t : β} (p q : Partner k t) : β := | |
| if (p.1.val β© q.1.val).Nonempty then 1 else 0 | |
| noncomputable def kernelCollision {k t : β} | |
| (rhs : Fin k β Bool) (p q : Partner k t) : β := by | |
| classical | |
| exact if kernel rhs p β kernel rhs q β β₯ then 1 else 0 | |
| theorem kernelCollision_le_activeOverlap {k t : β} | |
| (rhs : Fin k β Bool) (p q : Partner k t) : | |
| kernelCollision rhs p q β€ activeOverlap p q := by | |
| classical | |
| by_cases h : (p.1.val β© q.1.val).Nonempty | |
| Β· simp only [activeOverlap, ite_eq_left h, kernelCollision] | |
| split_ifs <;> norm_num | |
| Β· have hb := kernel_inf_eq_bot_of_no_overlap rhs p q h | |
| simp [kernelCollision, activeOverlap, h, hb] | |
| theorem kernel_collision_probability_le {k t : β} | |
| (hk : 0 < k) (htk : t β€ k) (rhs : Fin k β Bool) : | |
| (πΌ p : Partner k t, πΌ q : Partner k t, | |
| kernelCollision rhs p q) β€ (t : β)^2 / k := by | |
| calc | |
| (πΌ p : Partner k t, πΌ q : Partner k t, kernelCollision rhs p q) β€ | |
| (πΌ p : Partner k t, πΌ q : Partner k t, activeOverlap p q) := by | |
| apply Finset.expect_le_expect | |
| intro p _ | |
| apply Finset.expect_le_expect | |
| intro q _ | |
| exact kernelCollision_le_activeOverlap rhs p q | |
| _ β€ (t : β)^2 / k := partner_active_overlap_probability_le hk htk | |
| theorem kernel_overlap_weight_pointwise {k t : β} | |
| (rhs : Fin k β Bool) (m : β) (p q : Partner k t) : | |
| (2 : β) ^ (m * Module.finrank (ZMod 2) β₯(kernel rhs p β kernel rhs q : Submodule (ZMod 2) (PartnerProjection.SourcePoint rhs))) β€ | |
| 1 + activeOverlap p q * (2 : β) ^ (m * t) := by | |
| have hcap : | |
| (2 : β) ^ (m * Module.finrank (ZMod 2) β₯(kernel rhs p β kernel rhs q : Submodule (ZMod 2) (PartnerProjection.SourcePoint rhs))) β€ | |
| (2 : β) ^ (m * t) := by | |
| apply pow_le_pow_rightβ (by norm_num : (1 : β) β€ 2) | |
| exact Nat.mul_le_mul_left m (kernel_inf_finrank_le rhs p q) | |
| by_cases h : (p.1.val β© q.1.val).Nonempty | |
| Β· simp only [activeOverlap, ite_eq_left h, one_mul] | |
| linarith | |
| Β· have hb := kernel_inf_eq_bot_of_no_overlap rhs p q h | |
| rw [hb] | |
| simp [activeOverlap, h] | |
| theorem kernel_overlap_weight_le {k t : β} | |
| (hk : 0 < k) (htk : t β€ k) (rhs : Fin k β Bool) (m : β) : | |
| (πΌ p : Partner k t, πΌ q : Partner k t, | |
| (2 : β) ^ (m * Module.finrank (ZMod 2) β₯(kernel rhs p β kernel rhs q : Submodule (ZMod 2) (PartnerProjection.SourcePoint rhs)))) β€ | |
| 1 + ((t : β)^2 / k) * (2 : β) ^ (m * t) := by | |
| let : Nonempty (Partner k t) := partner_nonempty htk | |
| have hmean : | |
| (πΌ p : Partner k t, πΌ q : Partner k t, | |
| (1 + activeOverlap p q * (2 : β) ^ (m * t))) = | |
| 1 + (πΌ p : Partner k t, πΌ q : Partner k t, activeOverlap p q) * | |
| (2 : β) ^ (m * t) := by | |
| simp_rw [Finset.expect_add_distrib, β Finset.expect_mul, Fintype.expect_const] | |
| calc | |
| (πΌ p : Partner k t, πΌ q : Partner k t, | |
| (2 : β) ^ (m * Module.finrank (ZMod 2) β₯(kernel rhs p β kernel rhs q : Submodule (ZMod 2) (PartnerProjection.SourcePoint rhs)))) β€ | |
| (πΌ p : Partner k t, πΌ q : Partner k t, | |
| (1 + activeOverlap p q * (2 : β) ^ (m * t))) := by | |
| apply Finset.expect_le_expect | |
| intro p _ | |
| apply Finset.expect_le_expect | |
| intro q _ | |
| exact kernel_overlap_weight_pointwise rhs m p q | |
| _ = 1 + (πΌ p : Partner k t, πΌ q : Partner k t, activeOverlap p q) * | |
| (2 : β) ^ (m * t) := hmean | |
| _ β€ 1 + ((t : β)^2 / k) * (2 : β) ^ (m * t) := by | |
| apply add_le_add le_rfl | |
| apply mul_le_mul_of_nonneg_right | |
| Β· exact partner_active_overlap_probability_le hk htk | |
| Β· exact pow_nonneg (by norm_num) _ | |
| end DFVSGames.Soundness.PartnerSampling | |
| end OAI | |