Documentation

CslibFrontier.Probability.IID.Occurrence

Occurrence counts of independent samples #

Real expectations under k independent draws iid μ k split along the first draw (sum_iid_succ_mul) and along a split Fin (m + k) of the positions (sum_iid_add_mul). They are invariant under permuting the positions (sum_iid_comp_perm).

Cslib.Probability.PMF.occurrenceCount x b is the number of positions i with x i = b. The counts of all values add up to the number of samples (sum_occurrenceCount). Among m independent draws from μ, the count N of a value a has the inverse moment bound (m + 1) μ(a) E[1 / (N + 1)] ≤ 1 (mul_sum_iid_mul_inv_occurrenceCount_le). The proof is by exchangeability: under m + 1 draws, the events that position i holds a, weighted by the inverse number of occurrences of a, have equal expectations, and these expectations add up to at most one. This bound gives the fixed-sample-size form of the second part of Diakonikolas–Kane, Lemma 2.6 (lemma numbering of arXiv:1601.05557v1), which takes a Poisson number of samples.

Main definitions #

Main results #

References #

theorem Cslib.Probability.PMF.sum_iid_succ_mul {α : Type u_1} [Fintype α] (μ : PMF α) (k : ℕ) (f : (Fin (k + 1) → α) → ℝ) :
∑ x : Fin (k + 1) → α, ((iid μ (k + 1)) x).toReal * f x = ∑ a : α, (μ a).toReal * ∑ x : Fin k → α, ((iid μ k) x).toReal * f (Fin.cons a x)

Expectation under k + 1 independent draws: draw the first, then the rest.

theorem Cslib.Probability.PMF.sum_iid_add_mul {α : Type u_1} [Fintype α] (μ : PMF α) (m k : ℕ) (f : (Fin (m + k) → α) → ℝ) :
∑ x : Fin (m + k) → α, ((iid μ (m + k)) x).toReal * f x = ∑ x₁ : Fin m → α, ((iid μ m) x₁).toReal * ∑ x₂ : Fin k → α, ((iid μ k) x₂).toReal * f (Fin.append x₁ x₂)

Expectation under m + k independent draws: draw the first m, then the other k.

theorem Cslib.Probability.PMF.sum_iid_comp_perm {α : Type u_1} [Fintype α] (μ : PMF α) {k : ℕ} (σ : Equiv.Perm (Fin k)) (f : (Fin k → α) → ℝ) :
∑ y : Fin k → α, ((iid μ k) y).toReal * f (y ∘ ⇑σ) = ∑ y : Fin k → α, ((iid μ k) y).toReal * f y

Expectations under independent draws are invariant under permuting the draws.

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

The number of sample positions i with x i = b.

theorem Cslib.Probability.PMF.occurrenceCount_eq_sum {α : Type u_1} [DecidableEq α] {k : ℕ} (x : Fin k → α) (b : α) :
↑(occurrenceCount x b) = ∑ i : Fin k, if x i = b then 1 else 0

The occurrence count is a sum of indicators.

theorem Cslib.Probability.PMF.occurrenceCount_cons {α : Type u_1} [DecidableEq α] {k : ℕ} (a : α) (x : Fin k → α) (b : α) :
↑(occurrenceCount (Fin.cons a x) b) = (if a = b then 1 else 0) + ↑(occurrenceCount x b)

Prepending a sample adds its indicator to the occurrence count.

theorem Cslib.Probability.PMF.occurrenceCount_comp_perm {α : Type u_1} [DecidableEq α] {k : ℕ} (y : Fin k → α) (σ : Equiv.Perm (Fin k)) (b : α) :

Occurrence counts are invariant under permuting the positions.

theorem Cslib.Probability.PMF.sum_occurrenceCount {α : Type u_1} [Fintype α] [DecidableEq α] {k : ℕ} (x : Fin k → α) :
∑ b : α, occurrenceCount x b = k

The occurrence counts of all values add up to the number of samples.

theorem Cslib.Probability.PMF.mul_sum_iid_mul_inv_occurrenceCount_le {α : Type u_1} [Fintype α] [DecidableEq α] (μ : PMF α) (m : ℕ) (a : α) :
(↑m + 1) * ((μ a).toReal * ∑ x : Fin m → α, ((iid μ m) x).toReal / (↑(occurrenceCount x a) + 1)) ≤ 1

Inverse occurrence moment. Among m independent draws from μ, the value a occurs N times with (m + 1) μ(a) E[1 / (N + 1)] ≤ 1.