Documentation

CslibFrontier.Foundations.BooleanAnalysis.Influence

Influences on the Boolean cube #

The derivative of a real function f on the cube in coordinate i is half the difference between its values at bit i equal to false (sign 1) and to true (sign -1) (BitString.derivative); it is O'Donnell's Dᵢ f when bits are read as the signs BitString.signVal. The influence of i on f is the mean square of this derivative (BitString.influence), and the total influence of f is the sum of its influences (BitString.totalInfluence).

Differentiating in i removes i from the sets containing it and kills the others (BitString.fourierCoeff_derivative), so the influence of i is the Fourier weight of f on the sets containing i (BitString.influence_eq_sum_fourierCoeff_sq), and the total influence weighs each squared coefficient by the size of its set (BitString.totalInfluence_eq_sum_card_mul_fourierCoeff_sq). Since the variance is the weight on the nonempty sets (BitString.expect_sub_expect_sq_eq_sum_fourierCoeff_sq), it is at most the total influence (the Poincaré inequality, BitString.expect_sub_expect_sq_le_totalInfluence).

For a Boolean function read as signs, the derivative in i takes the values 0 and ±1 (BitString.sq_derivative_signVal) and is nonzero exactly where flipping bit i changes the value (BitString.derivative_signVal_ne_zero_iff). So the influence of i is the probability that flipping bit i changes the value (BitString.influence_signVal, BitString.influence_signVal_eq_dens), it is nonzero exactly when some flip of bit i changes the value (BitString.influence_signVal_ne_zero_iff), and the total influence is the expected number of bits whose flip changes the value, the average sensitivity (BitString.totalInfluence_signVal) O'Donnell, Sections 2.2 and 2.3.

The gradient ∇f(x) is the vector of derivatives at x (BitString.gradient), and the total influence is the mean squared norm of the gradient (BitString.totalInfluence_eq_expect_sum_gradient_sq) O'Donnell, Definition 2.34 and Proposition 2.35; for a Boolean function read as signs the squared norm at x is the number of bits whose flip changes the value (BitString.sum_gradient_signVal_sq).

Main definitions #

Main results #

References #

noncomputable def Cslib.BitString.derivative {ι : Type u_1} [DecidableEq ι] (i : ι) (f : (ι → Bool) → ℝ) (x : ι → Bool) :

The derivative of f in coordinate i: half the difference between the values of f at bit i equal to false, of sign 1, and to true, of sign -1.

@[simp]
theorem Cslib.BitString.derivative_update {ι : Type u_1} [DecidableEq ι] (i : ι) (f : (ι → Bool) → ℝ) (x : ι → Bool) (b : Bool) :

The derivative in i does not depend on bit i.

theorem Cslib.BitString.derivative_chi {ι : Type u_1} [DecidableEq ι] (i : ι) (S : Finset ι) (x : ι → Bool) :
derivative i (chi ℝ S) x = if i ∈ S then chi ℝ (S.erase i) x else 0

The derivative of a character: differentiating in i removes i from a set containing it, and kills the characters of the other sets.

theorem Cslib.BitString.sq_derivative_signVal {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (i : ι) (x : ι → Bool) :
derivative i (fun (x : ι → Bool) => signVal (f x)) x ^ 2 = |derivative i (fun (x : ι → Bool) => signVal (f x)) x|

The derivative of a Boolean function read as signs takes the values 0 and ±1, so its square is its absolute value.

theorem Cslib.BitString.derivative_signVal_ne_zero_iff {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (i : ι) (x : ι → Bool) :
derivative i (fun (x : ι → Bool) => signVal (f x)) x ≠ 0 ↔ f (Function.update x i !x i) ≠ f x

The derivative in i of a Boolean function read as signs is nonzero exactly where flipping bit i changes the value.

theorem Cslib.BitString.sq_derivative_signVal_eq_ite {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → Bool) (i : ι) (x : ι → Bool) :
derivative i (fun (x : ι → Bool) => signVal (f x)) x ^ 2 = if f (Function.update x i !x i) = f x then 0 else 1

The squared derivative of a Boolean function read as signs is 1 where flipping bit i changes the value and 0 elsewhere.

theorem Cslib.BitString.derivative_comp_arrowCongr {ι : Type u_1} [DecidableEq ι] {κ : Type u_2} [DecidableEq κ] (e : ι ≃ κ) (i : ι) (g : (κ → Bool) → ℝ) (x : ι → Bool) :
derivative i (fun (y : ι → Bool) => g fun (j : κ) => y (e.symm j)) x = derivative (e i) g fun (j : κ) => x (e.symm j)

The derivative commutes with renaming the coordinates: differentiating g with its coordinates renamed by e in i is differentiating g in e i.

theorem Cslib.BitString.derivative_eq_sum {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → ℝ) (x : ι → Bool) :
derivative i f x = ∑ S : Finset ι with i ∈ S, fourierCoeff f S * chi ℝ (S.erase i) x

The Fourier expansion of a derivative: differentiating in i keeps the sets containing i, with i removed.

theorem Cslib.BitString.fourierCoeff_derivative {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → ℝ) (T : Finset ι) :

The Fourier coefficients of a derivative: the coefficient of the derivative in i on a set avoiding i is the coefficient of f on the set with i added, and it vanishes on the sets containing i O'Donnell, Section 2.2.

noncomputable def Cslib.BitString.influence {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → ℝ) :

The influence of coordinate i on f: the mean square of the derivative of f in i.

theorem Cslib.BitString.influence_nonneg {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → ℝ) :

Influences are nonnegative.

theorem Cslib.BitString.influence_eq_sum_fourierCoeff_sq {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → ℝ) :
influence i f = ∑ S : Finset ι with i ∈ S, fourierCoeff f S ^ 2

The influence of i is the Fourier weight on the sets containing i O'Donnell, Section 2.2.

theorem Cslib.BitString.influence_le_expect_sq {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → ℝ) :
influence i f ≤ Finset.univ.expect fun (x : ι → Bool) => f x ^ 2

The influence of a coordinate is at most the mean square.

theorem Cslib.BitString.influence_comp_arrowCongr {ι : Type u_1} [DecidableEq ι] [Fintype ι] {κ : Type u_2} [Fintype κ] [DecidableEq κ] (e : ι ≃ κ) (i : ι) (g : (κ → Bool) → ℝ) :
(influence i fun (y : ι → Bool) => g fun (j : κ) => y (e.symm j)) = influence (e i) g

Relabelling the coordinates relabels the influences: renaming the coordinates of g by e, the influence of i is the influence of e i on g.

theorem Cslib.BitString.influence_chi {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (S : Finset ι) :
influence i (chi ℝ S) = if i ∈ S then 1 else 0

The influence of i on a character is one if i is in its set, and zero otherwise.

theorem Cslib.BitString.influence_signVal {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → Bool) :
(influence i fun (x : ι → Bool) => signVal (f x)) = Finset.univ.expect fun (x : ι → Bool) => if f (Function.update x i !x i) = f x then 0 else 1

The influence on a Boolean function read as signs is the probability that flipping bit i changes the value O'Donnell, Section 2.2.

theorem Cslib.BitString.influence_signVal_eq_dens {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → Bool) (i : ι) :
(influence i fun (x : ι → Bool) => signVal (f x)) = ↑{x : ι → Bool | derivative i (fun (x : ι → Bool) => signVal (f x)) x ≠ 0}.dens

The influence of i on a Boolean function read as signs is the density of the points where its derivative in i is nonzero.

theorem Cslib.BitString.influence_signVal_ne_zero_iff {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → Bool) (i : ι) :
(influence i fun (x : ι → Bool) => signVal (f x)) ≠ 0 ↔ ∃ (x : ι → Bool), f (Function.update x i !x i) ≠ f x

Relevant coordinates: a coordinate has nonzero influence on a Boolean function read as signs exactly when flipping it changes the value of the function on some input.

noncomputable def Cslib.BitString.totalInfluence {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → ℝ) :

The total influence of f: the sum of the influences of the coordinates.

theorem Cslib.BitString.totalInfluence_nonneg {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → ℝ) :

The total influence is nonnegative.

theorem Cslib.BitString.influence_le_totalInfluence {ι : Type u_1} [DecidableEq ι] [Fintype ι] (i : ι) (f : (ι → Bool) → ℝ) :

The influence of a coordinate is at most the total influence.

The spectral formula for the total influence: each squared Fourier coefficient counts as many times as its set has elements O'Donnell, Section 2.3.

noncomputable def Cslib.BitString.gradient {ι : Type u_1} [DecidableEq ι] (f : (ι → Bool) → ℝ) (x : ι → Bool) :
ι → ℝ

The gradient of f at x: the vector of its derivatives (D₁ f(x), …, Dₙ f(x)) O'Donnell, Definition 2.34. Its squared Euclidean norm ‖∇f(x)‖₂² is written ∑ i, gradient f x i ^ 2; the norm of ι → ℝ is the sup norm.

theorem Cslib.BitString.totalInfluence_eq_expect_sum_gradient_sq {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → ℝ) :
totalInfluence f = Finset.univ.expect fun (x : ι → Bool) => ∑ i : ι, gradient f x i ^ 2

The total influence is the mean squared norm of the gradient: I[f] = E[‖∇f(x)‖₂²] O'Donnell, Proposition 2.35.

theorem Cslib.BitString.sum_gradient_signVal_sq {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → Bool) (x : ι → Bool) :
∑ i : ι, gradient (fun (x : ι → Bool) => signVal (f x)) x i ^ 2 = ↑{i : ι | f (Function.update x i !x i) ≠ f x}.card

For a Boolean function read as signs, the squared norm of the gradient at x is the sensitivity of f at x, the number of bits whose flip changes the value O'Donnell, remark after Definition 2.34.

theorem Cslib.BitString.totalInfluence_signVal {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → Bool) :
(totalInfluence fun (x : ι → Bool) => signVal (f x)) = Finset.univ.expect fun (x : ι → Bool) => ↑{i : ι | f (Function.update x i !x i) ≠ f x}.card

The total influence of a Boolean function read as signs is its average sensitivity: the expected number of bits whose flip changes the value O'Donnell, Proposition 2.28.

A character has total influence the size of its set.

theorem Cslib.BitString.expect_sub_expect_sq_eq_sum_fourierCoeff_sq {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → ℝ) :
(Finset.univ.expect fun (x : ι → Bool) => (f x - Finset.univ.expect fun (y : ι → Bool) => f y) ^ 2) = ∑ S : Finset ι with S ≠ ∅, fourierCoeff f S ^ 2

The variance is the Fourier weight on the nonempty sets O'Donnell, Section 1.4.

theorem Cslib.BitString.expect_sub_expect_sq_le_totalInfluence {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → ℝ) :
(Finset.univ.expect fun (x : ι → Bool) => (f x - Finset.univ.expect fun (y : ι → Bool) => f y) ^ 2) ≤ totalInfluence f

The Poincaré inequality: the variance is at most the total influence O'Donnell, Section 2.3.

theorem Cslib.BitString.totalInfluence_le_mul_expect_sq {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → ℝ) :
totalInfluence f ≤ ↑(Fintype.card ι) * Finset.univ.expect fun (x : ι → Bool) => f x ^ 2

The total influence is at most the number of coordinates times the mean square.

theorem Cslib.BitString.expect_sub_expect_sq_signVal_le_one {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → Bool) :
(Finset.univ.expect fun (x : ι → Bool) => (signVal (f x) - Finset.univ.expect fun (y : ι → Bool) => signVal (f y)) ^ 2) ≤ 1

The variance of a Boolean function read as signs is at most one.

theorem Cslib.BitString.influence_signVal_le_one {ι : Type u_1} [DecidableEq ι] [Fintype ι] (f : (ι → Bool) → Bool) (i : ι) :
(influence i fun (x : ι → Bool) => signVal (f x)) ≤ 1

The influence of a coordinate on a Boolean function read as signs is at most one.