Documentation

CslibFrontier.Foundations.BooleanAnalysis.InnerProduct

The Fourier spectrum of the inner product modulo two #

The sign of the inner product of two n-bit strings has every Fourier coefficient equal to ±2⁻ⁿ: it is a bent function. Here the two strings are the two halves of one 2n-bit input, using BitString.fstBits, BitString.sndBits, and the Boolean-ring inner product ⬝ᵥ. The sign of the coefficient at a Fourier mask is the inner product of the mask's two halves.

Plancherel's identity then bounds correlation with an arbitrary real function g by 2⁻ⁿ times the spectral norm of g. Keeping the products on a set S of coordinate pairs gives correlation exactly 2 ^ |S| / 2 ^ n with the full inner product. In particular, this includes the empty set and all coordinate pairs. The formulas are proved directly in the library's existing Fourier normalization.

Main results #

theorem Cslib.BitString.fourierCoeff_signVal_dotProduct_fstBits_sndBits {n : ℕ} (S : Finset (Fin (n + n))) :
fourierCoeff (fun (z : BitString (n + n)) => signVal (z.fstBits ⬝ᵥ z.sndBits)) S = signVal ((fun (i : Fin n) => decide (Fin.castAdd n i ∈ S)) ⬝ᵥ fun (i : Fin n) => decide (Fin.natAdd n i ∈ S)) / 2 ^ n

The Fourier coefficient of the sign of the inner product is 2⁻ⁿ, with sign given by the inner product of the Fourier mask's two halves.

All Fourier coefficients of the sign of the n-pair inner product have magnitude 2⁻ⁿ. The case n = 0 is included.

theorem Cslib.BitString.abs_expect_signVal_dotProduct_mul_le {n : ℕ} (g : BitString (n + n) → ℝ) :
|Finset.univ.expect fun (z : BitString (n + n)) => signVal (z.fstBits ⬝ᵥ z.sndBits) * g z| ≤ (∑ S : Finset (Fin (n + n)), |fourierCoeff g S|) / 2 ^ n

Correlation with the inner product is at most the spectral norm divided by 2 ^ n. This applies to arbitrary real functions, with no boundedness assumption.

theorem Cslib.BitString.expect_signVal_dotProduct_mul_signVal_sum {n : ℕ} (S : Finset (Fin n)) :
(Finset.univ.expect fun (z : BitString (n + n)) => signVal (z.fstBits ⬝ᵥ z.sndBits) * signVal (∑ i ∈ S, z.fstBits i * z.sndBits i)) = 2 ^ S.card / 2 ^ n

Keeping the products on S gives correlation exactly 2 ^ |S| / 2 ^ n with the full inner product. In particular, retaining no pairs gives 2⁻ⁿ and retaining every pair gives one.