Comparison #
This file provides basic results about orderings and comparison in linear orders.
Definitions #
CmpLE: AnOrderingfrom≤.Ordering.Compares: Turns anOrderinginto<and=propositions.linearOrderOfCompares: Constructs aLinearOrderinstance from the fact that any two elements that are not one strictly less than the other either way are equal.
Like cmp, but uses a ≤ on the type instead of <. Given two elements x and y, returns a
three-way comparison result Ordering.
Instances For
theorem
cmpLE_swap
{α : Type u_3}
[LE α]
[Std.Total fun (x1 x2 : α) => x1 ≤ x2]
[DecidableLE α]
(x y : α)
:
Alias of the reverse direction of Ordering.compares_swap.
Alias of the forward direction of Ordering.compares_swap.
theorem
Ordering.Compares.eq_eq
{α : Type u_1}
[Preorder α]
{o : Ordering}
{a b : α}
:
o.Compares a b → (o = eq ↔ a = b)
theorem
Ordering.Compares.eq_gt
{α : Type u_1}
[Preorder α]
{o : Ordering}
{a b : α}
(h : o.Compares a b)
:
o = gt ↔ b < a
theorem
Ordering.Compares.ne_gt
{α : Type u_1}
[Preorder α]
{o : Ordering}
{a b : α}
(h : o.Compares a b)
:
o ≠ gt ↔ a ≤ b
theorem
Ordering.compares_iff_of_compares_impl
{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[Preorder β]
{a b : α}
{a' b' : β}
(h : ∀ {o : Ordering}, o.Compares a b → o.Compares a' b')
(o : Ordering)
:
@[simp]
theorem
toDual_compares_toDual
{α : Type u_1}
[LT α]
{a b : α}
{o : Ordering}
:
o.Compares (OrderDual.toDual a) (OrderDual.toDual b) ↔ o.Compares b a
@[simp]
theorem
ofDual_compares_ofDual
{α : Type u_1}
[LT α]
{a b : αᵒᵈ}
{o : Ordering}
:
o.Compares (OrderDual.ofDual a) (OrderDual.ofDual b) ↔ o.Compares b a
theorem
Ordering.Compares.cmp_eq
{α : Type u_1}
[LinearOrder α]
{a b : α}
{o : Ordering}
(h : o.Compares a b)
:
cmp a b = o
@[simp]
theorem
cmpLE_toDual
{α : Type u_1}
[LE α]
[DecidableLE α]
(x y : α)
:
cmpLE (OrderDual.toDual x) (OrderDual.toDual y) = cmpLE y x
@[simp]
theorem
cmpLE_ofDual
{α : Type u_1}
[LE α]
[DecidableLE α]
(x y : αᵒᵈ)
:
cmpLE (OrderDual.ofDual x) (OrderDual.ofDual y) = cmpLE y x
@[simp]
theorem
cmp_toDual
{α : Type u_1}
[LT α]
[DecidableLT α]
(x y : α)
:
cmp (OrderDual.toDual x) (OrderDual.toDual y) = cmp y x
@[simp]
theorem
cmp_ofDual
{α : Type u_1}
[LT α]
[DecidableLT α]
(x y : αᵒᵈ)
:
cmp (OrderDual.ofDual x) (OrderDual.ofDual y) = cmp y x
@[implicit_reducible]
def
linearOrderOfCompares
{α : Type u_1}
[Preorder α]
(cmp : α → α → Ordering)
(h : ∀ (a b : α), (cmp a b).Compares a b)
:
Generate a linear order structure from a preorder and cmp function.
Instances For
@[simp]
@[simp]
@[simp]
@[simp]
theorem
cmp_eq_cmp_symm
{α : Type u_1}
[LinearOrder α]
{x y : α}
{β : Type u_3}
[LinearOrder β]
{x' y' : β}
:
theorem
lt_iff_lt_of_cmp_eq_cmp
{α : Type u_1}
[LinearOrder α]
{x y : α}
{β : Type u_3}
[LinearOrder β]
{x' y' : β}
(h : cmp x y = cmp x' y')
:
theorem
le_iff_le_of_cmp_eq_cmp
{α : Type u_1}
[LinearOrder α]
{x y : α}
{β : Type u_3}
[LinearOrder β]
{x' y' : β}
(h : cmp x y = cmp x' y')
:
theorem
eq_iff_eq_of_cmp_eq_cmp
{α : Type u_1}
[LinearOrder α]
{x y : α}
{β : Type u_3}
[LinearOrder β]
{x' y' : β}
(h : cmp x y = cmp x' y')
:
x = y ↔ x' = y'