Sorting finsets #
Sorting the finset {a, b} of two distinct elements with r a b gives the list [a, b], and
sorting s.erase a gives the sorted list of s with a erased.
For a map f that is monotone on a finset s of a linear order, the points of s sorted in
increasing order are the concatenation, over the values y of f on s in increasing order, of
the sorted fibres {x ∈ s | f x = y}. Consequently the ordered product of a word along s is the
ordered product, over the values of f on s, of the ordered products along the fibres.
Consecutive entries of the sorted list of s are the pairs of positions of s with no position of
s strictly between them, so a chain condition on the sorted list is a condition on such adjacent
pairs.
The m-th element of a finset s in increasing order, s.orderEmbOfFin h m, has exactly m
elements of s below it.
Mapping the sorted list of s along an embedding that is strictly antitone on s gives the
sorted list of the image in reversed order; in particular, sorting the points of a finset of
Fin n moved along the reversal Fin.rev reverses the list of their images.
Moving the points of a finset B of Fin n along the rotation finRotate n (i ↦ i + 1, the
last position going to 0) commutes with sorting up to a cyclic rotation of the list.
The i-th smallest element of s has exactly i elements of s below it.
Removing the position of i from the increasing enumeration of s gives the increasing
enumeration of s.erase i.
Every nonempty finset can be listed by a sequence strictly increasing on a finite initial segment
(Finset.exists_strictMonoOn_Iic_surj).
If every element of I is at most s ≤ t, the sequence ⊥, the elements of I in increasing
order, s, then constantly t, is monotone in ℕ, Finset.monotone_bot_orderEmbOfFin_snoc.
The support-enlargement and adjacent-swap ordered-product lemmas are adapted from
Mei/Algebra/BigOperators/Group/Finset/Ordered.lean in
yuma-mizuno-lean/Mei, commit
3d2e9c869ee44c41ae9c7b5c6e2042898430d0ca (Apache 2.0), originally authored by Codex.
Sorting a two-element finset {a, b} with r a b lists a before b.
Sorting s.erase a erases a from the sorted list of s.
A nonempty finset in a linear order can be listed by a sequence strictly increasing on
Set.Iic n, with all entries on that segment in the finset and every element reached there.
Collapsing j onto its predecessor i in s is monotone on s, identifies only
i and j, and strictly decreases the cardinality of the image of s.
For a map f that is monotone on s, listing the values of f on s in increasing order and
replacing each value y by the increasing list of the points of s over y lists s in
increasing order.
For a map f that is monotone on s, the product of a word a along s in increasing order
is the product, over the values y of f on s in increasing order, of the products of a along
the fibres {x ∈ s | f x = y} in increasing order.
Enlarging an ordered index set by identity factors preserves the product.
Sorted products agree when their index sets agree wherever the factor is not one.
Swapping two consecutive indices in a finite increasing product preserves it when their factors commute.
A relation holds between the images of consecutive entries of s sorted in increasing order
exactly when it holds between the images of any two positions x < y of s with no position of
s strictly between them.
For an embedding e that is strictly antitone on s, mapping the increasing list of s along
e gives the decreasing list of the image of s, the reverse of its increasing list.
The m-th element of s in increasing order has exactly m elements of s below it.
Sorting the points of a finset B of Fin n moved along the reversal Fin.revPerm lists the
images under Fin.rev of the sorted points of B in reversed order.
Sorting a finset B of Fin n and then moving its points along finRotate n gives a cyclic
rotation of the sorted list of the moved points: the order is unchanged except that the last
position, which moves to 0, goes from the end of the list to its front.
Removing the position of i from the increasing enumeration of s gives the increasing
enumeration of s.erase i.
If every element of I is at most s and s ≤ t, then the sequence ⊥, the elements of
I in increasing order, s, then constantly t (from index I.card + 2 on), is monotone in
ℕ.