Fin is a group #
This file contains the additive and multiplicative monoid instances on Fin n
.
See note [foundational algebra order theory].
Instances #
This is not a global instance, but can introduced locally using open Fin.NatCast in ...
.
This is not an instance because the binop%
elaborator assumes that
there are no non-trivial coercion loops,
but this instance would introduce a coercion from Nat
to Fin n
and back.
Non-trivial loops lead to undesirable and counterintuitive elaboration behavior.
For example, for x : Fin k
and n : Nat
,
it causes x < n
to be elaborated as x < ↑n
rather than ↑x < n
,
silently introducing wraparound arithmetic.
Equations
Instances For
Note this is more general than Fin.addCommGroup
as it applies (vacuously) to Fin 0
too.
Equations
Note this is more general than Fin.addCommGroup
as it applies (vacuously) to Fin 0
too.
Note this is more general than Fin.addCommGroup
as it applies (vacuously) to Fin 0
too.
Equations
Note this is more general than Fin.addCommGroup
as it applies (vacuously) to Fin 0
too.