Insertions and appends in tuples #
The positions k.castSucc and k.succ of Fin (m + 1) are adjacent: each one skips the other
to land on k (Fin.succAbove_castSucc_self, Fin.succAbove_succ_self). This file reads off
the entry of an insertion at one of them in the other position, and compares updating the two
insertions there. It also shows how Fin.snoc interacts with reindexing along a map extended to
send the last position to the last position. The image of an initial segment under Fin.cons
is obtained by inserting the first entry into the corresponding image for the tail.
A tuple of length three is determined by its three entries. A tuple in a sum type that starts on
the left, ends on the right and never steps from right to left steps from left to right exactly
once.
Main results #
Fin.insertNth_castSucc_apply_succandFin.insertNth_succ_apply_castSucc: after inserting at one of two adjacent positions, the other position holds thek-th entry of the tuple.Fin.update_insertNth_castSucc: inserting atk.castSuccand updatingk.succis inserting atk.succand updatingk.castSucc.Fin.snoc_comp_snoc_castSucc_comp: reindexing alonggand then appending agrees with appending and then reindexing along the extension ofgthat fixes the last position.Fin.tail_contractNth_succ,Fin.init_contractNth_castSucc: contracting two adjacent entries away from the first (last) one commutes with dropping the first (last) entry.Fin.snoc_comp_swap_castSucc: exchanging two entries other than the last one commutes with appending.Fin.tail_snoc: dropping the first entry commutes with appending a last one.Fin.snoc_tail_comp_rev: appending the first entry to the reversed tail reverses the tuple.Fin.forall_snoc_eq_iff_snoc_eq: appending one entry to each of two tuples gives the same equality pattern exactly when the old patterns agree and the new entries repeat the same positions.Fin.update_append_castAdd,Fin.update_append_natAdd: updating an entry ofFin.append u vupdates the corresponding entry ofuor ofv.Fin.append_comp_swap_castAdd,Fin.append_comp_swap_natAdd: exchanging two entries ofFin.append u vexchanges the corresponding entries ofuor ofv.Fin.contractNth_zero_cons,Fin.contractNth_succ_cons: contracting entries of a tupleFin.cons x a.Fin.contractNth_castSucc_castSucc_snoc,Fin.contractNth_castSucc_last_snoc: contracting entries of a tupleFin.snoc a x.Fin.init_contractNth_castSucc_last: contracting the last two entries and dropping the last one drops the last two entries.Fin.contractNth_last: contracting at the last position drops the last entry.Fin.contractNth_castSucc_castSucc_apply_lastandFin.contractNth_castSucc_last_apply_last: the last entry of a contraction.Fin.contractNth_castSucc_eq_update_removeNth_succ: contracting the entriesjandj + 1is deleting entryj + 1and then overwriting entryjby the contraction.Fin.update_removeNth_succ_eq_removeNth_castSucc: deleting entryj + 1and then overwriting entryjby the deleted entry is deleting entryj.Fin.contractNth_castSucc_const: contracting two adjacent entries of a constant tuple.Fin.insertNth_apply_zero_of_ne_zero,Fin.insertNth_apply_last_of_ne_last: inserting away from the first (last) position keeps the first (last) entry.Fin.contractNth_castSucc_insertNth_succ_castSucc: contracting the two steps of a path that meet at an inserted vertex.Fin.removeNth_succ_cons: deleting an entry ofFin.cons x aother than the first deletes the corresponding entry ofa.Fin.insertNth_one_ne_zero: inserting the entry1gives a nonzero tuple.Fin.injective_apply_zero_one_two: a tuple of length three is determined by its entries.Fin.injective_comp_succAbove_of_eqandFin.range_comp_succAbove_of_eq: ifb p = b q, deleting the entry atpor atqgives an injective tuple in the same cases, and does not change the set of entries.Fin.existsUnique_isLeft_castSucc_and_isRight_succ: a tuple inα ⊕ βfrom the left summand to the right one that never steps back steps from left to right exactly once.
Two insertions at adjacent positions agree away from those positions.
Updating Fin.append u v at a position of u is appending the updated u to v.
Updating Fin.append u v at a position of v is appending u to the updated v.
Exchanging two entries of Fin.append u v at positions of u is appending v to u with
those entries exchanged.
Exchanging two entries of Fin.append u v at positions of v is prepending u to v with
those entries exchanged.
Contracting at the last position, which has no successor, drops the last entry.
Contracting two adjacent entries of a constant tuple overwrites one entry of the shorter constant tuple by the contraction.
Contracting along a path with an inserted vertex. Let f k be a function of the two
endpoints of the k-th step of a path. Along the path obtained from x by inserting v after
xₗ, contracting the steps l and l + 1 gives the entries f ((l + 1).succAbove k) read
along x, except in position l, which holds op (f l xₗ v) (f (l + 1) v xₗ₊₁).
The image of the first n + 1 entries of a prepended tuple consists of its first entry
and the image of the first n entries of its tail.
A tuple of length three is determined by its three entries.
If deleting the entry at q leaves an injective tuple, two positions other than q holding
the same entry are equal.
If b p = b q, deleting the entry at p leaves an injective tuple exactly when
deleting the entry at q does.
A tuple in α ⊕ β that starts in α, ends in β and never steps from β back to α steps
from α to β at exactly one position.