Documentation

CslibFrontier.Probability.JohnsonLindenstrauss

The Johnson–Lindenstrauss lemma for random sign matrices #

Fix n points of a finite-dimensional Euclidean space EuclideanSpace ℝ ι. A uniformly random k × ι matrix of independent signs ±1, scaled by 1 / √k, keeps every squared pairwise distance within a factor 1 ± ε, with probability at least 1 - n^(-β), once k ≥ (4 + 2β) / (ε² / 2 - ε³ / 3) · log n. This is Achlioptas's theorem for the ±1 distribution [Achlioptas2003, Theorem 1.1]. The union bound fails with probability at most n (n - 1) exp (-(k / 2) (ε² / 2 - ε³ / 3)), and n (n - 1) < n², so the threshold for β = 0 already gives a positive probability of success. This is the Johnson–Lindenstrauss lemma [JL84] with the constant of Dasgupta and Gupta [DasguptaGupta2003, Theorem 2.1]: n points embed into dimension k ≥ 4 log n / (ε² / 2 - ε³ / 3) with distortion 1 ± ε. For ε ≤ 1, k ≥ 24 log n / ε² suffices.

Achlioptas states the theorem for every ε > 0. Here ε < 3 / 2, which makes ε² / 2 - ε³ / 3 positive, and some restriction is needed. For ε = 2, β = 10 and the two points 0 and (1, 1, 1, 1) the threshold is negative, so k = 1 meets it. But the single row maps (1, 1, 1, 1) to the squared norm 16 > (1 + ε) · 4 with probability 1 / 8 > 2^(-10).

The seed is b : Fin k → ι → Bool, drawn uniformly. signProjection b is the linear map with matrix (1 / √k) signVal (b j i). Probabilities are densities of finsets of seeds.

Proof #

For a fixed vector x with S = ‖x‖², the rows give independent Rademacher sums Y_j = ∑ i, x i signVal (b j i), each with 𝔼 Y_j² = S, and k ‖signProjection b x‖² = ∑ j, Y_j².

Achlioptas compares the even moments of Y_j with those of a Gaussian [Achlioptas2003, Lemma 5.2]. Here the comparison goes through the moment generating function: Y_j is sub-Gaussian, so exp (t Y_j²) is dominated by exp (t S Z²) for a standard Gaussian Z. This is the standard sub-Gaussian comparison [Gupta2023, Lemma 11.9]. Both arguments give the same per-vector bound [Achlioptas2003, Lemma 5.1].

Main definitions #

Main results #

References #

Scalar inequalities #

Tails of sums of squared Rademacher sums #

theorem Cslib.Probability.dens_mul_lt_sum_sq_sum_mul_signVal_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (k : ℕ) {ε : ℝ} (hε : 0 ≤ ε) :
↑{b : Fin k → ι → Bool | ↑k * (1 + ε) * ∑ i : ι, a i ^ 2 < ∑ j : Fin k, (∑ i : ι, a i * BitString.signVal (b j i)) ^ 2}.dens ≤ Real.exp (-(↑k / 2) * (ε ^ 2 / 2 - ε ^ 3 / 3))

Upper tail: for k independent Rademacher sums Y_j = ∑ i, a i signVal (b j i) and 0 ≤ ε, Pr[k (1 + ε) ∑ a² < ∑ j, Y_j²] ≤ exp (-(k / 2) (ε² / 2 - ε³ / 3)).

theorem Cslib.Probability.dens_sum_sq_sum_mul_signVal_lt_mul_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (a : ι → ℝ) (k : ℕ) {ε : ℝ} (hε : 0 ≤ ε) :
↑{b : Fin k → ι → Bool | ∑ j : Fin k, (∑ i : ι, a i * BitString.signVal (b j i)) ^ 2 < ↑k * (1 - ε) * ∑ i : ι, a i ^ 2}.dens ≤ Real.exp (-(↑k / 2) * (ε ^ 2 / 2 - ε ^ 3 / 3))

Lower tail: for k independent Rademacher sums Y_j = ∑ i, a i signVal (b j i) and 0 ≤ ε, Pr[∑ j, Y_j² < k (1 - ε) ∑ a²] ≤ exp (-(k / 2) (ε² / 2 - ε³ / 3)).

Random sign projections #

noncomputable def Cslib.Probability.signProjection {ι : Type u_1} [Fintype ι] [DecidableEq ι] {k : ℕ} (b : Fin k → ι → Bool) :

The random sign projection with seed b : Fin k → ι → Bool: the linear map EuclideanSpace ℝ ι → EuclideanSpace ℝ (Fin k) whose matrix has entries signVal (b j i) / √k. For a uniformly random seed the entries are independent uniform signs ±1 / √k, Achlioptas's ±1 distribution [Ach03].

theorem Cslib.Probability.signProjection_apply {ι : Type u_1} [Fintype ι] [DecidableEq ι] {k : ℕ} (b : Fin k → ι → Bool) (x : EuclideanSpace ℝ ι) (j : Fin k) :
((signProjection b) x).ofLp j = (√↑k)⁻¹ * ∑ i : ι, x.ofLp i * BitString.signVal (b j i)
theorem Cslib.Probability.norm_signProjection_sq {ι : Type u_1} [Fintype ι] [DecidableEq ι] {k : ℕ} (b : Fin k → ι → Bool) (x : EuclideanSpace ℝ ι) :
‖(signProjection b) x‖ ^ 2 = (∑ j : Fin k, (∑ i : ι, x.ofLp i * BitString.signVal (b j i)) ^ 2) / ↑k

‖signProjection b x‖² = (1 / k) ∑ j, (∑ i, x i signVal (b j i))².

theorem Cslib.Probability.dens_lt_norm_signProjection_sq_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (x : EuclideanSpace ℝ ι) {ε : ℝ} (hε : 0 ≤ ε) :
↑{b : Fin k → ι → Bool | (1 + ε) * ‖x‖ ^ 2 < ‖(signProjection b) x‖ ^ 2}.dens ≤ Real.exp (-(↑k / 2) * (ε ^ 2 / 2 - ε ^ 3 / 3))

Upper tail for a vector [Ach03]: for 0 ≤ ε, Pr[(1 + ε) ‖x‖² < ‖signProjection b x‖²] ≤ exp (-(k / 2) (ε² / 2 - ε³ / 3)).

theorem Cslib.Probability.dens_norm_signProjection_sq_lt_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (x : EuclideanSpace ℝ ι) {ε : ℝ} (hε : 0 ≤ ε) :
↑{b : Fin k → ι → Bool | ‖(signProjection b) x‖ ^ 2 < (1 - ε) * ‖x‖ ^ 2}.dens ≤ Real.exp (-(↑k / 2) * (ε ^ 2 / 2 - ε ^ 3 / 3))

Lower tail for a vector [Ach03]: for 0 ≤ ε, Pr[‖signProjection b x‖² < (1 - ε) ‖x‖²] ≤ exp (-(k / 2) (ε² / 2 - ε³ / 3)).

theorem Cslib.Probability.dens_lt_abs_norm_signProjection_sq_sub_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] (k : ℕ) (x : EuclideanSpace ℝ ι) {ε : ℝ} (hε : 0 ≤ ε) :
↑{b : Fin k → ι → Bool | ε * ‖x‖ ^ 2 < |‖(signProjection b) x‖ ^ 2 - ‖x‖ ^ 2|}.dens ≤ 2 * Real.exp (-(↑k / 2) * (ε ^ 2 / 2 - ε ^ 3 / 3))

The distributional Johnson–Lindenstrauss lemma for sign matrices [Ach03]: for 0 ≤ ε, Pr[ε ‖x‖² < |‖signProjection b x‖² - ‖x‖²|] ≤ 2 exp (-(k / 2) (ε² / 2 - ε³ / 3)).

Finite point sets #

theorem Cslib.Probability.one_sub_le_dens_forall_norm_signProjection_sq_mem_Icc {ι : Type u_1} [Fintype ι] [DecidableEq ι] {n : ℕ} (p : Fin n → EuclideanSpace ℝ ι) (k : ℕ) {ε : ℝ} (hε : 0 ≤ ε) :
1 - ↑n * (↑n - 1) * Real.exp (-(↑k / 2) * (ε ^ 2 / 2 - ε ^ 3 / 3)) ≤ ↑{b : Fin k → ι → Bool | ∀ (i j : Fin n), ‖(signProjection b) (p i - p j)‖ ^ 2 ∈ Set.Icc ((1 - ε) * ‖p i - p j‖ ^ 2) ((1 + ε) * ‖p i - p j‖ ^ 2)}.dens

The Johnson–Lindenstrauss union bound [Ach03]: for n points and 0 ≤ ε, a random sign projection keeps every squared pairwise distance in [1 - ε, 1 + ε] times its original value with probability at least 1 - n (n - 1) exp (-(k / 2) (ε² / 2 - ε³ / 3)).

theorem Cslib.Probability.one_sub_rpow_le_dens_forall_norm_signProjection_sq_mem_Icc {ι : Type u_1} [Fintype ι] [DecidableEq ι] {n : ℕ} (p : Fin n → EuclideanSpace ℝ ι) {k : ℕ} {ε β : ℝ} (hε : 0 < ε) (hε' : ε < 3 / 2) (hk : (4 + 2 * β) / (ε ^ 2 / 2 - ε ^ 3 / 3) * Real.log ↑n ≤ ↑k) :
1 - ↑n ^ (-β) ≤ ↑{b : Fin k → ι → Bool | ∀ (i j : Fin n), ‖(signProjection b) (p i - p j)‖ ^ 2 ∈ Set.Icc ((1 - ε) * ‖p i - p j‖ ^ 2) ((1 + ε) * ‖p i - p j‖ ^ 2)}.dens

Achlioptas's theorem for sign matrices [Achlioptas2003, Theorem 1.1]: for n points, 0 < ε < 3 / 2, any real β and k ≥ (4 + 2β) / (ε² / 2 - ε³ / 3) · log n, a random sign projection keeps every squared pairwise distance in [1 - ε, 1 + ε] times its original value with probability at least 1 - n^(-β). The statement is informative for β > 0.

theorem Cslib.Probability.exists_signProjection_forall_norm_sq_mem_Icc {ι : Type u_1} [Fintype ι] [DecidableEq ι] {n : ℕ} (p : Fin n → EuclideanSpace ℝ ι) {k : ℕ} {ε : ℝ} (hε : 0 < ε) (hε' : ε < 3 / 2) (hk : 4 / (ε ^ 2 / 2 - ε ^ 3 / 3) * Real.log ↑n ≤ ↑k) :
∃ (b : Fin k → ι → Bool), ∀ (i j : Fin n), ‖(signProjection b) (p i - p j)‖ ^ 2 ∈ Set.Icc ((1 - ε) * ‖p i - p j‖ ^ 2) ((1 + ε) * ‖p i - p j‖ ^ 2)

The Johnson–Lindenstrauss lemma with sign matrices [Ach03] [DG03]: for n points, 0 < ε < 3 / 2 and k ≥ 4 log n / (ε² / 2 - ε³ / 3), some sign projection keeps every squared pairwise distance in [1 - ε, 1 + ε] times its original value.

theorem Cslib.Probability.exists_linearMap_forall_norm_sq_mem_Icc {ι : Type u_1} [Fintype ι] {n : ℕ} (p : Fin n → EuclideanSpace ℝ ι) {k : ℕ} {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) (hk : 24 / ε ^ 2 * Real.log ↑n ≤ ↑k) :
∃ (f : EuclideanSpace ℝ ι →ₗ[ℝ] EuclideanSpace ℝ (Fin k)), ∀ (i j : Fin n), ‖f (p i) - f (p j)‖ ^ 2 ∈ Set.Icc ((1 - ε) * ‖p i - p j‖ ^ 2) ((1 + ε) * ‖p i - p j‖ ^ 2)

The Johnson–Lindenstrauss lemma [JL84] [DG03]: for n points of EuclideanSpace ℝ ι, 0 < ε ≤ 1 and k ≥ 24 log n / ε², some linear map into EuclideanSpace ℝ (Fin k) keeps every squared pairwise distance in [1 - ε, 1 + ε] times its original value.