Documentation

CslibFrontier.Foundations.Combinatorics.InclusionExclusion

Inclusion–exclusion for injective self-maps #

On a finite type V, a self-map w : V → V is injective iff it is surjective (Finite.injective_iff_surjective), that is, it misses no element of V. Applying the inclusion–exclusion principle for an intersection of complements (Finset.inclusion_exclusion_sum_inf_compl; see also [FK10], Section 4.1, Theorem 4.2) to the sets of maps missing each v : V expresses the count of injective self-maps satisfying any decidable predicate P : (V → V) → Prop as an alternating sum over subsets S ⊆ V of the counts of maps satisfying P with range in S (Finset.card_filter_injective_eq_sum_powerset).

Main results #

References #

theorem Finset.card_filter_injective_eq_sum_powerset {V : Type u_1} [Fintype V] [DecidableEq V] (P : (V → V) → Prop) [DecidablePred P] :
↑{w : V → V | P w ∧ Function.Injective w}.card = ∑ S : Finset V, (-1) ^ (Fintype.card V - S.card) * ↑{w : V → V | P w ∧ ∀ (i : V), w i ∈ S}.card

Inclusion–exclusion for injective self-maps. On a finite type V, a map w : V → V is injective iff it is surjective, i.e., misses no element of V. Filtering by any predicate P and applying inclusion–exclusion over the sets of maps missing each v : V expresses the count of injective maps satisfying P as an alternating sum over subsets S ⊆ V of the counts of maps satisfying P with range in S.