Lexicographic ordering of lists. #
The lexicographic order on List α is defined by L < M iff
- [] < (a :: L)for any- aand- L,
- (a :: L) < (b :: M)where- a < b, or
- (a :: L) < (a :: M)where- L < M.
See also #
Related files are:
- Mathlib/Data/Finset/Colex.lean: Colexicographic order on finite sets.
- Mathlib/Data/PSigma/Order.lean: Lexicographic order on- Σ' i, α i.
- Mathlib/Data/Pi/Lex.lean: Lexicographic order on- Πₗ i, α i.
- Mathlib/Data/Sigma/Order.lean: Lexicographic order on- Σ i, α i.
- Mathlib/Data/Prod/Lex.lean: Lexicographic order on- α × β.
lexicographic ordering #
instance
List.Lex.isOrderConnected
{α : Type u}
(r : α → α → Prop)
[IsOrderConnected α r]
[IsTrichotomous α r]
 :
IsOrderConnected (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 α) (Lex r)
instance
List.Lex.decidableRel
{α : Type u}
[DecidableEq α]
(r : α → α → Prop)
[DecidableRel r]
 :
DecidableRel (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₂) ⋯
Equations
- List.instLinearOrder = linearOrderOfSTO (List.Lex fun (x1 x2 : α) => x1 < x2)