Tuple operations on maps Fin n →₀ M #
We interpret maps Fin n →₀ M as n-tuples of elements of M, and define the following
operations:
Finsupp.tail: the tail of a mapFin (n + 1) →₀ M, i.e., its lastnentries;Finsupp.init: the initial of a mapFin n →₀ M, i.e., its firstn - 1entries;Finsupp.removeNth: removing an element at a given entry of a mapFin (n + 1) →₀ M;Finsupp.cons: adding an element at the beginning of ann-tuple, to get ann + 1-tuple;Finsupp.snoc: adding an element at the end of ann-tuple, to get ann + 1-tuple;Finsupp.insertNth: adding an element at a given entry of ann-tuple, to get ann + 1-tuple.
In this context, we prove some usual properties of these operations, analogous to those of
Data.Fin.Tuple.Basic.
theorem
Finsupp.snoc_left_injective
{n : ℕ}
{M : Type u_1}
[Zero M]
{y : M}
:
Function.Injective fun (x : Fin n →₀ M) => x.snoc y
theorem
Finsupp.insertNth_right_injective
{n : ℕ}
{M : Type u_1}
[Zero M]
(p : Fin (n + 1))
{y : M}
:
Function.Injective (insertNth p y)