Successors and predecessor operations of Fin n #
This file contains a number of definitions and lemmas
related to Fin.succ, Fin.pred, and related operations on Fin n.
Main definitions #
finCongr:Fin.castas anEquiv, equivalence betweenFin nandFin mwhenn = m;Fin.succAbove: embedsFin nintoFin (n + 1)skippingp.Fin.predAbove: the (partial) inverse ofFin.succAbove.
succ and casts into larger Fin types #
The Fin.succ_one_eq_two in Lean only applies in Fin (n+2).
This one instead uses a NeZero n typeclass hypothesis.
While in many cases finCongr is better than Equiv.cast/cast, sometimes we want to apply
a generic theorem about cast.
The Fin.castSucc_zero in Lean only applies in Fin (n+1).
This one instead uses a NeZero n typeclass hypothesis.
pred #
Alias of Fin.castPred_zero.
succAbove is injective at the pivot
By moving succ to the outside of this expression, we create opportunities for further
simplification using succAbove_zero or succ_succAbove_zero.
Given i : Fin (n + 2) and j : Fin (n + 1),
there are two ways to represent the order embedding Fin n → Fin (n + 2)
leaving holes at i and i.succAbove j.
One is i.succAbove ∘ j.succAbove.
It corresponds to embedding Fin n to Fin (n + 1) leaving a hole at j,
then embedding the result to Fin (n + 2) leaving a hole at i.
The other one is (i.succAbove j).succAbove ∘ (j.predAbove i).succAbove.
It corresponds to swapping the roles of i and j.
This lemma says that these two ways are equal.
It is used in Fin.removeNth_removeNth_eq_swap
to show that two ways of removing 2 elements from a sequence give the same answer.