Finsupp.cons, Finsupp.snoc and their lexicographic comparison #
Finsupp.cons x s : Fin (n + 1) →₀ M puts x in front of s. Adding two of them adds heads and
tails separately. The lexicographic order compares the entries at 0 first, so two of them are
compared by their heads, and then by their tails.
Dually, Finsupp.snoc s x : Fin (n + 1) →₀ M appends x after s, and Finsupp.init t forgets
the last entry of t; these are the Finsupp versions of Fin.snoc and Fin.init. Adding two
such vectors adds initial parts and last entries separately. Two such vectors are compared
lexicographically by their initial parts first, and then by their last entries.
Strict lexicographic comparison of Finsupp.cons compares the heads first and compares
the tails when the heads are equal.
Strict lexicographic comparison of Finsupp.snoc compares the initial parts first and
compares the last entries when the initial parts are equal.