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
Given a finset s
of cardinal k
in a linear order α
, the map mono_of_fin s h
is the increasing bijection between fin k
and s
as an α
-valued map. Here, h
is a proof that
the cardinality of s
is k
. We use this instead of a map fin s.card → α
to avoid
casting issues in further uses of this function.
Equations
- s.mono_of_fin h i = have A : ↑i < (finset.sort has_le.le s).length, from _, (finset.sort has_le.le s).nth_le ↑i A
The bijection mono_of_fin s h
sends 0
to the minimum of s
.
The bijection mono_of_fin s h
sends k-1
to the maximum of s
.
mono_of_fin {a} h
sends any argument to a
.
Any increasing bijection between fin k
and a finset of cardinality k
has to coincide with
the increasing bijection mono_of_fin s h
. For a statement assuming only that f
maps univ
to
s
, see mono_of_fin_unique'
.
Any increasing map between fin k
and a finset of cardinality k
has to coincide with
the increasing bijection mono_of_fin s h
.
Two parametrizations mono_of_fin
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.val = j.val
.
Given a finset s
of cardinal k
in a linear order α
, the equiv mono_equiv_of_fin s h
is the increasing bijection between fin k
and s
as an s
-valued map. Here, h
is a proof that
the cardinality of s
is k
. We use this instead of a map fin s.card → α
to avoid
casting issues in further uses of this function.
Equations
- s.mono_equiv_of_fin h = set.bij_on.equiv (s.mono_of_fin h) _