AFTD Auto-Formalizing Theoretical Domains

KKL.lowDegree_l2_error

theoremverifiedimported Lean

$L^2$ error of the low-degree truncation. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function, and for a natural number $k$ let $f_{\le k}(x) = \sum_{\abs{S}\le k} \hat f(S)\,\chi_S(x)$ be its low-degree part, retaining only the Fourier--Walsh coefficients of degree at most $k$. Then, under the uniform measure on the cube, the squared $L^2$ distance between $f$ and this truncation equals the total Fourier weight sitting above level $k$: \[ \E\big[(f(x) - f_{\le k}(x))^2\big] \;=\; \sum_{\abs{S} > k} \hat f(S)^2 . \]

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
set_option maxHeartbeats 800000 in
open scoped BigOperators in
open BooleanAnalysis in
variable {n : ℕ} in
open Classical in
lemma KKL.lowDegree_l2_error (f : BooleanFunc n) (k : ℕ) :
    l2DistSq f (lowDegreePart f k) =
    ∑ S : Finset (Fin n), if k < S.card then fourierCoeff f S ^ 2 else 0
Source
TCSlib, `KKL.lowDegree_l2_error`
Lean proof
By Mina, Owen McGinty, Hydroxyi (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (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 13
  • BooleanAnalysis.uniformWeightThe uniform probability measure on $\{0,1\}^n$ assigns weight $2^{-n}$ to each point.
  • BooleanAnalysis.expectThe expectation of $f$ under the uniform measure: \[ \E[f] \;=\; 2^{-n}\sum_{x\in\{0,1\}^n} f(x). \]
  • KKL.lowDegreePartThe low-degree part of $f$ at level $k$ keeps only the Fourier coefficients of degree at most $k$:…
  • KKL.low_plus_high_eqLow and high degree parts reconstruct the function. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function and let $k \in \bbn$ be a threshold…
  • BooleanAnalysis.fourierCoeffThe Fourier--Walsh coefficient of $f$ at frequency $S$ is…
  • 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.innerProductThe $L^2$ inner product of two Boolean functions with respect to the uniform measure:…
  • KKL.fourierCoeff_lowDegreePartFourier coefficients of the low-degree truncation. Let $f\colon\{0,1\}^n\to\bbr$ be a Boolean function and $k$ a natural number. For every…
  • KKL.highDegreePartThe high-degree part of $f$ at level $k$ keeps only the Fourier coefficients of degree strictly greater than $k$:…
  • BooleanAnalysis.chiSThe Walsh--Fourier character associated to $S\subseteq[n]$ is…
  • KKL.l2DistSqThe squared $L^2$ distance between two Boolean functions is $\E\big[(f(x) - g(x))^2\big]$ under the uniform measure on the cube.
  • BooleanAnalysis.BooleanFuncA Boolean function of arity $n$ is a function $f : \{0,1\}^n \to \bbr$.
  • BooleanAnalysis.parsevalParseval's identity for Boolean functions. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function, and equip $\{0,1\}^n$ with the uniform…
Used by 1
  • KKL.lowDegree_approxLow-degree approximation error bound. Let $f\colon\{0,1\}^n\to\bbr$ be a Boolean function and let $k\ge 1$ be an integer. Writing…

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inset_option maxHeartbeats 800000 inopen scoped BigOperators inopen BooleanAnalysis invariable {n : ℕ} inopen Classical inlemma KKL.lowDegree_l2_error (f : BooleanFunc n) (k : ℕ) :    l2DistSq f (lowDegreePart f k) =    ∑ S : Finset (Fin n), if k < S.card then fourierCoeff f S ^ 2 else 0 := by  -- Step 1: f x - lowDegreePart f k x = highDegreePart f k x  have hfg : ∀ x, f x - lowDegreePart f k x = highDegreePart f k x := by    intro x; linarith [low_plus_high_eq f k x]  -- Step 2: l2DistSq = innerProduct (highDegreePart f k) (highDegreePart f k)  have step2 : l2DistSq f (lowDegreePart f k) =      innerProduct (highDegreePart f k) (highDegreePart f k) := by    simp only [l2DistSq, innerProduct, expect]    congr 1; congr 1; ext x    rw [hfg x, sq]  rw [step2, parseval]  -- Step 3: compute fourierCoeff of highDegreePart  congr 1; ext S  have hfour : fourierCoeff (highDegreePart f k) S =      if k < S.card then fourierCoeff f S else 0 := by    have hdef : highDegreePart f k = fun x => f x - lowDegreePart f k x :=      funext (fun x => (hfg x).symm)    rw [hdef]    unfold BooleanAnalysis.fourierCoeff innerProduct expect    rw [show uniformWeight n * ∑ x, (f x - lowDegreePart f k x) * chiS S x =        uniformWeight n * ∑ x, f x * chiS S x -        uniformWeight n * ∑ x, lowDegreePart f k x * chiS S x from by      rw [← mul_sub, ← Finset.sum_sub_distrib]      congr 1      apply Finset.sum_congr rfl; intro x _; ring]    change fourierCoeff f S - fourierCoeff (lowDegreePart f k) S =        if k < S.card then fourierCoeff f S else 0    rw [fourierCoeff_lowDegreePart]    by_cases h : S.card ≤ k    · simp [h, Nat.not_lt.mpr h]    · simp [h, Nat.lt_of_not_le h]  rw [hfour]  split_ifs <;> simp-- Step 09: Tail Fourier weight bound: sum_{|S|>k} fhat(S)^2 <= I[f] / k.-- This is the key estimate: levels > k contribute at most I[f]/k to Parseval.
See it in the graphDiscuss this resultChallenge it