Documentation

CslibFrontier.Probability.PMF.UniformPowerset

Uniform distributions over fixed-cardinality subsets (powersetCard) #

Uniform sampling identities for Finset.powersetCard under Cslib.Probability.PMF.uniformOfFinset:

These identities underlie the cache distribution invariants of randomized marking (CslibFrontier.DataStructure.Paging.Marking) and the McGeoch–Sleator Partition algorithm (CslibFrontier.DataStructure.Paging.Partition).

noncomputable def Cslib.Probability.PMF.uniformErase {α : Type u_1} [DecidableEq α] (U : Finset α) :
PMF (Finset α)

Helper step for erasing a uniform element from a subset U: returns U.erase e for a uniform e ∈ U when U is nonempty, and ∅ on the unreachable empty case.

Drawing a uniform t-subset U of S (1 ≤ t ≤ |S|) and erasing a uniformly chosen element of U yields the uniform distribution on (t - 1)-subsets of S.

theorem Cslib.Probability.PMF.uniformOfFinset_powersetCard_sub_one {α : Type u_1} [DecidableEq α] {S : Finset α} {k : ℕ} (hk : 0 < k) (hS : S.card = k) :
PMF.map (fun (e : α) => S.erase e) (uniformOfFinset S ⋯) = uniformOfFinset (Finset.powersetCard (k - 1) S) ⋯

Erasing a uniformly chosen element from a k-element set S (0 < k) yields the uniform distribution on (k - 1)-subsets of S.

theorem Cslib.Probability.PMF.uniformOfFinset_powersetCard_hitOrErase {α : Type u_1} [DecidableEq α] {S : Finset α} {p : α} {t : ℕ} (hpS : p ∈ S) (ht : 1 ≤ t) (htS : t ≤ S.card) :

For p ∈ S and 1 ≤ t ≤ |S|, drawing a uniform t-subset U of S and returning U.erase p when p ∈ U or uniformErase U when p ∉ U yields the uniform distribution on (t - 1)-subsets of S.erase p.

theorem Cslib.Probability.PMF.toOuterMeasure_uniformOfFinset_powersetCard_notMem {α : Type u_1} {S : Finset α} {p : α} {t : ℕ} (hpS : p ∈ S) (htS : t ≤ S.card) :
(uniformOfFinset (Finset.powersetCard t S) ⋯).toOuterMeasure {U : Finset α | p ∉ U} = ↑(S.card - t) * (↑S.card)⁻¹

A uniform t-subset of S (t ≤ |S|) misses a fixed element p ∈ S with probability (|S| - t) / |S|.