BooleanAnalysis.innerProduct_self_pm_one
theoremverifiedimported Lean
Self-inner product of a sign function. Let $f : \{0,1\}^n \to \bbr$ be a $\pm 1$-valued Boolean function, so that $f(x) \in \{-1, 1\}$ for every $x \in \{0,1\}^n$. Then its $L^2$ inner product with itself, taken with respect to the uniform measure on the cube, equals $1$: \[ \langle f, f \rangle \;=\; 2^{-n}\sum_{x \in \{0,1\}^n} f(x)^2 \;=\; 1. \]
Statement
set_option maxHeartbeats 400000 in open scoped BigOperators in variable {n : ℕ} in lemma BooleanAnalysis.innerProduct_self_pm_one (f : BooleanFunc n) (hf : isPmOne f) : innerProduct f f = 1
- Source
- TCSlib, `BooleanAnalysis.innerProduct_self_pm_one`
- Lean proof
- By Jingzhen Sha, Allan Li, Hydroxyi, Mina, 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.BooleanAnalysis.innerProduct_self_pm_one← BooleanAnalysis.innerProduct_self_pm_one (TCSlib/BooleanAnalysis/Basic.lean:1077): verbatim
- Verified
- 07 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 5
- BooleanAnalysis.uniformWeightThe uniform probability measure on $\{0,1\}^n$ assigns weight $2^{-n}$ to each point.
- BooleanAnalysis.BoolCubeThe Boolean hypercube of dimension $n$ is $\{0,1\}^n$, represented as the function type $\mathrm{Fin}\,n \to \mathrm{Bool}$.
- BooleanAnalysis.innerProductThe $L^2$ inner product of two Boolean functions with respect to the uniform measure:…
- BooleanAnalysis.isPmOne$f$ is $\pm 1$-valued if $f(x)\in\{-1,1\}$ for all $x$.
- BooleanAnalysis.BooleanFuncA Boolean function of arity $n$ is a function $f : \{0,1\}^n \to \bbr$.
- Used by 1
- BooleanAnalysis.parseval_pm_oneParseval's identity for $\pm 1$-valued functions. Let $f \colon \{0,1\}^n \to \bbr$ be a Boolean function that is $\pm 1$-valued, meaning…
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 maxHeartbeats 400000 inopen scoped BigOperators invariable {n : ℕ} in/-- For a `±1`-valued function, the `L²` self-inner-product equals `1`. -/lemma BooleanAnalysis.innerProduct_self_pm_one (f : BooleanFunc n) (hf : isPmOne f) : innerProduct f f = 1 := by simp only [innerProduct, expect, uniformWeight] have hsq : ∀ x : BoolCube n, f x * f x = 1 := fun x => by rcases hf x with h | h <;> simp [h] simp_rw [hsq] simp only [Finset.sum_const, Finset.card_univ] rw [Fintype.card_pi] simp only [Fintype.card_bool, Finset.prod_const, Finset.card_fin] rw [nsmul_eq_mul, mul_one] push_cast rw [← mul_pow, inv_mul_cancel₀ (by norm_num : (2 : ℝ) ≠ 0), one_pow]