Documentation

CslibFrontier.Probability.IID.CrossCollisionCount

Cross-collision counts of two independent samples #

Cslib.Probability.PMF.crossCollisionCount x y is the number of pairs (i, j) of positions with x i = y j, for samples x : Fin k → α and y : Fin l → α. It is the sum over values a of the products of the occurrence counts of a in x and in y (crossCollisionCount_eq_sum).

Let x be k independent draws from p and y, independently, l independent draws from q. Write t = ∑ a, p(a) q(a), u = ∑ a, p(a) q(a)² and v = ∑ a, p(a)² q(a). Then:

These are the moments of the collision-based closeness tester Diakonikolas–Gouleakis–Peebles–Price, §3 (section numbers follow arXiv:1611.03579v1). Each follows from the occurrence-count moments of CslibFrontier.Probability.IID.CollisionCount and the independence of the two samples.

Main definitions #

Main results #

References #

def Cslib.Probability.PMF.crossCollisionCount {α : Type u_1} [DecidableEq α] {k l : ℕ} (x : Fin k → α) (y : Fin l → α) :

The number of pairs (i, j) of positions with x i = y j.

theorem Cslib.Probability.PMF.crossCollisionCount_eq_sum {α : Type u_1} [DecidableEq α] [Fintype α] {k l : ℕ} (x : Fin k → α) (y : Fin l → α) :
↑(crossCollisionCount x y) = ∑ a : α, ↑(occurrenceCount x a) * ↑(occurrenceCount y a)

The cross-collision count is the sum over values of the products of their occurrence counts in the two samples.

theorem Cslib.Probability.PMF.sum_sum_iid_mul_crossCollisionCount {α : Type u_1} [DecidableEq α] [Fintype α] (p q : PMF α) (k l : ℕ) :
∑ x : Fin k → α, ∑ y : Fin l → α, ((iid p k) x).toReal * ((iid q l) y).toReal * ↑(crossCollisionCount x y) = ↑k * ↑l * ∑ a : α, (p a).toReal * (q a).toReal

Mean of the cross-collision count: for k draws from p and l independent draws from q, the expected number of colliding pairs across the samples is k l ∑ a, p(a) q(a).

theorem Cslib.Probability.PMF.sum_sum_iid_mul_crossCollisionCount_sq {α : Type u_1} [DecidableEq α] [Fintype α] (p q : PMF α) (k l : ℕ) :
∑ x : Fin k → α, ∑ y : Fin l → α, ((iid p k) x).toReal * ((iid q l) y).toReal * ↑(crossCollisionCount x y) ^ 2 = ↑k * ↑l * ∑ a : α, (p a).toReal * (q a).toReal + ↑k * (↑k - 1) * ↑l * ∑ a : α, (p a).toReal ^ 2 * (q a).toReal + ↑k * ↑l * (↑l - 1) * ∑ a : α, (p a).toReal * (q a).toReal ^ 2 + ↑k * (↑k - 1) * ↑l * (↑l - 1) * (∑ a : α, (p a).toReal * (q a).toReal) ^ 2

Second moment of the cross-collision count: with t = ∑ a, p(a) q(a), u = ∑ a, p(a) q(a)² and v = ∑ a, p(a)² q(a), it is k l t + k (k - 1) l v + k l (l - 1) u + k (k - 1) l (l - 1) t².

theorem Cslib.Probability.PMF.sum_sum_iid_mul_collisionCount_mul_crossCollisionCount {α : Type u_1} [DecidableEq α] [Fintype α] (p q : PMF α) (k l : ℕ) :
∑ x : Fin k → α, ∑ y : Fin l → α, ((iid p k) x).toReal * ((iid q l) y).toReal * (↑(collisionCount x) * ↑(crossCollisionCount x y)) = ↑k * (↑k - 1) * (↑k - 2) / 2 * ↑l * collisionProbability p * ∑ a : α, (p a).toReal * (q a).toReal + ↑k * (↑k - 1) * ↑l * ∑ a : α, (p a).toReal ^ 2 * (q a).toReal

Joint moment of the collision count of x and the cross-collision count: with t = ∑ a, p(a) q(a) and v = ∑ a, p(a)² q(a), it is k (k - 1) (k - 2) l ‖p‖₂² t / 2 + k (k - 1) l v.

theorem Cslib.Probability.PMF.sum_sum_iid_mul_crossCollisionCount_mul_collisionCount {α : Type u_1} [DecidableEq α] [Fintype α] (p q : PMF α) (k l : ℕ) :
∑ x : Fin k → α, ∑ y : Fin l → α, ((iid p k) x).toReal * ((iid q l) y).toReal * (↑(crossCollisionCount x y) * ↑(collisionCount y)) = ↑k * (↑l * (↑l - 1) * (↑l - 2) / 2) * collisionProbability q * ∑ a : α, (p a).toReal * (q a).toReal + ↑k * (↑l * (↑l - 1)) * ∑ a : α, (p a).toReal * (q a).toReal ^ 2

Joint moment of the cross-collision count and the collision count of y: with t = ∑ a, p(a) q(a) and u = ∑ a, p(a) q(a)², it is k l (l - 1) (l - 2) ‖q‖₂² t / 2 + k l (l - 1) u.