TCSLib

72 Boolean Analysis — Bool Fourier

72.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.

72.2 Declarations

Definition 72.1 Hypercube
✓
#

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

Definition 72.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 72.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 72.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 72.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 72.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 72.7 Cardinality of the Boolean hypercube
✓

For every natural number \(n\), the Boolean hypercube \(\{ 0,1\} ^n\) has exactly \(2^n\) elements.

Lemma 72.8 Mean of the Bool-to-\(\pm 1\) embedding vanishes
✓

Under the embedding \(\mathrm{BoolToPM1} : \mathrm{Bool} \to \mathbb {R}\) that sends \(\mathtt{false}\) to \(1\) and \(\mathtt{true}\) to \(-1\), the average of its two values is zero:

\[ \frac{\mathrm{BoolToPM1}(\mathtt{false}) + \mathrm{BoolToPM1}(\mathtt{true})}{2} = 0. \]
Lemma 72.9 Square of the Bool-to-\(\pm 1\) embedding
✓
#

For every Boolean value \(b\), the image \(\mathrm{BoolToPM1}(b)\) under the map sending \(\mathtt{false}\) to \(1\) and \(\mathtt{true}\) to \(-1\) satisfies \(\mathrm{BoolToPM1}(b)\cdot \mathrm{BoolToPM1}(b) = 1\); that is, this \(\pm 1\)-valued quantity squares to \(1\).

Lemma 72.10 Negation under the \(\pm 1\) embedding
✓
#

Let \(\mathrm{BoolToPM1} : \mathrm{Bool} \to \mathbb {R}\) be the Bool-to-\(\pm 1\) embedding, which sends \(\mathtt{false}\) to \(1\) and \(\mathtt{true}\) to \(-1\). Then for every Boolean value \(b\), negating \(b\) flips the sign of its image:

\[ \mathrm{BoolToPM1}(\lnot b) = -\, \mathrm{BoolToPM1}(b). \]
Lemma 72.11 XOR as multiplication under the \(\pm 1\) embedding
✓

Let \(\mathrm{BoolToPM1} : \mathrm{Bool} \to \mathbb {R}\) be the map sending \(\mathtt{false}\) to \(1\) and \(\mathtt{true}\) to \(-1\). Then for all Booleans \(a\) and \(b\),

\[ \mathrm{BoolToPM1}(a \oplus b) = \mathrm{BoolToPM1}(a)\cdot \mathrm{BoolToPM1}(b), \]

so the exclusive-or \(a \oplus b\) is carried to the ordinary product in \(\{ -1,1\} \subset \mathbb {R}\).

Definition 72.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 72.13 Factorisation of expectation over product functions
✓

Let \(g : \{ 0,1\} ^n \to \mathbb {R}\) be given coordinatewise, so that for each index \(i \in \{ 0,\dots ,n-1\} \) we have a function \(g_i : \{ 0,1\} \to \mathbb {R}\), and let \(f : \{ 0,1\} ^n \to \mathbb {R}\) be the product function \(f(x) = \prod _{i} g_i(x_i)\). Then its uniform expectation over the Boolean hypercube factorises as

\[ \mathbb {E}[f] = \prod _{i} \frac{g_i(0) + g_i(1)}{2}. \]
Definition 72.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 72.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 72.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 72.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 72.18 Walsh character at the origin
✓

Let \(n\) be a natural number and let \(S \subseteq [n]\). Evaluating the Walsh character \(\chi _S : \{ 0,1\} ^n \to \mathbb {R}\) at the all-zeros point \(\mathbf{0}\) (the vector whose every coordinate is \(\mathtt{false}\)) gives

\[ \chi _S(\mathbf{0}) = 1. \]
Lemma 72.19 Walsh characters take values in the unit sphere
✓

Let \(n\) be a natural number, let \(S \subseteq [n]\), and let \(x \in \{ 0,1\} ^n\). Then the Walsh–Fourier character \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\) satisfies

\[ \chi _S(x)\, \chi _S(x) = 1. \]
Lemma 72.20 Empty Walsh character is the constant one
✓
#

Let \(n\) be a natural number. The Walsh character \(\chi _\emptyset \) associated to the empty subset of \([n]\) is the constant function equal to \(1\) on the Boolean hypercube; that is, \(\chi _\emptyset (x) = 1\) for every \(x \in \{ 0,1\} ^n\).

Lemma 72.21 Product of Walsh characters
✓

For any two subsets \(S, T \subseteq [n]\) and any point \(x \in \{ 0,1\} ^n\),

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

where \(\chi _S\) denotes the Walsh–Fourier character of \(S\) and \(S \mathbin {\triangle } T\) is the symmetric difference of \(S\) and \(T\).

Lemma 72.22 Summing all Walsh characters at the origin
✓

Fix \(n \in \mathbb {N}\), and for each subset \(S \subseteq [n]\) let \(\chi _S \colon \{ 0,1\} ^n \to \mathbb {R}\) denote the Walsh–Fourier character \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\). Writing \(\mathbf{0}\) for the all-zeros point of \(\{ 0,1\} ^n\), summing these characters evaluated at \(\mathbf{0}\) over all \(2^n\) subsets of \([n]\) gives

\[ \sum _{S \subseteq [n]} \chi _S(\mathbf{0}) \; =\; \left\lvert \{ 0,1\} ^n\right\rvert , \]

the number of points of the Boolean hypercube.

Lemma 72.23 Vanishing of the character sum at a nonzero point
✓

Fix \(n\in \mathbb {N}\) and a point \(x\in \{ 0,1\} ^n\), and for each subset \(S\subseteq [n]\) let \(\chi _S(x)=\prod _{i\in S}(-1)^{x_i}\) be the Walsh–Fourier character. If \(x\) is not the all-zeros point, then

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

the sum ranging over all \(2^n\) subsets of \([n]\).

Lemma 72.24 Expectation of the empty Walsh character
✓

For every \(n \in \mathbb {N}\), the Walsh character \(\chi _\emptyset \) associated to the empty subset of \([n]\) has uniform expectation equal to one:

\[ \mathbb {E}[\chi _\emptyset ] \; =\; \frac{1}{2^n}\sum _{x \in \{ 0,1\} ^n} \chi _\emptyset (x) \; =\; 1. \]
Lemma 72.25 Non-trivial characters have mean zero
✓

Let \(n\) be a natural number and let \(S \subseteq [n]\) be a nonempty set of coordinates. Then the Walsh–Fourier character \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\) has vanishing uniform expectation over the Boolean hypercube \(\{ 0,1\} ^n\):

\[ \mathbb {E}[\chi _S] = \frac{1}{2^n}\sum _{x \in \{ 0,1\} ^n} \chi _S(x) = 0. \]
Lemma 72.26 Self inner product of a Walsh character
✓

Let \(n\) be a natural number and let \(S \subseteq [n]\). Then the Walsh–Fourier character \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\) satisfies

\[ \langle \chi _S, \chi _S \rangle \; =\; \frac{1}{2^n}\sum _{x \in \{ 0,1\} ^n} \chi _S(x)^2 \; =\; 1, \]

where the inner product is the uniform expectation of the pointwise product.

Lemma 72.27 Orthogonality of distinct Walsh characters
✓

Fix \(n \in \mathbb {N}\), and let \(S, T \subseteq [n]\) be two distinct subsets. Then the Walsh–Fourier characters \(\chi _S\) and \(\chi _T\) are orthogonal with respect to the uniform inner product on \(\{ 0,1\} ^n\):

\[ \langle \chi _S, \chi _T \rangle = \frac{1}{2^n}\sum _{x \in \{ 0,1\} ^n} \chi _S(x)\, \chi _T(x) = 0. \]
Definition 72.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 72.29 Self-Fourier coefficient of a Walsh character
✓

For every subset \(S \subseteq [n]\), the Fourier coefficient of the Walsh character \(\chi _S\) at the same set \(S\) equals \(1\); that is,

\[ \widehat{\chi _S}(S) = \langle \chi _S, \chi _S \rangle = 1. \]
Lemma 72.30 Orthogonality of Walsh characters
✓

Let \(S, T \subseteq [n]\) be distinct subsets of coordinates. Then the Fourier coefficient of the Walsh character \(\chi _S : \{ 0,1\} ^n \to \mathbb {R}\) at \(T\) vanishes:

\[ \widehat{\chi _S}(T) = \langle \chi _S, \chi _T \rangle = 0. \]
Lemma 72.31 Agreement of two definitions of the uniform expectation
✓

Let \(n\) be a natural number and let \(f : \{ 0,1\} ^n \to \mathbb {R}\) be a Boolean function of arity \(n\). Then the two forms of the uniform expectation of \(f\) coincide, namely

\[ \frac{1}{2^n} \sum _{x \in \{ 0,1\} ^n} f(x) \; =\; 2^{-n} \sum _{x \in \{ 0,1\} ^n} f(x). \]
Lemma 72.32 Agreement of two Fourier coefficient definitions
✓

Let \(f : \{ 0,1\} ^n \to \mathbb {R}\) be a Boolean function of arity \(n\), and let \(S \subseteq [n]\). Then the two definitions of the Fourier–Walsh coefficient \(\hat f(S)\) coincide: both are equal to the \(L^2\) inner product of \(f\) with the Walsh character \(\chi _S\),

\[ \hat f(S) \; =\; \langle f, \chi _S\rangle \; =\; 2^{-n}\sum _{x\in \{ 0,1\} ^n} f(x)\, \chi _S(x). \]
Lemma 72.33 Fourier–Walsh expansion
✓

Let \(f : \{ 0,1\} ^n \to \mathbb {R}\) be a Boolean function and let \(x \in \{ 0,1\} ^n\). Then \(f\) agrees pointwise with the sum of its Walsh characters weighted by its Fourier coefficients:

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

where the sum ranges over all subsets \(S\) of \([n]\), \(\hat f(S) = \langle f, \chi _S\rangle \) is the Fourier coefficient of \(f\) at \(S\), and \(\chi _S\) is the Walsh character of \(S\).

Lemma 72.34 Parseval’s identity for the Walsh–Fourier expansion
✓

Let \(f : \{ 0,1\} ^n \to \mathbb {R}\) be a real-valued function on the Boolean hypercube, and for each subset \(S \subseteq [n]\) let \(\hat f(S) = \langle f, \chi _S\rangle \) be its Fourier coefficient, where the inner product and expectation are taken with respect to the uniform measure. Then the sum of the squared Fourier coefficients equals the squared \(L^2\) norm of \(f\):

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

Let \(n\) be a natural number, and let \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) be Boolean functions. Then for every subset \(S \subseteq [n]\), the Fourier coefficient of the convolution \(f * g\) at \(S\) equals the product of the Fourier coefficients of \(f\) and \(g\) at \(S\):

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

72.3 Additional declarations

Lemma 72.36 Walsh characters square to one
✓
#

Fix a natural number \(n\), and let \(S \subseteq \{ 1,\dots ,n\} \) be a set of coordinates. For every point \(x\) of the Boolean hypercube \(\{ 0,1\} ^n\), the Walsh character \(\chi _S\) satisfies

\[ \chi _S(x)^2 = 1. \]
Lemma 72.37 Walsh characters equal one at the origin
✓

Fix \(n \ge 0\), and for each subset \(S \subseteq [n]\) let \(\chi _S : \{ 0,1\} ^n \to \mathbb {R}\) be the Walsh character \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\). Writing \(\mathbf{0}\) for the all-zeros point of \(\{ 0,1\} ^n\), the map sending each \(S\) to \(\chi _S(\mathbf{0})\) is the constant function equal to \(1\):

\[ \bigl(S \mapsto \chi _S(\mathbf{0})\bigr) \; =\; \bigl(S \mapsto 1\bigr). \]
Lemma 72.38 Sign-flip symmetry of the character sum at a nonzero point
✓

Let \(x \in \{ 0,1\} ^n\) be a point of the Boolean hypercube that differs from the all-zeros point \(\mathbf{0}\), and suppose \(i\) is a coordinate at which \(x_i = \mathtt{true}\). Then summing the Walsh–Fourier characters over all subsets \(S \subseteq [n]\), evaluated at \(x\), gives the same value as summing their negations:

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

Let \(n\) be a natural number and let \(S \subseteq [n]\) be a nonempty set of coordinates. Then the uniform expectation of the Walsh character \(\chi _S\) over the Boolean hypercube factorises as a product over the coordinates in \(S\):

\[ \mathbb {E}[\chi _S] \; =\; \prod _{j \in S} \frac{\mathrm{BoolToPM1}(\mathtt{false}) + \mathrm{BoolToPM1}(\mathtt{true})}{2}, \]

where \(\mathrm{BoolToPM1}\) sends \(\mathtt{false}\) to \(1\) and \(\mathtt{true}\) to \(-1\).

Lemma 72.40 \(L^2\) norm squared as a self inner product
✓

Let \(f : \{ 0,1\} ^n \to \mathbb {R}\) be a real-valued function on the Boolean hypercube, and equip such functions with the uniform-measure inner product \(\langle g, h \rangle = 2^{-n}\sum _{x \in \{ 0,1\} ^n} g(x)\, h(x)\). Then the squared \(L^2\) norm of \(f\) equals the inner product of \(f\) with itself:

\[ \| f\| _2^2 \; =\; \langle f, f \rangle . \]
Lemma 72.41 Interchange of summation in the convolution coefficient
✓

Let \(n\) be a natural number, let \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) be Boolean functions, and let \(S \subseteq [n]\) with associated Walsh character \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\). Writing \(x \oplus y\) for the componentwise XOR of \(x, y \in \{ 0,1\} ^n\), the following identity holds:

\[ \sum _{x \in \{ 0,1\} ^n} \Bigl(\sum _{y \in \{ 0,1\} ^n} f(y)\, g(x \oplus y)\Bigr)\, \chi _S(x) \; =\; \sum _{y \in \{ 0,1\} ^n} f(y) \sum _{x \in \{ 0,1\} ^n} g(x \oplus y)\, \chi _S(x). \]
Lemma 72.42 Multiplicative splitting of a Walsh character along XOR
✓

Let \(S \subseteq [n]\), let \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) be Boolean functions, and suppose the interchange-of-summation identity

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

holds, where all sums range over \(\{ 0,1\} ^n\) and \(\oplus \) is componentwise XOR. Then for all \(x, y \in \{ 0,1\} ^n\),

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

where \(\chi _S\) is the Walsh–Fourier character of \(S\); that is, \(\chi _S\) is a character of the group \((\mathbb {F}_2)^n\).

Lemma 72.43 Shift rule for character-weighted sums
✓

Let \(f, g : \{ 0,1\} ^n \to \mathbb {R}\) be Boolean functions, let \(S \subseteq [n]\), and write \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\) for the associated Walsh character, where \(\oplus \) denotes componentwise XOR. Suppose the order of summation may be interchanged in the double sum

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

Then for every \(y \in \{ 0,1\} ^n\), translating the argument of \(g\) by \(y\) multiplies the character-weighted sum by the factor \(\chi _S(y)\):

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