Inductive type variant of Fin #
Fin is defined as a subtype of ℕ. This file defines an equivalent type, Fin2, which is
defined inductively. This is useful for its induction principle and different definitional
equalities.
Main declarations #
Fin2 n: Inductive type variant ofFin n.fzcorresponds to0andfs ncorresponds ton.Fin2.toNat,Fin2.optOfNat,Fin2.ofNat': Conversions to and fromℕ.ofNat' mtakes a proof thatm < nthrough the classFin2.IsLT.Fin2.add k: Takesi : Fin2 ntoi + k : Fin2 (n + k).Fin2.left: EmbedsFin2 nintoFin2 (n + k).Fin2.insertPerm a: Permutation ofFin2 nwhich cycles0, ..., a - 1and leavesa, ..., n - 1unchanged.Fin2.remapLeft f: FunctionFin2 (m + k) → Fin2 (n + k)by applyingf : Fin m → Fin nto0, ..., m - 1and sendingm + iton + i.
Ex falso. The dependent eliminator for the empty Fin2 0 type.
Instances For
Converts a natural into a Fin2 if it is in range
Instances For
insertPerm a is a permutation of Fin2 n with the following properties:
insertPerm a i = i+1ifi < ainsertPerm a a = 0insertPerm a i = iifi > a
Instances For
Use type class inference to infer the boundedness proof, so that we can directly convert a
Nat into a Fin2 n. This supports notation like &1 : Fin 3.
Instances For
Maps 0 to n-1, 1 to n-2, ..., n-1 to 0.
Instances For
Converts a Fin2 into a Fin.
Instances For
Converts a Fin into a Fin2.
Instances For
Fin2 is equivalent to the usual encoding of Fin as a subtype of ℕ.
Instances For
@[simp]
@[simp]