File: Mathlib/Data/Finite/Defs.lean

full_name: Finite
code: /-- A type is `Finite` if it is in bijective correspondence to some `Fin n`.

This is similar to `Fintype`, but `Finite` is a proposition rather than data.
A particular benefit to this is that `Finite` instances are definitionally equal to one another
(due to proof irrelevance) rather than being merely propositionally equal,
and, furthermore, `Finite` instances generally avoid the need for `Decidable` instances.
One other notable difference is that `Finite` allows there to be `Finite p` instances
for all `p : Prop`, which is not allowed by `Fintype` due to universe constraints.
An application of this is that `Finite (x ∈ s → β x)` follows from the general instance for pi
types, assuming `[∀ x, Finite (β x)]`.
Implementation note: this is a reason `Finite α` is not defined as `Nonempty (Fintype α)`.

Every `Fintype` instance provides a `Finite` instance via `Finite.of_fintype`.
Conversely, one can noncomputably create a `Fintype` instance from a `Finite` instance
via `Fintype.ofFinite`. In a proof one might write
```lean
  have := Fintype.ofFinite α
```
to obtain such an instance.

Do not write noncomputable `Fintype` instances; instead write `Finite` instances
and use this `Fintype.ofFinite` interface.
The `Fintype` instances should be relied upon to be computable for evaluation purposes.

Theorems should use `Finite` instead of `Fintype`, unless definitions in the theorem statement
require `Fintype`.
Definitions should prefer `Finite` as well, unless it is important that the definitions
are meant to be computable in the reduction or `#eval` sense.
-/
class inductive Finite (α : Sort*) : Prop
  | intro {n : ℕ} : α ≃ Fin n → Finite _
goal: Prop

full_name: Finite.intro
code: /-- A type is `Finite` if it is in bijective correspondence to some `Fin n`.

This is similar to `Fintype`, but `Finite` is a proposition rather than data.
A particular benefit to this is that `Finite` instances are definitionally equal to one another
(due to proof irrelevance) rather than being merely propositionally equal,
and, furthermore, `Finite` instances generally avoid the need for `Decidable` instances.
One other notable difference is that `Finite` allows there to be `Finite p` instances
for all `p : Prop`, which is not allowed by `Fintype` due to universe constraints.
An application of this is that `Finite (x ∈ s → β x)` follows from the general instance for pi
types, assuming `[∀ x, Finite (β x)]`.
Implementation note: this is a reason `Finite α` is not defined as `Nonempty (Fintype α)`.

Every `Fintype` instance provides a `Finite` instance via `Finite.of_fintype`.
Conversely, one can noncomputably create a `Fintype` instance from a `Finite` instance
via `Fintype.ofFinite`. In a proof one might write
```lean
  have := Fintype.ofFinite α
```
to obtain such an instance.

Do not write noncomputable `Fintype` instances; instead write `Finite` instances
and use this `Fintype.ofFinite` interface.
The `Fintype` instances should be relied upon to be computable for evaluation purposes.

Theorems should use `Finite` instead of `Fintype`, unless definitions in the theorem statement
require `Fintype`.
Definitions should prefer `Finite` as well, unless it is important that the definitions
are meant to be computable in the reduction or `#eval` sense.
-/
class inductive Finite (α : Sort*) : Prop
  | intro {n : ℕ} : α ≃ Fin n → Finite _
goal: α ≃ Fin n → Finite α

full_name: finite_iff_exists_equiv_fin
code: theorem finite_iff_exists_equiv_fin {α : Sort*} : Finite α ↔ ∃ n, Nonempty (α ≃ Fin n) 
goal: Finite α ↔ ∃ n, Nonempty (α ≃ Fin n)

full_name: Finite.exists_equiv_fin
code: theorem Finite.exists_equiv_fin (α : Sort*) [h : Finite α] : ∃ n : ℕ, Nonempty (α ≃ Fin n) 
goal: ∃ n, Nonempty (α ≃ Fin n)

full_name: Finite.of_equiv
code: theorem Finite.of_equiv (α : Sort*) [h : Finite α] (f : α ≃ β) : Finite β 
goal: Finite β

full_name: Equiv.finite_iff
code: theorem Equiv.finite_iff (f : α ≃ β) : Finite α ↔ Finite β 
goal: Finite α ↔ Finite β

full_name: Function.Bijective.finite_iff
code: theorem Function.Bijective.finite_iff {f : α → β} (h : Bijective f) : Finite α ↔ Finite β 
goal: Finite α ↔ Finite β

full_name: Finite.ofBijective
code: theorem Finite.ofBijective [Finite α] {f : α → β} (h : Bijective f) : Finite β 
goal: Finite β

full_name: instFinitePLift
code: instance [Finite α] : Finite (PLift α) 
goal: Finite (PLift α)

full_name: instFiniteULift
code: instance {α : Type v} [Finite α] : Finite (ULift.{u} α) 
goal: Finite (ULift.{u, v} α)

full_name: Infinite.not_finite
code: /-- A type is said to be infinite if it is not finite. Note that `Infinite α` is equivalent to
`IsEmpty (Fintype α)` or `IsEmpty (Finite α)`. -/
class Infinite (α : Sort*) : Prop where
  /-- assertion that `α` is `¬Finite`-/
  not_finite : ¬Finite α
goal: ¬Finite α

full_name: Infinite
code: /-- A type is said to be infinite if it is not finite. Note that `Infinite α` is equivalent to
`IsEmpty (Fintype α)` or `IsEmpty (Finite α)`. -/
class Infinite (α : Sort*) : Prop where
  /-- assertion that `α` is `¬Finite`-/
  not_finite : ¬Finite α
goal: Prop

full_name: not_finite_iff_infinite
code: @[simp]
theorem not_finite_iff_infinite : ¬Finite α ↔ Infinite α 
goal: ¬Finite α ↔ Infinite α

full_name: not_infinite_iff_finite
code: @[simp]
theorem not_infinite_iff_finite : ¬Infinite α ↔ Finite α 
goal: ¬Infinite α ↔ Finite α

full_name: Equiv.infinite_iff
code: theorem Equiv.infinite_iff (e : α ≃ β) : Infinite α ↔ Infinite β 
goal: Infinite α ↔ Infinite β

full_name: instInfinitePLift
code: instance [Infinite α] : Infinite (PLift α) 
goal: Infinite (PLift α)

full_name: instInfiniteULift
code: instance {α : Type v} [Infinite α] : Infinite (ULift.{u} α) 
goal: Infinite (ULift.{u, v} α)

full_name: finite_or_infinite
code: theorem finite_or_infinite (α : Sort*) : Finite α ∨ Infinite α 
goal: Finite α ∨ Infinite α

full_name: not_finite
code: /-- `Infinite α` is not `Finite`-/
theorem not_finite (α : Sort*) [Infinite α] [Finite α] : False 
goal: False

full_name: Finite.false
code: protected theorem Finite.false [Infinite α] (_ : Finite α) : False 
goal: Finite α → False

full_name: Infinite.false
code: protected theorem Infinite.false [Finite α] (_ : Infinite α) : False 
goal: Infinite α → False