Documentation

Init.Data.Order.Lemmas

This module provides typeclass instances and lemmas about order-related typeclasses.

instance Std.instIrreflOfAsymm {α : Sort u_1} (r : ααProp) [Asymm r] :
instance Std.instReflOfTotal {α : Sort u_1} (r : ααProp) [Total r] :
instance Std.instAntisymmOfAsymm {α : Sort u_1} (r : ααProp) [Asymm r] :
instance Std.instTrichotomousOfTotal {α : Sort u_1} (r : ααProp) [Total r] :
theorem Std.Trichotomous.rel_or_eq_or_rel_swap {α : Sort u_1} {r : ααProp} [i : Trichotomous r] {a b : α} :
r a b a = b r b a
theorem Std.trichotomous_of_rel_or_eq_or_rel_swap {α : Sort u_1} {r : ααProp} (h : ∀ {a b : α}, r a b a = b r b a) :
instance Std.Antisymm.trichotomous_of_antisymm_not {α : Sort u_1} {r : ααProp} [i : Antisymm fun (x1 x2 : α) => ¬r x1 x2] :
theorem Std.Trichotomous.antisymm_not {α : Sort u_1} {r : ααProp} [i : Trichotomous r] :
Antisymm fun (x1 x2 : α) => ¬r x1 x2
theorem Std.Total.rel_of_not_rel_swap {α : Sort u_1} {r : ααProp} [Total r] {a b : α} (h : ¬r a b) :
r b a
theorem Std.total_of_not_rel_swap_imp_rel {α : Sort u_1} {r : ααProp} (h : ∀ {a b : α}, ¬r a br b a) :
theorem Std.total_of_refl_of_trichotomous {α : Sort u_1} (r : ααProp) [Refl r] [Trichotomous r] :
theorem Std.asymm_of_irrefl_of_antisymm {α : Sort u_1} (r : ααProp) [Irrefl r] [Antisymm r] :
instance Std.Total.asymm_of_total_not {α : Sort u_1} {r : ααProp} [i : Total fun (x1 x2 : α) => ¬r x1 x2] :
theorem Std.Asymm.total_not {α : Sort u_1} {r : ααProp} [i : Asymm r] :
Total fun (x1 x2 : α) => ¬r x1 x2
instance Std.instAntisymmLeOfIsPartialOrder {α : Type u} [LE α] [IsPartialOrder α] :
Antisymm fun (x1 x2 : α) => x1 x2
instance Std.instTransLeOfIsPreorder {α : Type u} [LE α] [IsPreorder α] :
Trans (fun (x1 x2 : α) => x1 x2) (fun (x1 x2 : α) => x1 x2) fun (x1 x2 : α) => x1 x2
Equations
    instance Std.instReflLeOfIsPreorder {α : Type u} [LE α] [IsPreorder α] :
    Refl fun (x1 x2 : α) => x1 x2
    instance Std.instTotalLeOfIsLinearPreorder {α : Type u} [LE α] [IsLinearPreorder α] :
    Total fun (x1 x2 : α) => x1 x2
    theorem Std.le_refl {α : Type u} [LE α] [Refl fun (x1 x2 : α) => x1 x2] (a : α) :
    a a
    theorem Std.le_antisymm {α : Type u} [LE α] [Antisymm fun (x1 x2 : α) => x1 x2] {a b : α} (hab : a b) (hba : b a) :
    a = b
    theorem Std.le_antisymm_iff {α : Type u} [LE α] [Antisymm fun (x1 x2 : α) => x1 x2] [Refl fun (x1 x2 : α) => x1 x2] {a b : α} :
    a b b a a = b
    theorem Std.le_trans {α : Type u} [LE α] [Trans (fun (x1 x2 : α) => x1 x2) (fun (x1 x2 : α) => x1 x2) fun (x1 x2 : α) => x1 x2] {a b c : α} (hab : a b) (hbc : b c) :
    a c
    theorem Std.le_total {α : Type u} [LE α] [Total fun (x1 x2 : α) => x1 x2] {a b : α} :
    a b b a
    theorem Std.le_of_not_ge {α : Type u} [LE α] [Total fun (x1 x2 : α) => x1 x2] {a b : α} :
    ¬b aa b
    theorem Std.lt_trans {α : Type u} [LT α] [Trans (fun (x1 x2 : α) => x1 < x2) (fun (x1 x2 : α) => x1 < x2) fun (x1 x2 : α) => x1 < x2] {a b c : α} (hab : a < b) (hbc : b < c) :
    a < c
    theorem Std.lt_iff_le_and_not_ge {α : Type u} [LT α] [LE α] [LawfulOrderLT α] {a b : α} :
    a < b a b ¬b a
    theorem Std.not_lt_iff_not_le_or_ge {α : Type u} [LT α] [LE α] [LawfulOrderLT α] {a b : α} :
    ¬a < b ¬a b b a
    theorem Std.not_le_of_gt {α : Type u} [LT α] [LE α] [LawfulOrderLT α] {a b : α} (h : a < b) :
    ¬b a
    theorem Std.not_lt_of_ge {α : Type u} [LT α] [LE α] [LawfulOrderLT α] {a b : α} (h : a b) :
    ¬b < a
    instance Std.instAntisymmLeOfLawfulOrderLTOfTrichotomousLt {α : Type u} {x✝ : LE α} [LT α] [LawfulOrderLT α] [Trichotomous fun (x1 x2 : α) => x1 < x2] :
    Antisymm fun (x1 x2 : α) => x1 x2
    theorem Std.not_gt_of_lt {α : Type u} [LT α] [i : Asymm fun (x1 x2 : α) => x1 < x2] {a b : α} (h : a < b) :
    ¬b < a
    theorem Std.le_of_lt {α : Type u} [LT α] [LE α] [LawfulOrderLT α] {a b : α} (h : a < b) :
    a b
    instance Std.instAntisymmLtOfLawfulOrderLTOfLe {α : Type u} {x✝ : LT α} [LE α] [LawfulOrderLT α] [Antisymm fun (x1 x2 : α) => x1 x2] :
    Antisymm fun (x1 x2 : α) => x1 < x2
    instance Std.instAsymmLtOfLawfulOrderLT {α : Type u} [LT α] [LE α] [LawfulOrderLT α] :
    Asymm fun (x1 x2 : α) => x1 < x2
    @[deprecated Std.instIrreflOfAsymm (since := "2025-10-24")]
    theorem Std.instIrreflLtOfIsPreorderOfLawfulOrderLT {α : Type u} [LT α] [LE α] [LawfulOrderLT α] :
    Irrefl fun (x1 x2 : α) => x1 < x2
    instance Std.instTransLtOfLeOfLawfulOrderLT {α : Type u} [LT α] [LE α] [Trans (fun (x1 x2 : α) => x1 x2) (fun (x1 x2 : α) => x1 x2) fun (x1 x2 : α) => x1 x2] [LawfulOrderLT α] :
    Trans (fun (x1 x2 : α) => x1 < x2) (fun (x1 x2 : α) => x1 < x2) fun (x1 x2 : α) => x1 < x2
    Equations
      theorem Std.not_lt {α : Type u} [LT α] [LE α] [Total fun (x1 x2 : α) => x1 x2] [LawfulOrderLT α] {a b : α} :
      ¬a < b b a
      theorem Std.not_le {α : Type u} [LT α] [LE α] [Total fun (x1 x2 : α) => x1 x2] [LawfulOrderLT α] {a b : α} :
      ¬a b b < a
      instance Std.instTrichotomousLtOfLawfulOrderLTOfTotalOfAntisymmLe {α : Type u} {x✝ : LT α} [LE α] [LawfulOrderLT α] [Total fun (x1 x2 : α) => x1 x2] [Antisymm fun (x1 x2 : α) => x1 x2] :
      Trichotomous fun (x1 x2 : α) => x1 < x2
      instance Std.instTransNotLtOfLawfulOrderLTOfTotalOfLe {α : Type u} {x✝ : LT α} [LE α] [LawfulOrderLT α] [Total fun (x1 x2 : α) => x1 x2] [Trans (fun (x1 x2 : α) => x1 x2) (fun (x1 x2 : α) => x1 x2) fun (x1 x2 : α) => x1 x2] :
      Trans (fun (x1 x2 : α) => ¬x1 < x2) (fun (x1 x2 : α) => ¬x1 < x2) fun (x1 x2 : α) => ¬x1 < x2
      Equations
        @[deprecated Std.Asymm.total_not (since := "2025-10-24")]
        theorem Std.instTotalNotLtOfLawfulOrderLTOfLe {α : Type u} {x✝ : LT α} [LE α] [LawfulOrderLT α] :
        Total fun (x1 x2 : α) => ¬x1 < x2
        theorem Std.lt_of_le_of_lt {α : Type u} [LE α] [LT α] [Trans (fun (x1 x2 : α) => x1 x2) (fun (x1 x2 : α) => x1 x2) fun (x1 x2 : α) => x1 x2] [LawfulOrderLT α] {a b c : α} (hab : a b) (hbc : b < c) :
        a < c
        theorem Std.lt_of_lt_of_le {α : Type u} [LE α] [LT α] [Trans (fun (x1 x2 : α) => x1 x2) (fun (x1 x2 : α) => x1 x2) fun (x1 x2 : α) => x1 x2] [LawfulOrderLT α] {a b c : α} (hab : a < b) (hbc : b c) :
        a < c
        theorem Std.lt_of_le_of_ne {α : Type u} [LE α] [LT α] [Antisymm fun (x1 x2 : α) => x1 x2] [LawfulOrderLT α] {a b : α} (hle : a b) (hne : a b) :
        a < b
        def Classical.Order.instLT {α : Type u} [LE α] :
        LT α
        Equations
          Instances For
            theorem Std.beq_iff_le_and_ge {α : Type u} [BEq α] [LE α] [LawfulOrderBEq α] {a b : α} :
            (a == b) = true a b b a
            instance Std.instSymmEqBoolBeqTrueOfLawfulOrderBEq {α : Type u} [BEq α] [LE α] [LawfulOrderBEq α] :
            Symm fun (x1 x2 : α) => (x1 == x2) = true
            noncomputable def Classical.Order.instBEq {α : Type u} [LE α] :
            BEq α
            Equations
              Instances For
                theorem Std.min_self {α : Type u} [Min α] [IdempotentOp min] {a : α} :
                min a a = a
                theorem Std.le_min_iff {α : Type u} [Min α] [LE α] [LawfulOrderInf α] {a b c : α} :
                a min b c a b a c
                theorem Std.min_le_left {α : Type u} [Min α] [LE α] [Refl fun (x1 x2 : α) => x1 x2] [LawfulOrderInf α] {a b : α} :
                min a b a
                theorem Std.min_le_right {α : Type u} [Min α] [LE α] [Refl fun (x1 x2 : α) => x1 x2] [LawfulOrderInf α] {a b : α} :
                min a b b
                theorem Std.min_le {α : Type u} [Min α] [LE α] [IsPreorder α] [LawfulOrderMin α] {a b c : α} :
                min a b c a c b c
                theorem Std.min_eq_or {α : Type u} [Min α] [MinEqOr α] {a b : α} :
                min a b = a min a b = b
                theorem Std.IsLinearOrder.of_refl_of_antisymm_of_lawfulOrderMin {α : Type u} [LE α] [LE α] [Min α] [Refl fun (x1 x2 : α) => x1 x2] [Antisymm fun (x1 x2 : α) => x1 x2] [LawfulOrderMin α] :

                If a Min α instance satisfies typical properties in terms of a reflexive and antisymmetric LE α instance, then the LE α instance represents a linear order.

                theorem Std.min_eq_if {α : Type u} [LE α] [DecidableLE α] {x✝ : Min α} [LawfulOrderLeftLeaningMin α] {a b : α} :
                min a b = if a b then a else b
                theorem Std.max_eq_if {α : Type u} [LE α] [DecidableLE α] {x✝ : Max α} [LawfulOrderLeftLeaningMax α] {a b : α} :
                max a b = if b a then a else b
                theorem Std.LawfulOrderLeftLeaningMin.of_eq {α : Type u} [LE α] [Min α] [DecidableLE α] (min_eq : ∀ (a b : α), min a b = if a b then a else b) :
                noncomputable def Classical.Order.instMin {α : Type u} [LE α] :
                Min α
                Equations
                  Instances For
                    theorem Std.max_self {α : Type u} [Max α] [IdempotentOp max] {a : α} :
                    max a a = a
                    theorem Std.max_le_iff {α : Type u} [Max α] [LE α] [LawfulOrderSup α] {a b c : α} :
                    max a b c a c b c
                    theorem Std.left_le_max {α : Type u} [Max α] [LE α] [Refl fun (x1 x2 : α) => x1 x2] [LawfulOrderSup α] {a b : α} :
                    a max a b
                    theorem Std.right_le_max {α : Type u} [Max α] [LE α] [Refl fun (x1 x2 : α) => x1 x2] [LawfulOrderSup α] {a b : α} :
                    b max a b
                    theorem Std.le_max {α : Type u} [Max α] [LE α] [IsPreorder α] [LawfulOrderMax α] {a b c : α} :
                    a max b c a b a c
                    theorem Std.max_eq_or {α : Type u} [Max α] [MaxEqOr α] {a b : α} :
                    max a b = a max a b = b
                    theorem Std.IsLinearOrder.of_refl_of_antisymm_of_lawfulOrderMax {α : Type u} [LE α] [Max α] [Refl fun (x1 x2 : α) => x1 x2] [Antisymm fun (x1 x2 : α) => x1 x2] [LawfulOrderMax α] :

                    If a Max α instance satisfies typical properties in terms of a reflexive and antisymmetric LE α instance, then the LE α instance represents a linear order.

                    instance Std.instMaxSubtypeOfMaxEqOr {α : Type u} [Max α] [MaxEqOr α] {P : αProp} :
                    Equations
                      theorem Std.LawfulOrderLeftLeaningMax.of_eq {α : Type u} [LE α] [Max α] [DecidableLE α] (min_eq : ∀ (a b : α), max a b = if b a then a else b) :
                      noncomputable def Classical.Order.instMax {α : Type u} [LE α] :
                      Max α
                      Equations
                        Instances For