TCSLib

71 Boolean Analysis — Bool BLR

71.1 Overview

This module develops the Blum–Luby–Rubinfeld (BLR) linearity test for Boolean functions \(f : \{ 0,1\} ^n \to \{ 0,1\} \). It establishes that a function is linear (i.e. satisfies \(f(x \oplus y) = f(x) \oplus f(y)\)) if and only if its \(\pm 1\) lift equals some Fourier character \(\chi _S\), and proves both completeness (a linear function passes BLR with probability \(1\)) and soundness (a function \(\varepsilon \)-far from every linear function passes BLR with probability at most \(1-\varepsilon \)), with the soundness bound derived via a Fourier-analytic argument using Parseval’s identity.

71.2 Declarations

Definition 71.1 Linearity of a Boolean function
✓
#

A function \(f : \{ 0,1\} ^n \to \{ 0,1\} \) is linear if for all \(x, y \in \{ 0,1\} ^n\) we have

\[ f(x \oplus y) = f(x) \oplus f(y), \]

where \(\oplus \) denotes bitwise XOR (i.e. Bool.xor).

Definition 71.2 \(\pm 1\) lift of a Boolean function
✓

Given \(f : \{ 0,1\} ^n \to \{ 0,1\} \), its \(\pm 1\) lift \(\texttt{BoolBLR.lift\_ pm1}\, f : \{ 0,1\} ^n \to \mathbb {R}\) is defined by \(x \mapsto (-1)^{f(x)}\), converting each Boolean output to a real sign via BoolToPM1.

Definition 71.3 Boolean distance
✓
#

The distance between two Boolean functions \(f, g : \{ 0,1\} ^n \to \{ 0,1\} \) is

\[ \operatorname{dist}(f, g) \; =\; \Pr _{x \sim \{ 0,1\} ^n}[f(x) \ne g(x)], \]

computed as the uniform expectation of the indicator \(\mathbf{1}[f(x) \ne g(x)]\).

Definition 71.4 \(\varepsilon \)-far from linear
✓

A function \(f : \{ 0,1\} ^n \to \{ 0,1\} \) is \(\varepsilon \)-far from linear if \(0 \le \varepsilon \le 1\) and for every linear function \(g : \{ 0,1\} ^n \to \{ 0,1\} \) we have \(\operatorname{dist}(f, g) \ge \varepsilon \).

Lemma 71.5 Linear Boolean functions are exactly the Walsh characters
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean function. Then \(f\) is linear — that is, \(f(x \oplus y) = f(x) \oplus f(y)\) for all \(x, y \in \{ 0,1\} ^n\), where \(\oplus \) denotes bitwise XOR — if and only if there exists a set \(S \subseteq [n]\) for which the \(\pm 1\) lift \(x \mapsto (-1)^{f(x)}\) coincides with the Walsh character \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\).

Definition 71.6 BLR acceptance probability
✓

The BLR acceptance probability of \(f : \{ 0,1\} ^n \to \{ 0,1\} \) is

\[ \Pr _{x,y}[\text{BLR accepts}] \; =\; \mathbb {E}_{x}\! \left[\mathbb {E}_{y}\! \left[ \mathbf{1}\! \left[ \texttt{BoolBLR.lift\_ pm1}\, f(x \oplus y) = \texttt{BoolBLR.lift\_ pm1}\, f(x)\cdot \texttt{BoolBLR.lift\_ pm1}\, f(y) \right] \right]\right], \]

where \(x, y\) are drawn uniformly from \(\{ 0,1\} ^n\).

Lemma 71.7 BLR acceptance probability in ±1 form
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean-valued function, and write \(F(x) = (-1)^{f(x)} \in \{ \pm 1\} \) for its sign lift. Then the BLR acceptance probability of \(f\), the probability that \(F(x \oplus y) = F(x)\, F(y)\) when \(x\) and \(y\) are drawn independently and uniformly from \(\{ 0,1\} ^n\), satisfies

\[ \Pr _{x,y}[\text{BLR accepts}] \; =\; \frac{1 + \mathbb {E}_{x}\! \left[\mathbb {E}_{y}\! \left[ F(x)\, F(y)\, F(x \oplus y) \right]\right]}{2}, \]

where \(x \oplus y\) denotes the componentwise XOR.

Lemma 71.8 Triple expectation as an inner expectation
✓

Let \(f : \{ 0,1\} ^n \to \mathbb {R}\) be a Boolean function on the hypercube, write \(x \oplus y\) for the componentwise XOR of \(x, y \in \{ 0,1\} ^n\), and let \(\mathbb {E}\) denote expectation over a uniformly random point of \(\{ 0,1\} ^n\). Then

\[ \mathbb {E}_x\! \left[\mathbb {E}_y\! \left[f(x)\, f(y)\, f(x \oplus y)\right]\right] \; =\; \mathbb {E}_x\! \left[f(x)\cdot \mathbb {E}_y\! \left[f(y)\, f(x \oplus y)\right]\right]. \]
Lemma 71.9 Cube of Fourier coefficients as an autocorrelation expectation
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean-valued function on the hypercube, and let \(g = (-1)^{f}\) denote its \(\pm 1\) lift. Then the double uniform expectation of the triple product of \(g\) over independent inputs and their componentwise XOR equals the sum of the cubes of the Fourier coefficients of \(g\):

\[ \mathbb {E}_{x}\! \left[\, \mathbb {E}_{y}\! \left[\, g(x)\, g(y)\, g(x \oplus y)\, \right]\right] \; =\; \sum _{S \subseteq [n]} \hat{g}(S)^{3}, \]

where \(x, y\) range uniformly over \(\{ 0,1\} ^n\), \((x \oplus y)_i = x_i \oplus y_i\), and \(\hat{g}(S) = \langle g, \chi _S \rangle \) is the Fourier coefficient at \(S \subseteq [n]\).

Let \(f,g:\{ 0,1\} ^n\to \{ 0,1\} \) be Boolean-valued functions, let \(S\subseteq [n]\), and let \(\varepsilon \in \mathbb {R}\). Write \(f^{\pm },g^{\pm }:\{ 0,1\} ^n\to \mathbb {R}\) for their \(\pm 1\) lifts, given by \(x\mapsto (-1)^{f(x)}\) and \(x\mapsto (-1)^{g(x)}\). Suppose that \(g^{\pm }\) coincides with the Walsh character \(\chi _S\), and that \(\operatorname{dist}(f,g)=\Pr _{x}[f(x)\ne g(x)]\ge \varepsilon \). Then the Fourier coefficient of \(f^{\pm }\) at \(S\) satisfies

\[ \widehat{f^{\pm }}(S)\; \le \; 1-2\varepsilon . \]
Lemma 71.11 Fourier coefficient bound for functions far from linear
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be \(\varepsilon \)-far from linear, meaning that \(0 \le \varepsilon \le 1\) and every linear function \(g : \{ 0,1\} ^n \to \{ 0,1\} \) (one satisfying \(g(x \oplus y) = g(x) \oplus g(y)\) for all \(x,y\)) has \(\Pr _{x}[f(x) \ne g(x)] \ge \varepsilon \) under the uniform distribution. Let \(F(x) = (-1)^{f(x)}\) be the \(\pm 1\) lift of \(f\). Then for every subset \(S \subseteq [n]\), the Fourier coefficient of \(F\) at \(S\) satisfies

\[ \hat F(S) \; =\; \mathbb {E}_{x}\bigl[F(x)\, \chi _S(x)\bigr] \; \le \; 1 - 2\varepsilon , \]

where \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\) is the Walsh character indexed by \(S\).

Lemma 71.12 Sum of cubed Fourier coefficients bounds distance to linearity
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean function and let \(\varepsilon \in \mathbb {R}\) with \(0 \le \varepsilon \le 1\), and suppose \(f\) is \(\varepsilon \)-far from linear: for every linear function \(g : \{ 0,1\} ^n \to \{ 0,1\} \) one has \(\operatorname{dist}(f,g) \ge \varepsilon \). Writing \(F = (-1)^{f}\) for the \(\pm 1\) lift of \(f\) and \(\hat F(S) = \langle F, \chi _S\rangle \) for its Fourier coefficient at \(S \subseteq [n]\), the sum of the cubed coefficients over all subsets satisfies

\[ \sum _{S \subseteq [n]} \hat F(S)^3 \; \le \; 1 - 2\varepsilon . \]
Lemma 71.13 Completeness of the BLR linearity test
✓

Let \(n\) be a natural number and let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be linear, meaning that \(f(x \oplus y) = f(x) \oplus f(y)\) for all \(x, y \in \{ 0,1\} ^n\). Then the BLR acceptance probability of \(f\) equals \(1\); that is, when \(x\) and \(y\) are drawn uniformly and independently from \(\{ 0,1\} ^n\), the test always accepts.

Lemma 71.14 Soundness of the BLR linearity test
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) and let \(\varepsilon \in \mathbb {R}\) satisfy \(0 \le \varepsilon \le 1\). Suppose \(f\) is \(\varepsilon \)-far from linear, meaning that every linear function \(g : \{ 0,1\} ^n \to \{ 0,1\} \) (one satisfying \(g(x \oplus y) = g(x) \oplus g(y)\) for all \(x, y\)) has distance \(\Pr _{x}[f(x) \ne g(x)] \ge \varepsilon \) from \(f\). Then the BLR acceptance probability of \(f\) satisfies

\[ \mathbb {E}_{x}\! \left[\mathbb {E}_{y}\! \left[\mathbf{1}\! \left[(-1)^{f(x \oplus y)} = (-1)^{f(x)}\, (-1)^{f(y)}\right]\right]\right] \; \le \; 1 - \varepsilon , \]

where \(x\) and \(y\) range uniformly over \(\{ 0,1\} ^n\); equivalently, the test rejects \(f\) with probability at least \(\varepsilon \).

71.3 Additional declarations

Lemma 71.15 Value of a linear Boolean function on an indicator vector
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a linear Boolean function, meaning \(f(x \oplus y) = f(x) \oplus f(y)\) for all \(x, y \in \{ 0,1\} ^n\), where \(\oplus \) is componentwise XOR. For a subset \(s \subseteq \{ 0, \dots , n-1\} \), let \(\mathbf{1}_s \in \{ 0,1\} ^n\) be its indicator vector, whose \(i\)-th coordinate is \(1\) when \(i \in s\) and \(0\) otherwise, and for each index \(i\) let \(e_i \in \{ 0,1\} ^n\) be the standard basis vector, whose \(i\)-th coordinate is \(1\) and all others \(0\). Then for every \(s\) the value \(f(\mathbf{1}_s)\) is \(0\) when

\[ \sum _{i \in s} \mathbf{1}[\, f(e_i) = 1\, ] \equiv 0 \pmod2, \]

and \(1\) otherwise; that is, \(f(\mathbf{1}_s)\) equals the parity of the number of \(i \in s\) with \(f(e_i) = 1\).

Lemma 71.16 Value of a linear Boolean function from its values on basis vectors
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a linear Boolean function, meaning \(f(x \oplus y) = f(x) \oplus f(y)\) for all \(x, y \in \{ 0,1\} ^n\), and for each coordinate \(i\) let \(e_i \in \{ 0,1\} ^n\) denote the standard basis vector that is \(1\) in position \(i\) and \(0\) elsewhere. Then for every \(x \in \{ 0,1\} ^n\), the value \(f(x)\) equals the parity of the number of coordinates \(i\) with \(x_i = 1\) and \(f(e_i) = 1\); that is, \(f(x) = 1\) if that count is odd and \(f(x) = 0\) if it is even.

Lemma 71.17 Multiplicativity of the Walsh characters
✓

Fix \(n\) and a subset \(S \subseteq [n]\), and let \(\chi _S(x) = \prod _{i \in S}(-1)^{x_i}\) be the associated Walsh character on the hypercube \(\{ 0,1\} ^n\). Then for all \(x, y \in \{ 0,1\} ^n\),

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

where \(x \oplus y\) denotes the componentwise XOR.

Lemma 71.18 XOR-additivity of a Boolean function whose lift is a character
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean-valued function whose \(\pm 1\) lift coincides with a Walsh character, say \(x \mapsto (-1)^{f(x)}\) equals \(\chi _S\) for some \(S \subseteq [n]\), and fix points \(x, y \in \{ 0,1\} ^n\). If the character is multiplicative at this pair, meaning \(\chi _S(x \oplus y) = \chi _S(x)\, \chi _S(y)\) where \(x \oplus y\) denotes the componentwise XOR, then

\[ (-1)^{f(x \oplus y)} \; =\; (-1)^{f(x) \oplus f(y)}. \]
Lemma 71.19 Value of a linear Boolean function from its action on basis vectors
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a linear Boolean function, meaning \(f(x \oplus y) = f(x) \oplus f(y)\) for all \(x, y \in \{ 0,1\} ^n\), where \(\oplus \) is componentwise XOR. For each coordinate \(i\), let \(e_i \in \{ 0,1\} ^n\) denote the standard basis vector that is \(1\) in coordinate \(i\) and \(0\) elsewhere. Then for every \(x \in \{ 0,1\} ^n\), the value \(f(x)\) is \(1\) if the number of coordinates \(i\) with \(x_i = 1\) and \(f(e_i) = 1\) is odd, and \(0\) if that number is even; equivalently, \(f(x)\) is the parity of \(\lvert \{ \, i : x_i = 1 \text{ and } f(e_i) = 1 \, \} \rvert \).

Lemma 71.20 XOR-additivity of a Boolean function that lifts to a character
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean-valued function whose \(\pm 1\) lift \(x \mapsto (-1)^{f(x)}\) coincides with the Walsh character \(\chi _S\) for some subset \(S \subseteq [n]\). Then for all \(x, y \in \{ 0,1\} ^n\),

\[ (-1)^{f(x \oplus y)} \; =\; (-1)^{f(x) \oplus f(y)}, \]

where \(x \oplus y\) denotes the componentwise XOR of \(x\) and \(y\) and \(f(x) \oplus f(y)\) the XOR of the two Boolean outputs.

Lemma 71.21 Pointwise \(\pm 1\) form of the BLR indicator
✓

Fix \(n \in \mathbb {N}\) and a Boolean-valued function \(f : \{ 0,1\} ^n \to \{ 0,1\} \), and let \(g : \{ 0,1\} ^n \to \mathbb {R}\) be its \(\pm 1\) lift, \(g(x) = (-1)^{f(x)}\). Then for all \(x, y \in \{ 0,1\} ^n\),

\[ \mathbf{1}\! \left[\, g(x \oplus y) = g(x)\, g(y) \, \right] \; =\; \frac{1 + g(x)\, g(y)\, g(x \oplus y)}{2}, \]

where \(x \oplus y\) denotes the componentwise XOR and the left-hand side is \(1\) when the equality holds and \(0\) otherwise.

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean-valued function, and let \(g : \{ 0,1\} ^n \to \mathbb {R}\) be its \(\pm 1\) lift, \(g(x) = (-1)^{f(x)}\). Writing \(g * g\) for the self-convolution \((g * g)(x) = \mathbb {E}_{y}\bigl[g(y)\, g(x \oplus y)\bigr]\) with respect to the uniform measure, and \(\hat g(S) = \mathbb {E}[g\, \chi _S]\) for the Fourier coefficient of \(g\) at \(S\), one has for every \(x \in \{ 0,1\} ^n\)

\[ (g * g)(x) \; =\; \sum _{S \subseteq [n]} \hat g(S)^2\, \chi _S(x), \]

where \(\chi _S(x) = \prod _{i \in S} (-1)^{x_i}\) is the Walsh character of \(S\). That is, the self-convolution of \(g\) has Fourier coefficients \(\hat g(S)^2\).

Lemma 71.23 Expectation of a function against its Fourier-expanded autocorrelation
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean function, and let \(g\) denote its \(\pm 1\) lift, so that \(g(x) = (-1)^{f(x)}\). Suppose that the convolution of \(g\) with itself admits the Fourier expansion

\[ (g * g)(x) \; =\; \sum _{S \subseteq [n]} \hat{g}(S)^2\, \chi _S(x) \qquad \text{for every } x \in \{ 0,1\} ^n, \]

where \(\chi _S\) is the Walsh character of \(S\) and \(\hat{g}(S) = \langle g, \chi _S\rangle \). Then

\[ \mathbb {E}_x\! \left[g(x)\, (g * g)(x)\right] \; =\; \sum _{S \subseteq [n]} \hat{g}(S)^2\, \mathbb {E}_x\! \left[g(x)\, \chi _S(x)\right], \]

the expectation being taken uniformly over \(x \in \{ 0,1\} ^n\).

Lemma 71.24 Product of \(\pm 1\) lifts as a disagreement indicator
✓

Let \(f, g : \{ 0,1\} ^n \to \{ 0,1\} \) be Boolean-valued functions on the hypercube, and write \(F, G : \{ 0,1\} ^n \to \mathbb {R}\) for their \(\pm 1\) lifts, given by \(F(x) = (-1)^{f(x)}\) and \(G(x) = (-1)^{g(x)}\). Then for every point \(x \in \{ 0,1\} ^n\),

\[ F(x)\, G(x) \; =\; 1 - 2\cdot \mathbf{1}\! \left[f(x) \ne g(x)\right], \]

so the product equals \(+1\) where \(f\) and \(g\) agree at \(x\) and \(-1\) where they disagree.

Lemma 71.25 Parseval identity for the sign lift of a Boolean function
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a Boolean-valued function, and let \(g : \{ 0,1\} ^n \to \mathbb {R}\) be its \(\pm 1\) lift, given by \(g(x) = (-1)^{f(x)}\). Then the Fourier coefficients \(\hat g(S) = \langle g, \chi _S\rangle \), taken over all subsets \(S \subseteq [n]\), satisfy

\[ \sum _{S \subseteq [n]} \hat g(S)^2 \; =\; 1. \]
Lemma 71.26 Per-coefficient cube bound for functions far from linear
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be \(\varepsilon \)-far from linear, meaning that \(0 \le \varepsilon \le 1\) and every linear function \(g : \{ 0,1\} ^n \to \{ 0,1\} \) (one satisfying \(g(x \oplus y) = g(x) \oplus g(y)\) for all \(x,y\)) has distance \(\Pr _{x}[f(x) \ne g(x)] \ge \varepsilon \) from \(f\). Write \(\hat F(S) = \mathbb {E}[F \cdot \chi _S]\) for the Fourier coefficient of \(F = (-1)^{f}\), the \(\pm 1\) lift of \(f\), at a subset \(S \subseteq [n]\). Then for every such \(S\),

\[ \hat F(S)^3 \; \le \; \hat F(S)^2\, (1 - 2\varepsilon ). \]
Lemma 71.27 Linearity gives additivity on XOR
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a linear function, meaning that \(f(x \oplus y) = f(x) \oplus f(y)\) for all \(x, y \in \{ 0,1\} ^n\), where \(\oplus \) denotes componentwise XOR. Then for all \(x, y \in \{ 0,1\} ^n\) we have \(f(x \oplus y) = f(x) \oplus f(y)\).

Lemma 71.28 Multiplicativity of the sign lift of an XOR-homomorphism
✓

Let \(f : \{ 0,1\} ^n \to \{ 0,1\} \) be a function that respects componentwise XOR, meaning \(f(x \oplus y) = f(x) \oplus f(y)\) for all \(x, y \in \{ 0,1\} ^n\), and let \(g : \{ 0,1\} ^n \to \mathbb {R}\) be its \(\pm 1\) lift, \(g(x) = (-1)^{f(x)}\). Then \(g\) turns XOR into multiplication:

\[ g(x \oplus y) \; =\; g(x)\, g(y) \qquad \text{for all } x, y \in \{ 0,1\} ^n. \]