Documentation

Complexitylib.BooleanAnalysis.FourierExpansion.Internal

Chapter 1: Boolean functions and the Fourier expansion — Internal lemmas #

Technical helper lemmas for the Fourier expansion theory. These support the main results in BooleanAnalysis.FourierExpansion but are not intended for direct use by downstream code.

@[simp]

χ(b)² = 1 for all b : ZMod 2.

@[simp]

χ(b) · χ(b) = 1 (non-pow form, useful when simp doesn't see sq).

χ(b) = 1 or χ(b) = -1.

@[simp]

χ is multiplicative: χ(a + b) = χ(a) · χ(b).

χ(b) ≠ 0 for all b : ZMod 2.

@[simp]

The parity function on the empty set is the constant function 1.

@[simp]

Parity functions are multiplicative: χ S (x + y) = χ S x · χ S y. (Equation 1.5 in the book)

@[simp]

(χ S x)² = 1 for all S and x.

@[simp]

χ S 0 = 1.

Fact 1.7: 𝔼[χ S] = 1 if S = ∅ and 𝔼[χ S] = 0 if S ≠ ∅.

theorem Complexity.BooleanAnalysis.Internal.expect_boolean_eq_prob_diff {n : } (f : BooleanFunction n) (hf : IsBooleanValued f) :
expect f = (prob fun (x : Cube n) => f x = 1) - prob fun (x : Cube n) => f x = -1

Definition 1.11 (explicit form): For Boolean-valued f, 𝔼[f] = Pr[f = 1] - Pr[f = -1].

theorem Complexity.BooleanAnalysis.Internal.prob_boolean_sum_one {n : } (f : BooleanFunction n) (hf : IsBooleanValued f) :
((prob fun (x : Cube n) => f x = 1) + prob fun (x : Cube n) => f x = -1) = 1

For Boolean-valued f, Pr[f = 1] + Pr[f = -1] = 1. (Implicit in Definition 1.11: every input maps to exactly one of 1 or -1.)

Helper: ⟪f, g⟫ + 2 · dist(f, g) = 1 for Boolean-valued f, g.

χ_S · χ_T = χ_{S △ T} (pointwise).

Theorem 1.5: The parity functions are orthonormal: ⟪χ S, χ T⟫ = 1 if S = T and 0 otherwise.

theorem Complexity.BooleanAnalysis.Internal.sum_parityFun {n : } (z : Cube n) :
S : Finset (Fin n), parityFun S z = if z = 0 then 2 ^ n else 0

Sum of all parity functions at a point: ∑_S χ_S(z) = 2^n if z = 0, else 0.

The Fourier expansion: f(x) = ∑_S 𝓕 f S · χ_S(x).

theorem Complexity.BooleanAnalysis.Internal.fourier_uniqueness_proof {n : } (f : BooleanFunction n) (c : Finset (Fin n)) (h : ∀ (x : Cube n), f x = S : Finset (Fin n), c S * parityFun S x) (T : Finset (Fin n)) :
c T = fourierCoeff f T

Fourier uniqueness: If f(x) = ∑_S c_S · χ_S(x) for all x, then c_S = 𝓕 f S for all S.

Proof: take ⟪–, χ T⟫ of both sides. On the right, orthonormality kills every term except S = T, leaving c T. On the left we get 𝓕 f T.

Orthonormal basis of parity functions #

The parity functions χ S form an orthonormal basis for BooleanFunction n under the uniform-measure inner product. Plancherel and Parseval follow directly from Mathlib's OrthonormalBasis API.

The parity functions are orthonormal under the uniform-measure inner product.

The parity functions span BooleanFunction n.

The parity functions form an orthonormal basis for BooleanFunction n.

Equations
Instances For

    Plancherel's theorem: ⟪f, g⟫ = ∑_S 𝓕 f S · 𝓕 g S. Derived from the OrthonormalBasis of parity functions.

    Helpers for §1.4 Proposition 1.15 (variance–distance bounds) #

    theorem Complexity.BooleanAnalysis.Internal.hammingDist_const_one {n : } (f : BooleanFunction n) (hf : IsBooleanValued f) :
    (hammingDist f fun (x : Cube n) => 1) = prob fun (x : Cube n) => f x = -1

    dist(f, 1) = Pr[f = -1] for Boolean-valued f.

    theorem Complexity.BooleanAnalysis.Internal.hammingDist_const_neg_one {n : } (f : BooleanFunction n) (hf : IsBooleanValued f) :
    (hammingDist f fun (x : Cube n) => -1) = prob fun (x : Cube n) => f x = 1

    dist(f, -1) = Pr[f = 1] for Boolean-valued f.

    theorem Complexity.BooleanAnalysis.Internal.variance_dist_bounds_arith (p q : ) (hp : 0 p) (hq : 0 q) (hpq : p + q = 1) :
    2 * min q p 4 * p * q 4 * p * q 4 * min q p

    For p, q ≥ 0 with p + q = 1: 2 · min(q, p) ≤ 4pq ≤ 4 · min(q, p).

    Helpers for §1.5 (densities and convolution) #

    z + y + y = z in 𝔽₂ⁿ (characteristic 2 cancellation).

    setDensity {0} evaluates to 2^n at 0 and 0 elsewhere.

    setDensity {0} equals the sum of all parity functions.

    Every Fourier coefficient of setDensity {0} is 1.

    The convolution of two densities is again a density.

    The convolution theorem: 𝓕 (f ⊛ g) S = (𝓕 f S) · (𝓕 g S).

    Helpers for §1.6 (BLR test and local correctability) #

    theorem Complexity.BooleanAnalysis.Internal.prob_compl {n : } (P : Cube nProp) :
    (prob P + prob fun (x : Cube n) => ¬P x) = 1

    Pr[P] + Pr[¬P] = 1.

    0 ≤ Pr[P].

    theorem Complexity.BooleanAnalysis.Internal.prob_union_bound {n : } {P Q R : Cube nProp} (h : ∀ (x : Cube n), ¬P xQ x R x) :
    (prob fun (x : Cube n) => ¬P x) prob Q + prob R

    Union bound: if ¬P ⊆ Q ∪ R then Pr[¬P] ≤ Pr[Q] + Pr[R].

    theorem Complexity.BooleanAnalysis.Internal.prob_shift {n : } (P : Cube nProp) (x : Cube n) :
    (prob fun (y : Cube n) => P (x + y)) = prob P

    Shift invariance of probability: Pr_y[P(x + y)] = Pr_z[P(z)].

    χ S y · χ S (x + y) = χ S x (key identity for local correctability).

    theorem Complexity.BooleanAnalysis.Internal.local_correctability_proof {n : } (f : BooleanFunction n) (_hf : IsBooleanValued f) (S : Finset (Fin n)) (ε : ) (hclose : IsClose f (parityFun S) ε) (x : Cube n) :
    (prob fun (y : Cube n) => f y * f (x + y) = parityFun S x) 1 - 2 * ε

    Local correctability of the Fourier decoding algorithm.

    Helpers for §1.6 (BLR acceptance probability and soundness) #

    Parseval's theorem: ⟪f, f⟫ = ∑_S (𝓕 f S)².

    Parseval's theorem for Boolean-valued functions.

    For Boolean f, (𝓕 f S)² ≤ 1.

    theorem Complexity.BooleanAnalysis.Internal.cube_le_max_sq {n : } {f : BooleanFunction n} (_f : BooleanFunction n) (_hf : IsBooleanValued f) (c : ) (hmax : ∀ (T : Finset (Fin n)), fourierCoeff f T c) (S : Finset (Fin n)) :

    For Boolean f, (𝓕 f S)³ ≤ c · (𝓕 f S)² when c dominates all Fourier coefficients.

    Parity functions are Boolean-valued.

    dist(f, χ S) = (1 - 𝓕 f S) / 2 for Boolean-valued f.

    theorem Complexity.BooleanAnalysis.Internal.blr_indicator_eq {n : } (f : BooleanFunction n) (hf : IsBooleanValued f) (x y : Cube n) :
    indicator (fun (y : Cube n) => f x * f y = f (x + y)) y = (1 + f x * f y * f (x + y)) / 2

    For Boolean f, the BLR indicator equals (1 + f(x)·f(y)·f(x+y))/2.

    theorem Complexity.BooleanAnalysis.Internal.triple_expect_eq {n : } (f : BooleanFunction n) :
    (expect fun (x : Cube n) => expect fun (y : Cube n) => f x * f y * f (x + y)) = inner f (convolution f f)

    𝔼_x[𝔼_y[f(x)·f(y)·f(x+y)]] = ⟪f, f ⊛ f⟫.

    ⟪f, f ⊛ f⟫ = ∑_S (𝓕 f S)³.

    theorem Complexity.BooleanAnalysis.Internal.expect_add_const {n : } (c : ) (g : BooleanFunction n) :
    (expect fun (x : Cube n) => c + g x) = c + expect g

    Linearity of expectation: 𝔼[c + g] = c + 𝔼[g].

    theorem Complexity.BooleanAnalysis.Internal.expect_scale {n : } (c : ) (g : BooleanFunction n) :
    (expect fun (x : Cube n) => c * g x) = c * expect g

    Linearity of expectation: 𝔼[c · g] = c · 𝔼[g].

    The BLR acceptance probability formula.

    BLR completeness: If f is linear (i.e., f = χ_S for some S), then the BLR test accepts with probability 1.

    BLR soundness: if the BLR test accepts with probability ≥ 1 - ε, then f is ε-close to a linear function.

    Equivalence of linearity characterizations (§1.6) #

    For Boolean-valued multiplicative f, f(0) = 1.

    theorem Complexity.BooleanAnalysis.Internal.multiplicative_finset_sum {n : } {ι : Type u_1} (f : BooleanFunction n) (hf : IsBooleanValued f) (hmul : IsMultiplicative f) (s : Finset ι) (g : ιCube n) :
    f (∑ is, g i) = is, f (g i)

    A multiplicative function distributes over finite sums: f(∑_{i ∈ s} gᵢ) = ∏_{i ∈ s} f(gᵢ).

    theorem Complexity.BooleanAnalysis.Internal.cube_eq_sum_support {n : } (x : Cube n) :
    x = i : Fin n with x i = 1, Pi.single i 1

    In 𝔽₂ⁿ, every element is the sum of its support basis vectors: x = ∑_{i : x i = 1} eᵢ.

    Multiplicative + Boolean-valued implies linear. Key idea: define S = {i | f(eᵢ) = -1} and show f = χ S by decomposing x into a sum of basis vectors and using multiplicativity.

    Definition 1.28 (equivalence): Linear ↔ multiplicative for Boolean-valued functions.

    Helpers for §1.5 (set density properties) #

    The expectation of an indicator is positive when the set is nonempty.

    For nonempty A, setDensity A is a valid probability density.

    Fact 1.23 (general): 𝓕 φ_A S = (1/|A|) · ∑_{x ∈ A} χ_S(x).