Documentation

CslibFrontier.Foundations.BooleanAnalysis.HastadTest

The Odd BLR test and Håstad's test #

The Odd BLR test queries a Boolean function f at independent uniformly random strings x and y and at z = x + y + (b, …, b) for a uniformly random bit b, and accepts when f(x) + f(y) + f(z) = b (BitString.oddBlrAcceptance). Håstad's test with noise rate δ first flips each bit of z independently with probability δ / 2 (BitString.hastadAcceptance). Reading f as signs F, the test accepts with probability 1/2 + 1/2 ∑_{|S| odd} (1 - δ) ^ |S| F̂(S)³ (BitString.hastadAcceptance_eq_sum) O'Donnell, (7.4), and at δ = 0 this is the Odd BLR test O'Donnell, Proposition 7.46. With b fixed to false the Odd BLR test corresponds to the Blum–Luby–Rubinfeld test (BitString.blrAcceptance), which every parity passes with probability one, the constant false and parities on many coordinates included. The noise rate is a real parameter, so the tests are stated through their acceptance probabilities rather than as PCP.LocalTests, whose random strings are uniform.

The same noisy 3-bit linear test, run on folded Long Code tables across a Label Cover projection, is Cslib.PCP.Hastad in CslibFrontier.Computability.PCP.Approximation.Hastad, with its own Fourier expansion PCP.Hastad.linearCorr_eq_sum Håstad. That two-table setting is Håstad's NP-hardness proof; this module is the single-function dictator test of O'Donnell's Section 7.4, and a Foundations module cannot import it.

These tests use only 3-variable linear equations over F₂ as predicates. A parity on an odd number k of coordinates is accepted with probability 1/2 + 1/2 (1 - δ) ^ k, and one on an even number with probability 1/2 (BitString.hastadAcceptance_parityOn), so dictators are accepted with probability 1 - δ / 2 (BitString.hastadAcceptance_dictator).

Soundness concerns functions with values in [-1, 1] as well O'Donnell, Remark 7.38. On such a g, each query returns an independent random sign with mean the value of g, and Håstad's test accepts with probability BitString.hastadValue δ g, which is BitString.hastadAcceptance δ f at the signs of a Boolean f (BitString.hastadAcceptance_eq_hastadValue); (7.4) holds verbatim (BitString.hastadValue_eq_sum) O'Donnell, Exercise 7.22. For 0 ≤ ε ≤ δ ≤ 1, if every (1 - ε)-stable influence of g is at most ε, so that g has no (ε, ε)-notable coordinates, the test accepts with probability at most 1/2 + 1/2 √ε (BitString.hastadValue_le_of_stableInfluence_le, and for Boolean functions BitString.hastadAcceptance_le_of_stableInfluence_le), and for 0 ≤ δ ≤ 2 it accepts with probability at most one (BitString.hastadValue_le_one, BitString.hastadAcceptance_le_one). With λ(ε) = 1/2 √ε for ε ≤ δ and λ(ε) = 1/2 otherwise, these are the clauses of a (1/2, 1 - δ / 2)-Dictator-vs.-No-Notables test O'Donnell, Theorem 7.42. That definition takes the test as a Max-E3-Lin instance, a finite list of checks, so it is stated at a rational noise rate in CslibFrontier.Logics.Propositional.CSP.HastadTest (Logic.PL.CSP.isDictatorVsNoNotables_hastadTest, Logic.PL.CSP.exists_isDictatorVsNoNotables_e3Lin).

The book's bound 1/2 + 1/2 max_{|S| odd} F̂(S) for the Odd BLR test needs the maximum to be nonnegative (BitString.oddBlrAcceptance_le_of_fourierCoeff_le).

Usage #

Open Cslib.BitString. The tests take a Boolean function f : (ι → Bool) → Bool on a finite index type and read it as signs, fun x => signVal (f x), with signVal true = -1, so true is the book's -1. Each test is its acceptance probability, a real expectation over the cube. BitString.hastadAcceptance_zero turns a statement about Håstad's test at δ = 0 into one about the Odd BLR test. To compute an acceptance probability, rewrite with BitString.hastadAcceptance_eq_sum (or BitString.hastadValue_eq_sum) and the Fourier coefficients of the function, as BitString.hastadAcceptance_parityOn does for parities. The soundness bound takes hg : ∀ x, |g x| ≤ 1 and h : ∀ i, stableInfluence (1 - ε) i g ≤ ε, for 0 ≤ ε ≤ δ ≤ 1. Proposition 7.46's bound BitString.oddBlrAcceptance_le_of_fourierCoeff_le takes any M ≥ 0 above the odd coefficients. The checked clients in CslibFrontierTests/BooleanAnalysisHastadTest.lean compute dictators, constants, odd and even parities, (7.4) at a [-1, 1]-valued constant, soundness for a concrete constant and for a hypothetical f, and the NAND of two bits, which passes the Odd BLR test with probability 3/8 although its odd coefficients are -1/2, the counterexample to the bound with a negative maximum.

Main definitions #

Main results #

References #

noncomputable def Cslib.BitString.hastadAcceptance {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (f : (ι → Bool) → Bool) :

The acceptance probability of Håstad's test with noise rate δ on f: over independent uniformly random strings x and y, a uniformly random bit b, and a string z' that flips each bit of z = x + y + (b, …, b) independently with probability δ / 2, the probability that f(x) + f(y) + f(z') = b. It is a probability for 0 ≤ δ ≤ 2.

theorem Cslib.BitString.hastadAcceptance_def {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (f : (ι → Bool) → Bool) :
hastadAcceptance δ f = Finset.univ.expect fun (x : ι → Bool) => Finset.univ.expect fun (y : ι → Bool) => Finset.univ.expect fun (b : Bool) => noiseOp (1 - δ) (fun (z : ι → Bool) => if (f x ^^ f y ^^ f z) = b then 1 else 0) (x + y + fun (x : ι) => b)

The defining formula of hastadAcceptance.

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

The acceptance probability of the Odd BLR test on f: over independent uniformly random strings x and y and a uniformly random bit b, the probability that f(x) + f(y) + f(x + y + (b, …, b)) = b.

theorem Cslib.BitString.oddBlrAcceptance_def {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
oddBlrAcceptance f = Finset.univ.expect fun (x : ι → Bool) => Finset.univ.expect fun (y : ι → Bool) => Finset.univ.expect fun (b : Bool) => if (f x ^^ f y ^^ f (x + y + fun (x : ι) => b)) = b then 1 else 0

The defining formula of oddBlrAcceptance.

noncomputable def Cslib.BitString.hastadValue {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (g : (ι → Bool) → ℝ) :

The acceptance probability of Håstad's test with noise rate δ on a real function g, for g with values in [-1, 1] O'Donnell, Exercise 7.22: each query of g at w returns an independent random sign with mean g w, so that the check g(x) g(y) g(z') = b, with b read as a sign, passes with probability 1/2 + 1/2 b g(x) g(y) g(z'), the multilinear extension of the check. The strings x, y, the bit b and the noisy z' are drawn as in hastadAcceptance, which is the case of signs of a Boolean function (hastadAcceptance_eq_hastadValue).

theorem Cslib.BitString.hastadValue_def {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (g : (ι → Bool) → ℝ) :
hastadValue δ g = Finset.univ.expect fun (x : ι → Bool) => Finset.univ.expect fun (y : ι → Bool) => Finset.univ.expect fun (b : Bool) => noiseOp (1 - δ) (fun (z : ι → Bool) => 1 / 2 + 1 / 2 * (signVal b * g x * g y * g z)) (x + y + fun (x : ι) => b)

The defining formula of hastadValue.

theorem Cslib.BitString.hastadAcceptance_eq_hastadValue {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (f : (ι → Bool) → Bool) :
hastadAcceptance δ f = hastadValue δ fun (x : ι → Bool) => signVal (f x)

On a Boolean function read as signs, the acceptance probability of Håstad's test on real functions is that of the test on f.

Håstad's test without noise is the Odd BLR test.

theorem Cslib.BitString.hastadValue_eq_sum {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (g : (ι → Bool) → ℝ) :
hastadValue δ g = 1 / 2 + 1 / 2 * ∑ S : Finset ι with Odd S.card, (1 - δ) ^ S.card * fourierCoeff g S ^ 3

The acceptance probability of Håstad's test on real functions O'Donnell, (7.4) and Exercise 7.22: on a real function g the test accepts with probability 1/2 + 1/2 ∑_{|S| odd} (1 - δ) ^ |S| ĝ(S)³.

theorem Cslib.BitString.hastadAcceptance_eq_sum {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (f : (ι → Bool) → Bool) :
hastadAcceptance δ f = 1 / 2 + 1 / 2 * ∑ S : Finset ι with Odd S.card, (1 - δ) ^ S.card * fourierCoeff (fun (x : ι → Bool) => signVal (f x)) S ^ 3

The acceptance probability of Håstad's test O'Donnell, (7.4): reading f as signs, the test accepts with probability 1/2 + 1/2 ∑_{|S| odd} (1 - δ) ^ |S| F̂(S)³.

theorem Cslib.BitString.oddBlrAcceptance_eq_sum {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
oddBlrAcceptance f = 1 / 2 + 1 / 2 * ∑ S : Finset ι with Odd S.card, fourierCoeff (fun (x : ι → Bool) => signVal (f x)) S ^ 3

The acceptance probability of the Odd BLR test O'Donnell, Proposition 7.46: reading f as signs, the test accepts with probability 1/2 + 1/2 ∑_{|S| odd} F̂(S)³.

theorem Cslib.BitString.oddBlrAcceptance_le_of_fourierCoeff_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f : (ι → Bool) → Bool} {M : ℝ} (hM0 : 0 ≤ M) (hM : ∀ (S : Finset ι), Odd S.card → fourierCoeff (fun (x : ι → Bool) => signVal (f x)) S ≤ M) :
oddBlrAcceptance f ≤ 1 / 2 + 1 / 2 * M

The Odd BLR test accepts with probability at most 1/2 + 1/2 M for any nonnegative bound M on the odd Fourier coefficients O'Donnell, Proposition 7.46. The book states this for M = max_{|S| odd} F̂(S), which needs M ≥ 0: for the NAND of two bits both odd coefficients are -1/2, and the test accepts with probability 3/8.

theorem Cslib.BitString.hastadAcceptance_parityOn {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (S : Finset ι) :
hastadAcceptance δ (parityOn S) = if Odd S.card then 1 / 2 + 1 / 2 * (1 - δ) ^ S.card else 1 / 2

Håstad's test on parities: a parity on S is accepted with probability 1/2 + 1/2 (1 - δ) ^ |S| if |S| is odd, and 1/2 if |S| is even.

theorem Cslib.BitString.hastadAcceptance_dictator {ι : Type u_1} [Fintype ι] [DecidableEq ι] (δ : ℝ) (i : ι) :
(hastadAcceptance δ fun (x : ι → Bool) => x i) = 1 - δ / 2

Completeness of Håstad's test O'Donnell, Theorem 7.42: dictators are accepted with probability 1 - δ / 2.

theorem Cslib.BitString.hastadValue_le_of_stableInfluence_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {δ ε : ℝ} (hε : 0 ≤ ε) (hεδ : ε ≤ δ) (hδ : δ ≤ 1) {g : (ι → Bool) → ℝ} (hg : ∀ (x : ι → Bool), |g x| ≤ 1) (h : ∀ (i : ι), stableInfluence (1 - ε) i g ≤ ε) :
hastadValue δ g ≤ 1 / 2 + 1 / 2 * √ε

Soundness of Håstad's test on real functions O'Donnell, Theorem 7.42, (7.6) and Exercise 7.22: for 0 ≤ ε ≤ δ ≤ 1 and g with values in [-1, 1], if every (1 - ε)-stable influence of g is at most ε, so that g has no (ε, ε)-notable coordinates, then the test accepts with probability at most 1/2 + 1/2 √ε. Every odd S contains some coordinate i, so ((1 - δ) ^ |S| ĝ(S))² ≤ (1 - ε) ^ (|S| - 1) ĝ(S)² is at most Infᵢ^{(1 - ε)}[g] ≤ ε, and the odd weight of g is at most 𝔼 g² ≤ 1.

theorem Cslib.BitString.hastadAcceptance_le_of_stableInfluence_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {δ ε : ℝ} (hε : 0 ≤ ε) (hεδ : ε ≤ δ) (hδ : δ ≤ 1) {f : (ι → Bool) → Bool} (h : ∀ (i : ι), (stableInfluence (1 - ε) i fun (x : ι → Bool) => signVal (f x)) ≤ ε) :
hastadAcceptance δ f ≤ 1 / 2 + 1 / 2 * √ε

Soundness of Håstad's test O'Donnell, Theorem 7.42 and (7.6): for 0 ≤ ε ≤ δ ≤ 1, if every (1 - ε)-stable influence of f, read as signs, is at most ε, so that f has no (ε, ε)-notable coordinates, then the test accepts with probability at most 1/2 + 1/2 √ε. This is the Boolean case of hastadValue_le_of_stableInfluence_le.

theorem Cslib.BitString.hastadValue_le_one {ι : Type u_1} [Fintype ι] [DecidableEq ι] {δ : ℝ} (hδ0 : 0 ≤ δ) (hδ2 : δ ≤ 2) {g : (ι → Bool) → ℝ} (hg : ∀ (x : ι → Bool), |g x| ≤ 1) :

Håstad's test accepts real functions with values in [-1, 1] with probability at most one for 0 ≤ δ ≤ 2, where the noise is a probability distribution. This gives the soundness clause of Theorem 7.42 with λ(ε) = 1/2 for ε > δ O'Donnell, Theorem 7.42.

theorem Cslib.BitString.hastadAcceptance_le_one {ι : Type u_1} [Fintype ι] [DecidableEq ι] {δ : ℝ} (hδ0 : 0 ≤ δ) (hδ2 : δ ≤ 2) (f : (ι → Bool) → Bool) :

Håstad's test accepts with probability at most one for 0 ≤ δ ≤ 2, where the noise is a probability distribution. This gives the soundness clause of Theorem 7.42 with λ(ε) = 1/2 for ε > δ O'Donnell, Theorem 7.42.