AFTD Auto-Formalizing Theoretical Domains

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.
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
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)])
See it in the graphDiscuss this resultChallenge it