The areas / V33. Data structures and computation
Mathlib.Data.List.Lex
19 declarations. Mathlib docs · Source
Lexicographic ordering of lists.
The lexicographic order on List α is defined by L < M iff
[] < (a :: L)for anyaandL,(a :: L) < (b :: M)wherea < b, or(a :: L) < (a :: M)whereL < M.
See also
Related files are:
Mathlib/Combinatorics/Colex.lean: Colexicographic order on finite sets.Mathlib/Order/PSigma.lean: Lexicographic order onΣ' i, α i.Mathlib/Order/PiLex.lean: Lexicographic order onΠₗ i, α i.Mathlib/Order/Sigma.lean: Lexicographic order onΣ i, α i.Mathlib/Order/Prod/Lex/Basic.lean: Lexicographic order onα × β.
lexicographic ordering
theorem List.lex_cons_iff E0 #
∀ {α : Type u} {r : α → α → Prop} [Std.Irrefl r] {a : α} {l₁ l₂ : List α},
List.Lex r (a :: l₁) (a :: l₂) ↔ List.Lex r l₁ l₂
theorem List.lex_nil_or_eq_nil E1 #
∀ {α : Type u} {r : α → α → Prop} (l : List α), List.Lex r [] l ∨ l = []
theorem List.lex_singleton_iff E0 #
∀ {α : Type u} {r : α → α → Prop} (a b : α), List.Lex r [a] [b] ↔ r a b
instance List.Lex.isOrderConnected E0 #
∀ {α : Type u} (r : α → α → Prop) [IsOrderConnected α r] [Std.Trichotomous r], IsOrderConnected (List α) (List.Lex r)
instance List.Lex.trichotomous E0 #
∀ {α : Type u} (r : α → α → Prop) [Std.Trichotomous r], Std.Trichotomous (List.Lex r)
instance List.Lex.asymm E0 #
∀ {α : Type u} (r : α → α → Prop) [Std.Asymm r], Std.Asymm (List.Lex r)
instance List.Lex.decidableRel E0 #
{α : Type u} → [DecidableEq α] → (r : α → α → Prop) → [DecidableRel r] → DecidableRel (List.Lex r)
theorem List.Lex.append_right E1 #
∀ {α : Type u} (r : α → α → Prop) {s₁ s₂ : List α} (t : List α), List.Lex r s₁ s₂ → List.Lex r s₁ (s₂ ++ t)
theorem List.Lex.append_left E1 #
∀ {α : Type u} (R : α → α → Prop) {t₁ t₂ : List α}, List.Lex R t₁ t₂ → ∀ (s : List α), List.Lex R (s ++ t₁) (s ++ t₂)
theorem List.Lex.imp E1 #
∀ {α : Type u} {r s : α → α → Prop},
(∀ (a b : α), r a b → s a b) → ∀ (l₁ l₂ : List α), List.Lex r l₁ l₂ → List.Lex s l₁ l₂
theorem List.Lex.to_ne E1 #
∀ {α : Type u} {l₁ l₂ : List α}, List.Lex (fun x1 x2 ↦ x1 ≠ x2) l₁ l₂ → l₁ ≠ l₂
theorem Decidable.List.Lex.ne_iff E0 #
∀ {α : Type u} [DecidableEq α] {l₁ l₂ : List α},
l₁.length ≤ l₂.length → (List.Lex (fun x1 x2 ↦ x1 ≠ x2) l₁ l₂ ↔ l₁ ≠ l₂)
theorem List.Lex.ne_iff E0 #
∀ {α : Type u} {l₁ l₂ : List α}, l₁.length ≤ l₂.length → (List.Lex (fun x1 x2 ↦ x1 ≠ x2) l₁ l₂ ↔ l₁ ≠ l₂)
instance List.instLinearOrder E0 #
{α : Type u} → [LinearOrder α] → LinearOrder (List α)
instance List.LE' E0 #
{α : Type u} → [LinearOrder α] → LE (List α)
theorem List.lt_iff_lex_lt E1 #
∀ {α : Type u} [inst : LT α] (l l' : List α), l.lt l' ↔ List.Lex (fun x1 x2 ↦ x1 < x2) l l'
theorem List.head_le_of_lt E1 #
∀ {α : Type u} [inst : Preorder α] {a a' : α} {l l' : List α}, a' :: l' < a :: l → a' ≤ a
theorem List.head!_le_of_lt E1 #
∀ {α : Type u} [inst : Preorder α] [inst_1 : Inhabited α] (l l' : List α), l' < l → l' ≠ [] → l'.head! ≤ l.head!
theorem List.cons_le_cons E1 #
∀ {α : Type u} [inst : LinearOrder α] (a : α) {l l' : List α}, l' ≤ l → a :: l' ≤ a :: l