The finite type with n elements #
Fin n is the type whose elements are natural numbers smaller than n.
This file expands on the development in the core library.
Main definitions #
finZeroElim: Elimination principle for the empty setFin 0, generalizesFin.elim0. Further definitions and eliminators can be found inInit.Data.Fin.LemmasFin.equivSubtype: Equivalence betweenFin nand{ i // i < n }.
@[simp]
@[simp]
coercions and constructions #
order #
Fin.lt_or_ge is an alias of Fin.lt_or_le.
It is preferred since it follows the mathlib naming convention.
Fin.le_or_gt is an alias of Fin.le_or_lt.
It is preferred since it follows the mathlib naming convention.
Use the ordering on Fin n for checking recursive definitions.
For example, the following definition is not accepted by the termination checker,
unless we declare the WellFoundedRelation instance:
def factorial {n : ℕ} : Fin n → ℕ
| ⟨0, _⟩ := 1
| ⟨i + 1, hi⟩ := (i + 1) * factorial ⟨i, i.lt_succ_self.trans hi⟩
Equations
Coercions to ℤ and the fin_omega tactic. #
Preprocessor for omega to handle inequalities in Fin.
Note that this involves a lot of case splitting, so may be slow.
Equations
Instances For
addition, numerals, and coercion from Nat #
@[simp]
recursion and induction principles #
@[simp]
instance
Fin.instNeZeroHAddNatOfNat_mathlib
{n m : ℕ}
[NeZero n]
[NeZero (OfNat.ofNat m)]
:
NeZero (OfNat.ofNat m)
mul #
@[deprecated Fin.mul_one (since := "2025-10-06")]
Alias of Fin.mul_one.
@[deprecated Fin.one_mul (since := "2025-10-06")]
Alias of Fin.one_mul.
@[deprecated Fin.mul_zero (since := "2025-10-06")]
Alias of Fin.mul_zero.
@[deprecated Fin.zero_mul (since := "2025-10-06")]
Alias of Fin.zero_mul.