Definition of the finite
typeclass #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines a typeclass finite
saying that α : Sort*
is finite. A type is finite
if it
is equivalent to fin n
for some n
. We also define infinite α
as a typeclass equivalent to
¬finite α
.
The finite
predicate has no computational relevance and, being Prop
-valued, gets to enjoy proof
irrelevance -- it represents the mere fact that the type is finite. While the fintype
class also
represents finiteness of a type, a key difference is that a fintype
instance represents finiteness
in a computable way: it gives a concrete algorithm to produce a finset
whose elements enumerate
the terms of the given type. As such, one generally relies on congruence lemmas when rewriting
expressions involving fintype
instances.
Every fintype
instance automatically gives a finite
instance, see fintype.finite
, but not vice
versa. Every fintype
instance should be computable since they are meant for computation. If it's
not possible to write a computable fintype
instance, one should prefer writing a finite
instance
instead.
Main definitions #
Implementation notes #
The definition of finite α
is not just nonempty (fintype α)
since fintype
requires
that α : Type*
, and the definition in this module allows for α : Sort*
. This means
we can write the instance finite.prop
.
Tags #
finite, fintype
A type is finite
if it is in bijective correspondence to some
fin n
.
While this could be defined as nonempty (fintype α)
, it is defined
in this way to allow there to be finite
instances for propositions.
Instances of this typeclass
- finite.of_subsingleton
- finite.of_fintype
- plift.finite
- ulift.finite
- additive.finite
- multiplicative.finite
- order_dual.finite
- set.finite'
- finite.prop
- finite.prod.finite
- finite.pprod.finite
- finite.sum.finite
- finite.sigma.finite
- finite.psigma.finite
- finite.set.finite
- subtype.finite
- pi.finite
- vector.finite
- quot.finite
- quotient.finite
- function.embedding.finite
- equiv.finite_right
- equiv.finite_left
- sym.finite
- finite.set.finite_union
- finite.set.finite_sep
- finite.set.finite_inter_of_right
- finite.set.finite_inter_of_left
- finite.set.finite_diff
- finite.set.finite_range
- finite.set.finite_Union
- finite.set.finite_sUnion
- finite.set.finite_bUnion'
- finite.set.finite_bUnion''
- finite.set.finite_Inter
- finite.set.finite_insert
- finite.set.finite_image
- finite.set.finite_replacement
- finite.set.finite_prod
- finite.set.finite_image2
- finite.set.finite_seq
- subgroup.finite
- add_subgroup.finite
- subgroup.finite_quotient_of_finite_index
- add_subgroup.finite_quotient_of_finite_index
- topological_space.opens.finite
- units.finite
A type is said to be infinite if it is not finite. Note that infinite α
is equivalent to
is_empty (fintype α)
or is_empty (finite α)
.
Instances of this typeclass
- denumerable.infinite
- char_zero.infinite
- plift.infinite
- ulift.infinite
- additive.infinite
- multiplicative.infinite
- nat.infinite
- int.infinite
- multiset.infinite
- list.infinite
- infinite.set
- finset.infinite
- option.infinite
- sum.infinite_of_left
- sum.infinite_of_right
- prod.infinite_of_right
- prod.infinite_of_left
- pi.infinite_of_left
- pi.infinite_of_right
- function.infinite_of_left
- function.infinite_of_right
- dfinsupp.infinite_of_left
- dfinsupp.infinite_of_right
- submodule.quotient_bot.infinite
- zmod.infinite
- set.Iio.infinite
- set.Iic.infinite
- set.Ioi.infinite
- set.Ici.infinite
- mv_polynomial.infinite_of_infinite
- mv_polynomial.infinite_of_nonempty
- polynomial.infinite
Alias of the forward direction of not_infinite_iff_finite
.
Alias of the reverse direction of not_infinite_iff_finite
.