Documentation

CslibFrontier.Foundations.BooleanAnalysis.MajorityFourier

The Fourier coefficients of majority #

The majority of an odd number n = 2 m + 1 of bits, read as signs, has Fourier coefficient 0 on every set of even size, and on a set of odd size k = 2 j + 1 the coefficient (-1) ^ j C(m, j) / C(2 m, 2 j) · C(2 m, m) / 4 ^ m (BitString.fourierCoeff_signVal_majority_of_even, BitString.fourierCoeff_signVal_majority_of_card_eq) O'Donnell, Theorem 5.19. In the book's notation this is (-1) ^ ((k - 1) / 2) C((n - 1) / 2, (k - 1) / 2) / C(n - 1, k - 1) · 2 / 2 ^ n · C(n - 1, (n - 1) / 2).

The even coefficients vanish because majority is odd (BitString.isOdd_majority): it has no ties (majority_eq_strictMajority in Data.BitString.Threshold). For the odd ones, the derivative of majority in a coordinate i is the indicator that the other 2 m bits tie (BitString.derivative_signVal_majority), so the coefficient on S ∋ i is the coefficient of that indicator on S \ {i}. A function of the weight has the same coefficient on all sets of a given size (BitString.fourierCoeff_eq_of_card_eq), so it suffices to sum the coefficients over all 2 j-subsets T of the other coordinates. At a string with m true and m false bits among the other 2 m coordinates, the characters of these sets sum to the coefficient of X ^ (2 m - 2 j) in (X - 1) ^ m (X + 1) ^ m = (X ^ 2 - 1) ^ m by Vieta's formula, which is (-1) ^ j C(m, j); such strings have density C(2 m, m) / 4 ^ m (BitString.expect_ite_card_filter_eq in Data.BitString.AgreeExpect). The book instead compares two expansions of the noise operator applied to the tie indicator.

For an even number 2 m of bits, ties are accepted by majority. Pairing each string with its complement shows that the constant Fourier coefficient is -C(2 m, m) / 4 ^ m (BitString.fourierCoeff_signVal_majority_two_mul_empty).

From the explicit formula, no coefficient exceeds the one on a singleton, C(2 m, m) / 4 ^ m, since C(m, j) ≤ C(2 m, 2 j), and up to size m the coefficients decrease in size, by the ratio |S| / (2 m - |S|) from |S| to |S| + 2 (BitString.fourierCoeff_signVal_majority_singleton, BitString.abs_fourierCoeff_signVal_majority_le_singleton, BitString.abs_fourierCoeff_signVal_majority_le_of_card_le) O'Donnell, Exercise 5.21. The exercise's asymptotic C(2 m, m) / 4 ^ m ∼ √(2 / (n π)) is, squared, the degree-one case W^1[Maj_n] → 2 / π of BitString.tendsto_levelWeight_signVal_majority. The coefficients on sets S, T with |S| + |T| = n + 1 agree up to the sign (-1) ^ ((n - 1) / 2), so (n - k + 1) W^{n-k+1} = k W^k (BitString.fourierCoeff_signVal_majority_of_card_add_card, BitString.card_mul_levelWeight_signVal_majority) O'Donnell, Corollary 5.20. The weight W^k on each odd level k strictly decreases as n grows (BitString.levelWeight_signVal_majority_succ_lt) O'Donnell, Corollary 5.21. Hence the noise stability Stab_ρ[Maj_n] = ∑_k ρ ^ k W^k strictly decreases from n to n + 2 for 0 < ρ < 1 (BitString.noiseStability_signVal_majority_succ_lt): the weight lost on the levels up to n moves to the new top level n + 2, where ρ ^ k is smaller O'Donnell, Theorem 5.18. The limits of the level weights and of the noise stability (Theorems 5.22 and 2.45) and the bounds of Theorem 5.18 are in CslibFrontier.Foundations.BooleanAnalysis.MajorityStability.

Usage #

Majority of n = 2 m + 1 bits read as signs is fun x => signVal (majority (2 * m + 1) x) on Fin (2 * m + 1) → Bool, the book's Maj_n with true read as −1; the statements write odd set sizes as 2 * j + 1. On a concrete set, discharge the size hypothesis of BitString.fourierCoeff_signVal_majority_of_card_eq by decide or simp and evaluate the right side with norm_num [Nat.choose]. Level weights are levelWeight k f from BooleanAnalysis.LevelWeight, and BitString.noiseStability_eq_sum_levelWeight there turns noise stability into a sum over levels. Import BooleanAnalysis.TransitiveSymmetric as well to use BitString.fourierCoeff_eq_of_card_eq, which this module imports privately. The checked clients in CslibFrontierTests/BooleanAnalysisMajorityFourier.lean compute the coefficients of majority of three and five bits, check two of them by brute force, check each step of the proof on small cases, compare the level weights and noise stability of majority of three and five bits, and follow the size of the coefficients of majority of seven bits across the levels.

Main results #

References #

Majority of an odd number of bits is odd: complementing the input complements the output.

theorem Cslib.BitString.fourierCoeff_signVal_majority_two_mul_empty (m : ℕ) :
fourierCoeff (fun (x : Fin (2 * m) → Bool) => signVal (majority (2 * m) x)) ∅ = -(↑((2 * m).choose m) / 4 ^ m)

The constant Fourier coefficient of majority on 2 m bits is the negative probability of a tie: complementary inputs cancel except when both have weight m, where both are accepted.

theorem Cslib.BitString.derivative_signVal_majority (m : ℕ) (i : Fin (2 * m + 1)) (x : Fin (2 * m + 1) → Bool) :
derivative i (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) x = if {l ∈ Finset.univ.erase i | x l = true}.card = m then 1 else 0

The derivative of majority in i, read as signs, is the indicator that exactly half of the other 2 m bits are true, that is, that i is pivotal O'Donnell, proof of Theorem 5.19.

theorem Cslib.BitString.fourierCoeff_signVal_majority_of_even (m : ℕ) {S : Finset (Fin (2 * m + 1))} (hS : Even S.card) :
fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) S = 0

The even Fourier coefficients of majority vanish O'Donnell, Theorem 5.19: majority of an odd number of bits, read as signs, is odd.

theorem Cslib.BitString.fourierCoeff_signVal_majority_of_card_eq (m j : ℕ) {S : Finset (Fin (2 * m + 1))} (hS : S.card = 2 * j + 1) :
fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) S = (-1) ^ j * ↑(m.choose j) / ↑((2 * m).choose (2 * j)) * (↑((2 * m).choose m) / 4 ^ m)

The odd Fourier coefficients of majority O'Donnell, Theorem 5.19: for majority of 2 m + 1 bits read as signs, the coefficient on a set of size 2 j + 1 is (-1) ^ j C(m, j) / C(2 m, 2 j) · C(2 m, m) / 4 ^ m.

Levels of majority #

theorem Cslib.BitString.levelWeight_signVal_majority_of_odd (m j : ℕ) :
(levelWeight (2 * j + 1) fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) = ↑((2 * m + 1).choose (2 * j + 1)) * (↑(m.choose j) / ↑((2 * m).choose (2 * j)) * (↑((2 * m).choose m) / 4 ^ m)) ^ 2

The level weights of majority: the Fourier weight W^{2 j + 1} of majority of 2 m + 1 bits, read as signs, is C(2 m + 1, 2 j + 1) times the square of the coefficient on a set of size 2 j + 1.

theorem Cslib.BitString.levelWeight_signVal_majority_of_even (m : ℕ) {k : ℕ} (hk : Even k) :
(levelWeight k fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) = 0

Majority has no Fourier weight on the levels of even size.

theorem Cslib.BitString.fourierCoeff_signVal_majority_singleton (m : ℕ) (i : Fin (2 * m + 1)) :
fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) {i} = ↑((2 * m).choose m) / 4 ^ m

The Fourier coefficient of majority of 2 m + 1 bits, read as signs, on a singleton is C(2 m, m) / 4 ^ m.

theorem Cslib.BitString.abs_fourierCoeff_signVal_majority_le_singleton (m : ℕ) (S : Finset (Fin (2 * m + 1))) (i : Fin (2 * m + 1)) :
|fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) S| ≤ fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) {i}

The largest Fourier coefficients of majority are on singletons O'Donnell, Exercise 5.21: ‖Maĵ‖_∞ = Maĵ({i}). Every coefficient of majority of 2 m + 1 bits, read as signs, is at most the coefficient C(2 m, m) / 4 ^ m on a singleton in absolute value, since C(m, j) ≤ C(2 m, 2 j). The exercise's asymptotic √(2 / (n π)) is not formalized.

theorem Cslib.BitString.abs_fourierCoeff_signVal_majority_le_of_card_le (m : ℕ) {S T : Finset (Fin (2 * m + 1))} (hS : Odd S.card) (hT : Odd T.card) (hST : S.card ≤ T.card) (hTm : T.card ≤ m + 2) :
|fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) T| ≤ |fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) S|

The Fourier coefficients of majority decrease in size O'Donnell, Exercise 5.21: for majority of 2 m + 1 bits and sets S, T of odd sizes |S| ≤ |T| ≤ m + 2, the coefficient on T is at most the one on S in absolute value. Each step from |S| to |S| + 2 multiplies the size by |S| / (2 m - |S|), so the book's range |T| ≤ m extends to m + 2, with equality at the last step from m.

theorem Cslib.BitString.fourierCoeff_signVal_majority_of_card_add_card (m : ℕ) {S T : Finset (Fin (2 * m + 1))} (h : S.card + T.card = 2 * m + 2) :
fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) T = (-1) ^ m * fourierCoeff (fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) S

Complementary levels of majority O'Donnell, Corollary 5.20: for majority of n = 2 m + 1 bits read as signs, the coefficients on sets S, T with |S| + |T| = n + 1 agree up to the sign (-1) ^ m = (-1) ^ ((n - 1) / 2).

theorem Cslib.BitString.card_mul_levelWeight_signVal_majority (m j : ℕ) (hj : j ≤ m) :
(↑(2 * (m - j) + 1) * levelWeight (2 * (m - j) + 1) fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)) = ↑(2 * j + 1) * levelWeight (2 * j + 1) fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)

Complementary level weights of majority O'Donnell, Corollary 5.20: for majority of n = 2 m + 1 bits and k = 2 j + 1, (n - k + 1) W^{n-k+1} = k W^k. The book's W^{n-k+1} = k / (n - k + 1) W^k is stated multiplied out, and only for odd k: for even k both levels are even and both sides vanish by BitString.levelWeight_signVal_majority_of_even.

theorem Cslib.BitString.levelWeight_signVal_majority_succ_lt (m j : ℕ) (hj : j ≤ m) :
(levelWeight (2 * j + 1) fun (x : Fin (2 * (m + 1) + 1) → Bool) => signVal (majority (2 * (m + 1) + 1) x)) < levelWeight (2 * j + 1) fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)

The level weights of majority decrease O'Donnell, Corollary 5.21: for odd k = 2 j + 1 ≤ n = 2 m + 1, the weight of majority on level k is strictly smaller on n + 2 bits than on n bits. Their ratio is (2 m + 3) (2 m + 1 - 2 j) / ((2 m + 2 - 2 j) (2 m + 2)) < 1.

theorem Cslib.BitString.noiseStability_signVal_majority_succ_lt (m : ℕ) {ρ : ℝ} (h0 : 0 < ρ) (h1 : ρ < 1) :
(noiseStability ρ fun (x : Fin (2 * (m + 1) + 1) → Bool) => signVal (majority (2 * (m + 1) + 1) x)) < noiseStability ρ fun (x : Fin (2 * m + 1) → Bool) => signVal (majority (2 * m + 1) x)

The noise stability of majority decreases in n O'Donnell, Theorem 5.18: for 0 < ρ < 1, Stab_ρ[Maj_n] is strictly smaller on n + 2 = 2 m + 3 bits than on n = 2 m + 1 bits. At the endpoints the two agree: both are 0 at ρ = 0 (majority is unbiased) and 1 at ρ = 1. The bounds of Theorem 5.18 by (2 / π) arcsin ρ are BitString.le_noiseStability_signVal_majority and BitString.noiseStability_signVal_majority_le. The levels up to n lose weight, which the new top level n + 2 gains, and ρ ^ k ≥ ρ ^ n > ρ ^ (n + 2) there.