AFTD Auto-Formalizing Theoretical Domains

BooleanAnalysis.BooleanFunc

abbrevimported Lean

A Boolean function of arity $n$ is a function $f : \{0,1\}^n \to \bbr$.

Statement

set_option maxHeartbeats 400000 in
open scoped BigOperators in
abbrev BooleanAnalysis.BooleanFunc (n : ℕ)
Defined in
TCSlib, `BooleanAnalysis.BooleanFunc`
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
none listed
Built on 1
  • BooleanAnalysis.BoolCubeThe Boolean hypercube of dimension $n$ is $\{0,1\}^n$, represented as the function type $\mathrm{Fin}\,n \to \mathrm{Bool}$.
Used by 79
  • BooleanAnalysis.totalInfluence_eq_sum_sq_degTotal influence via Fourier coefficients. For every Boolean function $f\colon\{0,1\}^n\to\bbr$, the total influence of $f$ is recovered…
  • fourier_cross_level_one_le_sqrt_variance_mulCauchy-Schwarz inequality for the first cross Fourier level: for any two functions f, g : {0,1}^n → ℝ, W_1[f, g] ≤ sqrt(Var(f) * Var(g)).
  • fourier_cross_levelThe $k$-th cross Fourier level $W_k[f,g]$ of two real-valued functions $f, g : \{0,1\}^n \to \mathbb{R}$ is the sum…
  • BooleanAnalysis.walsh_expansionWalsh–Fourier expansion of a Boolean function. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function of arity $n$. Then at every point…
  • BooleanAnalysis.expectThe expectation of $f$ under the uniform measure: \[ \E[f] \;=\; 2^{-n}\sum_{x\in\{0,1\}^n} f(x). \]
  • Bonami.fourierCoeff_diffLastFourier coefficient of the half-difference over the last coordinate. Let $f\colon\{0,1\}^{n+1}\to\bbr$ be a Boolean function on $n+1$…
  • BooleanAnalysis.max_influence_lower_boundAverage influence lower bound. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function on the hypercube of dimension $n\ge 1$. Then some coordinate…
  • ArrowTheorem.acyclicA social welfare function $f$ is acyclic if no profile of transitive voter orderings produces a Condorcet cycle in society's…
  • KKL.noisyInfluenceThe noisy influence of coordinate $i$ on $f$ at noise rate $\rho$ is…
  • KKL.friedgut_juntaFriedgut's junta theorem. Let $f : \{0,1\}^n \to \{-1,1\}$ be a $\pm 1$-valued Boolean function with total influence $I[f]$, and let…
  • KKL.lowDegreePartThe low-degree part of $f$ at level $k$ keeps only the Fourier coefficients of degree at most $k$:…
  • KKL.lowDegree_l2_error$L^2$ error of the low-degree truncation. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function, and for a natural number $k$ let…
  • Bonami.diffLastThe half-difference $\mathrm{diffLast}\,f$ of $f$ over its last coordinate is the function on $n$ variables given by…
  • discrete_level_one_to_three_sharp_constant_of_lt_threeThe sharp level 1 to 3 inequality holds for all n < 3 (i.e. n = 1, 2) because W_3[f,g] = 0 and the left-hand side is nonpositive by…
  • Bonami.degree_avgLastAveraging over a coordinate preserves the degree bound. Let $f\colon\{0,1\}^{n+1}\to\bbr$ be a Boolean function on $n+1$ variables, and…
  • ArrowTheorem.isDictator$f$ is a dictatorship if there exists a voter $i$ such that $f = \mathrm{dict}_i$, i.e.\ society's preference always equals voter…
  • discrete_level_one_to_three_ratioThe discrete level 1 to 3 ratio for functions $f, g : \{0,1\}^n \to \mathbb{R}$ is defined as…
  • KKL.low_plus_high_eqLow and high degree parts reconstruct the function. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function and let $k \in \bbn$ be a threshold…
  • Bonami.degree_zero_fourth_momentFourth moment of a degree-zero Boolean function. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function of degree at most $0$, meaning that every…
  • BooleanAnalysis.fourierCoeffThe Fourier--Walsh coefficient of $f$ at frequency $S$ is…
  • ArrowTheorem.expected_product_abcaExpected product of the $ab$ and $ca$ votes. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function. For a profile $p$ that assigns each of the…
  • BooleanAnalysis.influenceThe influence of coordinate $i$ on $f$ measures how often flipping bit $i$ changes the output:…
  • BooleanAnalysis.influence_eq_sum_fourierInfluence via Fourier coefficients. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function and fix a coordinate $i\in[n]$. Then the influence of…
  • BooleanAnalysis.dictatorThe dictator function for coordinate $i$ outputs the sign of the $i$-th bit: $\mathrm{dict}_i(x) = (-1)^{x_i}$. Its unique nonzero…
  • ArrowTheorem.degree_one_implies_dictatorDegree-one unanimous voting rules are dictatorships. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function that is odd, is $\pm 1$-valued, and is…
  • level_one_to_three_witness_gThe second witness function of the three-variable example of arXiv:2611.08289 equation (53): g(x) = -(sigma(x_0) + sigma(x_1) + sigma(x_2)…
  • Bonami.expect_succ_eqExpectation splits over the last coordinate. Let $\varphi : \{0,1\}^{n+1} \to \bbr$ be a Boolean function on $n+1$ variables, and for a…
  • BooleanAnalysis.has_degree_at_mostA Boolean function $f$ has degree at most $k$ if every nonzero Fourier coefficient is supported on a set of size at most $k$: for…
  • BooleanAnalysis.instModuleRealBooleanFuncBooleanAnalysis.instModuleRealBooleanFunc
  • BooleanAnalysis.plancherelPlancherel's identity. Let $f, g : \{0,1\}^n \to \bbr$ be Boolean functions. Then their $L^2$ inner product with respect to the uniform…
  • Bonami.second_moment_decompSecond-moment decomposition over the last coordinate. Let $f : \{0,1\}^{n+1} \to \bbr$ be a Boolean function on $n+1$ variables. Define…
  • Bonami.moment_eq_expectMoments equal expectations under the uniform law. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function of arity $n$, let $p$ be a natural…
  • ArrowTheorem.expected_product_eq_corrFuncExpected pairwise vote product equals the Fourier correlation function. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function. Suppose each of…
  • ArrowTheorem.corrFunc_eq_neg_third_of_weight_oneExtremal correlation concentrates weight on level one. Let $f:\{0,1\}^n\to\bbr$ be a $\pm 1$-valued Boolean function that is odd, meaning…
  • 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…
  • KKL.sum_noisyInfluenceSum of noisy influences. Fix an integer $n$ and a real number $\rho$, and let $f:\{0,1\}^n\to\bbr$ be a Boolean function. Summing the…
  • BooleanAnalysis.isOddFuncA Boolean function $f$ is odd if $f(\lnot x) = -f(x)$ for all $x$. This models antisymmetry of pairwise preferences in social choice.
  • ArrowTheorem.arrow_theoremArrow's impossibility theorem. Let $n$ be a natural number and let $f:\{0,1\}^n\to\bbr$ be a social welfare function that aggregates the…
  • KKL.tail_fourier_weight_boundFourier tail weight bound above level $k$. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function, and let $k$ be a positive integer. Then the…
  • KKL.influentialCoordsThe set of $\tau$-influential coordinates of $f$ is the finite set…
  • fourier_varianceThe Fourier variance $\mathrm{Var}(f)$ of a function $f : \{0,1\}^n \to \mathbb{R}$ is the sum of the squares of its non-empty…
  • 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…
  • BooleanAnalysis.innerProductThe $L^2$ inner product of two Boolean functions with respect to the uniform measure:…
  • BooleanAnalysis.fourierCoeff_emptyEmpty-set Fourier coefficient is the mean. Let $f\colon\{0,1\}^n\to\bbr$ be a Boolean function. Then its Fourier–Walsh coefficient at the…
  • Bonami.expect_sq_nonnegNonnegativity of the mean square. For every Boolean function $f : \{0,1\}^n \to \bbr$, the expectation of $f^2$ under the uniform measure…
  • KKL.fourierCoeff_lowDegreePartFourier coefficients of the low-degree truncation. Let $f\colon\{0,1\}^n\to\bbr$ be a Boolean function and $k$ a natural number. For every…
  • ArrowTheorem.unanimityA social welfare function $f:\{0,1\}^n\to\bbr$ is unanimous if $f(\texttt{false},\dots,\texttt{false}) = 1$: when all voters prefer…
  • level_one_to_three_witness_fThe first witness function of the three-variable example of arXiv:2611.08289 equation (53): f(x) = -(sigma(x_0) + sigma(x_1) + sigma(x_2)…
  • Bonami.avgLastThe average $\mathrm{avgLast}\,f$ of $f$ over its last coordinate is the function on $n$ variables given by…
  • KKL.highDegreePartThe high-degree part of $f$ at level $k$ keeps only the Fourier coefficients of degree strictly greater than $k$:…
  • Bonami.restrictLastGiven a Boolean function $f$ on $n+1$ variables and a bit $b$, the restriction $\mathrm{restrictLast}\,f\,b$ is the function on $n$…
  • KKL.influential_coords_cardFew influential coordinates. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function and let $\tau > 0$. The number of $\tau$-influential…
  • Bonami.bonami_lemmaBonami's hypercontractivity lemma for low-degree functions. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function whose Fourier expansion has…
  • DecisionTree.signEvalThe $\pm 1$-valued function computed by a decision tree $T$, namely $x \mapsto \mathrm{boolToSign}(T.\mathrm{eval}\,x)$, where…
  • BooleanAnalysis.isPmOne$f$ is $\pm 1$-valued if $f(x)\in\{-1,1\}$ for all $x$.
  • Bonami.degree_diffLastDegree bound for the half-difference over the last coordinate. Let $f\colon\{0,1\}^{n+1}\to\bbr$ be a Boolean function of degree at most…
  • BooleanAnalysis.totalInfluence$I[f] = \sum_{i=1}^n \mathrm{Inf}_i[f]$.
  • KKL.lowDegreePart_depends_on_influentialLow-degree part is close to a junta on the influential coordinates. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function, let $k$ be a natural…
  • ArrowTheorem.expected_product_bccaExpected product of the $bc$ and $ca$ vote vectors. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function, and for each profile…
  • fourier_cross_level_eq_zero_of_card_ltFor any two functions $f, g : \{0,1\}^n \to \mathbb{R}$ and any integer $k > n$, the $k$-th cross Fourier level $W_k[f,g]$ equals zero.
  • KKL.IsJuntaA function $g$ is a $J$-junta if it depends only on the coordinates in $J$: whenever $x$ and $y$ agree on every $i \in J$, we have…
  • Bonami.restrictLast_true_eqRecovering the true-restriction from average and half-difference. Let $f : \{0,1\}^{n+1} \to \bbr$ be a Boolean function on $n+1$…
  • Bonami.expect_sq_nonneg_prodNonnegativity of the expectation of a product of squares. For any two Boolean functions $g, h : \{0,1\}^n \to \bbr$, the expectation of…
  • BooleanAnalysis.chiSThe Walsh--Fourier character associated to $S\subseteq[n]$ is…
  • BoolFourier.BoolFunA Boolean function of arity $n$ is an element of type $\{0,1\}^n \to \mathbb{R}$, defined as an abbreviation for…
  • KKL.l2DistSqThe squared $L^2$ distance between two Boolean functions is $\E\big[(f(x) - g(x))^2\big]$ under the uniform measure on the cube.
  • Bonami.fourth_moment_decompFourth-moment decomposition over the last coordinate. Let $f : \{0,1\}^{n+1} \to \bbr$ be a Boolean function on $n+1$ variables, and let…
  • ArrowTheorem.acyclic_implies_corrFuncAcyclicity forces correlation $-1/3$. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function that is odd, $\pm 1$-valued, and acyclic. Then its…
  • Bonami.degree_zero_constDegree-zero Boolean functions are constant. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function of degree at most $0$; that is, every set $S$…
  • ArrowTheorem.expected_product_helperExpected product from the character kernel. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function, and let $\mathrm{votes}_1,\mathrm{votes}_2$…
  • BooleanAnalysis.fourierCoeff_odd_evenVanishing of even-level Fourier coefficients of odd functions. Let $f : \{0,1\}^n \to \bbr$ be an odd Boolean function, meaning…
  • BooleanAnalysis.parsevalParseval's identity for Boolean functions. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function, and equip $\{0,1\}^n$ with the uniform…
  • KKL.noisyInfluence_le_influenceNoisy influence is dominated by influence. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function, let $i\in[n]$ be a coordinate, and let…
  • Bonami.expect_fourth_nonnegNonnegativity of the fourth moment. Let $f : \{0,1\}^n \to \bbr$ be a Boolean function on the Boolean hypercube. Then its fourth moment…
  • KKL.lowDegree_approxLow-degree approximation error bound. Let $f\colon\{0,1\}^n\to\bbr$ be a Boolean function and let $k\ge 1$ be an integer. Writing…
  • BooleanAnalysis.innerProduct_self_pm_oneSelf-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…
  • BooleanAnalysis.instAddCommGroupBooleanFuncBoolean functions form an ℝ-vector space.
  • Bonami.expect_cs_sqCauchy–Schwarz for the uniform expectation. Let $g, h : \{0,1\}^n \to \bbr$ be Boolean functions, and let $\E[\,\cdot\,]$ denote the…
  • ArrowTheorem.corrFuncThe Fourier correlation function of $f$ is \[ \mathrm{corr}(f) \;=\; \sum_{S\subseteq[n]} \hat f(S)^2\,(-1/3)^{|S|}. \] For odd…

Lean source view module on GitHub

set_option maxHeartbeats 400000 in
open scoped BigOperators in
/-- Defines a real-valued Boolean function `f : {0,1}ⁿ → ℝ`. **Source:** [OD14, §1.1]. -/
abbrev BooleanAnalysis.BooleanFunc (n : ℕ) := BoolCube n → ℝ
See it in the graphDiscuss this resultChallenge it