TCSLib

75 Boolean Analysis — Bool Fourier

75.1 Overview

This module develops Fourier analysis on the Boolean hypercube \(\{ 0,1\} ^n\), building on top of TCSlib.BooleanAnalysis.Basic. It introduces type aliases for the hypercube and Boolean functions, the group structure (XOR), the uniform expectation operator, the inner product and \(L^2\) norm, Fourier–Walsh characters, Fourier coefficients, and proves the fundamental theorems: orthonormality of characters, the Walsh expansion, Parseval’s identity, and the convolution theorem.

75.2 Declarations

Definition 75.1 Hypercube
#

The Boolean hypercube of dimension \(n\) is the type \(\{ 0,1\} ^n\), defined as an abbreviation for BooleanAnalysis.BoolCube \(n\).

Definition 75.2 Boolean function type
#

A Boolean function of arity \(n\) is an element of type \(\{ 0,1\} ^n \to \mathbb {R}\), defined as an abbreviation for BooleanAnalysis.BooleanFunc \(n\).

Definition 75.3 Bool-to-\(\pm 1\) embedding
#

The map \(\mathrm{BoolToPM1} : \mathrm{Bool} \to \mathbb {R}\) sends \(\mathtt{false}\) to \(1\) and \(\mathtt{true}\) to \(-1\), realising the standard identification \(\{ 0,1\} \cong \{ \pm 1\} \).

Definition 75.4 Partial inverse of \(\pm 1\) embedding
#

The partial inverse \(\mathrm{PM1ToBool?} : \mathbb {R} \to \mathrm{Option}\, \mathrm{Bool}\) returns \(\mathtt{some}\, \mathtt{true}\) on \(-1\), \(\mathtt{some}\, \mathtt{false}\) on \(1\), and \(\mathtt{none}\) on all other real numbers.

Definition 75.5 All-zeros vector
#

\(\mathrm{zero\_ vec}(n) : \{ 0,1\} ^n\) is the constant-\(\mathtt{false}\) function, serving as the additive identity of the group \((\mathbb {F}_2)^n\).

Definition 75.6 Componentwise XOR
#

For \(x, y \in \{ 0,1\} ^n\), the vector \(\mathrm{xor\_ vec}(x,y)_i = x_i \oplus y_i\) is the componentwise XOR, giving the group operation on \((\mathbb {F}_2)^n\).

Lemma 75.7 Cardinality of the hypercube

For every \(n : \mathbb {N}\), the Boolean hypercube satisfies \(|\{ 0,1\} ^n| = 2^n\).

Lemma 75.8 Average of \(\pm 1\) values is zero

The average of the two values of the \(\pm 1\) embedding is zero:

\[ \frac{\mathrm{BoolToPM1}(\mathtt{false}) + \mathrm{BoolToPM1}(\mathtt{true})}{2} = 0. \]
Lemma 75.9 \(\pm 1\) values square to one
#

For every \(b : \mathrm{Bool}\), \(\mathrm{BoolToPM1}(b)^2 = 1\).

Lemma 75.10 Negation under \(\pm 1\) embedding
#

For every \(b : \mathrm{Bool}\), \(\mathrm{BoolToPM1}(\lnot b) = -\mathrm{BoolToPM1}(b)\).

Lemma 75.11 XOR under \(\pm 1\) embedding

For all \(a, b : \mathrm{Bool}\), \(\mathrm{BoolToPM1}(a \oplus b) = \mathrm{BoolToPM1}(a) \cdot \mathrm{BoolToPM1}(b)\); that is, XOR corresponds to multiplication in \(\{ \pm 1\} \subset \mathbb {R}\).

Definition 75.12 Uniform expectation
#

For \(f : \{ 0,1\} ^n \to \mathbb {R}\), the uniform expectation is

\[ \mathbb {E}[f] = \frac{1}{2^n} \sum _{x \in \{ 0,1\} ^n} f(x). \]
Lemma 75.13 Factorisation of expectation over product functions

If \(g : \mathrm{Fin}\, n \to \mathrm{Bool} \to \mathbb {R}\) and \(f(x) = \prod _{i} g_i(x_i)\), then

\[ \mathbb {E}[f] = \prod _{i=0}^{n-1} \frac{g_i(\mathtt{false}) + g_i(\mathtt{true})}{2}. \]
Definition 75.14 Inner product of Boolean functions

The inner product of \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) is

\[ \langle f, g \rangle = \mathbb {E}[f \cdot g] = \frac{1}{2^n}\sum _{x} f(x)\, g(x). \]
Definition 75.15 \(L^2\) norm squared
#

The squared \(L^2\) norm of \(f : \{ 0,1\} ^n \to \mathbb {R}\) is

\[ \| f\| _2^2 = \mathbb {E}[f^2] = \frac{1}{2^n}\sum _{x} f(x)^2. \]
Definition 75.16 Convolution on the hypercube

The convolution of \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) is the function

\[ (f * g)(x) = \mathbb {E}_{y}\bigl[f(y)\, g(x \oplus y)\bigr]. \]
Definition 75.17 Walsh–Fourier character
#

For a set \(S \subseteq [n]\), the Walsh character \(\chi _S : \{ 0,1\} ^n \to \mathbb {R}\) is

\[ \chi _S(x) = \prod _{i \in S} (-1)^{x_i}, \]

defined as an alias for BooleanAnalysis.chiS.

Lemma 75.18 Character evaluated at zero

For every \(S \subseteq [n]\), \(\chi _S(\mathbf{0}) = 1\).

Lemma 75.19 Character squared equals one

For every \(S \subseteq [n]\) and \(x \in \{ 0,1\} ^n\), \(\chi _S(x)^2 = 1\).

Lemma 75.20 Empty character is constant one
#

\(\chi _\emptyset = \mathbf{1}\), the constant function equal to \(1\).

Lemma 75.21 Product of characters

For all \(S, T \subseteq [n]\) and \(x \in \{ 0,1\} ^n\),

\[ \chi _S(x)\, \chi _T(x) = \chi _{S \mathbin {\triangle } T}(x), \]

where \(S \mathbin {\triangle } T\) denotes the symmetric difference.

Lemma 75.22 Sum of characters at zero equals \(2^n\)
\[ \sum _{S \subseteq [n]} \chi _S(\mathbf{0}) = 2^n. \]
Lemma 75.23 Sum of characters at non-zero point is zero

For every \(x \in \{ 0,1\} ^n\) with \(x \ne \mathbf{0}\),

\[ \sum _{S \subseteq [n]} \chi _S(x) = 0. \]
Lemma 75.24 Expectation of empty character is one

\(\mathbb {E}[\chi _\emptyset ] = 1\).

Lemma 75.25 Expectation of non-empty character is zero

If \(S \ne \emptyset \), then \(\mathbb {E}[\chi _S] = 0\).

Lemma 75.26 Orthonormality: self inner product

For every \(S \subseteq [n]\), \(\langle \chi _S, \chi _S \rangle = 1\).

Lemma 75.27 Orthonormality: distinct characters are orthogonal

If \(S \ne T\), then \(\langle \chi _S, \chi _T \rangle = 0\).

Definition 75.28 Fourier coefficient

The Fourier coefficient of \(f : \{ 0,1\} ^n \to \mathbb {R}\) at \(S \subseteq [n]\) is

\[ \hat f(S) = \langle f, \chi _S \rangle . \]
Lemma 75.29 Fourier coefficient of a character at itself

For every \(S \subseteq [n]\), \(\widehat{\chi _S}(S) = 1\).

Lemma 75.30 Fourier coefficient of a character at a different set

If \(S \ne T\), then \(\widehat{\chi _S}(T) = 0\).

Lemma 75.31 Expectation equals uniform-weight expectation

The locally-defined expectation BoolFourier.expectation agrees with BooleanAnalysis.expect: for every \(f\), \(\mathbb {E}[f] = \mathrm{expect}(f)\).

Lemma 75.32 Fourier coefficient agrees with upstream definition

For every \(f\) and \(S\), \(\mathrm{fourier\_ coeff}(f, S) = \mathrm{fourierCoeff}(f, S)\), bridging the local and upstream definitions.

Lemma 75.33 Fourier–Walsh expansion

Every Boolean function \(f : \{ 0,1\} ^n \to \mathbb {R}\) expands in the Walsh–Fourier basis:

\[ f(x) = \sum _{S \subseteq [n]} \hat f(S)\, \chi _S(x). \]

For every \(f : \{ 0,1\} ^n \to \mathbb {R}\),

\[ \sum _{S \subseteq [n]} \hat f(S)^2 = \| f\| _2^2. \]

For all \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) and \(S \subseteq [n]\),

\[ \widehat{f * g}(S) = \hat f(S) \cdot \hat g(S). \]

75.3 Additional declarations

Lemma 75.36 Character squared equals one, powered form
#

For every \(S \subseteq [n]\) and every \(x \in \{ 0,1\} ^n\), \(\chi _S(x)^2 = 1\). This is the squaring form (with exponent \(2\) rather than an explicit product) of the fact that Walsh characters take values in \(\{ \pm 1\} \).

Lemma 75.37 Characters at the origin form the constant function one

As functions of \(S\), the evaluation of characters at the all-zeros vector is constant:

\[ \bigl(S \mapsto \chi _S(\mathbf{0})\bigr) = \bigl(S \mapsto 1\bigr). \]
Lemma 75.38 Sign-flip pairing of characters at a non-zero point

Let \(x \in \{ 0,1\} ^n\) with \(x \ne \mathbf{0}\) and let \(i\) be a coordinate with \(x_i = \mathtt{true}\). Then the sum of all characters at \(x\) equals the sum of their negations:

\[ \sum _{S \subseteq [n]} \chi _S(x) \; =\; \sum _{S \subseteq [n]} -\chi _S(x). \]
Lemma 75.39 Expectation of a character as a coordinate product

For a non-empty \(S \subseteq [n]\), the uniform expectation of the character \(\chi _S\) factorises over the coordinates of \(S\):

\[ \mathbb {E}[\chi _S] \; =\; \prod _{j \in S} \frac{\mathrm{BoolToPM1}(\mathtt{false}) + \mathrm{BoolToPM1}(\mathtt{true})}{2}. \]
Lemma 75.40 \(L^2\) norm as a self inner product

For every \(f : \{ 0,1\} ^n \to \mathbb {R}\), the locally-defined squared \(L^2\) norm agrees with the upstream inner product of \(f\) with itself:

\[ \| f\| _2^2 \; =\; \langle f, f \rangle _{\mathbb {B}}. \]
Lemma 75.41 Interchange of summation in the convolution coefficient

For all \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) and \(S \subseteq [n]\), the double sum defining the unnormalised convolution coefficient may be reordered:

\[ \sum _{x} \Bigl(\sum _{y} f(y)\, g(x \oplus y)\Bigr) \chi _S(x) \; =\; \sum _{y} f(y) \sum _{x} g(x \oplus y)\, \chi _S(x). \]
Lemma 75.42 Multiplicative splitting of a character along XOR

For all \(x, y \in \{ 0,1\} ^n\) and \(S \subseteq [n]\),

\[ \chi _S(x) \; =\; \chi _S(x \oplus y)\, \chi _S(y), \]

expressing that \(\chi _S\) is a character of the group \((\mathbb {F}_2)^n\). The statement also carries the (unused) Fubini hypothesis of the enclosing proof.

Lemma 75.43 Shift rule for character-weighted sums

Let \(f, g : \{ 0,1\} ^n \to \mathbb {R}\), let \(S \subseteq [n]\), assume the Fubini interchange for the convolution coefficient, and let \(y \in \{ 0,1\} ^n\). Then translating the argument of \(g\) by \(y\) only multiplies the character-weighted sum by \(\chi _S(y)\):

\[ \sum _{x} g(x \oplus y)\, \chi _S(x) \; =\; \chi _S(y) \sum _{x} g(x)\, \chi _S(x). \]