Counting a finite set by its fibers #
Set.ncard forms of the familiar Finset estimates.
Main results #
Set.sum_ncard_inter_mul: double counting weighted incidences within a finite set.Set.ncard_eq_sum_ncard_fiberwise: a finite set mapped into a finset is the disjoint union of its fibers (Finset.card_eq_sum_card_fiberwise).Set.ncard_le_mul_ncard_image: a finite set whose fibers underfhave at mostnelements has at mostntimes as many elements as its image (Finset.card_le_mul_card_image).Set.ncard_image_le_ncard_image_of_factorsThrough: ifffactors throughgons, thenftakes at most as many values onsasg.Set.encard_lt_coe_iff_finite_ncard_lt:encardandncardagree below a natural number (Set.encard_le_coe_iff_finite_ncard_le).Set.finite_setOf_le_ncard_fiber,Set.mul_ncard_setOf_le_ncard_fiber_le: a finite set has finitely many fibers with at leastn ≠ 0elements, and at mosts.ncard / nof them.
theorem Set.ncard_image_le_ncard_image_of_factorsThrough {α : Type u_1} {β : Type u_2} {γ : Type u_3} {s : Set α} (hs : s.Finite) {f : α → β} {g : α → γ} (h : ∀ a ∈ s, ∀ b ∈ s, g a = g b → f a = f b) :
If f factors through g on s, that is, f agrees on any two points of s at which g
agrees, then f takes at most as many values on the finite set s as g does.
theorem Set.mul_ncard_setOf_le_ncard_fiber_le {α : Type u_1} {β : Type u_2} {s : Set α} (hs : s.Finite) (f : α → β) (n : ℕ) :
Heavy fibers are few. A finite set has at most s.ncard / n points whose fiber under f
has at least n elements. This is the Set.ncard counterpart of Mathlib's
Finset.mul_card_image_le_card_of_maps_to.