AFTD Auto-Formalizing Theoretical Domains

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.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
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

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]
See it in the graphDiscuss this resultChallenge it