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 α = ⊤.
@[protected]
nat.card α is the cardinality of α as a natural number.
If α is infinite, nat.card α = 0.
Equations
- nat.card α = ⇑cardinal.to_nat (cardinal.mk α)
@[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) _))
theorem
nat.card_pi
{α : Type u_1}
{β : α → Type u_2}
[fintype α] :
nat.card (Π (a : α), β a) = finset.univ.prod (λ (a : α), nat.card (β a))
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]