Download data/lean/OAI/Computability/MaxCut/PCP/FourierResponse.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.91 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/MaxCut/PCP/FourierResponse.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/MaxCut/PCP/FourierResponse.lean
-
curl -L -o FourierResponse.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/MaxCut/PCP/FourierResponse.lean
6.91 kB
| import Mathlib | |
| import OAI.Computability.MaxCut.Games.Basic | |
| import OAI.Computability.MaxCut.Encoding.Decoder | |
| namespace OAI | |
| /-! The Fourier decoder is an actual finite law of private answers. Empty | |
| Fourier supports use an explicit fallback answer, making every response law | |
| normalized even before folding has been imposed. -/ | |
| noncomputable section | |
| namespace MaxCutGames.Foundations.Hastad | |
| open scoped BigOperators | |
| open Finset | |
| open MaxCutGames.Foundations.Games | |
| variable {I J : Type*} [Fintype I] [DecidableEq I] | |
| [Fintype J] [DecidableEq J] | |
| def supportResponse (fallback : I) (s : Cube I) : FiniteDistribution I where | |
| weight i := if (support s).Nonempty then | |
| if i β support s then 1 / ((support s).card : β) else 0 | |
| else if i = fallback then 1 else 0 | |
| nonnegative i := by | |
| split_ifs <;> positivity | |
| normalized := by | |
| by_cases hs : (support s).Nonempty | |
| Β· have hc : ((support s).card : β) β 0 := | |
| ne_of_gt (Nat.cast_pos.mpr (Finset.card_pos.mpr hs)) | |
| simp [hs, hc] | |
| Β· simp [hs] | |
| theorem supportResponse_expectation (fallback : I) (s : Cube I) (H : I β β) | |
| (hs : (support s).Nonempty) : | |
| (supportResponse fallback s).expectation H = | |
| (β i β support s, H i) / ((support s).card : β) := by | |
| simp only [FiniteDistribution.expectation, supportResponse, hs, ite_true] | |
| simp_rw [ite_mul, zero_mul] | |
| rw [Finset.sum_ite_mem] | |
| simp only [div_eq_mul_inv, one_mul, Finset.univ_inter] | |
| rw [β Finset.mul_sum] | |
| ring | |
| /-- Squared Fourier coefficients select a mask; a uniform support coordinate | |
| selects the actual answer. Both stages use only this player's private table. -/ | |
| def fourierResponse (fallback : I) (F : Cube I β Bool) : FiniteDistribution I where | |
| weight i := β s, coefficient (fun f => bitSign (F f)) s ^ 2 * | |
| (supportResponse fallback s).weight i | |
| nonnegative i := Finset.sum_nonneg fun s _ => | |
| mul_nonneg (sq_nonneg _) ((supportResponse fallback s).nonnegative i) | |
| normalized := by | |
| rw [Finset.sum_comm] | |
| simp_rw [β Finset.mul_sum, FiniteDistribution.normalized, mul_one] | |
| exact sign_parseval F | |
| theorem fourierResponse_expectation (fallback : I) (F : Cube I β Bool) | |
| (H : I β β) : | |
| (fourierResponse fallback F).expectation H = | |
| β s, coefficient (fun f => bitSign (F f)) s ^ 2 * | |
| (supportResponse fallback s).expectation H := by | |
| unfold FiniteDistribution.expectation fourierResponse | |
| simp_rw [Finset.sum_mul] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro s _ | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| ring | |
| theorem response_expectation_nonnegative {K : Type*} [Fintype K] | |
| (law : FiniteDistribution K) (H : K β β) (hH : β k, 0 β€ H k) : | |
| 0 β€ law.expectation H := | |
| Finset.sum_nonneg fun k _ => mul_nonneg (law.nonnegative k) (hH k) | |
| def responseAgreement (Ο : J β I) (fallbackI : I) (fallbackJ : J) | |
| (A : Cube I β Bool) (B : Cube J β Bool) : β := | |
| (fourierResponse fallbackI A).expectation fun i => | |
| (fourierResponse fallbackJ B).expectation fun j => if Ο j = i then 1 else 0 | |
| def validResponseAgreement (valid : J β Bool) (Ο : J β I) | |
| (fallbackI : I) (fallbackJ : J) | |
| (A : Cube I β Bool) (B : Cube J β Bool) : β := | |
| (fourierResponse fallbackI A).expectation fun i => | |
| (fourierResponse fallbackJ B).expectation fun j => | |
| if Ο j = i β§ valid j = true then 1 else 0 | |
| theorem supportResponse_validAgreement (valid : J β Bool) (Ο : J β I) | |
| (fallbackI : I) (fallbackJ : J) (a : Cube I) (b : Cube J) | |
| (ha : (support a).Nonempty) (hb : (support b).Nonempty) : | |
| (supportResponse fallbackI a).expectation (fun i => | |
| (supportResponse fallbackJ b).expectation (fun j => | |
| if Ο j = i β§ valid j = true then 1 else 0)) = | |
| validAgreementProbability valid Ο a b := by | |
| rw [supportResponse_expectation fallbackI a _ ha] | |
| simp_rw [supportResponse_expectation fallbackJ b _ hb, Finset.sum_boole] | |
| unfold validAgreementProbability | |
| simp only [div_eq_mul_inv] | |
| rw [β Finset.sum_mul] | |
| ring | |
| theorem validAgreement_le_supportResponses (valid : J β Bool) (Ο : J β I) | |
| (fallbackI : I) (fallbackJ : J) (a : Cube I) (b : Cube J) : | |
| validAgreementProbability valid Ο a b β€ | |
| (supportResponse fallbackI a).expectation (fun i => | |
| (supportResponse fallbackJ b).expectation (fun j => | |
| if Ο j = i β§ valid j = true then 1 else 0)) := by | |
| by_cases ha : (support a).Nonempty | |
| Β· by_cases hb : (support b).Nonempty | |
| Β· exact le_of_eq (supportResponse_validAgreement valid Ο fallbackI fallbackJ a b ha hb).symm | |
| Β· have he : support b = β := Finset.not_nonempty_iff_eq_empty.mp hb | |
| simp only [validAgreementProbability, he, Finset.card_empty, Nat.cast_zero, | |
| mul_zero, div_zero] | |
| apply response_expectation_nonnegative | |
| intro i | |
| apply response_expectation_nonnegative | |
| intro j | |
| split_ifs <;> norm_num | |
| Β· have he : support a = β := Finset.not_nonempty_iff_eq_empty.mp ha | |
| simp only [validAgreementProbability, he, Finset.sum_empty, Finset.card_empty, | |
| Nat.cast_zero, zero_mul, div_zero] | |
| apply response_expectation_nonnegative | |
| intro i | |
| apply response_expectation_nonnegative | |
| intro j | |
| split_ifs <;> norm_num | |
| theorem validDecoderSuccess_le_response (valid : J β Bool) (Ο : J β I) | |
| (fallbackI : I) (fallbackJ : J) (A : Cube I β Bool) (B : Cube J β Bool) : | |
| validDecoderSuccess valid Ο A B β€ | |
| validResponseAgreement valid Ο fallbackI fallbackJ A B := by | |
| unfold validDecoderSuccess validResponseAgreement | |
| rw [FiniteDistribution.expectation_comm] | |
| rw [fourierResponse_expectation fallbackJ B] | |
| apply Finset.sum_le_sum | |
| intro b _ | |
| apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) | |
| rw [FiniteDistribution.expectation_comm] | |
| rw [fourierResponse_expectation fallbackI A] | |
| apply Finset.sum_le_sum | |
| intro a _ | |
| apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) | |
| exact validAgreement_le_supportResponses valid Ο fallbackI fallbackJ a b | |
| /-- Local soundness now bounds the success of two genuine normalized answer | |
| laws. No assumption about randomized decoding or its normalization remains. -/ | |
| theorem conditioned_folded_response_bound (Ξ΅ : β) (Ο : J β I) (valid : J β Bool) | |
| (iβ : I) (tableA : HalfCube iβ β Bool) | |
| (jβ : {j : J // valid j = true}) (tableB : HalfCube jβ β Bool) | |
| (hΞ΅ : 0 < Ξ΅) (hΞ΅' : Ξ΅ β€ 1 / 2) : | |
| 4 * Ξ΅ * testBias Ξ΅ Ο (fun f => bitSign (foldedAnswer iβ tableA f)) | |
| (fun g => bitSign (conditionedFoldedAnswer valid jβ tableB g)) ^ 2 β€ | |
| validResponseAgreement valid Ο iβ jβ.val (foldedAnswer iβ tableA) | |
| (conditionedFoldedAnswer valid jβ tableB) := | |
| (conditioned_folded_decoder_bound Ξ΅ Ο valid iβ tableA jβ tableB hΞ΅ hΞ΅').trans | |
| (validDecoderSuccess_le_response valid Ο iβ jβ.val _ _) | |
| end MaxCutGames.Foundations.Hastad | |
| end | |
| end OAI | |