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 }.
Elimination principle for the empty set Fin 0, dependent version.
Equations
- finZeroElim x = x.elim0
Instances For
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⟩
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
- Fin.tacticFin_omega = Lean.ParserDescr.node `Fin.tacticFin_omega 1024 (Lean.ParserDescr.nonReservedSymbol "fin_omega" false)
Instances For
addition, numerals, and coercion from Nat #
Equations
Alias of Fin.ofNat_eq_cast.
recursion and induction principles #
Alias of Fin.eq_one_of_ne_zero.