AFTD Auto-Formalizing Theoretical Domains

BoolBLR.triple_expectation_eq_cube_fourier_aux_h_substitute

theoremverifiedimported Lean

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 \[ \E_x\!\left[g(x)\,(g * g)(x)\right] \;=\; \sum_{S \subseteq [n]} \hat{g}(S)^2\,\E_x\!\left[g(x)\,\chi_S(x)\right], \] the expectation being taken uniformly over $x \in \{0,1\}^n$.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Finset BoolFourier in
lemma BoolBLR.triple_expectation_eq_cube_fourier_aux_h_substitute {n : ℕ} (f : BoolFourier.hypercube n → Bool) (h_convolution : ∀ (x : BooleanAnalysis.BoolCube n),
  BoolFourier.convolution (lift_pm1 f) (lift_pm1 f) x =
    ∑ S, BoolFourier.fourier_coeff (lift_pm1 f) S ^ 2 * BoolFourier.char_S S x) :
    (BoolFourier.expectation fun x => lift_pm1 f x * BoolFourier.convolution (lift_pm1 f) (lift_pm1 f) x) =
  ∑ S,
    BoolFourier.fourier_coeff (lift_pm1 f) S ^ 2 *
      BoolFourier.expectation fun x => lift_pm1 f x * BoolFourier.char_S S x
Source
TCSlib, `BoolBLR.triple_expectation_eq_cube_fourier_aux_h_substitute`
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.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 7
  • 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.char_SFor 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}, \]…
  • 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.hypercubeThe Boolean hypercube of dimension $n$ is the type $\{0,1\}^n$, defined as an abbreviation for BooleanAnalysis.BoolCube $n$.
  • BooleanAnalysis.BoolCubeThe Boolean hypercube of dimension $n$ is $\{0,1\}^n$, represented as the function type $\mathrm{Fin}\,n \to \mathrm{Bool}$.
  • 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.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

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Finset BoolFourier inlemma BoolBLR.triple_expectation_eq_cube_fourier_aux_h_substitute {n : ℕ} (f : BoolFourier.hypercube n → Bool) (h_convolution : ∀ (x : BooleanAnalysis.BoolCube n),  BoolFourier.convolution (lift_pm1 f) (lift_pm1 f) x =    ∑ S, BoolFourier.fourier_coeff (lift_pm1 f) S ^ 2 * BoolFourier.char_S S x) :    (BoolFourier.expectation fun x => lift_pm1 f x * BoolFourier.convolution (lift_pm1 f) (lift_pm1 f) x) =  ∑ S,    BoolFourier.fourier_coeff (lift_pm1 f) S ^ 2 *      BoolFourier.expectation fun x => lift_pm1 f x * BoolFourier.char_S S x :=  by  simp +decide only [h_convolution, Finset.mul_sum _ _ _, expectation];  rw [ Finset.sum_comm ] ; simp +decide [ div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm, Finset.mul_sum _ _ _] ;
See it in the graphDiscuss this resultChallenge it