The lexicographic order on finite tuples #
This file relates Pi.Lex on Fin n → α to the lexicographic order on lists and characterizes it
by the first differing coordinate. The order on Fin (n + 1)-tuples compares heads and then tails
(Pi.toLex_lt_toLex_iff_succ), so it is the order of the tuples' lists (List.ofFn_lex_lt_iff,
List.ofFn_le_ofFn_iff); since the list order is decidable, so is the tuple order
(Pi.Lex.decidableLT, Pi.Lex.decidableLE), where mathlib's LinearOrder on Pi.Lex carries only
a classical instance. A tuple is lexicographically at most another when every coordinate where it
exceeds the other is preceded by one where it falls short (Pi.lex_le_iff_forall), which is to say
that it falls short at the first coordinate where they differ (Pi.lex_le_iff_find). Reindexing
both tuples along an equivalence transports the index relation (Pi.lex_comp_equiv).
[UPSTREAM] candidates for Mathlib/Order/PiLex.lean and Mathlib/Data/List/OfFn.lean.
Reindexing both tuples along an equivalence e : κ ≃ ι transports the index relation of
the lexicographic order to its preimage along e.symm.
The lexicographic order on Fin (n + 1)-tuples compares heads, then tails.
The lexicographic order on Fin n-tuples is the lexicographic order on their lists.
The lexicographic order on lists compares heads, then tails.
< on Lex (Fin n → α) is decided by comparing the tuples' lists.
Equations
- Pi.Lex.decidableLT a b = decidable_of_iff (List.Lex (fun (x1 x2 : α) => x1 < x2) (List.ofFn (ofLex a)) (List.ofFn (ofLex b))) ⋯
Equations
- Pi.Lex.decidableLE a b = decidable_of_iff (¬b < a) ⋯
A tuple is lexicographically at most another iff every coordinate where it strictly exceeds the other is preceded by one where it is strictly below.
A tuple is lexicographically at most another iff it is strictly below at the first coordinate where they differ, when one exists.