Documentation

CslibFrontier.Logics.Propositional.CSP.HastadTest

Håstad's test as a Max-E3-Lin instance #

The predicates of Max-E3-Lin are the 3-variable linear equations x₁ + x₂ + x₃ = b over F₂ O'Donnell, Definition 7.22: the parity relations Logic.PL.CSP.paritySem of CslibFrontier.Logics.Propositional.CSP.Boolean, the relation symbol b holding when the XOR of the bits is b, at the arity Logic.PL.CSP.e3LinArity three. A check of Håstad's test is such an equation on the answers to three queries, so the test is a Max-E3-Lin instance on the strings O'Donnell, Section 7.3, p. 187. With every sign of a randomized assignment g of mean g w, an equation g(x) + g(y) + g(z) = b holds with probability 1/2 + 1/2 b g(x) g(y) g(z), b read as a sign (Logic.PL.CSP.satProb_paritySem).

The noise of Håstad's test, flipping each bit with probability δ / 2, is a finite uniform choice when the flip probability a / q is rational: bit i flips when an independent uniform digit m i ∈ Fin q is below a (BitString.expect_fin_lt_eq_bernoulliAverage). So for a ≤ q, Logic.PL.CSP.hastadTest a q n lists one check for each choice of x, y, b and m, and on every real g its value is Håstad's acceptance probability at noise rate 2 a / q (Logic.PL.CSP.expectedSatFraction_hastadTest), so that its value at a Boolean f is BitString.hastadAcceptance (2 a / q) f (Logic.PL.CSP.satFraction_hastadTest). The test realizes the noise at a rational rate, as the identification of testers with CSP instances requires; the book ignores irrational rates there O'Donnell, Section 7.3, p. 187.

By (7.4) for functions with values in [-1, 1] O'Donnell, Exercise 7.22, for 0 < a and 2 a < q this is a (1/2, 1 - a / q)-Dictator-vs.-No-Notables test using the Max-E3-Lin predicates (Logic.PL.CSP.isDictatorVsNoNotables_hastadTest). For every real 0 < δ < 1/2, a rational a / q ≤ δ then gives a (1/2, 1 - δ) test (Logic.PL.CSP.exists_isDictatorVsNoNotables_e3Lin) O'Donnell, Theorem 7.42. Through Theorem 7.40, which is not formalized, this gives UG-hardness of (1/2 + δ, 1 - δ)-approximating Max-E3-Lin O'Donnell, Corollary 7.44. The gap problem on linear systems over F₂ is Complexity.GapLin in CslibFrontier.Computability.PCP.Approximation.GapLin, NP-hard for one constant gap (Complexity.GapLin_npHard).

Usage #

Open Cslib.Logic.PL and Cslib.Logic.PL.CSP. Logic.PL.CSP.hastadTest a q n has 2 ^ (2 n + 1) q ^ n checks, one Logic.PL.CSP.hastadCheck a x y b m for each x, y, b and m (Logic.PL.CSP.mem_hastadTest); the checks are exposed, so a concrete check can be evaluated with decide. For its value on a concrete function, rewrite with Logic.PL.CSP.satFraction_hastadTest or Logic.PL.CSP.expectedSatFraction_hastadTest and use the lemmas of CslibFrontier.Foundations.BooleanAnalysis.HastadTest. The checked clients in CslibFrontierTests/BooleanAnalysisHastadTest.lean check Theorem 7.42 at flip probability 1/4 and at the irrational δ = 1/(2√2), the passing probability 3/4 of a dictator in hastadTest 1 4 5, membership and evaluation of concrete checks, and the value 1/2 of the constant 0, each query a fair coin. Run scripts/build.sh CslibFrontierTests.BooleanAnalysisHastadTest from the repository root to check them.

Main definitions #

Main results #

References #

The arity of the Max-E3-Lin predicates O'Donnell, Definition 7.22: three. With the parity relations paritySem, the relation symbol b at arity three is the equation x₁ + x₂ + x₃ = b over F₂ (paritySem_three).

theorem Cslib.Logic.PL.CSP.satProb_paritySem {V : Type u_1} (g : V → ℝ) (b : Bool) (u v w : V) :
Constraint.satProb paritySem g { rel := b, scope := [u, v, w] } = 1 / 2 + 1 / 2 * (BitString.signVal b * g u * g v * g w)

An equation at a randomized assignment: with independent signs of means g u, g v and g w, the equation u + v + w = b holds with probability 1/2 + 1/2 b g(u) g(v) g(w), b read as a sign.

def Cslib.Logic.PL.CSP.hastadCheck (a : ℕ) {n q : ℕ} (x y : Fin n → Bool) (b : Bool) (m : Fin n → Fin q) :

The check of Håstad's test for the outcome x, y, b, m, at flip probability a / q: query the strings x, y and z' = x + y + (b, …, b) + P, where the mask P flips bit i exactly when the digit m i ∈ Fin q is below a, and accept when the three answers sum to b in F₂.

noncomputable def Cslib.Logic.PL.CSP.hastadTest (a q n : ℕ) :
CSP Bool (Fin n → Bool)

Håstad's test on n bits at the rational flip probability a / q, as a Max-E3-Lin instance on the strings: one check hastadCheck a x y b m for each choice of strings x, y, a bit b and digits m : Fin n → Fin q, so that a uniformly random check is Håstad's test at noise rate 2 a / q O'Donnell, proof of Theorem 7.42.

theorem Cslib.Logic.PL.CSP.mem_hastadTest {a q n : ℕ} {c : Constraint Bool (Fin n → Bool)} :
c ∈ hastadTest a q n ↔ ∃ (x : Fin n → Bool) (y : Fin n → Bool) (b : Bool) (m : Fin n → Fin q), hastadCheck a x y b m = c

The checks of Håstad's test are the checks hastadCheck a x y b m.

The checks of Håstad's test are Max-E3-Lin equations.

theorem Cslib.Logic.PL.CSP.expectedSatFraction_hastadTest {a q : ℕ} (hq : 0 < q) (ha : a ≤ q) {n : ℕ} (g : (Fin n → Bool) → ℝ) :

The value of Håstad's test at a real function g is the acceptance probability of Håstad's test at noise rate 2 a / q, for a ≤ q.

theorem Cslib.Logic.PL.CSP.satFraction_hastadTest {a q : ℕ} (hq : 0 < q) (ha : a ≤ q) {n : ℕ} (f : (Fin n → Bool) → Bool) :

The value of Håstad's test at a Boolean function f is the acceptance probability hastadAcceptance (2 a / q) f of Håstad's test at noise rate 2 a / q, for a ≤ q.

theorem Cslib.Logic.PL.CSP.isDictatorVsNoNotables_hastadTest {a q : ℕ} (ha : 0 < a) (haq : 2 * a < q) :

Håstad's test is a Dictator-vs.-No-Notables test O'Donnell, Theorem 7.42 and Exercise 7.22: for 0 < a and 2 a < q, flipping each bit with probability a / q, it is a (1/2, 1 - a / q)-Dictator-vs.-No-Notables test using the Max-E3-Lin predicates, with error err(ε) = √ε / 2 for ε ≤ 2 a / q and 1/2 otherwise.

theorem Cslib.Logic.PL.CSP.exists_isDictatorVsNoNotables_e3Lin {δ : ℝ} (hδ : 0 < δ) (hδ1 : δ < 1 / 2) :
∃ (T : (n : ℕ) → CSP Bool (Fin n → Bool)), IsDictatorVsNoNotables e3LinArity paritySem (1 / 2) (1 - δ) T

Theorem 7.42 O'Donnell, Theorem 7.42 and Exercise 7.22: for every 0 < δ < 1/2 there is a (1/2, 1 - δ)-Dictator-vs.-No-Notables test using the Max-E3-Lin predicates, the 3-variable F₂-linear equations. It is Håstad's test flipping each bit with a probability 1 / q ≤ δ (hastadTest), whose completeness 1 - 1 / q is at least 1 - δ.