Affinity testing #
A Boolean function on the cube is affine when it is a parity plus a constant,
f x = b ^^ parityOn S x. Bit strings add coordinatewise modulo two (x + y, through Mathlib's
Boolean ring structure on Bool) and single bits by exclusive or (^^). The affine functions
are exactly those with f (x + y + z) = (f x ^^ f y ^^ f z) for all x, y, z
(BitString.exists_eq_xor_parityOn_iff), or equivalently with
f (x + y) = (f x ^^ f y ^^ f 0) for all x, y (BitString.exists_eq_xor_parityOn_iff_add)
O'Donnell, Exercise 1.29.
The affinity test queries f at independent uniformly random x, y and z and at
x + y + z, which is uniformly distributed as well (BitString.expect_expect_expect_add_add), and
accepts when (f x ^^ f y ^^ f z) = f (x + y + z); BitString.affinityAcceptance f is the
probability that it accepts. Reading f as the function F x = (-1) ^ f x, the four-point
correlation 𝔼 F(x) F(y) F(z) F(x + y + z) is ∑_S F̂(S)⁴
(BitString.expect_mul_mul_mul_eq_sum_fourierCoeff_pow_four), by the convolution theorem applied
twice, so the test accepts with probability 1/2 + 1/2 ∑_S F̂(S)⁴
(BitString.affinityAcceptance_eq_sum_fourierCoeff_pow_four). Affine functions pass with
probability one (BitString.affinityAcceptance_xor_parityOn). Conversely, a function passing with
probability at least 1 - ε differs from some affine function on at most an ε fraction of the
inputs (BitString.exists_hammingDist_xor_parityOn_le_of_le_affinityAcceptance): by Parseval's
identity, ∑_S F̂(S)⁴ ≤ max_S F̂(S)² ≤ max_S |F̂(S)|, and |F̂(S)| is one minus twice the
relative Hamming distance from f to the parity on S or to its negation
(BitString.fourierCoeff_signVal_eq_signVal_mul). This is the argument of the BLR test
(BitString.exists_hammingDist_parityOn_le_of_le_blrAcceptance) with fourth powers in place of
cubes, which is why it also finds negated parities.
The anchored affinity test reads f at uniformly random x and y, at x + y, and at the
fixed point 0, and accepts when (f x ^^ f y ^^ f 0) = f (x + y). It is the BLR test on
x ↦ f x ^^ f 0 (BitString.anchoredAffinityAcceptance_eq_blrAcceptance), so it has the same
completeness and soundness (BitString.anchoredAffinityAcceptance_xor_parityOn,
BitString.exists_hammingDist_xor_parityOn_le_of_le_anchoredAffinityAcceptance).
Main definitions #
Cslib.BitString.affinityAcceptance: the acceptance probability of the four-query affinity test with uniform queries.Cslib.BitString.anchoredAffinityAcceptance: the acceptance probability of the affinity test whose fourth query is the point0.
Main results #
Cslib.BitString.exists_eq_xor_parityOn_iff,Cslib.BitString.exists_eq_xor_parityOn_iff_add: characterizations of the affine functions.Cslib.BitString.expect_mul_mul_mul_eq_sum_fourierCoeff_pow_four: the four-point correlation in terms of the Fourier coefficients.Cslib.BitString.expect_expect_expect_add_add: the fourth queryx + y + zis uniform.Cslib.BitString.affinityAcceptance_eq_sum_fourierCoeff_pow_four: the acceptance probability in terms of the Fourier coefficients.Cslib.BitString.affinityAcceptance_xor_parityOn: completeness of the affinity test.Cslib.BitString.fourierCoeff_signVal_eq_signVal_mul: the Fourier coefficients measure the distance to the affine functions.Cslib.BitString.exists_sum_fourierCoeff_signVal_pow_four_le: the fourth spectral moment is at most the largest squared coefficient.Cslib.BitString.exists_hammingDist_xor_parityOn_le_of_le_abs_fourierCoeff: a large coefficient gives a nearby affine function.Cslib.BitString.exists_hammingDist_xor_parityOn_le_of_le_affinityAcceptance: soundness of the affinity test.Cslib.BitString.anchoredAffinityAcceptance_eq_blrAcceptance,Cslib.BitString.anchoredAffinityAcceptance_xor_parityOn,Cslib.BitString.exists_hammingDist_xor_parityOn_le_of_le_anchoredAffinityAcceptance: the anchored test is the BLR test on a shifted function, with completeness and soundness.
References #
Affine functions #
The affine Boolean functions, through a fixed point: a Boolean function satisfies
f (x + y) = (f x ^^ f y ^^ f 0) exactly when it is a parity plus a constant
O'Donnell, Exercise 1.29(d).
The affine Boolean functions: a Boolean function satisfies
f (x + y + z) = (f x ^^ f y ^^ f z) exactly when it is a parity plus a constant
O'Donnell, Exercise 1.29(a).
The four-point correlation #
The four-point correlation: for independent uniformly random x, y and z,
𝔼 F(x) F(y) F(z) F(x + y + z) = ∑_S F̂(S)⁴ O'Donnell, Exercise 1.29(b).
The fourth query x + y + z of the affinity test is uniformly distributed.
The affinity test #
The acceptance probability of the affinity test on f: the probability, over independent
uniformly random bit strings x, y and z, that (f x ^^ f y ^^ f z) = f (x + y + z). Each of
the four queries is uniformly distributed (expect_expect_expect_add_add).
The acceptance probability of the affinity test: reading f as signs, the test accepts
with probability 1/2 + 1/2 ∑_S F̂(S)⁴.
Completeness of the affinity test: affine functions pass with probability one O'Donnell, Exercise 1.29(c).
The Fourier coefficient on S of a Boolean function read as signs is ±1 times one minus
twice the relative Hamming distance from the function to the affine function b ^^ parityOn S,
with sign (-1) ^ b.
The fourth spectral moment of a Boolean function is at most its largest squared
coefficient: reading f as signs, some S has ∑_T F̂(T)⁴ ≤ F̂(S)², since
∑_T F̂(T)⁴ ≤ max_S F̂(S)² ∑_T F̂(T)² and the squares sum to one by Parseval's identity.
A large Fourier coefficient gives a nearby affine function: if t ≤ |F̂(S)| for the
Boolean function f read as signs, then f differs from b ^^ parityOn S on at most a
1/2 - t/2 fraction of the inputs for some bit b, namely b = true exactly when
F̂(S) < 0.
Soundness of the affinity test: if the test accepts f with probability at least
1 - ε, then f differs from some affine function on at most an ε fraction of the inputs
O'Donnell, Exercise 1.29(c).
The anchored affinity test #
The acceptance probability of the anchored affinity test on f: the probability, over
independent uniformly random bit strings x and y, that (f x ^^ f y ^^ f 0) = f (x + y).
Three of the four queries are uniformly distributed and the fourth is the point 0.
The anchored affinity test on f is the BLR test on x ↦ f x ^^ f 0.
Completeness of the anchored affinity test: affine functions pass with probability one O'Donnell, Exercise 1.29(d).
Soundness of the anchored affinity test: if the test accepts f with probability at
least 1 - ε, then f differs from some affine function on at most an ε fraction of the inputs
O'Donnell, Exercise 1.29(d).