AFTD Auto-Formalizing Theoretical Domains

Bonami.fourth_moment_decomp

theoremverifiedimported Lean

Fourth-moment decomposition over the last coordinate. Let $f : \{0,1\}^{n+1} \to \bbr$ be a Boolean function on $n+1$ variables, and let $g$ and $h$ be the average and the half-difference of $f$ over its last coordinate, so that $g(x) = \tfrac12\bigl(f(x,0) + f(x,1)\bigr)$ and $h(x) = \tfrac12\bigl(f(x,0) - f(x,1)\bigr)$ for $x \in \{0,1\}^n$. Then, with all expectations taken under the uniform measure, the fourth moment of $f$ decomposes as \[ \E[f^4] \;=\; \E[g^4] + 6\,\E[g^2 h^2] + \E[h^4]. \]

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open BooleanAnalysis in
lemma Bonami.fourth_moment_decomp {n : ℕ} (f : BooleanFunc (n + 1)) :
    expect (fun x => f x ^ 4) =
    expect (fun x => avgLast f x ^ 4) +
      6 * expect (fun x => avgLast f x ^ 2 * diffLast f x ^ 2) +
      expect (fun x => diffLast f x ^ 4)
Source
TCSlib, `Bonami.fourth_moment_decomp`
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 6
  • 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…
  • Bonami.expect_succ_eqExpectation splits over the last coordinate. Let $\varphi : \{0,1\}^{n+1} \to \bbr$ be a Boolean function on $n+1$ variables, and for a…
  • Bonami.avgLastThe average $\mathrm{avgLast}\,f$ of $f$ over its last coordinate is the function on $n$ variables given by…
  • 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.BooleanFuncA Boolean function of arity $n$ is a function $f : \{0,1\}^n \to \bbr$.
Used by 1
  • Bonami.bonami_expectBonami inequality in expectation form. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function of degree at most $k$, meaning that every…

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen BooleanAnalysis in/-- Decomposes a fourth moment into the average and half-difference components. **Source:** [OD14, Cor. 9.6 (proof), Eq. (9.1)]. -/lemma Bonami.fourth_moment_decomp {n : ℕ} (f : BooleanFunc (n + 1)) :    expect (fun x => f x ^ 4) =    expect (fun x => avgLast f x ^ 4) +      6 * expect (fun x => avgLast f x ^ 2 * diffLast f x ^ 2) +      expect (fun x => diffLast f x ^ 4) := by  have h_decomp :      expect (fun x => f x ^ 4) =        expect (fun x => (avgLast f x + diffLast f x) ^ 4) / 2 +        expect (fun x => (avgLast f x - diffLast f x) ^ 4) / 2 := by    convert expect_succ_eq (fun x => f x ^ 4) using 1    unfold expect restrictLast avgLast diffLast    ring_nf    rfl  rw [h_decomp]  ring_nf  norm_num [Finset.sum_add_distrib, Finset.mul_sum _ _ _, Finset.sum_mul]  ring_nf  unfold expect  norm_num [Finset.sum_add_distrib, Finset.mul_sum _ _ _, Finset.sum_mul]  ring_nf  simpa only [mul_assoc, ← Finset.mul_sum _ _ _, ← Finset.sum_mul] using by ring
See it in the graphDiscuss this resultChallenge it