AFTD Auto-Formalizing Theoretical Domains

BoolBLR.triple_expectation_eq_cube_fourier

theoremverifiedimported Lean

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$: \[ \E_{x}\!\left[\,\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]$.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Finset BoolFourier in
lemma BoolBLR.triple_expectation_eq_cube_fourier {n : ℕ} (f : hypercube n → Bool) :
  expectation (fun x =>
    expectation (fun y =>
      lift_pm1 f x * lift_pm1 f y * lift_pm1 f (xor_vec x y)))
  = ∑ S : Finset (Fin n), (fourier_coeff (lift_pm1 f) S) ^ 3
Source
TCSlib, `BoolBLR.triple_expectation_eq_cube_fourier`
Lean proof
By Prastik Mohanraj, from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Copyright (c) 2026 Prastik Mohanraj. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
What was changed in BoolBLR.triple_expectation_eq_cube_fourier
--- TCSlib/BooleanAnalysis/BLR/BoolBLR.lean:245 (BoolBLR.triple_expectation_eq_cube_fourier)
+++ as compiled here
@@ -1,5 +1,5 @@
-/-- Expresses the BLR triple correlation as the cube-sum of Fourier coefficients.
-
-**Source:** [OD14, §1.6 (Fourier soundness proof)]. -/
-lemma triple_expectation_eq_cube_fourier {n : ℕ} (f : hypercube n → Bool) :
+set_option autoImplicit true in
+set_option relaxedAutoImplicit true in
+open Finset BoolFourier in
+lemma BoolBLR.triple_expectation_eq_cube_fourier {n : ℕ} (f : hypercube n → Bool) :
   expectation (fun x =>
@@ -15,2 +15,3 @@
   simp +decide only [Finset.sum_div, Finset.mul_sum _ _ _, mul_div]
+  all_goals (rw [pow_succ]; rfl)
 
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 8
  • BoolFourier.expectationFor $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). \]
  • BoolFourier.convolutionThe 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]. \]
  • BoolFourier.xor_vecFor $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…
  • BoolFourier.hypercubeThe Boolean hypercube of dimension $n$ is the type $\{0,1\}^n$, defined as an abbreviation for BooleanAnalysis.BoolCube $n$.
  • BoolBLR.triple_expectation_eq_cube_fourier_aux_h_substituteExpectation of a function against its Fourier-expanded autocorrelation. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean function, and let $g$…
  • BoolFourier.fourier_coeffThe Fourier coefficient of $f : \{0,1\}^n \to \mathbb{R}$ at $S \subseteq [n]$ is \[ \hat f(S) = \langle f, \chi_S \rangle. \]
  • BoolBLR.triple_expectation_eq_cube_fourier_aux_h_convolutionFourier expansion of the self-convolution. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean-valued function, and let $g : \{0,1\}^n \to \bbr$…
  • BoolBLR.lift_pm1Given $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…
Used by 1
  • BoolBLR.BLR_soundnessSoundness of the BLR linearity test. Let $f : \{0,1\}^n \to \{0,1\}$ and let $\varepsilon \in \bbr$ satisfy $0 \le \varepsilon \le 1$.…

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Finset BoolFourier in/-- Expresses the BLR triple correlation as the cube-sum of Fourier coefficients. **Source:** [OD14, §1.6 (Fourier soundness proof)]. -/lemma BoolBLR.triple_expectation_eq_cube_fourier {n : ℕ} (f : hypercube n → Bool) :  expectation (fun x =>    expectation (fun y =>      lift_pm1 f x * lift_pm1 f y * lift_pm1 f (xor_vec x y)))  = ∑ S : Finset (Fin n), (fourier_coeff (lift_pm1 f) S) ^ 3 := by  -- Step 1: Fourier expansion of f * f, with coefficients f̂(S)^2 by BoolFourier.convolution thm.  -- Step 2: substitute into E[f(x)·(f*f)(x)] and pull the Fourier sum out.  -- The final step: each E[f·χ_S] = f̂(S), so f̂(S)^2 · f̂(S) = f̂(S)^3.  convert (triple_expectation_eq_cube_fourier_aux_h_substitute f (triple_expectation_eq_cube_fourier_aux_h_convolution f)) using 2;  unfold BoolFourier.convolution; norm_num [ mul_assoc, mul_comm, mul_left_comm, Finset.mul_sum _ _ _ ] ;  unfold expectation; norm_num [ Finset.mul_sum _ _ _ ] ;  simp +decide only [Finset.sum_div, Finset.mul_sum _ _ _, mul_div]  all_goals (rw [pow_succ]; rfl)-- if f is epsilon-far from a given linear function (i.e., chi_S), then f-hat (S) ≤ 1 - 2 * ε
See it in the graphDiscuss this resultChallenge it