Documentation

CslibFrontier.Probability.SmallBias.Random

Short ε-biased lists exist #

A list s₁, …, s_d of bit strings in ι → Bool is ε-biased when the uniform distribution over the list is ε-biased (Cslib.BitString.IsSmallBias): for every nonempty set S of coordinates, |Σⱼ χ_S(sⱼ)| ≤ ε d. If ε ≥ 0, d ≥ 1 and 2 · 2^|ι| · exp(-ε² d / 2) < 1, such a list exists (Cslib.BitString.exists_isSmallBias_map_of_exp_lt). Unlike the explicit powering construction (Cslib.BitString.exists_isSmallBias_uniformOfFintype_map), whose lists have length a power of four, this gives every length d for which the bound holds, as [OAI26k] needs for its prescribed number of shifts.

The proof is the probabilistic method in counting form. For a fixed nonempty S the parities on S of the d strings are d independent unbiased bits: a shear of the cube (shear), adding to one coordinate i₀ ∈ S of each string the parity on S \ {i₀}, turns them into d coordinates of a uniformly random bit string. Hoeffding's inequality (Cslib.BitString.card_filter_le_abs_card_filter_sub_half_le) then bounds the number of lists biased at S by a 2 exp(-ε² d / 2) fraction (Cslib.BitString.card_biased_le), and a union bound over the fewer than 2^|ι| nonempty sets leaves an ε-biased list. This is the existence argument for the ε-biased shifts in [OpenAI2026ETH, proof of Lemma 6.1, (6.2)]; such lists are the generators of small-bias Cayley graphs Naor and Naor.

Main definitions #

Main results #

References #

theorem Cslib.BitString.sum_chi_eq {ι : Type u_1} {d : ℕ} (S : Finset ι) (s : Fin d → ι → Bool) :
∑ j : Fin d, chi ℝ S (s j) = ↑d - 2 * ↑{j : Fin d | parityOn S (s j) = true}.card

The sum of the character of S over a list is d minus twice the number of strings of the list with odd parity on S.

theorem Cslib.BitString.card_biased_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {d : ℕ} {S : Finset ι} (hS : S.Nonempty) {ε : ℝ} (hε : 0 ≤ ε) :
↑{s : Fin d → ι → Bool | ε * ↑d ≤ |∑ j : Fin d, chi ℝ S (s j)|}.card ≤ 2 * 2 ^ (d * Fintype.card ι) * Real.exp (-(ε ^ 2 * ↑d / 2))

Few lists are biased at a fixed nonempty set: at most a 2 exp(-ε² d / 2) fraction of the lists of d bit strings have |Σⱼ χ_S(sⱼ)| ≥ ε d.

theorem Cslib.BitString.exists_isSmallBias_map_of_exp_lt {ι : Type u_1} [Fintype ι] [DecidableEq ι] {d : ℕ} [NeZero d] {ε : ℝ} (hε : 0 ≤ ε) (h : 2 * 2 ^ Fintype.card ι * Real.exp (-(ε ^ 2 * ↑d / 2)) < 1) :
∃ (s : Fin d → ι → Bool), IsSmallBias ε (PMF.map s (Probability.PMF.uniformOfFintype (Fin d)))

Short ε-biased lists exist: if ε ≥ 0 and 2 · 2^|ι| · exp(-ε² d / 2) < 1, some list of d ≥ 1 bit strings has, at every nonempty set S, |Σⱼ χ_S(sⱼ)| < ε d; so the uniform distribution over it is ε-biased.

theorem Cslib.BitString.exp_neg_lt_of_ceil_le {ι : Type u_1} [Fintype ι] {d : ℕ} {ε : ℝ} (hε : 0 < ε) (hd : ⌈4 * (↑(Fintype.card ι) + 1) / ε ^ 2⌉₊ ≤ d) :
2 * 2 ^ Fintype.card ι * Real.exp (-(ε ^ 2 * ↑d / 2)) < 1

For ε > 0 and d ≥ ⌈4 (|ι| + 1) / ε²⌉, the probabilistic-method union bound 2 · 2^|ι| · exp (-ε² d / 2) < 1 holds.

theorem Cslib.BitString.exists_isSmallBias_map_of_ceil_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {d : ℕ} [NeZero d] {ε : ℝ} (hε : 0 < ε) (hd : ⌈4 * (↑(Fintype.card ι) + 1) / ε ^ 2⌉₊ ≤ d) :
∃ (s : Fin d → ι → Bool), IsSmallBias ε (PMF.map s (Probability.PMF.uniformOfFintype (Fin d)))

Short ε-biased lists of size ⌈4 (|ι| + 1) / ε²⌉: for ε > 0 and d ≥ ⌈4 (|ι| + 1) / ε²⌉, an ε-biased list of d bit strings on ι exists.

theorem Cslib.BitString.exists_isSmallBias_bitString_of_ceil (r : ℕ) {ε : ℝ} (hε : 0 < ε) :
0 < ⌈4 * (↑r + 1) / ε ^ 2⌉₊ ∧ ∃ (x : NeZero ⌈4 * (↑r + 1) / ε ^ 2⌉₊) (s : Fin ⌈4 * (↑r + 1) / ε ^ 2⌉₊ → BitString r), IsSmallBias ε (PMF.map s (Probability.PMF.uniformOfFintype (Fin ⌈4 * (↑r + 1) / ε ^ 2⌉₊)))

Explicit ⌈4 (r + 1) / ε²⌉ size bound: for every r and ε > 0, putting d = ⌈4 (r + 1) / ε²⌉ gives 0 < d and an ε-biased list of length d.

def Cslib.BitString.IsSmallBiasMultiset (r : ℕ) (ε : ℝ) (M : Multiset (Fin r → ZMod 2)) :

An ε-biased multiset over (ZMod 2) ^ r ([NaorNaor1993]): every nontrivial linear character x ↦ (-1) ^ (a ⬝ᵥ x).val (a ≠ 0) has average at most ε in absolute value.

theorem Cslib.BitString.isSmallBiasMultiset_iff {r : ℕ} {ε : ℝ} {M : Multiset (Fin r → ZMod 2)} :
IsSmallBiasMultiset r ε M ↔ 0 < M.card ∧ ∀ (a : Fin r → ZMod 2), a ≠ 0 → |(Multiset.map (fun (x : Fin r → ZMod 2) => (-1) ^ (a ⬝ᵥ x).val) M).sum / ↑M.card| ≤ ε

Unfolding lemma for IsSmallBiasMultiset.

theorem Cslib.BitString.exists_isSmallBiasMultiset_of_rat (r : ℕ) {ε : ℚ} (hε : 0 < ε) :
∃ (M : Multiset (Fin r → ZMod 2)), M.card = ⌈4 * (↑r + 1) / ↑ε ^ 2⌉₊ ∧ IsSmallBiasMultiset r (↑ε) M

Existence of ε-biased multisets over (ZMod 2) ^ r: for every r : ℕ and rational 0 < ε, there exists an ε-biased multiset of size ⌈4 (r + 1) / ε²⌉.