AFTD Auto-Formalizing Theoretical Domains

Bonami.fourierCoeff_diffLast

theoremverifiedimported Lean

Fourier coefficient of the half-difference over the last coordinate. Let $f\colon\{0,1\}^{n+1}\to\bbr$ be a Boolean function on $n+1$ variables, and let $g\colon\{0,1\}^{n}\to\bbr$ be its half-difference over the last coordinate, given by $g(x)=\tfrac12\bigl(f(x,0)-f(x,1)\bigr)$. For every frequency set $S\subseteq\{1,\dots,n\}$, the Fourier--Walsh coefficient of $g$ at $S$ equals the Fourier--Walsh coefficient of $f$ at the frequency set obtained by regarding $S$ as a subset of the first $n$ coordinates of $\{1,\dots,n+1\}$ and adjoining the last coordinate: \[ \hat g(S) \;=\; \hat f\bigl(S\cup\{n+1\}\bigr). \]

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open BooleanAnalysis in
lemma Bonami.fourierCoeff_diffLast {n : ℕ} (f : BooleanFunc (n + 1)) (S : Finset (Fin n)) :
    BooleanAnalysis.fourierCoeff (diffLast f) S =
      BooleanAnalysis.fourierCoeff f (S.image Fin.castSucc ∪ {Fin.last n})
Source
TCSlib, `Bonami.fourierCoeff_diffLast`
Lean proof
By Owen McGinty (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 9
  • BooleanAnalysis.expectThe expectation of $f$ under the uniform measure: \[ \E[f] \;=\; 2^{-n}\sum_{x\in\{0,1\}^n} f(x). \]
  • Bonami.diffLastThe half-difference $\mathrm{diffLast}\,f$ of $f$ over its last coordinate is the function on $n$ variables given by…
  • 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…
  • Bonami.uniformWeight_succUniform weight halves with each added coordinate. For every natural number $n$, the uniform weight $2^{-n}$ assigned to each point of…
  • BooleanAnalysis.innerProductThe $L^2$ inner product of two Boolean functions with respect to the uniform measure:…
  • Bonami.restrictLastGiven a Boolean function $f$ on $n+1$ variables and a bit $b$, the restriction $\mathrm{restrictLast}\,f\,b$ is the function on $n$…
  • BooleanAnalysis.chiSThe Walsh--Fourier character associated to $S\subseteq[n]$ is…
  • BooleanAnalysis.BooleanFuncA Boolean function of arity $n$ is a function $f : \{0,1\}^n \to \bbr$.
Used by 1
  • Bonami.degree_diffLastDegree bound for the half-difference over the last coordinate. Let $f\colon\{0,1\}^{n+1}\to\bbr$ be a Boolean function of degree at most…

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen BooleanAnalysis in/-- The Fourier coefficient of `diffLast f` at `S` is the lifted coefficient containing the final coordinate. **Source:** [OD14, Cor. 9.6 (proof)]. -/lemma Bonami.fourierCoeff_diffLast {n : ℕ} (f : BooleanFunc (n + 1)) (S : Finset (Fin n)) :    BooleanAnalysis.fourierCoeff (diffLast f) S =      BooleanAnalysis.fourierCoeff f (S.image Fin.castSucc ∪ {Fin.last n}) := by  unfold diffLast BooleanAnalysis.fourierCoeff innerProduct expect chiS restrictLast  rw [uniformWeight_succ]  rw [show (Finset.univ : Finset (Fin (n + 1) → Bool)) =    Finset.image (fun x : Fin n → Bool => Fin.snoc x Bool.false) Finset.univ ∪      Finset.image (fun x : Fin n → Bool => Fin.snoc x Bool.true) Finset.univ from ?_,    Finset.sum_union]  · rw [Finset.sum_image, Finset.sum_image] <;>      norm_num [Finset.prod_union, Finset.prod_image]    ring_nf    · simp +decide only [mul_assoc, Finset.sum_add_distrib, Finset.sum_mul _ _ _]      rw [mul_add]    · exact fun x y h => by simpa using congrArg Fin.init h    · exact fun x y h => by simpa using congrArg Fin.init h  · norm_num [Finset.disjoint_left]  · ext x    by_cases hx : x (Fin.last n) <;>      simp +decide only [Finset.mem_univ, Finset.mem_union, Finset.mem_image, true_and, true_iff]    · exact Or.inr ⟨fun i => x i.castSucc, by        ext i        cases i using Fin.lastCases <;> aesop⟩    · exact Or.inl ⟨fun i => x i.castSucc, by        ext i        cases i using Fin.lastCases <;> aesop⟩
See it in the graphDiscuss this resultChallenge it