Mathlib.Algebra.Group.Fin.Basic
22 declarations. Mathlib docs · Source
Fin is a group
This file contains the additive and multiplicative monoid instances on Fin n.
See note [foundational algebra order theory].
Instances
Miscellaneous lemmas
instance Fin.addCommSemigroup E0 #
(n : ℕ) → AddCommSemigroup (Fin n)
instance Fin.addCommMonoid E0 #
(n : ℕ) → [NeZero n] → AddCommMonoid (Fin n)
def Fin.instAddMonoidWithOne E1 #
(n : ℕ) → [NeZero n] → AddMonoidWithOne (Fin n)
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.
instance Fin.addCommGroup E0 #
(n : ℕ) → [NeZero n] → AddCommGroup (Fin n)
instance Fin.instInvolutiveNeg E0 #
(n : ℕ) → InvolutiveNeg (Fin n)
Note this is more general than Fin.addCommGroup as it applies (vacuously) to Fin 0 too.
instance Fin.instIsCancelAdd E0 #
∀ (n : ℕ), IsCancelAdd (Fin n)
Note this is more general than Fin.addCommGroup as it applies (vacuously) to Fin 0 too.
instance Fin.instAddLeftCancelSemigroup E0 #
(n : ℕ) → AddLeftCancelSemigroup (Fin n)
Note this is more general than Fin.addCommGroup as it applies (vacuously) to Fin 0 too.
instance Fin.instAddRightCancelSemigroup E0 #
(n : ℕ) → AddRightCancelSemigroup (Fin n)
Note this is more general than Fin.addCommGroup as it applies (vacuously) to Fin 0 too.
theorem Fin.intCast_def' E1 #
∀ {n : ℕ} [inst : NeZero n] (x : ℤ), ↑x = if 0 ≤ x then ↑x.natAbs else -↑x.natAbs
Variant of Fin.intCast_def with Nat.cast on the RHS.
theorem Fin.coe_sub_one E0 #
∀ {n : ℕ} (a : Fin (n + 1)), ↑(a - 1) = if a = 0 then n else ↑a - 1
theorem Fin.lt_sub_iff E0 #
∀ {n : ℕ} {a b : Fin n}, a < a - b ↔ a < b
theorem Fin.sub_le_iff E0 #
∀ {n : ℕ} {a b : Fin n}, a - b ≤ a ↔ b ≤ a
theorem Fin.lt_one_iff E0 #
∀ {n : ℕ} (x : Fin (n + 2)), x < 1 ↔ x = 0
theorem Fin.lt_sub_one_iff E0 #
∀ {n : ℕ} {k : Fin (n + 2)}, k < k - 1 ↔ k = 0
theorem Fin.le_sub_one_iff E0 #
∀ {n : ℕ} {k : Fin (n + 1)}, k ≤ k - 1 ↔ k = 0
theorem Fin.sub_one_lt_iff E0 #
∀ {n : ℕ} {k : Fin (n + 1)}, k - 1 < k ↔ 0 < k
theorem Fin.neg_last E0 #
∀ (n : ℕ), -Fin.last n = 1
theorem Fin.neg_natCast_eq_one E1 #
∀ (n : ℕ), -↑n = 1
theorem Fin.rev_add E1 #
∀ {n : ℕ} (a b : Fin n), (a + b).rev = a.rev - b
theorem Fin.rev_sub E1 #
∀ {n : ℕ} (a b : Fin n), (a - b).rev = a.rev + b
theorem Fin.lt_add_one_of_succ_lt E1 #
∀ {n : ℕ} [inst : NeZero n] {a : Fin n}, ↑a + 1 < n → a < a + 1
theorem Fin.add_lt_left_iff E0 #
∀ {n : ℕ} {a b : Fin n}, a + b < a ↔ b.rev < a