Prefixes and intervals in the lexicographic order on lists #
A prefix of a list is lexicographically at most that list (List.isPrefix_le), and the extensions
of any prefix form an order-convex interval under the lexicographic order
(List.IsPrefix.of_le_of_le, List.IsPrefix.of_prefix_of_le_of_le). Lists of equal length keep a
strict comparison when anything is appended to them (List.append_lt_append_of_lt_of_length_eq),
and truncating two lists to a common length preserves their order (List.take_le_take_of_le).
Mathlib's lexicographic LinearOrder on lists replaces core's ≤ on lists, so core's
List.cons_le_cons_iff does not apply to it; List.cons_le_cons_iff' is its counterpart.
Main results #
List.cons_le_cons_iff':a :: l ≤ b :: l'iffa < b, ora = bandl ≤ l'.List.append_lt_append_of_lt_of_length_eq: ifa < banda,bhave the same length, thena ++ c < b ++ d.List.isPrefix_le: ifa <+: b, thena ≤ blexicographically.List.IsPrefix.of_le_of_le: ifp <+: bandp ≤ c ≤ b, thenp <+: c.List.IsPrefix.of_prefix_of_le_of_le: ifp <+: a,p <+: b, anda ≤ c ≤ b, thenp <+: c.List.take_le_take_of_le: ifa ≤ b, thena.take n ≤ b.take n.
A strict comparison between lists of the same length survives appending anything to them: it is decided at a position inside both.
A list is lexicographically at most every list it is a prefix of.
A list lexicographically between a prefix p of b and b itself also has p as a prefix.
Lists with a common prefix form a lexicographic interval.
Truncating two lists to a common length preserves their lexicographic order.