Documentation

Mathlib.Data.Finite.Defs

Definition of the Finite typeclass #

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 α¬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 Finite 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 #

• Finite α denotes that α is a finite type.
• Infinite α denotes that α is an infinite type.

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

class inductive Finite (α : Sort u_1) :

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
theorem finite_iff_exists_equiv_fin {α : Sort u_1} :
n, Nonempty (α Fin n)
theorem Finite.exists_equiv_fin (α : Sort u_1) [h : ] :
n, Nonempty (α Fin n)
theorem Finite.of_equiv {β : Sort u_2} (α : Sort u_1) [h : ] (f : α β) :
theorem Equiv.finite_iff {α : Sort u_1} {β : Sort u_2} (f : α β) :
theorem Function.Bijective.finite_iff {α : Sort u_1} {β : Sort u_2} {f : αβ} (h : ) :
theorem Finite.ofBijective {α : Sort u_1} {β : Sort u_2} [inst : ] {f : αβ} (h : ) :
instance instFinitePLift {α : Sort u_1} [inst : ] :
Equations
instance instFiniteULift {α : Type v} [inst : ] :
Equations
class Infinite (α : Sort u_1) :
• assertion that α is ¬Finite¬Finite

not_finite : ¬

A type is said to be infinite if it is not finite. Note that Infinite α is equivalent to IsEmpty (Fintype α) or IsEmpty (Finite α).

Instances
@[simp]
theorem not_finite_iff_infinite {α : Sort u_1} :
@[simp]
theorem not_infinite_iff_finite {α : Sort u_1} :
theorem Equiv.infinite_iff {α : Sort u_1} {β : Sort u_2} (e : α β) :
instance instInfinitePLift {α : Sort u_1} [inst : ] :
Equations
instance instInfiniteULift {α : Type v} [inst : ] :
Equations
theorem finite_or_infinite (α : Sort u_1) :
theorem not_finite (α : Sort u_1) [inst : ] [inst : ] :

Infinite α is not Finite

theorem Finite.false {α : Sort u_1} [inst : ] :
False
theorem Infinite.false {α : Sort u_1} [inst : ] :
theorem Finite.not_infinite {α : Sort u_1} :

Alias of the reverse direction of not_infinite_iff_finite.

theorem Finite.of_not_infinite {α : Sort u_1} :

Alias of the forward direction of not_infinite_iff_finite.