Documentation

CslibFrontier.Probability.PairwiseIndependentHash.RetentionChannel

Retention channels over a prime field #

A retention channel selects a random set of identifiers at a prescribed rate, with pairwise independence. Its seed is an affine map y ↦ A y + b from 𝔽_P to 𝔽_P ^ H, with a uniformly random matrix A and vector b. The identifier y : ZMod P is retained (affineRetains P H L s y) when every coordinate of A y + b, read as a number in {0, …, P - 1}, is less than L. The target is then the box retentionBox P H L with L ^ H points (card_retentionBox). By the pairwise independence of affine hashing (isPairwiseIndependentHash_affineHash) and the general retention bounds of CslibFrontier.Probability.PairwiseIndependentHash.Retention, every identifier is retained with probability exactly π = (L / P) ^ H, and two distinct identifiers both with probability π ^ 2. This is sampling by pairwise independent hashing [CG89] with the hash families of Carter and Wegman [CW79].

For a target rate f = a ^ H with 1 ≤ P a and a ≤ 1, the side L = ⌈P a⌉ gives f ≤ π ≤ 2 ^ H f (affineRetains_rates). Then the conditional probability that w is retained, given that y ≠ w is retained, is at most 2 ^ H f. A deterministic nonempty set A retains fewer than #A π / 2 of its identifiers with probability at most 4 / (#A π). Two channels with independent seeds, on the product seed space, give independent events (dens_filter_fst_and_snd).

These are the channel properties used in Section 4 of the unrefereed preprint [OAI26e]: there, c_π f ≤ π_f ≤ C_π f, Pr[Y(w) | Y(y)] ≤ C_pair f, the lower tail Pr[∑_{x ∈ A} X(x) < |A| π / 2] ≤ C_var / (|A| π), and the independence of the channels X and Y. Here the constants are c_π = 1, C_π = C_pair = 2 ^ H and C_var = 4. The preprint conditions its channels on linearly independent frames, which changes these constants only by a bounded factor. The frames matter only for the later averaging walks, so they are not needed here.

Main definitions #

Main results #

References #

The retention box {v | ∀ j, (v j).val < L} in ZMod P ^ H: every coordinate, read as a number in {0, …, P - 1}, is less than L.

@[simp]
theorem Cslib.Probability.mem_retentionBox {P H L : ℕ} [NeZero P] {v : Fin H → ZMod P} :
v ∈ retentionBox P H L ↔ ∀ (j : Fin H), (v j).val < L

A vector lies in the retention box when each coordinate has representative less than L.

theorem Cslib.Probability.card_retentionBox {P H L : ℕ} [NeZero P] (hL : L ≤ P) :
(retentionBox P H L).card = L ^ H

The retention box has L ^ H points when L ≤ P.

@[reducible, inline]
abbrev Cslib.Probability.affineRetains (P H L : ℕ) [NeZero P] (s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P)) (y : ZMod P) :

The identifier y is retained by the affine seed s = (A, b) when A y + b lies in the retention box.

theorem Cslib.Probability.dens_affineRetains {P H L : ℕ} [NeZero P] [Fact (Nat.Prime P)] (hL : L ≤ P) (y : ZMod P) :
{s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P) | affineRetains P H L s y}.dens = (↑L / ↑P) ^ H

Retention probability: every identifier is retained with probability (L / P) ^ H.

theorem Cslib.Probability.dens_affineRetains_and {P H L : ℕ} [NeZero P] [Fact (Nat.Prime P)] (hL : L ≤ P) {w y : ZMod P} (hwy : w ≠ y) :
{s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P) | affineRetains P H L s w ∧ affineRetains P H L s y}.dens = (↑L / ↑P) ^ H * (↑L / ↑P) ^ H

Pairwise independent retention: two distinct identifiers are both retained with probability ((L / P) ^ H) ^ 2.

theorem Cslib.Probability.affineRetains_of_le {P H : ℕ} [NeZero P] {L₁ L₂ : ℕ} (hL : L₂ ≤ L₁) {s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P)} {y : ZMod P} (h : affineRetains P H L₂ s y) :
affineRetains P H L₁ s y

Nested boxes: an identifier retained with side L₂ is retained with every side L₁ ≥ L₂, by the same seed. So a channel at a lower rate retains a subset.

theorem Cslib.Probability.dens_affineRetains_and_affineRetains {P H : ℕ} [NeZero P] [Fact (Nat.Prime P)] {L₁ L₂ : ℕ} (hL₁ : L₁ ≤ P) (hL₂ : L₂ ≤ P) {w y : ZMod P} (hwy : w ≠ y) :
{s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P) | affineRetains P H L₁ s w ∧ affineRetains P H L₂ s y}.dens = (↑L₁ / ↑P) ^ H * (↑L₂ / ↑P) ^ H

Pairwise independent retention at two rates: for distinct identifiers w ≠ y, the seed retains w with side L₁ and y with side L₂ with probability (L₁ / P) ^ H * (L₂ / P) ^ H.

theorem Cslib.Probability.dens_two_mul_card_filter_affineRetains_lt_le {P H L : ℕ} [NeZero P] [Fact (Nat.Prime P)] (hL : L ≤ P) (A : Finset (ZMod P)) (hpos : 0 < ↑A.card * (↑L / ↑P) ^ H) :
↑{s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P) | 2 * ↑{y ∈ A | affineRetains P H L s y}.card < ↑A.card * (↑L / ↑P) ^ H}.dens ≤ 4 / (↑A.card * (↑L / ↑P) ^ H)

Lower tail of the retained count: a set A of identifiers retains fewer than half of its expected number #A π, with π = (L / P) ^ H, with probability at most 4 / (#A π).

theorem Cslib.Probability.affineRetains_rates {P H : ℕ} [NeZero P] [Fact (Nat.Prime P)] {a : ℝ} (hPa : 1 ≤ ↑P * a) (ha : a ≤ 1) :
have L := ⌈↑P * a⌉₊; L ≤ P ∧ a ^ H ≤ (↑L / ↑P) ^ H ∧ (↑L / ↑P) ^ H ≤ 2 ^ H * a ^ H ∧ (∀ (w y : ZMod P), w ≠ y → ↑{s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P) | affineRetains P H L s w ∧ affineRetains P H L s y}.dens ≤ 2 ^ H * a ^ H * ↑{s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P) | affineRetains P H L s y}.dens) ∧ ∀ (A : Finset (ZMod P)), A.Nonempty → ↑{s : Matrix (Fin H) (Fin 1) (ZMod P) × (Fin H → ZMod P) | 2 * ↑{y ∈ A | affineRetains P H L s y}.card < ↑A.card * (↑L / ↑P) ^ H}.dens ≤ 4 / (↑A.card * (↑L / ↑P) ^ H)

The four channel properties at rate f = a ^ H. Let 1 ≤ P a, a ≤ 1 and L = ⌈P a⌉, and write π = (L / P) ^ H for the retention probability. Then L ≤ P, f ≤ π ≤ 2 ^ H f, two distinct identifiers are both retained with probability at most 2 ^ H f times the probability that one of them is, and a nonempty set A retains fewer than #A π / 2 of its identifiers with probability at most 4 / (#A π). Independence of two channels is dens_filter_fst_and_snd.