The collision tester for closeness #
Given k samples x of an unknown distribution p and k independent samples y of an unknown
distribution q on a finite type, the collision statistic of
Diakonikolas–Gouleakis–Peebles–Price, §3 is
Z = C₁ + C₂ - ((k - 1) / k) C₃ (closenessStatistic). Here C₁ and C₂ count colliding pairs
within x and within y (Cslib.Probability.PMF.collisionCount), and C₃ counts colliding pairs
across them (Cslib.Probability.PMF.crossCollisionCount). The statistic estimates the squared
ℓ₂ distance without bias: E[Z] = C(k, 2) ‖p - q‖₂² (sum_sum_iid_mul_closenessStatistic).
The variance has a closed form (sum_sum_iid_mul_closenessStatistic_sub_sq). If
‖p‖₂², ‖q‖₂² ≤ b, it is at most (k - 1) (2 k - 1) b + 2 (k - 1)² (k + 1) √b ‖p - q‖₄²
(sum_sum_iid_mul_closenessStatistic_sub_sq_le_sqrt_sum_pow_four), hence at most the same with
‖p - q‖₂² in place of ‖p - q‖₄² (sum_sum_iid_mul_closenessStatistic_sub_sq_le). The tester
(closenessTester) accepts when Z ≤ C(k, 2) ε² / 2. For 0 < ε, Chebyshev's inequality shows
that it distinguishes ‖p - q‖₂ ≤ ε / 2 from ‖p - q‖₂ ≥ ε, with error at most δ on each side,
once 36 √b ≤ (k - 1) ε² δ (le_acceptProb₂_closenessTester, acceptProb₂_closenessTester_le;
the Lean statements use the squared distances ‖p - q‖₂² ≤ ε² / 4 and ε² ≤ ‖p - q‖₂²). So
k = O(√b / ε²) samples suffice, as in
Diakonikolas–Gouleakis–Peebles–Price, Theorem 8. The ℓ₂
tester goes back to Batu–Fortnow–Rubinfeld–Smith–White.
Since ‖p‖₂² ≤ 1 and n ‖p - q‖₂² ≥ 4 dist(p, q)² on a domain of size n, this is in particular
a closeness tester in statistical distance with k = O(n / ε²) samples
(isClosenessTester_closenessTester). This sample complexity is not optimal: it is also the rate
of learning both distributions to statistical distance ε / 4 from their empirical distributions
and comparing. The ℓ₂ tester is, however, the last step of the optimal tester, which flattens the
distributions first.
The source proves Var[Z] ≤ 116 k² b + 16 k³ ‖p - q‖₄² √b
(Diakonikolas–Gouleakis–Peebles–Price, Lemma 10) and uses
its weakening with ‖p - q‖₂² in the proof of Theorem 8 (§3.2); section, lemma and theorem numbers
follow arXiv:1611.03579v1. Here the variance is computed exactly from the cross-collision moments.
Since (k - 1) (2 k - 1) ≤ 116 k² and 2 (k - 1)² (k + 1) ≤ 16 k³, the ℓ₄ bound above implies
Lemma 10. The constants 2, 36 and 27 are the ones this proof gives.
Main definitions #
Cslib.DistributionTesting.closenessStatistic: the collision statisticZ.Cslib.DistributionTesting.closenessThreshold: the acceptance thresholdC(k, 2) ε² / 2.Cslib.DistributionTesting.closenessTester: the collision tester for closeness.
Main results #
Cslib.DistributionTesting.sum_sum_iid_mul_closenessStatistic: the mean ofZ.Cslib.DistributionTesting.sum_sum_iid_mul_closenessStatistic_sub_sq: the variance ofZ.Cslib.DistributionTesting.sum_sum_iid_mul_closenessStatistic_sub_sq_le_sqrt_sum_pow_four,sum_sum_iid_mul_closenessStatistic_sub_sq_le: the variance bounds inℓ₄andℓ₂.Cslib.DistributionTesting.le_acceptProb₂_closenessTester,acceptProb₂_closenessTester_le: the tolerantℓ₂closeness tester.Cslib.DistributionTesting.isClosenessTester_closenessTester: a closeness tester in statistical distance.
References #
The collision statistic C₁ + C₂ - ((k - 1) / k) C₃ of two samples: the colliding pairs within
each sample minus a rescaled count of the colliding pairs across them.
Unfolding lemma for closenessStatistic.
The acceptance threshold C(k, 2) ε² / 2 of the closeness tester with ℓ₂ proximity ε,
halfway between 0 and the expected statistic C(k, 2) ε² at ℓ₂ distance ε.
Unfolding lemma for closenessThreshold.
The collision tester for closeness with ℓ₂ proximity ε: it accepts two samples when their
collision statistic is at most closenessThreshold.
Unfolding lemma for closenessTester.
Mean of the collision statistic: for k independent samples of each of p and q, the
expected collision statistic is C(k, 2) ‖p - q‖₂²
Diakonikolas–Gouleakis–Peebles–Price, Lemma 9.
Variance of the collision statistic: with s = ‖p‖₂², s' = ‖q‖₂², t = ∑ a, p(a) q(a)
and R = ∑ a, (p(a) + q(a)) (p(a) - q(a))², the statistic of k ≥ 1 samples of each has
variance (k - 1) [k (s + s') / 2 + (k - 1) t + (k² - 1) R - (2 k - 1) (‖p‖₃³ + ‖q‖₃³) - k (k - 1) ((s - t)² + (s' - t)²) + k (s² + s'²) / 2 + (k - 1) t²].
Variance bound for the collision statistic: if ‖p‖₂², ‖q‖₂² ≤ b, the statistic of
k ≥ 1 samples of each has variance at most
(k - 1) (2 k - 1) b + 2 (k - 1)² (k + 1) √b ‖p - q‖₄². Since (k - 1) (2 k - 1) ≤ 116 k² and
2 (k - 1)² (k + 1) ≤ 16 k³, this implies
Diakonikolas–Gouleakis–Peebles–Price, Lemma 10.
Variance bound for the collision statistic in ℓ₂: if ‖p‖₂², ‖q‖₂² ≤ b, the statistic
of k ≥ 1 samples of each has variance at most
(k - 1) (2 k - 1) b + 2 (k - 1)² (k + 1) √b ‖p - q‖₂². This is the form used by the tester.
Completeness of the ℓ₂ closeness tester: if ‖p‖₂², ‖q‖₂² ≤ b, ‖p - q‖₂² ≤ ε² / 4
(that is, ‖p - q‖₂ ≤ ε / 2 for 0 < ε) and 36 √b ≤ (k - 1) ε² δ, the tester accepts with
probability at least 1 - δ.
Soundness of the ℓ₂ closeness tester: if ‖p‖₂², ‖q‖₂² ≤ b, ε² ≤ ‖p - q‖₂² (that is,
‖p - q‖₂ ≥ ε for 0 < ε) and 36 √b ≤ (k - 1) ε² δ, the tester accepts with probability at
most δ.
A closeness tester in statistical distance: on a domain of size n, the collision tester
with ℓ₂ proximity 2 ε / √n is a closeness tester with proximity ε whenever
27 n ≤ (k - 1) ε².