Cardinalities of finite types #
This file defines the cardinality Fintype.card α
as the number of elements in (univ : Finset α)
.
We also include some elementary results on the values of Fintype.card
on specific types.
Main declarations #
Fintype.card α
: Cardinality of a fintype. Equal toFinset.univ.card
.Finite.surjective_of_injective
: an injective function from a finite type to itself is also surjective.
Note: this lemma is specifically about Fintype.ofSubsingleton
. For a statement about
arbitrary Fintype
instances, use either Fintype.card_le_one_iff_subsingleton
or
Fintype.card_unique
.
Note: this lemma is specifically about Fintype.ofIsEmpty
. For a statement about
arbitrary Fintype
instances, use Fintype.card_eq_zero
.
Given that α ⊕ β
is a fintype, α
is also a fintype. This is non-computable as it uses
that Sum.inl
is an injection, but there's no clear inverse if α
is empty.
Equations
Instances For
Given that α ⊕ β
is a fintype, β
is also a fintype. This is non-computable as it uses
that Sum.inr
is an injection, but there's no clear inverse if β
is empty.
Equations
Instances For
Alias of Fintype.card_eq_zero
.
Alias of Fintype.existsUnique_iff_card_one
.
Alias of the forward direction of Finite.injective_iff_bijective
.
Alias of the forward direction of Finite.surjective_iff_bijective
.
Alias of the forward direction of Finite.injective_iff_surjective_of_equiv
.
Alias of the reverse direction of Finite.injective_iff_surjective_of_equiv
.
If two subtypes of a fintype have equal cardinality, so do their complements.
A custom induction principle for fintypes. The base case is a subsingleton type,
and the induction step is for non-trivial types, and one can assume the hypothesis for
smaller types (via Fintype.card
).
The major premise is Fintype α
, so to use this with the induction
tactic you have to give a name
to that instance and use that name.
Fin
as a map from ℕ
to Type
is injective. Note that since this is a statement about
equality of types, using it should be avoided if possible.
A reversed version of Fin.cast_eq_cast
that is easier to rewrite with.