Documentation

CslibFrontier.Foundations.BooleanAnalysis.Majority

Majority maximizes the sum of the degree-one coefficients #

The degree-one Fourier coefficients of a real function f on the cube sum to its correlation with x₁ + ⋯ + xₙ, the sum of the signs of the bits (BitString.sum_fourierCoeff_singleton_eq_expect in BooleanAnalysis.LevelWeight) O'Donnell, equation (2.3). For a Boolean function read as signs F viewed as a two-candidate voting rule, this gives the expected number of voters who agree with the outcome, n / 2 + ½ ∑ᵢ F̂(i) (BitString.expect_card_agree) O'Donnell, Proposition 2.32.

Since F(x) (x₁ + ⋯ + xₙ) ≤ |x₁ + ⋯ + xₙ|, the sum ∑ᵢ F̂(i) is at most 𝔼 |x₁ + ⋯ + xₙ| (BitString.sum_fourierCoeff_singleton_signVal_le), with equality exactly for the majority functions, those with F(x) = sgn(x₁ + ⋯ + xₙ) wherever x₁ + ⋯ + xₙ ≠ 0, that is, F(x) (x₁ + ⋯ + xₙ) ≥ 0 everywhere (BitString.sum_fourierCoeff_singleton_signVal_eq_iff). So the majority functions are the unique maximizers of ∑ᵢ F̂(i) O'Donnell, Definition 2.1, Theorem 2.33 and its proof. The library's Cslib.majority n is a majority function for every n, breaking ties towards true, the book's -1 (BitString.signVal_majority_mul_sum_signVal_nonneg); for odd n it is the book's Majₙ. So it maximizes ∑ᵢ F̂(i) (BitString.sum_fourierCoeff_singleton_le_majority), uniquely for odd n (BitString.sum_fourierCoeff_singleton_eq_majority_iff). Applying BitString.sum_fourierCoeff_singleton_signVal_le to a Boolean function f and its negation shows that when all degree-one coefficients are equal, n W^1[f] ≤ (𝔼 |x₁ + ⋯ + xₙ|)² (BitString.card_mul_levelWeight_one_le_of_fourierCoeff_singleton_eq) O'Donnell, Section 2.5 and Exercise 2.24; the asymptotic bound W^1[f] ≤ 2/π + o_n(1) (Proposition 2.58) is in BooleanAnalysis.MajorityStability.

A monotone Boolean function has total influence ∑ᵢ F̂(i) (BitString.totalInfluence_eq_sum_fourierCoeff_singleton_of_monotone) O'Donnell, Proposition 2.31, so among monotone functions the majority has the largest total influence (BitString.totalInfluence_le_majority_of_monotone) O'Donnell, Theorem 2.33. The leading term of the asymptotic value I[Majₙ] = √(2/π) √n + O(n^{-1/2}) of the book's statement is BitString.tendsto_totalInfluence_majority_div_sqrt in BooleanAnalysis.MajorityInfluence; the error term is not formalized.

Main results #

References #

theorem Cslib.BitString.expect_card_agree {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
(Finset.univ.expect fun (x : ι → Bool) => ↑{i : ι | x i = f x}.card) = ↑(Fintype.card ι) / 2 + (∑ i : ι, fourierCoeff (fun (x : ι → Bool) => signVal (f x)) {i}) / 2

The expected number of voters agreeing with the outcome: for a Boolean function f as a two-candidate voting rule, the expected number of coordinates i with xᵢ = f(x) is n / 2 + ½ ∑ᵢ F̂(i) O'Donnell, Proposition 2.32.

theorem Cslib.BitString.sum_fourierCoeff_singleton_signVal_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
∑ i : ι, fourierCoeff (fun (x : ι → Bool) => signVal (f x)) {i} ≤ Finset.univ.expect fun (x : ι → Bool) => |∑ i : ι, signVal (x i)|

The degree-one Fourier coefficients of a Boolean function read as signs sum to at most 𝔼 |x₁ + ⋯ + xₙ| O'Donnell, proof of Theorem 2.33.

theorem Cslib.BitString.sum_fourierCoeff_singleton_signVal_eq_iff {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
(∑ i : ι, fourierCoeff (fun (x : ι → Bool) => signVal (f x)) {i} = Finset.univ.expect fun (x : ι → Bool) => |∑ i : ι, signVal (x i)|) ↔ ∀ (x : ι → Bool), 0 ≤ signVal (f x) * ∑ i : ι, signVal (x i)

The majority functions are the maximizers: the degree-one Fourier coefficients of a Boolean function read as signs sum to 𝔼 |x₁ + ⋯ + xₙ|, their maximum, exactly when it is a majority function, F(x) (x₁ + ⋯ + xₙ) ≥ 0 everywhere, that is, F(x) = sgn(x₁ + ⋯ + xₙ) wherever the sum is nonzero O'Donnell, Definition 2.1, Theorem 2.33 and its proof.

theorem Cslib.BitString.card_mul_levelWeight_one_le_of_fourierCoeff_singleton_eq {n : ℕ} (f : BooleanFunction n) (hf : ∀ (i j : Fin n), fourierCoeff (fun (x : Fin n → Bool) => signVal (f x)) {i} = fourierCoeff (fun (x : Fin n → Bool) => signVal (f x)) {j}) :
(↑n * levelWeight 1 fun (x : Fin n → Bool) => signVal (f x)) ≤ (Finset.univ.expect fun (x : Fin n → Bool) => |∑ i : Fin n, signVal (x i)|) ^ 2

Equal degree-one coefficients are at most majority's O'Donnell, Section 2.5 and Exercise 2.24: a Boolean function f on n bits, read as signs, whose degree-one Fourier coefficients are all equal has n W^1[f] ≤ E[|x₁ + ⋯ + xₙ|]². For odd n the right side is n W^1[Maj_n].

The majority is a majority function: for every n, the majority of n bits read as signs satisfies F(x) (x₁ + ⋯ + xₙ) ≥ 0; on a tie it is true, the book's -1 O'Donnell, Definition 2.1.

theorem Cslib.BitString.sum_fourierCoeff_singleton_majority (n : ℕ) :
∑ i : Fin n, fourierCoeff (fun (x : Fin n → Bool) => signVal (majority n x)) {i} = Finset.univ.expect fun (x : BitString n) => |∑ i : Fin n, signVal (x i)|

The degree-one Fourier coefficients of the majority of n bits, read as signs, sum to 𝔼 |x₁ + ⋯ + xₙ|.

theorem Cslib.BitString.sum_fourierCoeff_singleton_le_majority {n : ℕ} (f : BooleanFunction n) :
∑ i : Fin n, fourierCoeff (fun (x : Fin n → Bool) => signVal (f x)) {i} ≤ ∑ i : Fin n, fourierCoeff (fun (x : Fin n → Bool) => signVal (majority n x)) {i}

The majority maximizes the sum of the degree-one coefficients: every Boolean function of n bits, read as signs, has degree-one Fourier coefficients summing to at most those of the majority O'Donnell, Theorem 2.33.

theorem Cslib.BitString.sum_fourierCoeff_singleton_eq_majority_iff {n : ℕ} (hn : Odd n) (f : BooleanFunction n) :
∑ i : Fin n, fourierCoeff (fun (x : Fin n → Bool) => signVal (f x)) {i} = ∑ i : Fin n, fourierCoeff (fun (x : Fin n → Bool) => signVal (majority n x)) {i} ↔ f = majority n

For odd n the majority is the unique maximizer: a Boolean function of an odd number of bits, read as signs, has degree-one Fourier coefficients summing to those of the majority only if it is the majority O'Donnell, Theorem 2.33.

The majority has the largest total influence among monotone functions: a monotone Boolean function of n bits has total influence at most that of the majority, the inequality of O'Donnell, Theorem 2.33; the leading term of I[Majₙ] is in BooleanAnalysis.MajorityInfluence. For even n the comparison is with the majority breaking ties towards true, the book's -1.

theorem Cslib.majority_not (m : ℕ) (x : BitString (2 * m + 1)) :
(majority (2 * m + 1) fun (i : Fin (2 * m + 1)) => !x i) = !majority (2 * m + 1) x

On an odd number of bits, majority is self-dual: negating the input negates the output.