Fourier analysis on the Boolean cube #
The character of a set S of coordinates is χ_S x = ∏_{i ∈ S} (-1) ^ (x i)
(BitString.chi), the sign of the parity of the bits of x : ι → Bool in S
(BitString.chi_eq_neg_one_pow_parityOn), with values in any commutative ring R; Fourier
analysis takes R = ℝ, where the sign of a bit is BitString.signVal. Bit strings add
coordinatewise modulo two, (x + y) i = (x i ^^ y i), through Mathlib's Boolean ring structure on
Bool, and the characters turn sums into products (BitString.chi_add): they are additive
characters of the cube (BitString.chiChar), whose sums are Mathlib's AddChar.sum_eq_ite.
Summed over the subsets of K, χ_S x χ_S y is 2 ^ |K| when x and y agree on K and
0 otherwise (BitString.sum_powerset_chi_mul_chi). The characters are orthonormal for
the uniform expectation (BitString.expect_chi_mul_chi), and every real function on the cube is
the sum of its Fourier expansion f = ∑_S f̂(S) χ_S, with the
Fourier coefficients f̂(S) = 𝔼_x f x χ_S x (BitString.fourierCoeff,
BitString.sum_fourierCoeff_mul_chi), which are unique
(BitString.fourierCoeff_sum_mul_chi), so the Fourier transform is a linear equivalence
(BitString.fourierTransform). The expectation of a product is the sum of products of
coefficients (Plancherel, BitString.expect_mul_eq_sum_fourierCoeff_mul), so the squared
coefficients of a function with values ±1 sum to one (BitString.sum_fourierCoeff_sq_signVal).
For Boolean functions read as signs, correlation is one minus twice the relative Hamming distance
(BitString.expect_signVal_mul_signVal), so the coefficient on S measures the distance to the
parity on S (BitString.fourierCoeff_signVal) O'Donnell, Chapter 1.
The coefficients are named BitString.fourierCoeff; Mathlib's root fourierCoeff is the Fourier
coefficient on the circle, so the name is meant to be used qualified.
Main definitions #
Cslib.BitString.chi: the character of a set of coordinates, with values in a commutative ring, andCslib.BitString.chiCharthe same as an additive character.Cslib.BitString.fourierCoeff: the Fourier coefficient of a real function on the cube, andCslib.BitString.fourierCoeffₗthe same as a linear map.Cslib.BitString.fourierTransform: the Fourier transform, as a linear equivalence.
Main results #
Cslib.BitString.expect_chi_mul_chi,Cslib.BitString.fourierCoeff_chi: the characters are orthonormal.Cslib.BitString.fourierCoeff_ite_eq,Cslib.BitString.fourierCoeff_signVal_decide_eq: the Fourier coefficients of the indicator of a point.Cslib.BitString.chi_add,Cslib.BitString.chi_mul_chi: the characters are multiplicative, in the input and in the set.Cslib.BitString.fourierCoeff_comp_add,Cslib.BitString.fourierCoeff_comp_not: the coefficients of a translatex ↦ g (x + y)and ofx ↦ g(-x); so an even function has no weight on sets of odd size (Cslib.BitString.fourierCoeff_eq_zero_of_odd_card).Cslib.BitString.sum_fourierCoeff_mul_chi: the Fourier expansion.Cslib.BitString.sum_powerset_chi_mul_chi: summed over the subsets ofK, the characters at two points detect their agreement onK.Cslib.BitString.fourierCoeff_sum_mul_chi,Cslib.BitString.fourierCoeff_injective: uniqueness of the Fourier coefficients.Cslib.BitString.abs_fourierCoeff_le_expect_abs,Cslib.BitString.abs_le_sum_abs_fourierCoeff:‖f̂‖∞ ≤ ‖f‖₁and‖f‖∞ ≤ ‖f̂‖₁; the second follows fromCslib.BitString.abs_sum_mul_chi_le, which bounds a combination of characters by the sum of its absolute weights.Cslib.BitString.expect_mul_eq_sum_fourierCoeff_mul: Plancherel's identity.Cslib.BitString.fourierCoeff_comp_arrowCongr: relabelling the coordinates relabels the Fourier coefficients.Cslib.BitString.sum_fourierCoeff_sq_signVal: Parseval's identity for functions with values±1; so their coefficients have square and absolute value at most one (Cslib.BitString.fourierCoeff_sq_signVal_le_one,Cslib.BitString.abs_fourierCoeff_signVal_le_one), every partial sum of their squares is at most one (Cslib.BitString.sum_fourierCoeff_sq_signVal_le_one), and their spectral norm is at least one (Cslib.BitString.one_le_sum_abs_fourierCoeff_signVal). For functions with values in[-1, 1]the same partial sums and absolute values are at most one (Cslib.BitString.sum_fourierCoeff_sq_le_one_of_abs_le_one,Cslib.BitString.abs_fourierCoeff_le_one_of_abs_le_one).Cslib.BitString.expect_signVal_mul_signVal,Cslib.BitString.fourierCoeff_signVal: the correlation of two Boolean functions is one minus twice their relative Hamming distance.
References #
The character of a set S of coordinates, with values in a commutative ring R: the product
of the signs (-1) ^ xᵢ over S, the sign of the parity of the bits in S
(chi_eq_neg_one_pow_parityOn). The Fourier analysis of real functions uses chi ℝ.
The characters of the subsets of K at two points, summed, are 2 ^ |K| when the points agree
on K and 0 otherwise: the sum is the product over K of 1 + (-1) ^ xᵢ (-1) ^ yᵢ. The
statement takes the decidability of the agreement as an instance argument, as Finset.sum_boole
does.
Changing a bit outside S leaves the character of S unchanged.
Setting a bit in S to b splits off the sign (-1) ^ b from the character of S.
A combination of real characters has absolute value at most the sum of the absolute values of
its weights. With the Fourier expansion this is ‖f‖∞ ≤ ‖f̂‖₁
(BitString.abs_le_sum_abs_fourierCoeff).
The Fourier coefficient of f on S: the correlation of f with the character of S.
The Fourier coefficient as a normalised sum.
The Fourier coefficients are additive.
The Fourier coefficients commute with subtraction.
The Fourier coefficients commute with scaling.
The Fourier coefficients commute with finite linear combinations.
Multiplying by a character shifts the coefficients by the symmetric difference.
The Fourier coefficients of a translate: x ↦ g (x + y) has coefficient χ_S(y) ĝ(S)
on S, since adding y permutes the cube and χ_S(x + y) = χ_S(x) χ_S(y).
Complementing the input multiplies the coefficient on S by (-1) ^ |S|: the Fourier
coefficients of x ↦ g(-x), the translate by the all-true string. This is the computation of
O'Donnell, Exercise 1.8(a), which is about the dual x ↦ -g(-x), without the
outer sign.
An even function has no Fourier weight on sets of odd size O'Donnell, Exercise 1.8(c).
A constant has all its weight on the empty set.
The indicator of a point a has Fourier coefficients χ_S(a) / 2ⁿ.
The Boolean indicator of a point a, read as signs, has Fourier coefficients
[S = ∅] - 2 χ_S(a) / 2ⁿ.
The Fourier coefficients of a character are 1 at its own set and 0 elsewhere.
A literal x ↦ b ⊕ x_i, read as ±1, is signVal b times the character of {i}, so its
only nonzero Fourier coefficient is signVal b, on {i}.
A parity, read as ±1, is the character of its set, so all its weight is on that set.
Relabelling the coordinates relabels the Fourier coefficients: renaming the coordinates
of g by e, the coefficient on S is the coefficient of g on the image of S under e.
For a permutation π this is f̂^π(S) = f̂(π⁻¹(S)), where f^π(x) = f(x^π) and
(x^π)ᵢ = x_{π(i)} O'Donnell, Exercise 1.30(a).
The coefficient on the empty set is the expectation.
A Fourier coefficient is at most the mean absolute value: |f̂(S)| ≤ 𝔼 |f|, that is
‖f̂‖∞ ≤ ‖f‖₁, the first half of O'Donnell, Exercise 3.9.
The Fourier expansion: every function is the sum of its characters weighted by its Fourier coefficients.
A function is at most the sum of the absolute values of its Fourier coefficients:
‖f‖∞ ≤ ‖f̂‖₁, the second half of O'Donnell, Exercise 3.9.
The Fourier coefficients are unique: a combination of characters has its weights as coefficients.
A function is determined by its Fourier coefficients.
The linear map fourierCoeffₗ S sends f to its Fourier coefficient on S.
The Fourier transform sends a function to its Fourier coefficients.
The inverse Fourier transform sends weights c to the combination ∑ S, c S * χ_S.
Plancherel's identity: the expectation of a product is the sum of the products of the Fourier coefficients.
Parseval's identity.
Parseval's identity for functions with values ±1: the squared Fourier coefficients sum
to one.
A Fourier coefficient of a Boolean function, read as signs, has square at most one.
Partial Fourier weight of a bounded function: over any family of sets, the squared Fourier
coefficients of a real function with values in [-1, 1] sum to at most one.
Partial Fourier weight: over any family of sets, the squared Fourier coefficients of a Boolean function, read as signs, sum to at most one.
A Fourier coefficient of a Boolean function, read as signs, has absolute value at most one.
A Boolean function, read as signs, has spectral norm ∑_S |f̂(S)| at least one.
Distance and correlation #
Correlation is one minus twice the distance: the correlation of two Boolean functions, read as signs, is one minus twice the fraction of the inputs on which they differ O'Donnell, Section 1.4.
The Fourier coefficient on S of a Boolean function read as signs is one minus twice the
relative Hamming distance from the function to the parity on S.
Character sums for the inner product #
Character orthogonality for the inner product, over any ring: the signs (-1) ^ (w ⬝ᵥ y)
cancel over all bit strings y unless w = 0, since flipping a bit i with w i = true
negates them. Over ℝ this is sum_chi for the set of positions where w is true.