1.5. Probability densities and convolution
-
FABL.ProbabilityDensity[complete] -
FABL.ProbabilityDensity.toPMF[complete] -
FABL.ProbabilityDensity.toPMF_apply[complete]
Definition 1.20. A probability density function on the Hamming cube
\mathbb F_2^n is a nonnegative function
\varphi:\mathbb F_2^n\to\mathbb R^{\ge0} satisfying
\mathbb E_{\boldsymbol{x}\sim\mathbb F_2^n}[\varphi(\boldsymbol{x})]=1.
The notation \boldsymbol{y}\sim\varphi means that \boldsymbol{y} is drawn
from the associated probability distribution, defined by
\Pr_{\boldsymbol{y}\sim\varphi}[\boldsymbol{y}=y]
=\frac{\varphi(y)}{2^n}
\qquad\text{for every }y\in\mathbb F_2^n.
Lean code for Definition1.5.1●3 declarations
Associated Lean declarations
-
FABL.ProbabilityDensity[complete]
-
FABL.ProbabilityDensity.toPMF[complete]
-
FABL.ProbabilityDensity.toPMF_apply[complete]
-
FABL.ProbabilityDensity[complete] -
FABL.ProbabilityDensity.toPMF[complete] -
FABL.ProbabilityDensity.toPMF_apply[complete]
-
structuredefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
structure FABL.ProbabilityDensity (n : ℕ) : Type
structure FABL.ProbabilityDensity (n : ℕ) : Type
O'Donnell, Definition 1.20: a nonnegative real density relative to uniform measure.
Fields
toFun : FABL.F₂Cube n → ℝ
The density function.
nonneg' : ∀ (x : FABL.F₂Cube n), 0 ≤ self.toFun x
A density is pointwise nonnegative.
expect_eq_one' : (Finset.univ.expect fun x => self.toFun x) = 1
A density has uniform expectation one.
-
defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
def FABL.ProbabilityDensity.toPMF {n : ℕ} (φ : FABL.ProbabilityDensity n) : PMF (FABL.F₂Cube n)
def FABL.ProbabilityDensity.toPMF {n : ℕ} (φ : FABL.ProbabilityDensity n) : PMF (FABL.F₂Cube n)
The genuine probability mass function induced by a density; its mass at `x` is `φ(x) / |𝔽₂ⁿ|`.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.ProbabilityDensity.toPMF_apply {n : ℕ} (φ : FABL.ProbabilityDensity n) (x : FABL.F₂Cube n) : φ.toPMF x = ENNReal.ofReal (φ.toFun x / ↑(Fintype.card (FABL.F₂Cube n)))
theorem FABL.ProbabilityDensity.toPMF_apply {n : ℕ} (φ : FABL.ProbabilityDensity n) (x : FABL.F₂Cube n) : φ.toPMF x = ENNReal.ofReal (φ.toFun x / ↑(Fintype.card (FABL.F₂Cube n)))
The mass assigned by the PMF induced from a probability density.
-
FABL.ProbabilityDensity.expectation[complete] -
FABL.ProbabilityDensity.integral_toPMF_eq_expectation[complete] -
FABL.densityExpectation_eq_uniformInner[complete]
Fact 1.21. If \varphi is a density function and
g:\mathbb F_2^n\to\mathbb R, then
\mathbb E_{\boldsymbol{y}\sim\varphi}[g(\boldsymbol{y})]
=\langle\varphi,g\rangle
=\mathbb E_{\boldsymbol{x}\sim\mathbb F_2^n}
[\varphi(\boldsymbol{x})g(\boldsymbol{x})].
Lean code for Lemma1.5.2●3 declarations
Associated Lean declarations
-
FABL.ProbabilityDensity.expectation[complete]
-
FABL.ProbabilityDensity.integral_toPMF_eq_expectation[complete]
-
FABL.densityExpectation_eq_uniformInner[complete]
-
FABL.ProbabilityDensity.expectation[complete] -
FABL.ProbabilityDensity.integral_toPMF_eq_expectation[complete] -
FABL.densityExpectation_eq_uniformInner[complete]
-
defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
def FABL.ProbabilityDensity.expectation {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : ℝ
def FABL.ProbabilityDensity.expectation {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : ℝ
Expectation with respect to the probability distribution induced by `φ`.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.ProbabilityDensity.integral_toPMF_eq_expectation {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : ∫ (x : FABL.F₂Cube n), g x ∂φ.toPMF.toMeasure = φ.expectation g
theorem FABL.ProbabilityDensity.integral_toPMF_eq_expectation {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : ∫ (x : FABL.F₂Cube n), g x ∂φ.toPMF.toMeasure = φ.expectation g
Integrating against the PMF induced by a density agrees with density-weighted expectation.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.densityExpectation_eq_uniformInner {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : φ.expectation g = FABL.uniformInner φ.toFun g
theorem FABL.densityExpectation_eq_uniformInner {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : φ.expectation g = FABL.uniformInner φ.toFun g
O'Donnell, Fact 1.21: density-weighted expectation is the uniform inner product.
-
FABL.setIndicator[complete] -
FABL.subsetDensity[complete]
Definition 1.22. If A\subseteq\mathbb F_2^n, write
\mathbf 1_A:\mathbb F_2^n\to\{0,1\} for its indicator function,
\mathbf 1_A(x)=
\begin{cases}
1 & \text{if }x\in A,\\
0 & \text{if }x\notin A.
\end{cases}
If A\ne\varnothing, write \varphi_A for the density of the uniform
distribution on A, namely
\varphi_A=\frac{1}{\mathbb E[\mathbf 1_A]}\mathbf 1_A.
The notation \boldsymbol{y}\sim A abbreviates
\boldsymbol{y}\sim\varphi_A.
Lean code for Definition1.5.3●2 definitions
Associated Lean declarations
-
FABL.setIndicator[complete]
-
FABL.subsetDensity[complete]
-
FABL.setIndicator[complete] -
FABL.subsetDensity[complete]
-
defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
def FABL.setIndicator {n : ℕ} (A : Set (FABL.F₂Cube n)) : FABL.F₂Cube n → ℝ
def FABL.setIndicator {n : ℕ} (A : Set (FABL.F₂Cube n)) : FABL.F₂Cube n → ℝ
The indicator `𝟙_A`, defined using Mathlib's `Set.indicator`.
-
defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
def FABL.subsetDensity {n : ℕ} (A : Set (FABL.F₂Cube n)) (hA : A.Nonempty) : FABL.ProbabilityDensity n
def FABL.subsetDensity {n : ℕ} (A : Set (FABL.F₂Cube n)) (hA : A.Nonempty) : FABL.ProbabilityDensity n
O'Donnell, Definition 1.22: the normalized uniform density on a nonempty set.
Fact 1.23. Every Fourier coefficient of \varphi_{\{0\}} is 1;
equivalently, its Fourier expansion is
\varphi_{\{0\}}(y)=\sum_{S\subseteq[n]}\chi_S(y).
Lean code for Lemma1.5.4●2 theorems
Associated Lean declarations
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.binaryFourierCoeff_subsetDensity_singleton_zero {n : ℕ} (S : Finset (Fin n)) : FABL.binaryFourierCoeff (FABL.subsetDensity {0} ⋯).toFun S = 1
theorem FABL.binaryFourierCoeff_subsetDensity_singleton_zero {n : ℕ} (S : Finset (Fin n)) : FABL.binaryFourierCoeff (FABL.subsetDensity {0} ⋯).toFun S = 1
O'Donnell, Fact 1.23: every Fourier coefficient of the density at the origin is one.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.subsetDensity_singleton_zero_eq_sum_χ {n : ℕ} (x : FABL.F₂Cube n) : (FABL.subsetDensity {0} ⋯).toFun x = ∑ S, (FABL.χ S) x
theorem FABL.subsetDensity_singleton_zero_eq_sum_χ {n : ℕ} (x : FABL.F₂Cube n) : (FABL.subsetDensity {0} ⋯).toFun x = ∑ S, (FABL.χ S) x
The full Fourier expansion following O'Donnell, Fact 1.23.
-
FABL.convolution[complete] -
FABL.convolution_apply[complete] -
FABL.convolution_apply_add[complete] -
FABL.convolution_apply_swap[complete] -
FABL.convolution_apply_swap_add[complete]
Definition 1.24. Let f,g:\mathbb F_2^n\to\mathbb R. Their convolution
is the function f*g:\mathbb F_2^n\to\mathbb R defined by
(f*g)(x)
=\mathbb E_{\boldsymbol{y}\sim\mathbb F_2^n}
[f(\boldsymbol{y})g(x-\boldsymbol{y})]
=\mathbb E_{\boldsymbol{y}\sim\mathbb F_2^n}
[f(x-\boldsymbol{y})g(\boldsymbol{y})].
Since subtraction equals addition in \mathbb F_2^n, one may also write
(f*g)(x)
=\mathbb E_{\boldsymbol{y}}[f(\boldsymbol{y})g(x+\boldsymbol{y})]
=\mathbb E_{\boldsymbol{y}}[f(x+\boldsymbol{y})g(\boldsymbol{y})].
Under the \{-1,1\}^n representation, x+y is replaced by
coordinatewise multiplication x\circ y.
Lean code for Definition1.5.5●5 declarations
Associated Lean declarations
-
FABL.convolution[complete]
-
FABL.convolution_apply[complete]
-
FABL.convolution_apply_add[complete]
-
FABL.convolution_apply_swap[complete]
-
FABL.convolution_apply_swap_add[complete]
-
FABL.convolution[complete] -
FABL.convolution_apply[complete] -
FABL.convolution_apply_add[complete] -
FABL.convolution_apply_swap[complete] -
FABL.convolution_apply_swap_add[complete]
-
defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
def FABL.convolution {n : ℕ} (f g : FABL.F₂Cube n → ℝ) : FABL.F₂Cube n → ℝ
def FABL.convolution {n : ℕ} (f g : FABL.F₂Cube n → ℝ) : FABL.F₂Cube n → ℝ
O'Donnell, Definition 1.24: normalized convolution on `𝔽₂ⁿ`. The underlying algebraic sum is Mathlib's `DiscreteConvolution.addConvolution`; FABL adds only the book's uniform normalization.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.convolution_apply {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f y * g (x - y)
theorem FABL.convolution_apply {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f y * g (x - y)
The expectation formula in O'Donnell, Definition 1.24.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.convolution_apply_add {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f y * g (x + y)
theorem FABL.convolution_apply_add {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f y * g (x + y)
The addition form of convolution on the characteristic-two cube.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.convolution_apply_swap {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f (x - y) * g y
theorem FABL.convolution_apply_swap {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f (x - y) * g y
The reversed-subtraction expectation formula in O'Donnell, Definition 1.24.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.convolution_apply_swap_add {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f (x + y) * g y
theorem FABL.convolution_apply_swap_add {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : FABL.convolution f g x = Finset.univ.expect fun y => f (x + y) * g y
The reversed-addition expectation formula in O'Donnell, Definition 1.24.
-
FABL.convolution_comm[complete] -
FABL.convolution_assoc[complete]
Exercise 1.25. For functions f,g,h:\mathbb F_2^n\to\mathbb R,
normalized convolution is commutative and associative:
f*g=g*f,
\qquad
f*(g*h)=(f*g)*h.
Lean code for Lemma1.5.6●2 theorems
Associated Lean declarations
-
FABL.convolution_comm[complete]
-
FABL.convolution_assoc[complete]
-
FABL.convolution_comm[complete] -
FABL.convolution_assoc[complete]
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.convolution_comm {n : ℕ} (f g : FABL.F₂Cube n → ℝ) : FABL.convolution f g = FABL.convolution g f
theorem FABL.convolution_comm {n : ℕ} (f g : FABL.F₂Cube n → ℝ) : FABL.convolution f g = FABL.convolution g f
Commutativity of normalized convolution, cited in the main text from Exercise 1.25.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.convolution_assoc {n : ℕ} (f g h : FABL.F₂Cube n → ℝ) : FABL.convolution (FABL.convolution f g) h = FABL.convolution f (FABL.convolution g h)
theorem FABL.convolution_assoc {n : ℕ} (f g h : FABL.F₂Cube n → ℝ) : FABL.convolution (FABL.convolution f g) h = FABL.convolution f (FABL.convolution g h)
Associativity of normalized convolution, cited in the main text from Exercise 1.25.
-
FABL.density_convolution_apply[complete] -
FABL.densityExpectation_eq_convolution_apply_zero[complete]
Proposition 1.25. If \varphi is a density function on \mathbb F_2^n
and g:\mathbb F_2^n\to\mathbb R, then for every x\in\mathbb F_2^n,
(\varphi*g)(x)
=\mathbb E_{\boldsymbol{y}\sim\varphi}[g(x-\boldsymbol{y})]
=\mathbb E_{\boldsymbol{y}\sim\varphi}[g(x+\boldsymbol{y})].
In particular, \mathbb E_{\boldsymbol{y}\sim\varphi}[g(\boldsymbol{y})]=(\varphi*g)(0).
Lean code for Proposition1.5.7●2 theorems
Associated Lean declarations
-
FABL.density_convolution_apply[complete]
-
FABL.densityExpectation_eq_convolution_apply_zero[complete]
-
FABL.density_convolution_apply[complete] -
FABL.densityExpectation_eq_convolution_apply_zero[complete]
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.density_convolution_apply {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : (FABL.convolution φ.toFun g x = φ.expectation fun y => g (x - y)) ∧ FABL.convolution φ.toFun g x = φ.expectation fun y => g (x + y)
theorem FABL.density_convolution_apply {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) (x : FABL.F₂Cube n) : (FABL.convolution φ.toFun g x = φ.expectation fun y => g (x - y)) ∧ FABL.convolution φ.toFun g x = φ.expectation fun y => g (x + y)
O'Donnell, Proposition 1.25: convolving against a density is translated expectation.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.densityExpectation_eq_convolution_apply_zero {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : φ.expectation g = FABL.convolution φ.toFun g 0
theorem FABL.densityExpectation_eq_convolution_apply_zero {n : ℕ} (φ : FABL.ProbabilityDensity n) (g : FABL.F₂Cube n → ℝ) : φ.expectation g = FABL.convolution φ.toFun g 0
The special case at zero in O'Donnell, Proposition 1.25.
-
FABL.ProbabilityDensity.convolution[complete] -
FABL.ProbabilityDensity.toPMF_convolution[complete] -
FABL.convolution_probability_eq_add[complete]
Proposition 1.26. If \varphi and \psi are probability density
functions on \mathbb F_2^n, then \varphi*\psi is also a probability
density function. It represents the distribution of
\boldsymbol{x}=\boldsymbol{y}+\boldsymbol{z}, where
\boldsymbol{y}\sim\varphi and \boldsymbol{z}\sim\psi are chosen
independently.
Lean code for Proposition1.5.8●3 declarations
Associated Lean declarations
-
FABL.ProbabilityDensity.convolution[complete]
-
FABL.ProbabilityDensity.toPMF_convolution[complete]
-
FABL.convolution_probability_eq_add[complete]
-
FABL.ProbabilityDensity.convolution[complete] -
FABL.ProbabilityDensity.toPMF_convolution[complete] -
FABL.convolution_probability_eq_add[complete]
-
defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
def FABL.ProbabilityDensity.convolution {n : ℕ} (φ ψ : FABL.ProbabilityDensity n) : FABL.ProbabilityDensity n
def FABL.ProbabilityDensity.convolution {n : ℕ} (φ ψ : FABL.ProbabilityDensity n) : FABL.ProbabilityDensity n
The convolution of two probability densities.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.ProbabilityDensity.toPMF_convolution {n : ℕ} (φ ψ : FABL.ProbabilityDensity n) : (φ.toPMF.bind fun y => PMF.map (fun z => y + z) ψ.toPMF) = (φ.convolution ψ).toPMF
theorem FABL.ProbabilityDensity.toPMF_convolution {n : ℕ} (φ ψ : FABL.ProbabilityDensity n) : (φ.toPMF.bind fun y => PMF.map (fun z => y + z) ψ.toPMF) = (φ.convolution ψ).toPMF
O'Donnell, Proposition 1.26 in PMF form: binding two independent density-induced PMFs and adding their samples gives the PMF induced by the convolution density.
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.convolution_probability_eq_add {n : ℕ} (φ ψ : FABL.ProbabilityDensity n) (A : Set (FABL.F₂Cube n)) : (φ.convolution ψ).probability A = Finset.univ.expect fun y => Finset.univ.expect fun z => φ.toFun y * ψ.toFun z * FABL.setIndicator A (y + z)
theorem FABL.convolution_probability_eq_add {n : ℕ} (φ ψ : FABL.ProbabilityDensity n) (A : Set (FABL.F₂Cube n)) : (φ.convolution ψ).probability A = Finset.univ.expect fun y => Finset.univ.expect fun z => φ.toFun y * ψ.toFun z * FABL.setIndicator A (y + z)
O'Donnell, Proposition 1.26: convolution is the density of the sum of two independent draws.
-
FABL.binaryFourierCoeff_convolution[complete]
Theorem 1.27. Let f,g:\mathbb F_2^n\to\mathbb R. Then for every
S\subseteq[n],
\widehat{f*g}(S)=\widehat f(S)\widehat g(S).
Lean code for Theorem1.5.9●1 theorem
Associated Lean declarations
-
FABL.binaryFourierCoeff_convolution[complete]
-
FABL.binaryFourierCoeff_convolution[complete]
-
theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.leancomplete
theorem FABL.binaryFourierCoeff_convolution {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (S : Finset (Fin n)) : FABL.binaryFourierCoeff (FABL.convolution f g) S = FABL.binaryFourierCoeff f S * FABL.binaryFourierCoeff g S
theorem FABL.binaryFourierCoeff_convolution {n : ℕ} (f g : FABL.F₂Cube n → ℝ) (S : Finset (Fin n)) : FABL.binaryFourierCoeff (FABL.convolution f g) S = FABL.binaryFourierCoeff f S * FABL.binaryFourierCoeff g S
O'Donnell, Theorem 1.27: Fourier transform converts normalized convolution to pointwise multiplication.