BoolBLR.BLR_soundness_via_fourier
theoremverifiedimported Lean
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 \bbr$ 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 $\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. \]
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open Finset BoolFourier in lemma BoolBLR.BLR_soundness_via_fourier {n : ℕ} (f : hypercube n → Bool) (ε : ℝ) (hfar : epsilon_far_from_linear f ε) : ∑ S : Finset (Fin n), (fourier_coeff (lift_pm1 f) S) ^ 3 ≤ 1 - 2 * ε
- Source
- TCSlib, `BoolBLR.BLR_soundness_via_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.BoolBLR.BLR_soundness_via_fourier← BoolBLR.BLR_soundness_via_fourier (TCSlib/BooleanAnalysis/BLR/BoolBLR.lean:336): adapted
What was changed in
BoolBLR.BLR_soundness_via_fourier--- TCSlib/BooleanAnalysis/BLR/BoolBLR.lean:336 (BoolBLR.BLR_soundness_via_fourier) +++ as compiled here @@ -1,5 +1,5 @@ -/-- Proves the Fourier-analytic upper bound on BLR acceptance for far functions. - -**Source:** [OD14, §1.6]. -/ -lemma BLR_soundness_via_fourier {n : ℕ} +set_option autoImplicit true in +set_option relaxedAutoImplicit true in +open Finset BoolFourier in +lemma BoolBLR.BLR_soundness_via_fourier {n : ℕ} (f : hypercube n → Bool) @@ -12,2 +12,2 @@ -- Sum the per-S bound and apply Parseval. - convert Finset.sum_le_sum fun S _ => (BLR_soundness_via_fourier_aux_h_bound f ε hfar) S using 1 ; rw [ ← Finset.sum_mul _ _ _ ] ; simp_all only [one_mul, (BLR_soundness_via_fourier_aux_hparseval f)]; + convert Finset.sum_le_sum fun S _ => (BLR_soundness_via_fourier_aux_h_bound f ε hfar) S using 1 <;> first | rfl | (rw [ ← Finset.sum_mul _ _ _ ] ; simp_all only [one_mul, (BLR_soundness_via_fourier_aux_hparseval f)]) - Verified
- 16 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 17
- BoolBLR.BLR_soundness_via_fourier_aux_h_boundPer-coefficient cube bound for functions far from linear. Let $f : \{0,1\}^n \to \{0,1\}$ be $\varepsilon$-far from linear, meaning that…
- BoolBLR.epsilon_far_from_linearA function $f : \{0,1\}^n \to \{0,1\}$ is $\varepsilon$-far from linear if $0 \le \varepsilon \le 1$ and for every linear function…
- 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…
- BoolBLR.BLR_soundness_via_fourier_aux_hparsevalParseval identity for the sign lift of a Boolean function. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean-valued function, and let…
- 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.hypercubeThe Boolean hypercube of dimension $n$ is the type $\{0,1\}^n$, defined as an abbreviation for
BooleanAnalysis.BoolCube$n$. - BooleanAnalysis.boolToSign_falseSign encoding of false. Under the sign encoding $\sigma\colon\mathrm{Bool}\to\{-1,1\}$, the Boolean value $\mathrm{false}$ is sent to $1$;…
- BooleanAnalysis.boolToSign_trueSign encoding of false. Under the sign encoding $\sigma\colon\mathrm{Bool}\to\{-1,1\}$, the Boolean value $\mathrm{false}$ is sent to $1$;…
- BooleanAnalysis.boolToSign_sqSign encoding of false. Under the sign encoding $\sigma\colon\mathrm{Bool}\to\{-1,1\}$, the Boolean value $\mathrm{false}$ is sent to $1$;…
- BooleanAnalysis.boolToSign_mul_selfSign encoding of false. Under the sign encoding $\sigma\colon\mathrm{Bool}\to\{-1,1\}$, the Boolean value $\mathrm{false}$ is sent to $1$;…
- BooleanAnalysis.chiS_singletonValue of a singleton Walsh character. Fix a dimension $n$, a coordinate $i \in [n]$, and a point $x$ of the Boolean hypercube $\{0,1\}^n$.…
- BooleanAnalysis.sum_boolToSignSign encoding sums to zero over the Booleans. Let $\sigma\colon\mathrm{Bool}\to\{-1,1\}$ be the sign encoding, sending the value *false*…
- BooleanAnalysis.innerProduct_chi_selfWalsh characters have unit norm. Let $n$ be a natural number and let $S \subseteq [n]$. Under the uniform measure on the Boolean hypercube…
- BooleanAnalysis.flipBit_flipBitBit-flip is an involution. For a point $x$ in the Boolean hypercube $\{0,1\}^n$ and a coordinate $i$, flipping the $i$-th coordinate of…
- BooleanAnalysis.boolToSign_notSign encoding of false. Under the sign encoding $\sigma\colon\mathrm{Bool}\to\{-1,1\}$, the Boolean value $\mathrm{false}$ is sent to $1$;…
- BooleanAnalysis.instAddCommGroupBooleanFuncBoolean functions form an
ℝ-vector space. - BooleanAnalysis.instModuleRealBooleanFuncBooleanAnalysis.instModuleRealBooleanFunc
- 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 in set_option relaxedAutoImplicit true in open Finset BoolFourier in /-- Proves the Fourier-analytic upper bound on BLR acceptance for far functions. **Source:** [OD14, §1.6]. -/ lemma BoolBLR.BLR_soundness_via_fourier {n : ℕ} (f : hypercube n → Bool) (ε : ℝ) (hfar : epsilon_far_from_linear f ε) : ∑ S : Finset (Fin n), (fourier_coeff (lift_pm1 f) S) ^ 3 ≤ 1 - 2 * ε := by -- Parseval for ±1-valued lift_pm1: each (lift_pm1 f)(x)^2 = 1, so ‖f‖_2^2 = 1. -- f̂(S)^3 = f̂(S)^2 · f̂(S) ≤ f̂(S)^2 · (1 - 2ε), since f̂(S)^2 ≥ 0 and f̂(S) ≤ 1 - 2ε. -- Sum the per-S bound and apply Parseval. convert Finset.sum_le_sum fun S _ => (BLR_soundness_via_fourier_aux_h_bound f ε hfar) S using 1 <;> first | rfl | (rw [ ← Finset.sum_mul _ _ _ ] ; simp_all only [one_mul, (BLR_soundness_via_fourier_aux_hparseval f)])