Lexicographic ordering #
theorem
Vector.lt_irrefl
{α : Type u_1}
{n : Nat}
[LT α]
[Std.Irrefl fun (x1 x2 : α) => x1 < x2]
(xs : Vector α n)
 :
instance
Vector.ltIrrefl
{α : Type u_1}
{n : Nat}
[LT α]
[Std.Irrefl fun (x1 x2 : α) => x1 < x2]
 :
Std.Irrefl fun (x1 x2 : Vector α n) => x1 < x2
theorem
Vector.le_refl
{α : Type u_1}
{n : Nat}
[LT α]
[i₀ : Std.Irrefl fun (x1 x2 : α) => x1 < x2]
(xs : Vector α n)
 :
instance
Vector.instReflLeOfIrreflLt
{α : Type u_1}
{n : Nat}
[LT α]
[Std.Irrefl fun (x1 x2 : α) => x1 < x2]
 :
theorem
Vector.lt_of_le_of_lt
{α : Type u_1}
{n : Nat}
[LT α]
[LE α]
[Std.LawfulOrderLT α]
[Std.IsLinearOrder α]
{xs ys zs : Vector α n}
(h₁ : xs ≤ ys)
(h₂ : ys < zs)
 :
@[deprecated Vector.lt_of_le_of_lt (since := "2025-08-01")]
theorem
Vector.le_trans
{α : Type u_1}
{n : Nat}
[LT α]
[LE α]
[Std.LawfulOrderLT α]
[Std.IsLinearOrder α]
{xs ys zs : Vector α n}
(h₁ : xs ≤ ys)
(h₂ : ys ≤ zs)
 :
@[deprecated Vector.le_trans (since := "2025-08-01")]
instance
Vector.instTransLeOfLawfulOrderLTOfIsLinearOrder
{α : Type u_1}
{n : Nat}
[LT α]
[LE α]
[Std.LawfulOrderLT α]
[Std.IsLinearOrder α]
 :
Equations
- Vector.instTransLeOfLawfulOrderLTOfIsLinearOrder = { trans := ⋯ }
theorem
Vector.le_antisymm
{α : Type u_1}
{n : Nat}
[LT α]
[LE α]
[Std.IsLinearOrder α]
[Std.LawfulOrderLT α]
{xs ys : Vector α n}
(h₁ : xs ≤ ys)
(h₂ : ys ≤ xs)
 :
instance
Vector.instIsLinearOrderOfLawfulOrderLT
{α : Type u_1}
{n : Nat}
[LT α]
[LE α]
[Std.IsLinearOrder α]
[Std.LawfulOrderLT α]
 :
Std.IsLinearOrder (Vector α n)
instance
Vector.instLawfulOrderLTOfAsymmLt
{α : Type u_1}
{n : Nat}
[LT α]
[Std.Asymm fun (x1 x2 : α) => x1 < x2]
 :
Std.LawfulOrderLT (Vector α n)
instance
Vector.instDecidableLTOfDecidableEq
{α : Type u_1}
{n : Nat}
[DecidableEq α]
[LT α]
[DecidableLT α]
 :
DecidableLT (Vector α n)
Equations
- xs.instDecidableLTOfDecidableEq ys = decidable_of_iff ((xs.lex ys fun (x1 x2 : α) => decide (x1 < x2)) = true) ⋯
instance
Vector.instDecidableLEOfDecidableEqOfDecidableLT
{α : Type u_1}
{n : Nat}
[DecidableEq α]
[LT α]
[DecidableLT α]
 :
DecidableLE (Vector α n)
Equations
- xs.instDecidableLEOfDecidableEqOfDecidableLT ys = decidable_of_iff ((ys.lex xs fun (x1 x2 : α) => decide (x1 < x2)) = false) ⋯
theorem
Vector.lex_eq_false_iff_exists
{α : Type u_1}
{n : Nat}
[BEq α]
[PartialEquivBEq α]
(lt : α → α → Bool)
(lt_irrefl : ∀ (x y : α), (x == y) = true → lt x y = false)
(lt_asymm : ∀ (x y : α), lt x y = true → lt y x = false)
(lt_antisymm : ∀ (x y : α), lt x y = false → lt y x = false → (x == y) = true)
{xs ys : Vector α n}
 :
l₁ is not lexicographically less than l₂
(which you might think of as "l₂ is lexicographically greater than or equal to l₁"") if either
- l₁is pairwise equivalent under- · == ·to- l₂or
- there exists an index isuch that- for all j < i,l₁[j] == l₂[j]and
- l₂[i] < l₁[i]
 
- for all 
This formulation requires that == and lt are compatible in the following senses:
- ==is symmetric (we unnecessarily further assume it is transitive, to make use of the existing typeclasses)
- ltis irreflexive with respect to- ==(i.e. if- x == ythen- lt x y = false
- ltis asymmetric (i.e.- lt x y = true → lt y x = false)
- ltis antisymmetric with respect to- ==(i.e.- lt x y = false → lt y x = false → x == y)
theorem
Vector.map_le
{α : Type u_1}
{β : Type u_2}
{n : Nat}
[LT α]
[LT β]
[Std.Asymm fun (x1 x2 : α) => x1 < x2]
[Std.Antisymm fun (x1 x2 : α) => ¬x1 < x2]
[Std.Asymm fun (x1 x2 : β) => x1 < x2]
[Std.Antisymm fun (x1 x2 : β) => ¬x1 < x2]
{xs ys : Vector α n}
{f : α → β}
(w : ∀ (x y : α), x < y → f x < f y)
(h : xs ≤ ys)
 :