Uniform subset insertion with collision replacement #
Choose a uniform k-subset of S and an independent uniform element of insert p S, where
p ∉ S. Inserting that element, or p when it collides, gives a uniform (k + 1)-subset of
insert p S. The proof keeps the candidate as a marked element of the resulting set: this is
a bijection, and every result has exactly k + 1 possible marks.
Main results #
Cslib.Probability.PMF.uniformOfFinset_collisionInsert: collision replacement preserves uniform fixed-cardinality subsets while increasing their size by one.
theorem Cslib.Probability.PMF.uniformOfFinset_collisionInsert {α : Type u_1} [DecidableEq α] {S : Finset α} {p : α} {k : ℕ} (hp : p ∉ S) (hk : k ≤ S.card) :
((uniformOfFinset (Finset.powersetCard k S) ⋯).bind fun (U : Finset α) =>
PMF.map (fun (r : α) => U.collisionInsert p r) (uniformOfFinset (insert p S) ⋯)) = uniformOfFinset (Finset.powersetCard (k + 1) (insert p S)) ⋯
Inserting an independent uniform candidate into a uniform k-subset of S, with a
reserved replacement p ∉ S for collisions, gives a uniform (k + 1)-subset of insert p S.