AFTD Auto-Formalizing Theoretical Domains

BoolFourier.fourier_expansion

theoremverifiedimported Lean

Fourier–Walsh expansion. Let $f : \{0,1\}^n \to \bbr$ 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$.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open Finset BooleanAnalysis in
lemma BoolFourier.fourier_expansion {n : ℕ} (f : BoolFun n) (x : hypercube n) :
    f x = ∑ S : Finset (Fin n), fourier_coeff f S * char_S S x
Source
TCSlib, `BoolFourier.fourier_expansion`
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 6
  • BooleanAnalysis.walsh_expansionWalsh–Fourier expansion of a Boolean function. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function of arity $n$. Then at every point…
  • BoolFourier.fourier_coeff_eqAgreement of two Fourier coefficient definitions. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function of arity $n$, and let…
  • 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.hypercubeThe Boolean hypercube of dimension $n$ is the type $\{0,1\}^n$, defined as an abbreviation for BooleanAnalysis.BoolCube $n$.
  • 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. \]
  • BoolFourier.BoolFunA Boolean function of arity $n$ is an element of type $\{0,1\}^n \to \mathbb{R}$, defined as an abbreviation for…
Used by 1

Lean source view module on GitHub

set_option relaxedAutoImplicit false inset_option autoImplicit false inopen Finset BooleanAnalysis in/-- Gives the Fourier--Walsh expansion of a Boolean-cube function. **Source:** [OD14, §1.3]. -/lemma BoolFourier.fourier_expansion {n : ℕ} (f : BoolFun n) (x : hypercube n) :    f x = ∑ S : Finset (Fin n), fourier_coeff f S * char_S S x := by  simp_rw [fourier_coeff_eq]  exact walsh_expansion f x-- ∑_S f̂(S)² = ‖f‖₂²
See it in the graphDiscuss this resultChallenge it