Boolean Function Definitions #
Core definitions for Boolean functions on the hypercube Fin n → Bool,
including bit flips, sensitivity, and local sensitivity.
Main definitions #
LeanPoolSensitivity.BoolFun— a Boolean function onnvariables.LeanPoolSensitivity.flipBit— flip thei-th coordinate of an input.LeanPoolSensitivity.BoolFun.sensitiveAt— predicate:fchanges value when flipping coordinateiat inputx.LeanPoolSensitivity.BoolFun.localSensitivity— the number of sensitive coordinates offat a given input.LeanPoolSensitivity.BoolFun.sensitivity— the maximum local sensitivity over all inputs.LeanPoolSensitivity.flipCoords— flip all bits inside a finite set of coordinates simultaneously.
Flip the i-th bit of an input x : Fin n → Bool, leaving all other
coordinates fixed.
Equations
- LeanPoolSensitivity.flipBit x i = Function.update x i !x i
Instances For
Different coordinates produce different bit flips of x.
def
LeanPoolSensitivity.BoolFun.sensitiveAt
{n : ℕ}
(f : BoolFun n)
(x : Fin n → Bool)
(i : Fin n)
:
f is sensitive at input x in coordinate i when flipping bit i
changes the value of f.
Equations
- f.sensitiveAt x i = (f (LeanPoolSensitivity.flipBit x i) ≠ f x)
Instances For
@[implicit_reducible]
instance
LeanPoolSensitivity.BoolFun.instDecidableSensitiveAt
{n : ℕ}
(f : BoolFun n)
(x : Fin n → Bool)
(i : Fin n)
:
Decidable (f.sensitiveAt x i)
Equations
The local sensitivity of f at input x: number of coordinates i at
which f is sensitive.
Equations
- f.localSensitivity x = {i : Fin n | f.sensitiveAt x i}.card
Instances For
The sensitivity of f: the maximum of f.localSensitivity x over all
inputs x.
Equations
- f.sensitivity = Finset.univ.sup fun (x : Fin n → Bool) => f.localSensitivity x
Instances For
The sensitivity of any Boolean function on n variables is at most n.
theorem
LeanPoolSensitivity.BoolFun.localSensitivity_le_sensitivity
{n : ℕ}
(f : BoolFun n)
(x : Fin n → Bool)
:
The local sensitivity at any specific input is bounded above by the
sensitivity of f.