Analysis of Boolean Functions in Lean

1.5. Probability densities and convolution🔗

Definition1.5.1
uses 1
Used by 3
Reverse dependency previews
Preview
Lemma 1.5.2
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
L∃∀N

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.13 declarations
  • structure(3 fields)defined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    structure FABL.ProbabilityDensity (n : ) : Type
    structure FABL.ProbabilityDensity (n : ) : Type
    O'Donnell, Definition 1.20: a nonnegative real density relative to uniform measure. 
    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.lean
    complete
    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.lean
    complete
    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. 
Lemma1.5.2
uses 1
Used by 2
Reverse dependency previews
Preview
Proposition 1.5.7
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
L∃∀N

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.23 declarations
  • defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.lean
    complete
    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.lean
    complete
    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. 
Definition1.5.3
uses 1
Used by 3
Reverse dependency previews
Preview
Lemma 1.5.4
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
L∃∀N

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.32 definitions
  • defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.lean
    complete
    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. 
Lemma1.5.4
uses 1used by 0L∃∀N

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.42 theorems
  • theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.lean
    complete
    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. 
Definition1.5.5
uses 1
Used by 4
Reverse dependency previews
Preview
Lemma 1.5.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
L∃∀N

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.55 declarations
  • defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.lean
    complete
    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.lean
    complete
    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.lean
    complete
    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.lean
    complete
    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. 
Lemma1.5.6
uses 1used by 0L∃∀N

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.62 theorems
  • theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.lean
    complete
    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. 
Proposition1.5.7
Statement uses 2
Statement dependency previews
Preview
Lemma 1.5.2
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0L∃∀N

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.72 theorems
  • theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.lean
    complete
    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. 
Proposition1.5.8
Statement uses 2
Statement dependency previews
Preview
Definition 1.5.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0L∃∀N

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.83 declarations
  • defdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.lean
    complete
    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.lean
    complete
    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. 
Theorem1.5.9
Statement uses 2
Statement dependency previews
Preview
Definition 1.2.6
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Lemma 1.6.4
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
L∃∀N

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.91 theorem
  • theoremdefined in FABL/Chapter01/ProbabilityDensitiesAndConvolution.lean
    complete
    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.