Comparison #
This file provides basic results about orderings and comparison in linear orders.
Definitions #
CmpLE
: AnOrdering
from≤
.Ordering.Compares
: Turns anOrdering
into<
and=
propositions.linearOrderOfCompares
: Constructs aLinearOrder
instance 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
.
Equations
- cmpLE x y = if x ≤ y then if y ≤ x then Ordering.eq else Ordering.lt else Ordering.gt
Instances For
theorem
cmpLE_eq_cmp
{α : Type u_3}
[Preorder α]
[IsTotal α fun (x1 x2 : α) => x1 ≤ x2]
[DecidableRel fun (x1 x2 : α) => x1 ≤ x2]
[DecidableRel fun (x1 x2 : α) => x1 < x2]
(x y : α)
:
Alias of the forward direction of Ordering.compares_swap
.
Alias of the reverse direction of Ordering.compares_swap
.
@[simp]
@[simp]
theorem
Ordering.Compares.cmp_eq
{α : Type u_1}
[LinearOrder α]
{a b : α}
{o : Ordering}
(h : o.Compares a b)
:
@[simp]
@[simp]
@[simp]
@[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')
: