AFTD Auto-Formalizing Theoretical Domains

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.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
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/-- 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]
See it in the graphDiscuss this resultChallenge it