Documentation

LeanPool.LeanBooleanfun.BooleanValued

Boolean valued functions #

This file introduces a typeclass BooleanValued for Boolean functions only taking values ±1 and proves some basic properties specific to Boolean-valued functions.

Main results #

BooleanValued f bundles a proof that f takes values ±1.

  • one_or_neg_one (x : Fin nFin 2) : f x = 1 f x = -1
Instances
    theorem LeanPool.LeanBooleanfun.BooleanFun.BV.eq_one_or_eq_neg_one {n : } {f : BooleanFunc n} [hbv : BooleanValued f] (x : Fin nFin 2) :
    f x = 1 f x = -1
    theorem LeanPool.LeanBooleanfun.BooleanFun.BV.eq_neg_one_of_ne_one {n : } {f : BooleanFunc n} {x : Fin nFin 2} [hbv : BooleanValued f] (h' : f x 1) :
    f x = -1
    theorem LeanPool.LeanBooleanfun.BooleanFun.BV.eq_one_of_ne_neg_one {n : } {f : BooleanFunc n} {x : Fin nFin 2} [hbv : BooleanValued f] (h' : f x -1) :
    f x = 1
    theorem LeanPool.LeanBooleanfun.BooleanFun.BV.eq_character_of_eq_sum_degree_one {n : } {f : BooleanFunc n} [hbv : BooleanValued f] (hn : n > 0) (hf : ∀ (x : Fin nFin 2), f x = i : Fin n, fourierTransform f {i} * (-1) ^ (x i)) :
    S{S : Finset (Fin n) | S.card = 1}, ∃ (c : ), f = c walshCharacter S

    A Boolean valued function that is a linear combination of degree one characters must be constant times a degree one character. Most involved step towards eq_character_of_fourier_weight_one_eq_one.

    theorem LeanPool.LeanBooleanfun.BooleanFun.BV.eq_character_of_fourier_weight_one_eq_one' {n : } {f : BooleanFunc n} [hbv : BooleanValued f] (hn : n > 0) (hf : fourierWeight 1 f = 1) :
    S{S : Finset (Fin n) | S.card = 1}, ∃ (c : ), f = c walshCharacter S

    A Boolean valued function with degree one Fourier weight equal to one must be ±1 times a degree one character.

    A Boolean valued function with degree one Fourier weight equal to one must be ±1 times a degree one character. This is [odonnell2014], Exercise 1.19(a).

    @[reducible, inline]

    The Hamming distance of two Boolean-valued functions is equal to the proportion of inputs where they are not equal. The definition does not require f g be Boolean-valued, but it will only be used in this context.

    Equations
    Instances For
      theorem LeanPool.LeanBooleanfun.BooleanFun.BV.oneOn_eq_of_one_or_neg_one {x y : } (hx : x = 1 x = -1) (hy : y = 1 y = -1) :
      oneOn (x = y) = 1 / 2 * (1 + x * y)
      theorem LeanPool.LeanBooleanfun.BooleanFun.BV.oneOn_ne_of_one_or_neg_one {x y : } (hx : x = 1 x = -1) (hy : y = 1 y = -1) :
      oneOn (x y) = 1 / 2 * (1 - x * y)
      theorem LeanPool.LeanBooleanfun.BooleanFun.BV.distance_eq {n : } {f g : BooleanFunc n} [hbv : BooleanValued f] [hbvg : BooleanValued g] :
      distance f g = expectation fun (x : Fin nFin 2) => 1 / 2 * (1 - f x * g x)

      We introduce the BLR "linearity" test [Blum, Luby, Rubinfeld][blr1990] following O'Donnell [odonnell2014], Sec. 1.6.

      @[reducible, inline]

      The BLR test accepts f on independently and uniformly chosen x y if (f x) * (f y) = f (x + y). The acceptance probability is the proportion of inputs x y on which the test accepts.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem LeanPool.LeanBooleanfun.BooleanFun.BV.acceptanceProbabilityBLR_eq {n : } {f : BooleanFunc n} [hbv : BooleanValued f] :
        acceptanceProbabilityBLR f = expectation fun (x : Fin nFin 2) => expectation fun (y : Fin nFin 2) => 1 / 2 * (1 + f x * f y * f (x + y))

        The BLR test can detect that a Boolean valued function is close to being a character. See [odonnell2014], Theorem 1.30.