The Hamming distance in the Fourier basis #
Read Boolean functions f g : (ι → Bool) → Bool as the functions F = (-1) ^ f and
G = (-1) ^ g with values ±1. Where f and g agree, F - G vanishes, and where they differ
(F - G) ^ 2 = 4, so the relative Hamming distance is a quarter of the mean of (F - G) ^ 2
(BitString.expect_sq_signVal_sub_signVal). By Parseval's identity it is a quarter of the squared
Euclidean distance between the Fourier coefficients,
d_H(f, g) / 2 ^ n = 1 / 4 ∑_S (F̂(S) - Ĝ(S)) ^ 2
(BitString.hammingDist_div_eq_sum_fourierCoeff_sub_sq) O'Donnell, Section 1.4.
Smoothing both functions by the noise operator T_ρ before comparing them gives the noise
distance D_ρ(f, g) = 1 / 4 𝔼 (T_ρ F - T_ρ G) ^ 2 (BitString.noiseDist). The noise operator
damps the coefficient on S by ρ ^ |S|, so D_ρ(f, g) = 1 / 4 ∑_S ρ ^ (2 |S|) (F̂(S) - Ĝ(S)) ^ 2
(BitString.noiseDist_eq_sum), the noise stability of F - G at ρ ^ 2 up to the factor 1 / 4
(BitString.noiseDist_eq_noiseStability). At ρ = 1 it is the relative Hamming distance
(BitString.noiseDist_one), and it shrinks as |ρ| decreases
(BitString.noiseDist_mono), so on |ρ| ≤ 1 noise contracts the relative Hamming distance
(BitString.noiseDist_le_hammingDist_div). High-degree disagreements are damped most: two
distinct parities on sets of size k are at relative Hamming distance 1 / 2, but at noise
distance ρ ^ (2 k) / 2 (BitString.noiseDist_parityOn).
The damped coefficients ρ ^ |S| F̂(S) / 2 are a point of the Euclidean space indexed by the sets
of coordinates (BitString.noiseEmbedding), and √D_ρ is the Euclidean distance between the
points of f and g (BitString.dist_noiseEmbedding). Hence √D_ρ satisfies the triangle
inequality (BitString.sqrt_noiseDist_triangle), and for ρ ≠ 0 it separates Boolean functions
(BitString.noiseDist_eq_zero_iff), since a function is determined by its Fourier coefficients.
So √D_ρ is a metric on Boolean functions for every ρ ≠ 0 (BitString.noiseMetricSpace); for
ρ = 1 this is the square root of the relative Hamming distance, which is therefore a Euclidean
metric. The noise distance is an average over a probability distribution only for |ρ| ≤ 1,
but the algebraic statements hold for every real ρ.
Main definitions #
Cslib.BitString.noiseDist: the noise distanceD_ρbetween Boolean functions.Cslib.BitString.noiseEmbedding: the damped Fourier coefficients, as a point of Euclidean space.Cslib.BitString.noiseMetricSpace: the metric√D_ρ, forρ ≠ 0.
Main results #
Cslib.BitString.hammingDist_div_eq_sum_fourierCoeff_sub_sq: the relative Hamming distance is a quarter of the squared distance between the Fourier coefficients.Cslib.BitString.noiseDist_eq_sum,Cslib.BitString.noiseDist_eq_noiseStability: the Fourier formula for the noise distance.Cslib.BitString.noiseDist_one,Cslib.BitString.noiseDist_mono,Cslib.BitString.noiseDist_le_hammingDist_div: noise contracts the relative Hamming distance.Cslib.BitString.noiseDist_parityOn: the noise distance between two distinct parities.Cslib.BitString.dist_noiseEmbedding,Cslib.BitString.sqrt_noiseDist_triangle,Cslib.BitString.noiseDist_eq_zero_iff:√D_ρis a Euclidean metric.
References #
The Hamming distance and the Fourier coefficients #
The mean squared difference of two Boolean functions read as signs is four times their relative Hamming distance.
The relative Hamming distance in the Fourier basis: it is a quarter of the squared
Euclidean distance between the Fourier coefficients of the two functions read as signs,
d_H(f, g) / 2 ^ n = 1 / 4 ∑_S (F̂(S) - Ĝ(S)) ^ 2, by Parseval's identity for F - G
O'Donnell, Section 1.4.
The noise distance #
The noise distance D_ρ(f, g) between two Boolean functions: a quarter of the mean
squared difference of T_ρ F and T_ρ G, for F and G the functions read as signs and T_ρ
the noise operator. For |ρ| ≤ 1 it compares f and g after averaging each over the strings
ρ-correlated with the input.
Instances For
The noise distance is a quarter of the noise stability of F - G at ρ ^ 2.
The Fourier formula for the noise distance:
D_ρ(f, g) = 1 / 4 ∑_S ρ ^ (2 |S|) (F̂(S) - Ĝ(S)) ^ 2.
Without noise, the noise distance is the relative Hamming distance.
With full noise, the noise distance compares only the means.
The noise distance is nonnegative.
A Boolean function is at noise distance zero from itself.
Noise contracts the relative Hamming distance: for |ρ| ≤ 1, the noise distance is at
most the relative Hamming distance.
Two distinct parities on sets S and T are at noise distance
(ρ ^ (2 |S|) + ρ ^ (2 |T|)) / 4: all their Fourier weight sits on S and T.
The Euclidean embedding #
The point of a Boolean function in the Euclidean space indexed by the sets of coordinates:
its Fourier coefficients, read as signs, damped by ρ ^ |S| and halved.
Instances For
The noise distance is the squared Euclidean distance between the embedded functions.
The square root of the noise distance is a Euclidean distance.
For ρ ≠ 0 the embedding is injective: the damping is invertible, a function is determined
by its Fourier coefficients, and a Boolean function by its signs.
The square root of the noise distance is a metric on Boolean functions, for ρ ≠ 0:
the metric induced by the Euclidean embedding. For ρ = 1 it is the square root of the relative
Hamming distance. This is a definition, not an instance, since it depends on ρ.
Instances For
The distance in noiseMetricSpace is the square root √D_ρ of the noise distance.