Documentation

LeanPool.LeanBooleanfun.Basic

Analysis on Boolean functions #

This file contains some basic definitions and theorems for analysis of real-valued Boolean functions mainly following Ryan O'Donnell's book [odonnell2014]. The Hamming cube is represented by the function type Fin n β†’ Fin 2, so that a BooleanFunc n is a (Fin n β†’ Fin 2) β†’ ℝ.

Thanks to Mathlib, it is relatively straightforward to get started with Fourier analysis:

Even if there was a general framework for Fourier transforms on LCA groups in Mathlib, it may be preferrable to use this ad-hoc definition due to slightly different notational conventions in the context of Boolean functions, and the simplicity of working with finite sums.

Main results #

Notation #

@[reducible, inline]

A Boolean function maps an n-tuple of bits (of type Fin n β†’ Fin 2) to a real number.

Equations
Instances For
    theorem LeanPool.LeanBooleanfun.BooleanFun.sum_translate {n : β„•} {f : BooleanFunc n} (a : Fin n β†’ Fin 2) :
    βˆ‘ x : Fin n β†’ Fin 2, f x = βˆ‘ x : Fin n β†’ Fin 2, f (x + a)

    Translation invariance

    The expectation of a Boolean function is its average value with respect to the uniform probability measure on Fin n β†’ Fin 2.

    Equations
    Instances For

      Expectation of a Boolean function

      Equations
      Instances For
        @[reducible, inline]

        Definition of Walsh character

        Equations
        Instances For

          Walsh character

          Equations
          Instances For
            theorem LeanPool.LeanBooleanfun.BooleanFun.walsh_def {n : β„•} {x : Fin n β†’ Fin 2} {S : Finset (Fin n)} :
            walshCharacter S x = ∏ i ∈ S, (-1) ^ ↑(x i)
            theorem LeanPool.LeanBooleanfun.BooleanFun.walsh_eq_neg_one_pow_sum {n : β„•} {x : Fin n β†’ Fin 2} {S : Finset (Fin n)} :
            walshCharacter S x = (-1) ^ βˆ‘ i ∈ S, ↑(x i)

            Walsh characters are characters.

            @[reducible, inline]

            Dual space of Boolean functions as the type of real-valued functions on Finset (Fin n).

            Equations
            Instances For

              The Walsh-Fourier transform of a Boolean function f is defined on sets of coordinates S : Finset (Fin n) as expectation of the Walsh character Ο‡ S times f.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Walsh-Fourier transform on Boolean functions

                Equations
                Instances For
                  @[implicit_reducible]

                  Boolean functions form an inner product space.

                  Equations
                  • One or more equations did not get rendered due to their size.

                  Cauchy-Schwarz inequality on Boolean functions

                  @[simp]

                  Walsh characters are LΒ² normalized.

                  def LeanPool.LeanBooleanfun.BooleanFun.flipAt {n : β„•} (iβ‚€ : Fin n) (x : Fin n β†’ Fin 2) :
                  Fin n β†’ Fin 2

                  Flip the iβ‚€th bit of x.

                  Equations
                  Instances For
                    @[simp]
                    theorem LeanPool.LeanBooleanfun.BooleanFun.flipAt_flipped {n : β„•} {iβ‚€ : Fin n} {x : Fin n β†’ Fin 2} :
                    flipAt iβ‚€ x iβ‚€ = 1 - x iβ‚€

                    The iβ‚€th bit of x is flipped.

                    theorem LeanPool.LeanBooleanfun.BooleanFun.flipAt_unflipped {n : β„•} {i iβ‚€ : Fin n} {x : Fin n β†’ Fin 2} (h : i β‰  iβ‚€) :
                    flipAt iβ‚€ x i = x i

                    Bits that are not the iβ‚€th bits remain unchanged.

                    @[simp]
                    theorem LeanPool.LeanBooleanfun.BooleanFun.flipAt_flipAt_eq {n : β„•} {iβ‚€ : Fin n} {x : Fin n β†’ Fin 2} :
                    flipAt iβ‚€ (flipAt iβ‚€ x) = x

                    Flipping a bit twice results in no change.

                    Flipping a bit is an involution on Fin n β†’ Fin 2.

                    Flipping a bit is a bijection on Fin n β†’ Fin 2.

                    @[simp]

                    Expectation of Ο‡ S is zero if S is nonempty

                    @[reducible, inline]

                    Basis of Walsh characters on BooleanFunc n.

                    Equations
                    Instances For
                      @[reducible, inline]

                      Orthonormal basis of Walsh characters on BooleanFunc n.

                      Equations
                      Instances For

                        Walsh-Fourier expansion : Every Boolean function is equal to a linear combination of Walsh characters.

                        Plancherel/Parseval theorem for Boolean functions.

                        Plancherel/Parseval theorem for Boolean functions.

                        @[reducible, inline]
                        abbrev LeanPool.LeanBooleanfun.BooleanFun.setAt {n : β„•} (iβ‚€ : Fin n) (v : Fin 2) (x : Fin n β†’ Fin 2) :
                        Fin n β†’ Fin 2

                        Set the iβ‚€th bit of x to v.

                        Equations
                        Instances For
                          @[simp]
                          theorem LeanPool.LeanBooleanfun.BooleanFun.setAt_it {n : β„•} (iβ‚€ : Fin n) (v : Fin 2) (x : Fin n β†’ Fin 2) :
                          setAt iβ‚€ v x iβ‚€ = v

                          The iβ‚€th bit of setAt iβ‚€ v x has value v.

                          theorem LeanPool.LeanBooleanfun.BooleanFun.setAt_other {n : β„•} (iβ‚€ : Fin n) (v : Fin 2) (x : Fin n β†’ Fin 2) (i : Fin n) (h : iβ‚€ β‰  i) :
                          setAt iβ‚€ v x i = x i

                          Bits other than the iβ‚€th bit are unaffected by setAt.

                          Discrete partial "derivative" of a Boolean function with respect to the ith coordinate. See Def. 2.16 in [odonnell2014].

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem LeanPool.LeanBooleanfun.BooleanFun.walsh_setAt_eq_ite {n : β„•} {x : Fin n β†’ Fin 2} {i : Fin n} {S : Finset (Fin n)} {v : Fin 2} :
                            walshCharacter S (setAt i v x) = if i ∈ S then (-1) ^ ↑v * walshCharacter (S \ {i}) x else walshCharacter S x

                            The ith coordinate Laplacian operator as in Def. 2.25 [odonnell2014].

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem LeanPool.LeanBooleanfun.BooleanFun.setAt_eq_id {n : β„•} {x : Fin n β†’ Fin 2} {i : Fin n} {v : Fin 2} (h : x i = v) :
                              setAt i v x = x
                              theorem LeanPool.LeanBooleanfun.BooleanFun.setAt_eq_flipAt {n : β„•} {x : Fin n β†’ Fin 2} {i : Fin n} {v : Fin 2} (h : x i β‰  v) :
                              setAt i v x = flipAt i x
                              theorem LeanPool.LeanBooleanfun.BooleanFun.laplace_eq_dderiv {n : β„•} (i : Fin n) (f : BooleanFunc n) (x : Fin n β†’ Fin 2) :
                              (laplace i) f x = (-1) ^ ↑(x i) * (dderiv i) f x
                              @[reducible, inline]
                              noncomputable abbrev LeanPool.LeanBooleanfun.BooleanFun.influence {n : β„•} (f : BooleanFunc n) (i : Fin n) :

                              The ith influence of a Boolean function is defined as the expectation of the ith Laplacian squared.

                              Equations
                              Instances For
                                @[reducible, inline]

                                The total influence of a Boolean function is defined as the sum of the ith influences.

                                Equations
                                Instances For
                                  @[reducible, inline]

                                  Covariance of two Boolean functions

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[reducible, inline]

                                    Variance of a Boolean function defined via covariance

                                    Equations
                                    Instances For

                                      LΒ² PoincarΓ© inequality : variance of a Boolean function is ≀ total Influence. See [odonnell2014], Sec. 2.3.

                                      @[reducible, inline]

                                      The kth Fourier weight is the sum of squares of degree k Fourier coefficients

                                      Equations
                                      Instances For
                                        @[reducible, inline]

                                        Alternative expression for degree one Fourier weight in terms in terms of sum over coordinates

                                        Equations
                                        Instances For
                                          theorem LeanPool.LeanBooleanfun.BooleanFun.eq_sum_degree_one_of_fourier_weight_one {n : β„•} {f : BooleanFunc n} (h : fourierWeight 1 f = β€–fβ€– ^ 2) (x : Fin n β†’ Fin 2) :
                                          f x = βˆ‘ i : Fin n, fourierTransform f {i} * (-1) ^ ↑(x i)
                                          theorem LeanPool.LeanBooleanfun.BooleanFun.eq_sum_degree_one_of_fourier_eq_zero {n : β„•} {f : BooleanFunc n} (h : βˆ€ (S : Finset (Fin n)), S.card β‰  1 β†’ fourierTransform f S = 0) (x : Fin n β†’ Fin 2) :
                                          f x = βˆ‘ i : Fin n, fourierTransform f {i} * (-1) ^ ↑(x i)

                                          Walsh-Fourier multiplier as an ℝ-linear operator on Boolean functions

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            Walsh characters are eigenfunctions of multipliers.

                                            @[reducible, inline]

                                            The noise operator defined via Fourier expansion. See Prop. 2.47 in [odonnell2014].

                                            Equations
                                            Instances For
                                              @[reducible, inline]

                                              Noise stability

                                              Equations
                                              Instances For
                                                @[reducible, inline]

                                                Discrete convolution of Boolean functions

                                                Equations
                                                Instances For

                                                  Discrete convolution of Boolean functions

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Convolution theorem : the Walsh-Fourier transform turns convolution into pointwise product.