Basic results about finite ordinal types #
This file collects elementary facts about finite ordinal types, including the classification of
permutations of Fin 2, sums of reversed indices, indicator sums indexed by Fin n, the final
value of a partial product, and the cyclic index arithmetic of Fin 3.
Fintype.sum_ite_eq evaluates a sum whose indicator compares two elements of the index type.
When the comparison is instead between a natural number and the Fin.val of the index — as it is
whenever a family is indexed by ℕ and summed over Fin n — the index may fall outside the
range, so the value is a dite rather than a plain application.
Main results #
TauCeti.perm_fin_two_eq_one_or_swap: every permutation ofFin 2is the identity or the transposition.TauCeti.forall_cons_swap_eq_zero_iff: vanishing of the final coordinates after swapping coordinate zero with coordinatedin a vector built withFin.cons.Fin.rev_finRotate_revandFin.rev_finRotate_symm: reversal carries forward rotation to backward rotation and conversely.Fin.finRotate_rev_finRotate_rev: negation modulon, written asi ↦ finRotate n i.rev, is an involution.Fin.coe_finRotate_pow: a power of the rotationfinRotate nadds its exponent modulon.Finset.sum_range_const_sub_succ: the sum of a reversed initial segment of natural numbers.Fin.sum_rev_castLE: the sum of the values of a reversed embedded finite ordinal.Fin.castSucc_add_one_of_ne_last,Fin.castSucc_sub_one_of_ne_zero: howFin.castSuccinteracts with the cyclic successor and predecessor.Fin.zero_sub_one_eq_last: subtracting one from0gives the last index.Fin.eq_castSucc_last_or_eq_last: an index≥ nofFin (n + 2)is the penultimate or the last one.Fin.last_ne_zero,Fin.castSucc_last_ne_zero,Fin.castSucc_last_ne_one,Fin.last_ne_one: the last and penultimate indices differ from0and1in the nondegenerate cases.Fin.sum_univ_eq_zero_add_last_add_sum_erase: a sum overFin (n + 1)with its first and last summands split off.Fin.natCast_ne_zero: the cast of a natural number0 < a < ntoFin n(underopen Fin.NatCast) is nonzero.Fin.predAbove_succ_succAbove:Fin.predAbove pinvertsp.succ.succAbove, the counterpart of Mathlib'sFin.predAbove_succAboveforp.castSucc.succAbove.Fin.val_succAbove: the value ofp.succAbove i, read off the comparison ofiwithp.Fin.finRotate_succ_eq_succ_succAboveandFin.finRotate_succ_succAbove_of_ne: the cyclic successor ofFin (n + 1)against the embeddingsFin.succandi.succ.succAboveofFin n, as used when a new entry is inserted into a cyclic sequence.Fin.succAbove_adjacent_cases: the positionspofFin (n + 1)cyclically adjacent top.succAbove i.Fin.swap_castSucc_succ_succAbove: the transposition ofk.castSuccandk.succexchanges the embeddings ofFin nskipping either of them.Fin.card_filter_prod_succAbove: a count of pairs inFin (n + 1)split at a point in each coordinate.Fin.val_orderSucc_of_ltandFin.orderSucc_eq_self_of_not_lt: the order successor ofFin nread off the value, below and at the top element. Mathlib'sFin.orderSucc_castSuccandFin.orderSucc_laststate the same thing in thecastSucc/lastnormal form; these are the versions keyed on the inequalityi + 1 < n.Fin.partialProd_last: the final partial product is the product of all the entries.Fin.partialSum_last: the final partial sum is the sum of all the entries.TauCeti.add_one_ne_self: adding one inFin nis nontrivial when2 ≤ n.TauCeti.add_one_add_one_ne_self: adding one twice inFin nis nontrivial when3 ≤ n;TauCeti.sub_one_ne_selfandTauCeti.add_one_ne_sub_oneare the companions for subtraction.TauCeti.apply_eq_apply_zero_of_add_one: a function onFin (n + 1)unchanged by adding one is constant.TauCeti.eq_add_one_or_eq_add_two_fin_three: a distinct index ofFin 3is one of the two shifts of the other.TauCeti.add_one_add_one_fin_three,TauCeti.add_one_add_two_fin_three,TauCeti.add_two_add_one_fin_threeandTauCeti.add_two_add_two_fin_three: the shifts by1and2compose cyclically inFin 3.TauCeti.sum_fin_three_rotate: a sum overFin 3read off starting from an arbitrary index.TauCeti.neg_one_pow_val_add_one: forneven, adding one inFin nflips the sign(-1) ^ ·read off the value.TauCeti.sum_ite_val_add: a sum against the indicator ofb = k + jpicks out the summand atb - j, or vanishes when there is no such index.TauCeti.exists_foldl_eq_of_parent: a decreasing parent table gives paths from its root.TauCeti.not_mem_Ioo_castSucc_succ: a monotoneFinfamily has no value strictly between consecutive entries.TauCeti.exists_mem_Icc_castSucc_succ: consecutive closed intervals cover the interval between the first and last values of a monotoneFinfamily.
The final partial product is the product of all the entries.
The final partial sum is the sum of all the entries.
Conjugating forward rotation of a finite ordinal by reversal gives backward rotation.
A position p of Fin (n + 1) cyclically adjacent to p.succAbove i is i.castSucc or
i.succ, or wraps around: p is last and p.succAbove i is 0, or p is 0 and
p.succAbove i is last.
The transposition of k.castSucc and k.succ carries the embedding k.castSucc.succAbove,
which skips k.castSucc, to the embedding k.succ.succAbove, which skips k.succ.
A count of pairs in Fin (n + 1), split at a in the first coordinate and at b in the
second: the pair (a, b), the pairs with exactly one coordinate at its split point, and the pairs
embedded by a.succAbove and b.succAbove.
Below the top element of Fin n, the order successor increments the value.
At the top element of Fin n the order successor is that element itself.
A decreasing parent table gives a word carrying its root to every vertex.
Adding one in Fin n flips the sign (-1) ^ · read off the value when n is even. The
wraparound at the last index respects the sign exactly because n is even.
A permutation of Fin 2 is either the identity or the transposition.
A shifted indicator picks out one summand. Summing f over Fin n against the indicator
of b = k + j gives f at the index b - j when that is a valid index and j ≤ b, and 0
otherwise.