Counting functions by a property of their restriction #
For an injection ι : A → D, a function g : D → β is determined by its restriction g ∘ ι and
its values off the range of ι. So the functions whose restriction has a property Q are, in
proportion, exactly as many as the functions A → β with Q: the restriction of a uniformly random
function along an injection is uniformly random.
Main results #
Nat.card_subtype_comp_injective_mul: the multiplicative form, with no finiteness hypotheses.Nat.card_subtype_comp_injective_div: the proportion form, for finiteDandβ.
theorem Nat.card_subtype_comp_injective_mul {A : Type u_1} {D : Type u_2} {β : Type u_3} (ι : A → D) (hι : Function.Injective ι) (Q : (A → β) → Prop) :
For an injection ι : A → D, the functions D → β whose restriction along ι has the property
Q, counted against all functions A → β, are as many as the functions A → β with Q counted
against all functions D → β.
theorem Nat.card_subtype_comp_injective_div {A : Type u_1} {D : Type u_2} {β : Type u_3} [Finite D] [Finite β] [Nonempty β] (ι : A → D) (hι : Function.Injective ι) (Q : (A → β) → Prop) :
Restrictions of uniform functions are uniform. For an injection ι : A → D, the fraction
of the functions g : D → β whose restriction g ∘ ι has the property Q equals the fraction of
the functions A → β with Q.