Documentation

CslibFrontier.Foundations.Data.Fintype.RestrictInjective

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 #

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) :
Nat.card { g : D → β // Q (g ∘ ι) } * Nat.card (A → β) = Nat.card { h : A → β // Q h } * Nat.card (D → β)

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) :
↑(Nat.card { g : D → β // Q (g ∘ ι) }) / ↑(Nat.card (D → β)) = ↑(Nat.card { h : A → β // Q h }) / ↑(Nat.card (A → β))

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.