mathlib3 documentation

core / init.algebra.order

Definition of preorder and lemmas about types with a preorder #

@[instance]
def preorder.to_has_lt (α : Type u) [self : preorder α] :
@[instance]
def preorder.to_has_le (α : Type u) [self : preorder α] :
@[simp, refl]
theorem le_refl {α : Type u} [preorder α] (a : α) :
a ≤ a

The relation ≤ on a preorder is reflexive.

@[trans]
theorem le_trans {α : Type u} [preorder α] {a b c : α} :
a ≤ b → b ≤ c → a ≤ c

The relation ≤ on a preorder is transitive.

theorem lt_iff_le_not_le {α : Type u} [preorder α] {a b : α} :
a < b ↔ a ≤ b ∧ ¬b ≤ a
theorem lt_of_le_not_le {α : Type u} [preorder α] {a b : α} :
a ≤ b → ¬b ≤ a → a < b
theorem le_not_le_of_lt {α : Type u} [preorder α] {a b : α} :
a < b → a ≤ b ∧ ¬b ≤ a
theorem le_of_eq {α : Type u} [preorder α] {a b : α} :
a = b → a ≤ b
@[trans]
theorem ge_trans {α : Type u} [preorder α] {a b c : α} :
a ≥ b → b ≥ c → a ≥ c
theorem lt_irrefl {α : Type u} [preorder α] (a : α) :
¬a < a
theorem gt_irrefl {α : Type u} [preorder α] (a : α) :
¬a > a
@[trans]
theorem lt_trans {α : Type u} [preorder α] {a b c : α} :
a < b → b < c → a < c
@[trans]
theorem gt_trans {α : Type u} [preorder α] {a b c : α} :
a > b → b > c → a > c
theorem ne_of_lt {α : Type u} [preorder α] {a b : α} (h : a < b) :
a ≠ b
theorem ne_of_gt {α : Type u} [preorder α] {a b : α} (h : b < a) :
a ≠ b
theorem lt_asymm {α : Type u} [preorder α] {a b : α} (h : a < b) :
¬b < a
theorem le_of_lt {α : Type u} [preorder α] {a b : α} :
a < b → a ≤ b
@[trans]
theorem lt_of_lt_of_le {α : Type u} [preorder α] {a b c : α} :
a < b → b ≤ c → a < c
@[trans]
theorem lt_of_le_of_lt {α : Type u} [preorder α] {a b c : α} :
a ≤ b → b < c → a < c
@[trans]
theorem gt_of_gt_of_ge {α : Type u} [preorder α] {a b c : α} (h₁ : a > b) (h₂ : b ≥ c) :
a > c
@[trans]
theorem gt_of_ge_of_gt {α : Type u} [preorder α] {a b c : α} (h₁ : a ≥ b) (h₂ : b > c) :
a > c
theorem not_le_of_gt {α : Type u} [preorder α] {a b : α} (h : a > b) :
¬a ≤ b
theorem not_lt_of_ge {α : Type u} [preorder α] {a b : α} (h : a ≥ b) :
¬a < b
theorem le_of_lt_or_eq {α : Type u} [preorder α] {a b : α} :
a < b ∨ a = b → a ≤ b
theorem le_of_eq_or_lt {α : Type u} [preorder α] {a b : α} (h : a = b ∨ a < b) :
a ≤ b

< is decidable if ≤ is.

Equations

Definition of partial_order and lemmas about types with a partial order #

@[class]
structure partial_order (α : Type u) :

A partial order is a reflexive, transitive, antisymmetric relation ≤.

Instances of this typeclass
Instances of other typeclasses for partial_order
  • partial_order.has_sizeof_inst
@[instance]
def partial_order.to_preorder (α : Type u) [self : partial_order α] :
Instances for partial_order.to_preorder
theorem le_antisymm {α : Type u} [partial_order α] {a b : α} :
a ≤ b → b ≤ a → a = b
theorem le_antisymm_iff {α : Type u} [partial_order α] {a b : α} :
a = b ↔ a ≤ b ∧ b ≤ a
theorem lt_of_le_of_ne {α : Type u} [partial_order α] {a b : α} :
a ≤ b → a ≠ b → a < b

Equality is decidable if ≤ is.

Equations
theorem decidable.lt_or_eq_of_le {α : Type u} [partial_order α] [decidable_rel has_le.le] {a b : α} (hab : a ≤ b) :
a < b ∨ a = b
theorem decidable.eq_or_lt_of_le {α : Type u} [partial_order α] [decidable_rel has_le.le] {a b : α} (hab : a ≤ b) :
a = 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 lt_or_eq_of_le {α : Type u} [partial_order α] {a b : α} :
a ≤ b → a < b ∨ a = b
theorem le_iff_lt_or_eq {α : Type u} [partial_order α] {a b : α} :
a ≤ b ↔ a < b ∨ a = b

Definition of linear_order and lemmas about types with a linear order #

def max_default {α : Type u} [has_le α] [decidable_rel has_le.le] (a b : α) :
α

Default definition of max.

Equations
def min_default {α : Type u} [has_le α] [decidable_rel has_le.le] (a b : α) :
α

Default definition of min.

Equations
@[class]
structure linear_order (α : Type u) :

A linear order is reflexive, transitive, antisymmetric and total relation ≤. We assume that every linear ordered type has decidable (≤), (<), and (=).

Instances of this typeclass
Instances of other typeclasses for linear_order
  • linear_order.has_sizeof_inst
theorem le_total {α : Type u} [linear_order α] (a b : α) :
a ≤ b ∨ b ≤ a
theorem le_of_not_ge {α : Type u} [linear_order α] {a b : α} :
¬a ≥ b → a ≤ b
theorem le_of_not_le {α : Type u} [linear_order α] {a b : α} :
¬a ≤ b → b ≤ a
theorem not_lt_of_gt {α : Type u} [linear_order α] {a b : α} (h : a > b) :
¬a < b
theorem lt_trichotomy {α : Type u} [linear_order α] (a b : α) :
a < b ∨ a = b ∨ b < a
theorem le_of_not_lt {α : Type u} [linear_order α] {a b : α} (h : ¬b < a) :
a ≤ b
theorem le_of_not_gt {α : Type u} [linear_order α] {a b : α} :
¬a > b → a ≤ b
theorem lt_of_not_ge {α : Type u} [linear_order α] {a b : α} (h : ¬a ≥ b) :
a < b
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 lt_or_ge {α : Type u} [linear_order α] (a b : α) :
a < b ∨ a ≥ b
theorem le_or_gt {α : Type u} [linear_order α] (a b : α) :
a ≤ b ∨ a > b
theorem lt_or_gt_of_ne {α : Type u} [linear_order α] {a b : α} (h : a ≠ b) :
a < b ∨ a > b
theorem ne_iff_lt_or_gt {α : Type u} [linear_order α] {a b : α} :
a ≠ b ↔ a < b ∨ a > b
theorem lt_iff_not_ge {α : Type u} [linear_order α] (x y : α) :
x < y ↔ ¬x ≥ y
@[simp]
theorem not_lt {α : Type u} [linear_order α] {a b : α} :
¬a < b ↔ b ≤ a
@[simp]
theorem not_le {α : Type u} [linear_order α] {a b : α} :
¬a ≤ b ↔ b < a
@[protected, instance]
def has_lt.lt.decidable {α : Type u} [linear_order α] (a b : α) :
decidable (a < b)
Equations
@[protected, instance]
def has_le.le.decidable {α : Type u} [linear_order α] (a b : α) :
Equations
@[protected, instance]
def eq.decidable {α : Type u} [linear_order α] (a b : α) :
decidable (a = b)
Equations
theorem eq_or_lt_of_not_lt {α : Type u} [linear_order α] {a b : α} (h : ¬a < b) :
a = b ∨ b < a
@[protected, instance]
def lt_by_cases {α : Type u} [linear_order α] (x y : α) {P : Sort u_1} (h₁ : x < y → P) (h₂ : x = y → P) (h₃ : y < x → P) :
P

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

Equations
  • lt_by_cases x y h₁ h₂ h₃ = dite (x < y) (λ (h : x < y), h₁ h) (λ (h : ¬x < y), dite (y < x) (λ (h' : y < x), h₃ h') (λ (h' : ¬y < x), h₂ _))
theorem le_imp_le_of_lt_imp_lt {α : Type u} [linear_order α] {β : Type u_1} [preorder α] [linear_order β] {a b : α} {c d : β} (H : d < c → b < a) (h : a ≤ b) :
c ≤ d