Documentation

CslibFrontier.Foundations.BooleanAnalysis.DerandomizedBLR

The derandomized BLR test #

The derandomized Blum–Luby–Rubinfeld test with a distribution X on the cube queries a Boolean function f at a uniformly random x, at an independent y ∼ X, and at x + y, and accepts when (f x ^^ f y) = f (x + y); BitString.derandomizedBLRAcceptance X f is the probability that it accepts. With X uniform it is the BLR test (BitString.derandomizedBLRAcceptance_uniformOfFintype). When X is ε-biased and has small support, it uses far fewer random bits O'Donnell, Section 6.4.

Reading f as the function F x = (-1) ^ f x, the test accepts with probability 1/2 + 1/2 𝔼_{y ∼ X} [F(y) (F ∗ F)(y)] (BitString.derandomizedBLRAcceptance_eq_sum_mul_convolution). Linear functions, in particular parities, still pass with probability one (BitString.derandomizedBLRAcceptance_of_map_add).

Conversely, write the acceptance probability as 1/2 + θ/2. By Cauchy–Schwarz under X, θ² ≤ 𝔼_{y ∼ X} [(F ∗ F)(y)²]; since ‖(F ∗ F)^‖₁ = ∑_S F̂(S)² = 1, an ε-biased X fools (F ∗ F)² up to ε (BitString.IsSmallBias.fools_sq), and the uniform expectation of (F ∗ F)² is ∑_S F̂(S)⁴ ≤ max_S F̂(S)². Hence some S has θ² - ε ≤ F̂(S)² (BitString.exists_two_mul_derandomizedBLRAcceptance_sub_one_sq_sub_le_fourierCoeff_sq), so f has correlation at least √(θ² - ε) with χ_S or -χ_S, and is within relative distance 1/2 - 1/2 √(θ² - ε) of an affine function b ^^ parityOn S O'Donnell, Theorem 6.44. The affine function may be a negated parity: those are rejected with probability one, but a function that is false on the small support of X and true off it is accepted almost always and is close only to the constant true.

Main definitions #

Main results #

Usage #

Open Cslib.BitString. Functions are f : (ι → Bool) → Bool with ^^ and +, as in the BLR test of CslibFrontier.Foundations.BooleanAnalysis.Linearity, and the Fourier statements read f as the signs fun x => signVal (f x). The distribution is any X : PMF (ι → Bool); the soundness theorems assume IsSmallBias ε X (CslibFrontier.Probability.SmallBias) with 0 ≤ ε. Unfold the acceptance probability with derandomizedBLRAcceptance_def. The spectral form takes θ = 2 * derandomizedBLRAcceptance X f - 1, of either sign. The correlation and distance forms take any θ with |θ| ≤ |2 * derandomizedBLRAcceptance X f - 1|: the book's exact acceptance 1/2 + θ/2 of either sign, or acceptance at least 1/2 + θ/2 for 0 ≤ θ; Real.sqrt is 0 on nonpositive arguments, so they are vacuous, not false, when θ ^ 2 ≤ ε. The relative Hamming distance is (hammingDist f g : ℝ) / 2 ^ Fintype.card ι. The proof shares two steps with the affinity test (exists_sum_fourierCoeff_signVal_pow_four_le and exists_hammingDist_xor_parityOn_le_of_le_abs_fourierCoeff in CslibFrontier.Foundations.BooleanAnalysis.Affinity) and the BLR acceptance condition in signs, ite_xor_eq_eq_signVal in Linearity. The checked clients in CslibFrontierTests/BooleanAnalysisDerandomizedBLR.lean recover the BLR bounds from the uniform distribution and run the test with the powering small-bias space on a thousand bits from 40 seed bits (exists_isSmallBias_uniformOfFintype_map), where parities pass and acceptance 9/10 gives distance below 101/1000. They also show that the point mass at 0, which is 1-biased, accepts a conjunction with no Fourier coefficient above 1/2, so Theorem 6.44 proves that this point mass is not ε-biased for any ε < 3/4. The test is an expectation over the cube: it is not packaged as a PCP.LocalTest, its count of n + O(log(n/ε)) random bits is not stated, and the improvements of O'Donnell, Exercises 6.32 and 6.33 are not formalized.

References #

noncomputable def Cslib.BitString.derandomizedBLRAcceptance {ι : Type u_1} [Fintype ι] [DecidableEq ι] (X : PMF (ι → Bool)) (f : (ι → Bool) → Bool) :

The acceptance probability of the derandomized BLR test on f with distribution X: the probability, over a uniformly random x and an independent y ∼ X, that (f x ^^ f y) = f (x + y) O'Donnell, Section 6.4.

theorem Cslib.BitString.derandomizedBLRAcceptance_def {ι : Type u_1} [Fintype ι] [DecidableEq ι] (X : PMF (ι → Bool)) (f : (ι → Bool) → Bool) :
derandomizedBLRAcceptance X f = Finset.univ.expect fun (x : ι → Bool) => ∑ y : ι → Bool, (X y).toReal * if (f x ^^ f y) = f (x + y) then 1 else 0

The acceptance probability of the derandomized BLR test, unfolded.

theorem Cslib.BitString.derandomizedBLRAcceptance_eq_sum_mul_convolution {ι : Type u_1} [Fintype ι] [DecidableEq ι] (X : PMF (ι → Bool)) (f : (ι → Bool) → Bool) :
derandomizedBLRAcceptance X f = 1 / 2 + 1 / 2 * ∑ y : ι → Bool, (X y).toReal * (signVal (f y) * convolution (fun (x : ι → Bool) => signVal (f x)) (fun (x : ι → Bool) => signVal (f x)) y)

The acceptance probability of the derandomized BLR test: reading f as signs F, the test accepts with probability 1/2 + 1/2 𝔼_{y ∼ X} [F(y) (F ∗ F)(y)].

With the uniform distribution, the derandomized BLR test is the BLR test.

theorem Cslib.BitString.derandomizedBLRAcceptance_of_map_add {ι : Type u_1} [Fintype ι] [DecidableEq ι] (X : PMF (ι → Bool)) {f : (ι → Bool) → Bool} (hf : ∀ (x y : ι → Bool), f (x + y) = (f x ^^ f y)) :

Completeness of the derandomized BLR test: a linear function, one with f (x + y) = (f x ^^ f y), passes with probability one for every distribution X.

Completeness of the derandomized BLR test for parities.

theorem Cslib.BitString.exists_two_mul_derandomizedBLRAcceptance_sub_one_sq_sub_le_fourierCoeff_sq {ι : Type u_1} [Fintype ι] [DecidableEq ι] {ε : ℝ} (hε : 0 ≤ ε) {X : PMF (ι → Bool)} (hX : IsSmallBias ε X) (f : (ι → Bool) → Bool) :
∃ (S : Finset ι), (2 * derandomizedBLRAcceptance X f - 1) ^ 2 - ε ≤ fourierCoeff (fun (x : ι → Bool) => signVal (f x)) S ^ 2

Soundness of the derandomized BLR test, spectral form: if X is ε-biased and the test accepts f with probability 1/2 + θ/2, then θ² - ε ≤ F̂(S)² for some S, where F reads f as signs; this is the core of O'Donnell, Theorem 6.44. Here θ = 2 * derandomizedBLRAcceptance X f - 1, which may be negative: this is the only form that covers θ < 0, as the book's exact acceptance 1/2 + θ/2 allows.

theorem Cslib.BitString.exists_le_abs_fourierCoeff_of_le_derandomizedBLRAcceptance {ι : Type u_1} [Fintype ι] [DecidableEq ι] {ε θ : ℝ} (hε : 0 ≤ ε) {X : PMF (ι → Bool)} (hX : IsSmallBias ε X) {f : (ι → Bool) → Bool} (h : |θ| ≤ |2 * derandomizedBLRAcceptance X f - 1|) :
∃ (S : Finset ι), √(θ ^ 2 - ε) ≤ |fourierCoeff (fun (x : ι → Bool) => signVal (f x)) S|

Soundness of the derandomized BLR test, correlation form O'Donnell, Theorem 6.44: if X is ε-biased and the test accepts f with probability 1/2 + θ'/2 where |θ| ≤ |θ'|, then reading f as signs, some Fourier coefficient has √(θ² - ε) ≤ |F̂(S)|; that is, f has correlation at least √(θ² - ε) with χ_S or -χ_S. This is the book's headline statement, whose hypothesis is the case θ = θ', of either sign; acceptance at least 1/2 + θ/2 with θ ≥ 0 is the case 0 ≤ θ ≤ θ'. The bound is vacuous when θ² ≤ ε, where the square root is zero.

theorem Cslib.BitString.exists_hammingDist_xor_parityOn_le_of_le_derandomizedBLRAcceptance {ι : Type u_1} [Fintype ι] [DecidableEq ι] {ε θ : ℝ} (hε : 0 ≤ ε) {X : PMF (ι → Bool)} (hX : IsSmallBias ε X) {f : (ι → Bool) → Bool} (h : |θ| ≤ |2 * derandomizedBLRAcceptance X f - 1|) :
∃ (b : Bool) (S : Finset ι), ↑(hammingDist f fun (x : ι → Bool) => b ^^ parityOn S x) / 2 ^ Fintype.card ι ≤ 1 / 2 - 1 / 2 * √(θ ^ 2 - ε)

Soundness of the derandomized BLR test, distance form O'Donnell, Theorem 6.44: if X is ε-biased and the test accepts f with probability 1/2 + θ'/2 where |θ| ≤ |θ'|, then f differs from some affine function b ^^ parityOn S on at most a 1/2 - 1/2 √(θ² - ε) fraction of the inputs. This is the book's "i.e." restatement, the form that Remark 6.45 uses (exists_hammingDist_xor_parityOn_le_of_one_sub_le_derandomizedBLRAcceptance). The bound is vacuous when θ² ≤ ε, where the square root is zero.

theorem Cslib.BitString.exists_hammingDist_xor_parityOn_le_of_one_sub_le_derandomizedBLRAcceptance {ι : Type u_1} [Fintype ι] [DecidableEq ι] {ε δ : ℝ} (hε : 0 ≤ ε) {X : PMF (ι → Bool)} (hX : IsSmallBias ε X) {f : (ι → Bool) → Bool} (hδ : δ < 1 / 2) (h : 1 - δ ≤ derandomizedBLRAcceptance X f) :
∃ (b : Bool) (S : Finset ι), ↑(hammingDist f fun (x : ι → Bool) => b ^^ parityOn S x) / 2 ^ Fintype.card ι ≤ δ + ε / (2 * (1 - 2 * δ))

Acceptance near one gives a nearby affine function, a quantitative form of O'Donnell, Remark 6.45: if X is ε-biased and the test accepts f with probability at least 1 - δ, where δ < 1/2, then f differs from some affine function on at most a δ + ε / (2 (1 - 2δ)) fraction of the inputs. The explicit bound is not in the book; it follows from Theorem 6.44 with θ = 1 - 2δ and √(a² - ε) ≥ a - ε / a for a > 0. So f is nearly δ-close to an affine function when ε ≪ δ (1 - 2δ), as the remark says for ε ≪ δ with δ bounded away from 1/2.