Documentation

CslibFrontier.Foundations.BooleanAnalysis.LevelWeight

Fourier weight by degree #

The degree-k part of a real function f on the cube is f^{=k} = ∑_{|S| = k} f̂(S) χ_S (BitString.levelPart), and its Fourier weight at degree k is W^k[f] = ∑_{|S| = k} f̂(S) ^ 2 (BitString.levelWeight) O'Donnell, Definition 1.19. The degree-k part keeps exactly the Fourier coefficients on the sets of size k (BitString.fourierCoeff_levelPart), has degree at most k (BitString.levelPart_mem_lowDegree), and the parts sum to f (BitString.sum_levelPart). The parts of different degrees are orthogonal, and the part of degree k has squared norm W^k[f] (BitString.expect_levelPart_mul_levelPart) O'Donnell, Exercise 1.18, so the weights sum to 𝔼 f ^ 2 (BitString.sum_levelWeight), and the noise stability is Stab_ρ[f] = ∑_k ρ ^ k W^k[f] (BitString.noiseStability_eq_sum_levelWeight) O'Donnell, Theorem 2.49. The weight at degree zero is the squared mean (BitString.levelWeight_zero), the weight at degree one is ∑ᵢ f̂({i}) ^ 2 (BitString.levelWeight_one), and the weights above a level t are the Fourier weight ∑_{t < |S|} f̂(S) ^ 2 that the library uses for spectral concentration (BitString.sum_levelWeight_Ioc). The degree-one coefficients themselves sum to the correlation 𝔼_x f(x) (x₁ + ⋯ + xₙ) with the sum of the signs (BitString.sum_fourierCoeff_singleton_eq_expect) O'Donnell, equation (2.3). For a function invariant under permutations of the n coordinates the degree-one coefficients are all equal, so W^1[f] · n = (𝔼_x f(x) ∑ᵢ xᵢ)² (BitString.levelWeight_one_mul_card_of_comp_perm), or W^1[f] = (𝔼_x f(x) ∑ᵢ xᵢ / √n)² (BitString.levelWeight_one_eq_sq_expect_mul_of_comp_perm) O'Donnell, Exercise 5.30.

Main definitions #

Main results #

References #

noncomputable def Cslib.BitString.levelPart {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (f : (ι → Bool) → ℝ) (x : ι → Bool) :

The degree-k part f^{=k} = ∑_{|S| = k} f̂(S) χ_S of a real function on the cube O'Donnell, Definition 1.19.

noncomputable def Cslib.BitString.levelWeight {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (f : (ι → Bool) → ℝ) :

The Fourier weight W^k[f] = ∑_{|S| = k} f̂(S) ^ 2 of a real function at degree k O'Donnell, Definition 1.19.

theorem Cslib.BitString.levelPart_eq_sum_ite {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (f : (ι → Bool) → ℝ) (x : ι → Bool) :
levelPart k f x = ∑ S : Finset ι, (if S.card = k then fourierCoeff f S else 0) * chi ℝ S x

The degree-k part as a combination of all the characters, with weight zero off size k.

@[simp]
theorem Cslib.BitString.fourierCoeff_levelPart {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (f : (ι → Bool) → ℝ) (S : Finset ι) :

The degree-k part keeps the Fourier coefficients on the sets of size k and no others.

theorem Cslib.BitString.levelPart_mem_lowDegree {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (f : (ι → Bool) → ℝ) :

The degree-k part has degree at most k.

theorem Cslib.BitString.sum_levelPart {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → ℝ) (x : ι → Bool) :
∑ k ∈ Finset.range (Fintype.card ι + 1), levelPart k f x = f x

A function is the sum of its parts of each degree.

theorem Cslib.BitString.expect_levelPart_mul_levelPart {ι : Type u_1} [Fintype ι] [DecidableEq ι] (j k : ℕ) (f : (ι → Bool) → ℝ) :
(Finset.univ.expect fun (x : ι → Bool) => levelPart j f x * levelPart k f x) = if j = k then levelWeight k f else 0

The parts of different degrees are orthogonal, and the part of degree k has squared norm W^k[f] O'Donnell, Exercise 1.18.

theorem Cslib.BitString.expect_levelPart_sq {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (f : (ι → Bool) → ℝ) :
(Finset.univ.expect fun (x : ι → Bool) => levelPart k f x ^ 2) = levelWeight k f

The part of degree k has squared norm W^k[f].

theorem Cslib.BitString.levelWeight_nonneg {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (f : (ι → Bool) → ℝ) :

The Fourier weight at each degree is nonnegative.

theorem Cslib.BitString.levelWeight_eq_zero_of_card_lt {ι : Type u_1} [Fintype ι] [DecidableEq ι] {k : ℕ} (hk : Fintype.card ι < k) (f : (ι → Bool) → ℝ) :

There is no Fourier weight above the number of coordinates.

theorem Cslib.BitString.sum_levelWeight {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → ℝ) :
∑ k ∈ Finset.range (Fintype.card ι + 1), levelWeight k f = Finset.univ.expect fun (x : ι → Bool) => f x ^ 2

Parseval's identity by degree: the Fourier weights sum to 𝔼 f ^ 2.

theorem Cslib.BitString.sum_levelWeight_signVal {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
(∑ k ∈ Finset.range (Fintype.card ι + 1), levelWeight k fun (x : ι → Bool) => signVal (f x)) = 1

The Fourier weights of a Boolean function read as signs sum to one.

theorem Cslib.BitString.noiseStability_eq_sum_levelWeight {ι : Type u_1} [Fintype ι] [DecidableEq ι] (ρ : ℝ) (f : (ι → Bool) → ℝ) :
noiseStability ρ f = ∑ k ∈ Finset.range (Fintype.card ι + 1), ρ ^ k * levelWeight k f

The Fourier formula for the noise stability by degree: Stab_ρ[f] = ∑_k ρ ^ k W^k[f] O'Donnell, Theorem 2.49.

theorem Cslib.BitString.levelWeight_zero {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → ℝ) :
levelWeight 0 f = (Finset.univ.expect fun (x : ι → Bool) => f x) ^ 2

The Fourier weight at degree zero is the squared mean.

theorem Cslib.BitString.levelWeight_one {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → ℝ) :
levelWeight 1 f = ∑ i : ι, fourierCoeff f {i} ^ 2

The Fourier weight at degree one is the sum of the squared degree-one coefficients, W^1[f] = ∑ᵢ f̂({i}) ^ 2.

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

The degree-one coefficients and the vote count: the degree-one Fourier coefficients of f sum to its correlation with the sum of the signs of the bits O'Donnell, equation (2.3).

theorem Cslib.BitString.sum_levelWeight_Ioc {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → ℝ) (t : ℕ) :
∑ k ∈ Finset.Ioc t (Fintype.card ι), levelWeight k f = ∑ S : Finset ι with t < S.card, fourierCoeff f S ^ 2

The Fourier weights above level t are the Fourier weight on the sets of more than t coordinates.

Degree-one weight of symmetric functions #

theorem Cslib.BitString.fourierCoeff_singleton_eq_of_comp_swap {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f : (ι → Bool) → ℝ} {i j : ι} (hf : ∀ (x : ι → Bool), f (x ∘ ⇑(Equiv.swap i j)) = f x) :

If f is unchanged when coordinates i and j are swapped, its degree-one Fourier coefficients at i and j agree.

theorem Cslib.BitString.levelWeight_one_mul_card_of_comp_perm {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f : (ι → Bool) → ℝ} (hf : ∀ (σ : Equiv.Perm ι) (x : ι → Bool), f (x ∘ ⇑σ) = f x) :
levelWeight 1 f * ↑(Fintype.card ι) = (Finset.univ.expect fun (x : ι → Bool) => f x * ∑ i : ι, signVal (x i)) ^ 2

Degree-one weight of a symmetric function. If f is invariant under permutations of the coordinates, all its degree-one coefficients are equal, so W^1[f] · n = (∑ᵢ f̂({i}))² = (𝔼_x f(x) ∑ᵢ xᵢ)², where xᵢ = signVal (x i) and n is the number of coordinates O'Donnell, Exercise 5.30.

theorem Cslib.BitString.levelWeight_one_eq_sq_expect_mul_of_comp_perm {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f : (ι → Bool) → ℝ} (hf : ∀ (σ : Equiv.Perm ι) (x : ι → Bool), f (x ∘ ⇑σ) = f x) :
levelWeight 1 f = (Finset.univ.expect fun (x : ι → Bool) => f x * ((√↑(Fintype.card ι))⁻¹ * ∑ i : ι, signVal (x i))) ^ 2

Degree-one weight of a symmetric function, normalized: for f invariant under permutations of the n coordinates, W^1[f] = (𝔼_x f(x) · ∑ᵢ xᵢ / √n)², where xᵢ = signVal (x i) O'Donnell, Exercise 5.30.