Finite Cardinality Functions #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Main Definitions #
nat.card α
is the cardinality ofα
as a natural number. Ifα
is infinite,nat.card α = 0
.part_enat.card α
is the cardinality ofα
as an extended natural number (part ℕ
implementation). Ifα
is infinite,part_enat.card α = ⊤
.
@[simp]
theorem
nat.card_eq_of_bijective
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(hf : function.bijective f) :
If the cardinality is positive, that means it is a finite type, so there is
an equivalence between α
and fin (nat.card α)
. See also finite.equiv_fin
.
Equations
- nat.equiv_fin_of_card_pos h = (fintype_or_infinite α).cases_on (λ (val : fintype α), _.mpr (_.mp (fintype.equiv_fin α))) (λ (val : infinite α), _.mpr (false.rec (α ≃ fin 0) _))
part_enat.card α
is the cardinality of α
as an extended natural number.
If α
is infinite, part_enat.card α = ⊤
.
Equations
@[simp]
theorem
part_enat.card_eq_coe_fintype_card
{α : Type u_1}
[fintype α] :
part_enat.card α = ↑(fintype.card α)
@[simp]
@[simp]
theorem
part_enat.card_image_of_inj_on
{α : Type u_1}
{β : Type u_2}
{f : α → β}
{s : set α}
(h : set.inj_on f s) :
part_enat.card ↥(f '' s) = part_enat.card ↥s
theorem
part_enat.card_image_of_injective
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : set α)
(h : function.injective f) :
part_enat.card ↥(f '' s) = part_enat.card ↥s
theorem
part_enat.card_le_one_iff_subsingleton
(α : Type u_1) :
part_enat.card α ≤ 1 ↔ subsingleton α