Construct a sorted list from a finset. #
sort #
sort s
constructs a sorted list from the unordered set s
.
(Uses merge sort algorithm.)
Equations
- Finset.sort r s = Multiset.sort r s.val
Instances For
Given a finset s
of cardinality k
in a linear order α
, the map orderIsoOfFin s h
is the increasing bijection between Fin k
and s
as an OrderIso
. Here, h
is a proof that
the cardinality of s
is k
. We use this instead of an iso Fin s.card ≃o s
to avoid
casting issues in further uses of this function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a finset s
of cardinality k
in a linear order α
, the map orderEmbOfFin s h
is
the increasing bijection between Fin k
and s
as an order embedding into α
. Here, h
is a
proof that the cardinality of s
is k
. We use this instead of an embedding Fin s.card ↪o α
to
avoid casting issues in further uses of this function.
Equations
- s.orderEmbOfFin h = RelEmbedding.trans (s.orderIsoOfFin h).toOrderEmbedding (OrderEmbedding.subtype fun (x : α) => x ∈ s)
Instances For
The bijection orderEmbOfFin s h
sends 0
to the minimum of s
.
The bijection orderEmbOfFin s h
sends k-1
to the maximum of s
.
orderEmbOfFin {a} h
sends any argument to a
.
Any increasing map f
from Fin k
to a finset of cardinality k
has to coincide with
the increasing bijection orderEmbOfFin s h
.
An order embedding f
from Fin k
to a finset of cardinality k
has to coincide with
the increasing bijection orderEmbOfFin s h
.
Two parametrizations orderEmbOfFin
of the same set take the same value on i
and j
if
and only if i = j
. Since they can be defined on a priori not defeq types Fin k
and Fin l
(although necessarily k = l
), the conclusion is rather written (i : ℕ) = (j : ℕ)
.
Given a finset s
of size at least k
in a linear order α
, the map orderEmbOfCardLe
is an order embedding from Fin k
to α
whose image is contained in s
. Specifically, it maps
Fin k
to an initial segment of s
.
Equations
- s.orderEmbOfCardLe h = RelEmbedding.trans (Fin.castLEOrderEmb h) (s.orderEmbOfFin ⋯)
Instances For
Given a Fintype
α
of cardinality k
, the map orderIsoFinOfCardEq s h
is the increasing
bijection between Fin k
and α
as an OrderIso
. Here, h
is a proof that the cardinality of α
is k
. We use this instead of an iso Fin (Fintype.card α) ≃o α
to avoid casting issues in further
uses of this function.
Equations
- Fintype.orderIsoFinOfCardEq α h = (Finset.univ.orderIsoOfFin h).trans ((OrderIso.setCongr (↑Finset.univ) Set.univ ⋯).trans OrderIso.Set.univ)
Instances For
Any finite linear order order-embeds into any infinite linear order.