Documentation

CslibFrontier.Foundations.BooleanAnalysis.BiasedFourier

p-biased Fourier analysis #

Under the p-biased distribution each bit is true, read as -1, independently with probability p (BitString.bernoulliAverage). With μ = 1 - 2p and σ = 2 √(p (1 - p)) the mean and the standard deviation of a bit read as a sign, the biased basis function is φ(b) = (signVal b - μ) / σ (BitString.biasedBasis) O'Donnell, Definition 8.39, and the biased characters are φ_S(x) = ∏_{i ∈ S} φ(xᵢ) (BitString.biasedChi), with the biased Fourier coefficients f̂(S) = 𝔼_p[f φ_S] (BitString.biasedFourierCoeff) O'Donnell, Definition 8.40.

For 0 < p < 1 a bit's φ has mean 0 and second moment 1, so the biased characters are orthonormal under the p-biased distribution (BitString.bernoulliAverage_biasedChi_mul_biasedChi). The indicator of agreeing with y in one bit is π_p(yᵢ) (1 + φ(xᵢ) φ(yᵢ)), so the indicator of the point y is bernoulliWeight p y ∑_S φ_S(x) φ_S(y), with bernoulliWeight p y = ∏ᵢ π_p(yᵢ) the product mass at y, which gives the biased Fourier expansion f = ∑_S f̂(S) φ_S (BitString.sum_biasedFourierCoeff_mul_biasedChi) and Plancherel's identity 𝔼_p[f g] = ∑_S f̂(S) ĝ(S) (BitString.bernoulliAverage_mul_eq_sum_biasedFourierCoeff_mul). The coefficient on ∅ is the mean (BitString.biasedFourierCoeff_empty), so the covariance and the variance are the same sums over the nonempty sets (BitString.bernoulliAverage_sub_bernoulliAverage_mul_sub_bernoulliAverage_eq_sum, BitString.bernoulliAverage_sub_bernoulliAverage_sq_eq_sum_biasedFourierCoeff_sq); with Parseval these are the five formulas of O'Donnell, Proposition 8.16 for this basis. Conditioning on bit i (BitString.bernoulliAverage_eq_bernoulliAverage_update) pairs each string with its flip at i: for every p, 𝔼_p[f · (signVal (x i) - μ)] = 4p(1 - p) 𝔼_p[D_{x_i} f], with D_{x_i} the usual derivative BitString.derivative (BitString.bernoulliAverage_mul_signVal_sub), so for 0 < p < 1 the coefficient on {i} is σ 𝔼_p[D_{x_i} f] (BitString.biasedFourierCoeff_singleton), the step of the proof of O'Donnell, (8.8) that gives the Margulis–Russo Formula in the book's form (BitString.hasDerivAt_bernoulliAverage_one_sub_div_two of CslibFrontier.Foundations.BooleanAnalysis.MargulisRusso). A dictator xᵢ is μ + σ φ_{i}, so its coefficients are μ on ∅, σ on {i} and 0 elsewhere (BitString.biasedFourierCoeff_dictator) O'Donnell, Example 8.41.

The book writes ±1 bits with π_p(-1) = p; here true is the bit of probability p, which is -1 under signVal, so the book's φ(1) = √(p/q) and φ(-1) = -√(q/p) are BitString.biasedBasis_false and BitString.biasedBasis_true. Outside 0 < p < 1 the definitions still make sense, with σ = 0 and φ = 0; the basis facts take 0 < p < 1. The book proves orthonormality and completeness (Proposition 8.13) and the five formulas of Proposition 8.16 for every product Fourier basis of a finite product space; here they are proved for this two-point basis on bits only, and the expansion comes from the point-indicator identity rather than from a dimension count.

Usage #

Open Cslib.BitString. The p-biased expectation is bernoulliAverage p, the coefficient f̂(S) is biasedFourierCoeff p f S and φ_S(x) is biasedChi p S x. Pass hp : 0 < p and hp1 : p < 1 to the expansion, Parseval, Plancherel, the covariance and the variance, orthonormality, the dictator's coefficients and the degree-one formula; the mean biasedFourierCoeff_empty and the pairing identity bernoulliAverage_mul_signVal_sub hold for every p. To compute the biased coefficients of a function written in the usual characters, substitute signVal (x i) = μ + σ φ_{i} as in biasedFourierCoeff_dictator; at p = 1/2, biasedFourierCoeff_one_half and biasedChi_one_half return to fourierCoeff and chi.

Checked clients compute the basis at rates 1/4, 1/3 and 3/4, check orthonormality, the expansion and the coefficients of indicator bits and dictators, derive σ² = 1 - μ² from Parseval, the correlation μ² of two dictators from Plancherel, the variance σ² of a dictator and the zero covariance of two dictators, and return to the uniform case at p = 1/2, in CslibFrontierTests/BooleanAnalysisBiasedFourier.lean.

Main definitions #

Main results #

References #

noncomputable def Cslib.BitString.biasedStd (p : ℝ) :

The standard deviation σ = 2 √(p (1 - p)) of a p-biased bit read as a sign. Outside 0 < p < 1 it is 0, since √ of a nonpositive number is 0.

noncomputable def Cslib.BitString.biasedBasis (p : ℝ) (b : Bool) :

The p-biased basis function φ(b) = (signVal b - μ) / σ, with μ = 1 - 2p O'Donnell, Definition 8.39. Outside 0 < p < 1, where σ = 0, it is 0.

noncomputable def Cslib.BitString.biasedChi {ι : Type u_1} (p : ℝ) (S : Finset ι) (x : ι → Bool) :

The p-biased character φ_S(x) = ∏_{i ∈ S} φ(xᵢ) O'Donnell, Definition 8.40.

noncomputable def Cslib.BitString.biasedFourierCoeff {ι : Type u_1} [Fintype ι] [DecidableEq ι] (p : ℝ) (f : (ι → Bool) → ℝ) (S : Finset ι) :

The p-biased Fourier coefficient f̂(S) = 𝔼_p[f φ_S] O'Donnell, Definition 8.40.

theorem Cslib.BitString.biasedStd_sq {p : ℝ} (hp : 0 ≤ p) (hp1 : p ≤ 1) :
biasedStd p ^ 2 = 4 * (p * (1 - p))

The variance of a p-biased bit read as a sign: σ² = 4 p (1 - p).

theorem Cslib.BitString.biasedStd_pos {p : ℝ} (hp : 0 < p) (hp1 : p < 1) :

The standard deviation σ is positive for 0 < p < 1.

theorem Cslib.BitString.biasedStd_ne_zero {p : ℝ} (hp : 0 < p) (hp1 : p < 1) :

The standard deviation σ is nonzero for 0 < p < 1.

The basis function has mean zero under the p-biased distribution.

theorem Cslib.BitString.biasedBasis_sq_mean {p : ℝ} (hp : 0 < p) (hp1 : p < 1) :
(1 - p) * biasedBasis p false ^ 2 + p * biasedBasis p true ^ 2 = 1

The basis function has second moment one under the p-biased distribution.

theorem Cslib.BitString.biasedBasis_false {p : ℝ} (hp : 0 < p) (hp1 : p < 1) :
biasedBasis p false = √(p / (1 - p))

The basis function at false, the book's 1, is √(p / q) with q = 1 - p: the formula φ(1) = √(p/q) after O'Donnell, Definition 8.39.

Exchanging the rates p and 1 - p and complementing the bit negates the basis function: φ_{1-p}(¬b) = -φ_p(b).

theorem Cslib.BitString.biasedBasis_true {p : ℝ} (hp : 0 < p) (hp1 : p < 1) :
biasedBasis p true = -√((1 - p) / p)

The basis function at true, the book's -1, is -√(q / p) with q = 1 - p: the formula φ(-1) = -√(q/p) after O'Donnell, Definition 8.39.

theorem Cslib.BitString.biasedChi_one_half {ι : Type u_1} (S : Finset ι) (x : ι → Bool) :
biasedChi (1 / 2) S x = chi ℝ S x

At p = 1/2 the biased characters are the usual characters.

theorem Cslib.BitString.biasedFourierCoeff_one_half {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → ℝ) (S : Finset ι) :

At p = 1/2 the biased Fourier coefficients are the usual Fourier coefficients.

theorem Cslib.BitString.biasedChi_eq_prod_univ {ι : Type u_1} [Fintype ι] [DecidableEq ι] (p : ℝ) (S : Finset ι) (x : ι → Bool) :
biasedChi p S x = ∏ i : ι, if i ∈ S then biasedBasis p (x i) else 1

A biased character as a product over all coordinates.

@[simp]
theorem Cslib.BitString.biasedChi_empty {ι : Type u_1} (p : ℝ) (x : ι → Bool) :

The biased character of the empty set is the constant 1.

@[simp]

The biased Fourier coefficient on the empty set is the mean, the first formula of O'Donnell, Proposition 8.16; it holds for every p.

theorem Cslib.BitString.bernoulliAverage_biasedChi_mul_biasedChi {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (S T : Finset ι) :
(bernoulliAverage p fun (x : ι → Bool) => biasedChi p S x * biasedChi p T x) = if S = T then 1 else 0

The biased characters are orthonormal under the p-biased distribution, for 0 < p < 1: the orthonormality half of O'Donnell, Proposition 8.13 for bits.

theorem Cslib.BitString.bernoulliWeight_mul_sum_biasedChi_mul_biasedChi {ι : Type u_1} [Fintype ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (x y : ι → Bool) :
bernoulliWeight p y * ∑ S : Finset ι, biasedChi p S x * biasedChi p S y = if x = y then 1 else 0

The indicator of the point y is bernoulliWeight p y ∑_S φ_S(x) φ_S(y), where bernoulliWeight p y = ∏ᵢ π_p(yᵢ) is the product mass at y.

theorem Cslib.BitString.sum_biasedFourierCoeff_mul_biasedChi {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (f : (ι → Bool) → ℝ) (x : ι → Bool) :
∑ S : Finset ι, biasedFourierCoeff p f S * biasedChi p S x = f x

The biased Fourier expansion O'Donnell, Definition 8.40: for 0 < p < 1, f = ∑_S f̂(S) φ_S.

theorem Cslib.BitString.bernoulliAverage_mul_eq_sum_biasedFourierCoeff_mul {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (f g : (ι → Bool) → ℝ) :
(bernoulliAverage p fun (x : ι → Bool) => f x * g x) = ∑ S : Finset ι, biasedFourierCoeff p f S * biasedFourierCoeff p g S

Plancherel's identity for biased Fourier coefficients, for 0 < p < 1, one of the formulas of O'Donnell, Proposition 8.16.

theorem Cslib.BitString.bernoulliAverage_sq_eq_sum_biasedFourierCoeff_sq {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (f : (ι → Bool) → ℝ) :
(bernoulliAverage p fun (x : ι → Bool) => f x ^ 2) = ∑ S : Finset ι, biasedFourierCoeff p f S ^ 2

Parseval's identity for biased Fourier coefficients, for 0 < p < 1, one of the formulas of O'Donnell, Proposition 8.16.

theorem Cslib.BitString.bernoulliAverage_sub_bernoulliAverage_mul_sub_bernoulliAverage_eq_sum {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (f g : (ι → Bool) → ℝ) :
(bernoulliAverage p fun (x : ι → Bool) => (f x - bernoulliAverage p f) * (g x - bernoulliAverage p g)) = ∑ S : Finset ι with S ≠ ∅, biasedFourierCoeff p f S * biasedFourierCoeff p g S

The covariance is the sum of the products of the biased Fourier coefficients on the nonempty sets, for 0 < p < 1, one of the formulas of O'Donnell, Proposition 8.16.

theorem Cslib.BitString.bernoulliAverage_sub_bernoulliAverage_sq_eq_sum_biasedFourierCoeff_sq {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (f : (ι → Bool) → ℝ) :
(bernoulliAverage p fun (x : ι → Bool) => (f x - bernoulliAverage p f) ^ 2) = ∑ S : Finset ι with S ≠ ∅, biasedFourierCoeff p f S ^ 2

The variance is the biased Fourier weight on the nonempty sets, for 0 < p < 1, one of the formulas of O'Donnell, Proposition 8.16.

theorem Cslib.BitString.biasedFourierCoeff_dictator {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (i : ι) (S : Finset ι) :
biasedFourierCoeff p (fun (x : ι → Bool) => signVal (x i)) S = (if S = ∅ then 1 - 2 * p else 0) + if S = {i} then biasedStd p else 0

The biased Fourier coefficients of a dictator O'Donnell, Example 8.41: for 0 < p < 1, the dictator xᵢ, read as a sign, is μ + σ φ_{i}, so its coefficients are μ on ∅, σ on {i} and 0 elsewhere.

theorem Cslib.BitString.bernoulliAverage_mul_signVal_sub {ι : Type u_1} [Fintype ι] [DecidableEq ι] (h : (ι → Bool) → ℝ) (p : ℝ) (i : ι) :
(bernoulliAverage p fun (x : ι → Bool) => h x * (signVal (x i) - (1 - 2 * p))) = 4 * p * (1 - p) * bernoulliAverage p (derivative i h)

Pairing across bit i against the centered sign of bit i: with μ = 1 - 2p, the mean of signVal (x i), the p-biased expectation of h · (signVal (x i) - μ) is 4p(1 - p) times that of the derivative Dᵢ h, for every p. Since σ² = 4p(1 - p), this is the step 𝔼_p[D_{x_i} f] = σ⁻¹ f̂^{(p)}(i) of the book's proof of (8.8) (BitString.biasedFourierCoeff_singleton).

theorem Cslib.BitString.biasedFourierCoeff_singleton {ι : Type u_1} [Fintype ι] [DecidableEq ι] {p : ℝ} (hp : 0 < p) (hp1 : p < 1) (i : ι) (f : (ι → Bool) → ℝ) :

The step f̂(i) = σ 𝔼_p[D_{x_i} f] of the proof of O'Donnell, (8.8) (p. 225): for 0 < p < 1, a degree-one biased coefficient is σ times a mean derivative, where D_{x_i} f is the usual derivative BitString.derivative, so that σ D_{x_i} is the book's biased derivative Dᵢ of its Definition 8.44.