BoolFourier.expectation
defimported Lean
For $f : \{0,1\}^n \to \mathbb{R}$, the uniform expectation is \[ \mathbb{E}[f] = \frac{1}{2^n} \sum_{x \in \{0,1\}^n} f(x). \]
Statement
set_option relaxedAutoImplicit false in set_option autoImplicit false in open Finset BooleanAnalysis in noncomputable def BoolFourier.expectation {n : ℕ} (f : BoolFun n) : ℝ
- Defined in
- TCSlib, `BoolFourier.expectation`
- Lean proof
- By Prastik Mohanraj, from github.com/Shilun-Allan-Li/tcslib at
c8a02591b1e5(Copyright (c) 2026 Prastik Mohanraj. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.BoolFourier.expectation← BoolFourier.expectation (TCSlib/BooleanAnalysis/BLR/BoolFourier.lean:123): verbatim
- Verified
- 07 Oct 2026
- Axioms
- none listed
- Built on 1
- BoolFourier.BoolFunA Boolean function of arity $n$ is an element of type $\{0,1\}^n \to \mathbb{R}$, defined as an abbreviation for…
- Used by 14
- BoolBLR.BLR_completenessCompleteness of the BLR linearity test. Let $n$ be a natural number and let $f : \{0,1\}^n \to \{0,1\}$ be linear, meaning that…
- BoolBLR.triple_expectation_eq_cube_fourierCube of Fourier coefficients as an autocorrelation expectation. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean-valued function on the…
- BoolFourier.convolutionThe convolution of $f, g : \{0,1\}^n \to \mathbb{R}$ is the function \[ (f * g)(x) = \mathbb{E}_{y}\bigl[f(y)\,g(x \oplus y)\bigr]. \]
- BoolFourier.L2_norm_sqThe squared $L^2$ norm of $f : \{0,1\}^n \to \mathbb{R}$ is \[ \|f\|_2^2 = \mathbb{E}[f^2] = \frac{1}{2^n}\sum_{x} f(x)^2. \]
- BoolBLR.BLR_accept_probThe BLR acceptance probability of $f : \{0,1\}^n \to \{0,1\}$ is…
- BoolFourier.expectation_eq_expectAgreement of two definitions of the uniform expectation. Let $n$ be a natural number and let $f : \{0,1\}^n \to \bbr$ be a Boolean…
- BoolBLR.fourier_coeff_le_of_dist_geFourier coefficient bound from distance. Let $f,g:\{0,1\}^n\to\{0,1\}$ be Boolean-valued functions, let $S\subseteq[n]$, and let…
- BoolFourier.fourier_coeff_convolutionConvolution theorem on the Boolean cube. Let $n$ be a natural number, and let $f, g : \{0,1\}^n \to \bbr$ be Boolean functions. Then for…
- BoolBLR.triple_expectation_eq_cube_fourier_aux_h_substituteExpectation of a function against its Fourier-expanded autocorrelation. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean function, and let $g$…
- BoolBLR.BLR_soundness_via_fourier_aux_hparsevalParseval identity for the sign lift of a Boolean function. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean-valued function, and let…
- BoolBLR.BLR_soundnessSoundness of the BLR linearity test. Let $f : \{0,1\}^n \to \{0,1\}$ and let $\varepsilon \in \bbr$ satisfy $0 \le \varepsilon \le 1$.…
- BoolBLR.bool_distThe distance between two Boolean functions $f, g : \{0,1\}^n \to \{0,1\}$ is…
- BoolBLR.BLR_accept_prob_pm1BLR acceptance probability in ±1 form. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean-valued function, and write…
- BoolFourier.inner_productThe inner product of $f, g : \{0,1\}^n \to \mathbb{R}$ is…
Lean source view module on GitHub
set_option relaxedAutoImplicit false in set_option autoImplicit false in open Finset BooleanAnalysis in /-- Defines uniform expectation on the Boolean cube. **Source:** [OD14, §1.3]. -/ noncomputable def BoolFourier.expectation {n : ℕ} (f : BoolFun n) : ℝ := (Finset.sum Finset.univ fun x => f x) / (2 : ℝ) ^ n -- E[∏_i g_i(x_i)] = ∏_i (g_i(false) + g_i(true)) / 2