Bonami.expect_cs_sq
theoremverifiedimported Lean
Cauchy–Schwarz for the uniform expectation. Let $g, h : \{0,1\}^n \to \bbr$ be Boolean functions, and let $\E[\,\cdot\,]$ denote the expectation under the uniform measure on the hypercube $\{0,1\}^n$. Then \[ \bigl(\E[g^2 h^2]\bigr)^2 \;\le\; \E[g^4]\cdot\E[h^4]. \]
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open BooleanAnalysis in lemma Bonami.expect_cs_sq {n : ℕ} (g h : BooleanFunc n) : expect (fun x => g x ^ 2 * h x ^ 2) ^ 2 ≤ expect (fun x => g x ^ 4) * expect (fun x => h x ^ 4)
- Source
- TCSlib, `Bonami.expect_cs_sq`
- 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.Bonami.expect_cs_sq← Bonami.expect_cs_sq (TCSlib/BooleanAnalysis/Hypercontractivity/Decomposition.lean:211): verbatim
- Verified
- 07 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 4
- 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). \]
- BooleanAnalysis.BoolCubeThe Boolean hypercube of dimension $n$ is $\{0,1\}^n$, represented as the function type $\mathrm{Fin}\,n \to \mathrm{Bool}$.
- 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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option autoImplicit true inset_option relaxedAutoImplicit true inopen BooleanAnalysis in/-- Applies Cauchy--Schwarz to the square functions of two Boolean functions. **Source:** [OD14, Cor. 9.6 (proof)]. -/lemma Bonami.expect_cs_sq {n : ℕ} (g h : BooleanFunc n) : expect (fun x => g x ^ 2 * h x ^ 2) ^ 2 ≤ expect (fun x => g x ^ 4) * expect (fun x => h x ^ 4) := by norm_num [expect] at * have h_cauchy_schwarz : (∑ x, g x ^ 2 * h x ^ 2) ^ 2 ≤ (∑ x, g x ^ 4) * (∑ x, h x ^ 4) := by have h_cs : ∀ u v : BoolCube n → ℝ, (∑ x, u x * v x) ^ 2 ≤ (∑ x, u x ^ 2) * (∑ x, v x ^ 2) := fun u v => Finset.sum_mul_sq_le_sq_mul_sq Finset.univ u v convert h_cs (fun x => g x ^ 2) (fun x => h x ^ 2) using 3 <;> ring nlinarith [show 0 ≤ uniformWeight n ^ 2 by positivity]