AFTD Auto-Formalizing Theoretical Domains

Bonami.expect_sq_nonneg

theoremverifiedimported Lean

Nonnegativity of the mean square. For every Boolean function $f : \{0,1\}^n \to \bbr$, the expectation of $f^2$ under the uniform measure is nonnegative: $0 \le \E[f^2]$, where $\E[f^2] = 2^{-n}\sum_{x\in\{0,1\}^n} f(x)^2$.

Statement

open BooleanAnalysis in
lemma Bonami.expect_sq_nonneg {n : ℕ} (f : BooleanFunc n) :
    0 ≤ expect (fun x => f x ^ 2)
Source
TCSlib, `Bonami.expect_sq_nonneg`
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 2
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

open BooleanAnalysis in/-- Shows that the expectation of a square is nonnegative. **Source:** [OD14, Cor. 9.6 (proof)]. -/lemma Bonami.expect_sq_nonneg {n : ℕ} (f : BooleanFunc n) :    0 ≤ expect (fun x => f x ^ 2) := by  exact mul_nonneg (pow_nonneg (by norm_num) _)    (Finset.sum_nonneg fun _ _ => sq_nonneg _)
See it in the graphDiscuss this resultChallenge it