Lexicographic ordering of lists. #
The lexicographic order on List α
is defined by L < M
iff
[] < (a :: L)
for anya
andL
,(a :: L) < (b :: M)
wherea < b
, or(a :: L) < (a :: M)
whereL < M
.
See also #
Related files are:
Mathlib.Data.Finset.Colex
: Colexicographic order on finite sets.Mathlib.Data.PSigma.Order
: Lexicographic order onΣ' i, α i
.Mathlib.Data.Pi.Lex
: Lexicographic order onΠₗ i, α i
.Mathlib.Data.Sigma.Order
: Lexicographic order onΣ i, α i
.Mathlib.Data.Prod.Lex
: Lexicographic order onα × β
.
lexicographic ordering #
@[deprecated List.not_lex_nil (since := "2024-12-21")]
Alias of List.not_lex_nil
.
instance
List.Lex.isOrderConnected
{α : Type u}
(r : α → α → Prop)
[IsOrderConnected α r]
[IsTrichotomous α r]
:
IsOrderConnected (List α) (List.Lex r)
theorem
List.Lex.isOrderConnected.aux
{α : Type u}
(r : α → α → Prop)
[IsOrderConnected α r]
[IsTrichotomous α r]
(x✝ x✝¹ x✝² : List α)
:
instance
List.Lex.isTrichotomous
{α : Type u}
(r : α → α → Prop)
[IsTrichotomous α r]
:
IsTrichotomous (List α) (List.Lex r)
@[deprecated "No deprecation message was provided." (since := "2024-07-30")]
instance
List.Lex.isStrictTotalOrder
{α : Type u}
(r : α → α → Prop)
[IsStrictTotalOrder α r]
:
IsStrictTotalOrder (List α) (List.Lex r)
instance
List.Lex.decidableRel
{α : Type u}
[DecidableEq α]
(r : α → α → Prop)
[DecidableRel r]
:
DecidableRel (List.Lex r)
Equations
- List.Lex.decidableRel r x✝ [] = isFalse ⋯
- List.Lex.decidableRel r [] (head :: tail) = isTrue ⋯
- List.Lex.decidableRel r (a :: l₁) (b :: l₂) = decidable_of_iff (r a b ∨ a = b ∧ List.Lex r l₁ l₂) ⋯
theorem
Decidable.List.Lex.ne_iff
{α : Type u}
[DecidableEq α]
{l₁ l₂ : List α}
(H : l₁.length ≤ l₂.length)
:
Equations
- List.instLinearOrder = linearOrderOfSTO (List.Lex fun (x1 x2 : α) => x1 < x2)