mathlib documentation

algebra.​order

algebra.​order

Lemmas about inequalities

This file contains some lemmas about //</>, and cmp.

theorem le_rfl {α : Type u} [preorder α] {x : α} :
x x

A version of le_refl where the argument is implicit

theorem eq.​ge {α : Type u} [preorder α] {x y : α} :
x = yy x

If x = y then y ≤ x. Note: this lemma uses y ≤ x instead of x ≥ y, because le is used almost exclusively in mathlib.

theorem eq.​trans_le {α : Type u} [preorder α] {x y z : α} :
x = yy zx z

@[nolint]
theorem has_le.​le.​ge {α : Type u} [has_le α] {x y : α} :
x yy x

theorem has_le.​le.​trans_eq {α : Type u} [preorder α] {x y z : α} :
x yy = zx z

@[nolint]
theorem has_lt.​lt.​gt {α : Type u} [has_lt α] {x y : α} :
x < yy > x

theorem has_lt.​lt.​false {α : Type u} [preorder α] {x : α} :
x < xfalse

@[nolint]
theorem ge.​le {α : Type u} [has_le α] {x y : α} :
x yy x

@[nolint]
theorem gt.​lt {α : Type u} [has_lt α] {x y : α} :
x > yy < x

@[nolint]
theorem ge_of_eq {α : Type u} [preorder α] {a b : α} :
a = ba b

@[simp, nolint]
theorem ge_iff_le {α : Type u} [preorder α] {a b : α} :
a b b a

@[simp, nolint]
theorem gt_iff_lt {α : Type u} [preorder α] {a b : α} :
a > b b < a

theorem not_le_of_lt {α : Type u} [preorder α] {a b : α} :
a < b¬b a

theorem not_lt_of_le {α : Type u} [preorder α] {a b : α} :
a b¬b < a

theorem le_iff_eq_or_lt {α : Type u} [partial_order α] {a b : α} :
a b a = b a < b

theorem lt_iff_le_and_ne {α : Type u} [partial_order α] {a b : α} :
a < b a b a b

theorem eq_iff_le_not_lt {α : Type u} [partial_order α] {a b : α} :
a = b a b ¬a < b

theorem eq_or_lt_of_le {α : Type u} [partial_order α] {a b : α} :
a ba = b a < b

theorem lt_of_not_ge' {α : Type u} [linear_order α] {a b : α} :
¬b aa < b

theorem lt_iff_not_ge' {α : Type u} [linear_order α] {x y : α} :
x < y ¬y x

@[simp]
theorem not_lt {α : Type u} [linear_order α] {a b : α} :
¬a < b b a

theorem le_of_not_lt {α : Type u} [linear_order α] {a b : α} :
¬a < bb a

@[simp]
theorem not_le {α : Type u} [linear_order α] {a b : α} :
¬a b b < a

theorem lt_or_le {α : Type u} [linear_order α] (a b : α) :
a < b b a

theorem le_or_lt {α : Type u} [linear_order α] (a b : α) :
a b b < a

theorem has_le.​le.​lt_or_le {α : Type u} [linear_order α] {a b : α} (h : a b) (c : α) :
a < c c b

theorem has_le.​le.​le_or_lt {α : Type u} [linear_order α] {a b : α} (h : a b) (c : α) :
a c c < b

theorem not_lt_iff_eq_or_lt {α : Type u} [linear_order α] {a b : α} :
¬a < b a = b b < a

theorem exists_ge_of_linear {α : Type u} [linear_order α] (a b : α) :
∃ (c : α), a c b c

theorem lt_imp_lt_of_le_imp_le {α : Type u} {β : Type u_1} [linear_order α] [preorder β] {a b : α} {c d : β} :
(a bc d)d < cb < a

theorem le_imp_le_of_lt_imp_lt {α : Type u} {β : Type u_1} [preorder α] [linear_order β] {a b : α} {c d : β} :
(d < cb < a)a bc d

theorem le_imp_le_iff_lt_imp_lt {α : Type u} {β : Type u_1} [linear_order α] [linear_order β] {a b : α} {c d : β} :
a bc d d < cb < a

theorem lt_iff_lt_of_le_iff_le' {α : Type u} {β : Type u_1} [preorder α] [preorder β] {a b : α} {c d : β} :
(a b c d)(b a d c)(b < a d < c)

theorem lt_iff_lt_of_le_iff_le {α : Type u} {β : Type u_1} [linear_order α] [linear_order β] {a b : α} {c d : β} :
(a b c d)(b < a d < c)

theorem le_iff_le_iff_lt_iff_lt {α : Type u} {β : Type u_1} [linear_order α] [linear_order β] {a b : α} {c d : β} :
a b c d (b < a d < c)

theorem eq_of_forall_le_iff {α : Type u} [partial_order α] {a b : α} :
(∀ (c : α), c a c b)a = b

theorem le_of_forall_le {α : Type u} [preorder α] {a b : α} :
(∀ (c : α), c ac b)a b

theorem le_of_forall_le' {α : Type u} [preorder α] {a b : α} :
(∀ (c : α), a cb c)b a

theorem le_of_forall_lt {α : Type u} [linear_order α] {a b : α} :
(∀ (c : α), c < ac < b)a b

theorem forall_lt_iff_le {α : Type u} [linear_order α] {a b : α} :
(∀ ⦃c : α⦄, c < ac < b) a b

theorem le_of_forall_lt' {α : Type u} [linear_order α] {a b : α} :
(∀ (c : α), a < cb < c)b a

theorem forall_lt_iff_le' {α : Type u} [linear_order α] {a b : α} :
(∀ ⦃c : α⦄, a < cb < c) b a

theorem eq_of_forall_ge_iff {α : Type u} [partial_order α] {a b : α} :
(∀ (c : α), a c b c)a = b

theorem le_implies_le_of_le_of_le {α : Type u} {a b c d : α} [preorder α] :
c ab da bc d

monotonicity of with respect to

theorem decidable.​lt_or_eq_of_le {α : Type u} [partial_order α] [decidable_rel has_le.le] {a b : α} :
a ba < b a = b

theorem decidable.​eq_or_lt_of_le {α : Type u} [partial_order α] [decidable_rel has_le.le] {a b : α} :
a ba = b a < b

theorem decidable.​le_iff_lt_or_eq {α : Type u} [partial_order α] [decidable_rel has_le.le] {a b : α} :
a b a < b a = b

theorem decidable.​le_of_not_lt {α : Type u} [decidable_linear_order α] {a b : α} :
¬b < aa b

theorem decidable.​not_lt {α : Type u} [decidable_linear_order α] {a b : α} :
¬a < b b a

theorem decidable.​lt_or_le {α : Type u} [decidable_linear_order α] (a b : α) :
a < b b a

theorem decidable.​le_or_lt {α : Type u} [decidable_linear_order α] (a b : α) :
a b b < a

theorem decidable.​lt_trichotomy {α : Type u} [decidable_linear_order α] (a b : α) :
a < b a = b b < a

theorem decidable.​lt_or_gt_of_ne {α : Type u} [decidable_linear_order α] {a b : α} :
a ba < b b < a

def decidable.​lt_by_cases {α : Type u} [decidable_linear_order α] (x y : α) {P : Sort u_1} :
(x < y → P)(x = y → P)(y < x → P) → P

Perform a case-split on the ordering of x and y in a decidable linear order.

Equations
theorem decidable.​ne_iff_lt_or_gt {α : Type u} [decidable_linear_order α] {a b : α} :
a b a < b b < a

theorem decidable.​le_imp_le_of_lt_imp_lt {α : Type u} {β : Type u_1} [preorder α] [decidable_linear_order β] {a b : α} {c d : β} :
(d < cb < a)a bc d

theorem decidable.​le_imp_le_iff_lt_imp_lt {α : Type u} {β : Type u_1} [linear_order α] [decidable_linear_order β] {a b : α} {c d : β} :
a bc d d < cb < a

theorem decidable.​le_iff_le_iff_lt_iff_lt {α : Type u} {β : Type u_1} [decidable_linear_order α] [decidable_linear_order β] {a b : α} {c d : β} :
a b c d (b < a d < c)

@[simp]
def ordering.​compares {α : Type u} [has_lt α] :
orderingα → α → Prop

compares o a b means that a and b have the ordering relation o between them, assuming that the relation a < b is defined

Equations
theorem ordering.​compares.​eq_lt {α : Type u} [preorder α] {o : ordering} {a b : α} :
o.compares a b(o = ordering.lt a < b)

theorem ordering.​compares.​eq_eq {α : Type u} [preorder α] {o : ordering} {a b : α} :
o.compares a b(o = ordering.eq a = b)

theorem ordering.​compares.​eq_gt {α : Type u} [preorder α] {o : ordering} {a b : α} :
o.compares a b(o = ordering.gt b < a)

theorem ordering.​compares.​inj {α : Type u} [preorder α] {o₁ o₂ : ordering} {a b : α} :
o₁.compares a bo₂.compares a bo₁ = o₂

theorem ordering.​compares_iff_of_compares_impl {α : Type u} {β : Type u_1} [linear_order α] [preorder β] {a b : α} {a' b' : β} (h : ∀ {o : ordering}, o.compares a bo.compares a' b') (o : ordering) :
o.compares a b o.compares a' b'

theorem ordering.​swap_or_else (o₁ o₂ : ordering) :
(o₁.or_else o₂).swap = o₁.swap.or_else o₂.swap

theorem cmp_compares {α : Type u} [decidable_linear_order α] (a b : α) :
(cmp a b).compares a b

theorem cmp_swap {α : Type u} [preorder α] [decidable_rel has_lt.lt] (a b : α) :
(cmp a b).swap = cmp b a