NLA-lib Explorer

NLAlib.measureReal_pi_samplingMeasure_setOf_apply_eq_apply

Library · theorem

Collision probability: two distinct coordinates of an i.i.d. sample from NLAlib.samplingMeasure p, with weights summing to 1, agree with probability \sum_r p_r^2; at uniform weights 1/\lvert \iota \rvert this is 1/\lvert \iota \rvert. The hash-collision step of CountSketch (NLAlib.Sketching.Sparse.CountSketch).

NLAlib.measureReal_pi_samplingMeasure_setOf_apply_eq_apply.{u_2, u_3} {ι : Type u_2} [Fintype ι]
  [MeasurableSpace ι] [MeasurableSingletonClass ι] (p : ι → ℝ≥0) {κ : Type u_3} [Fintype κ]
  (hp : ∑ i, p i = 1) {i j : κ} (hij : i ≠ j) :
  (Measure.pi fun x ↦ samplingMeasure p).real {f | f i = f j} = ∑ r, ↑(p r) ^ 2

Full source on GitHub

Import NLAlib.Probability.Distributions.Sampling.