Documentation

Mathlib.Order.Defs.Unbundled

Orders #

Defines classes for preorders, partial orders, and linear orders and proves some basic lemmas about them.

Unbundled classes #

class IsTrans (α : Sort u_1) (r : ααProp) :

IsTrans X r means the binary relation r on X is transitive.

  • trans (a b c : α) : r a br b cr a c
Instances
    @[instance_reducible]
    instance instTransOfIsTrans {α : Sort u_1} {r : ααProp} [IsTrans α r] :
    Trans r r r
    Equations
    @[instance 100]
    instance instIsTransOfTrans {α : Sort u_1} {r : ααProp} [Trans r r r] :
    IsTrans α r
    class IsPreorder (α : Sort u_1) (r : ααProp) extends Std.Refl r, IsTrans α r :

    IsPreorder X r means that the binary relation r on X is a pre-order, that is, reflexive and transitive.

    • refl (a : α) : r a a
    • trans (a b c : α) : r a br b cr a c
    Instances
      class IsPartialOrder (α : Sort u_1) (r : ααProp) extends IsPreorder α r, Std.Antisymm r :

      IsPartialOrder X r means that the binary relation r on X is a partial order, that is, IsPreorder X r and Std.Antisymm r.

      • refl (a : α) : r a a
      • trans (a b c : α) : r a br b cr a c
      • antisymm (a b : α) : r a br b aa = b
      Instances
        class IsLinearOrder (α : Sort u_1) (r : ααProp) extends IsPartialOrder α r, Std.Total r :

        IsLinearOrder X r means that the binary relation r on X is a linear order, that is, IsPartialOrder X r and Std.Total r.

        • refl (a : α) : r a a
        • trans (a b c : α) : r a br b cr a c
        • antisymm (a b : α) : r a br b aa = b
        • total (a b : α) : r a b r b a
        Instances
          class IsEquiv (α : Sort u_1) (r : ααProp) extends IsPreorder α r, Std.Symm r :

          IsEquiv X r means that the binary relation r on X is an equivalence relation, that is, IsPreorder X r and Std.Symm r.

          • refl (a : α) : r a a
          • trans (a b c : α) : r a br b cr a c
          • symm (a b : α) : r a br b a
          Instances
            class IsStrictOrder (α : Sort u_1) (r : ααProp) extends Std.Irrefl r, IsTrans α r :

            IsStrictOrder X r means that the binary relation r on X is a strict order, that is, Std.Irrefl r and IsTrans X r.

            • irrefl (a : α) : ¬r a a
            • trans (a b c : α) : r a br b cr a c
            Instances
              class IsStrictWeakOrder (α : Sort u_1) (lt : ααProp) extends IsStrictOrder α lt :

              IsStrictWeakOrder X lt means that the binary relation lt on X is a strict weak order, that is, IsStrictOrder X lt and ¬lt a b ∧ ¬lt b a → ¬lt b c ∧ ¬lt c b → ¬lt a c ∧ ¬lt c a.

              • irrefl (a : α) : ¬lt a a
              • trans (a b c : α) : lt a blt b clt a c
              • incomp_trans (a b c : α) : ¬lt a b ¬lt b a¬lt b c ¬lt c b¬lt a c ¬lt c a
              Instances
                class IsStrictTotalOrder (α : Sort u_1) (lt : ααProp) extends Std.Trichotomous lt, IsStrictOrder α lt :

                IsStrictTotalOrder X lt means that the binary relation lt on X is a strict total order, that is, Std.Trichotomous lt and IsStrictOrder X lt.

                Instances
                  theorem Equivalence.of_isEquiv {α : Sort u_1} (lt : ααProp) [IsEquiv α lt] :
                  theorem IsEquiv.of_equivalence {α : Sort u_1} {lt : ααProp} (h : Equivalence lt) :
                  IsEquiv α lt
                  theorem equivalence_iff_isEquiv {α : Sort u_1} (lt : ααProp) :
                  instance eq_isEquiv (α : Sort u_1) :
                  IsEquiv α fun (x1 x2 : α) => x1 = x2

                  Equality is an equivalence relation.

                  Iff is an equivalence relation.

                  theorem irrefl {α : Sort u_1} {r : ααProp} [Std.Irrefl r] (a : α) :
                  ¬r a a
                  theorem refl {α : Sort u_1} {r : ααProp} [Std.Refl r] (a : α) :
                  r a a
                  theorem trans {α : Sort u_1} {r : ααProp} {a b c : α} [IsTrans α r] :
                  r a br b cr a c
                  theorem symm {α : Sort u_1} {r : ααProp} {a b : α} [Std.Symm r] :
                  r a br b a
                  theorem antisymm {α : Sort u_1} {r : ααProp} {a b : α} [Std.Antisymm r] :
                  r a br b aa = b
                  theorem asymm {α : Sort u_1} {r : ααProp} {a b : α} [Std.Asymm r] :
                  r a b¬r b a
                  theorem trichotomous {α : Sort u_1} {r : ααProp} [Std.Trichotomous r] (a b : α) :
                  r a b a = b r b a
                  theorem irrefl_def {α : Sort u_1} {r : ααProp} :
                  Std.Irrefl r ∀ ⦃a : α⦄, ¬r a a
                  theorem refl_def {α : Sort u_1} {r : ααProp} :
                  Std.Refl r ∀ ⦃a : α⦄, r a a
                  theorem isTrans_def {α : Sort u_2} {r : ααProp} :
                  IsTrans α r ∀ ⦃a b c : α⦄, r a br b cr a c
                  theorem symm_def {α : Sort u_1} {r : ααProp} :
                  Std.Symm r ∀ ⦃a b : α⦄, r a br b a
                  theorem antisymm_def {α : Sort u_1} {r : ααProp} :
                  Std.Antisymm r ∀ ⦃a b : α⦄, r a br b aa = b
                  theorem asymm_def {α : Sort u_1} {r : ααProp} :
                  Std.Asymm r ∀ ⦃a b : α⦄, r a b¬r b a
                  theorem total_def {α : Sort u_1} {r : ααProp} :
                  Std.Total r ∀ ⦃a b : α⦄, r a b r b a
                  theorem trichotomous_def {α : Sort u_1} {r : ααProp} :
                  Std.Trichotomous r ∀ ⦃a b : α⦄, ¬r a b¬r b aa = b
                  @[instance 90]
                  instance asymm_of_isTrans_of_irrefl {α : Sort u_1} {r : ααProp} [IsTrans α r] [Std.Irrefl r] :
                  instance Std.Irrefl.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [Irrefl r] :
                  Irrefl fun (a b : α) => Decidable.decide (r a b) = true
                  instance Std.Refl.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [Refl r] :
                  Refl fun (a b : α) => Decidable.decide (r a b) = true
                  instance IsTrans.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [IsTrans α r] :
                  IsTrans α fun (a b : α) => Decidable.decide (r a b) = true
                  instance Std.Symm.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [Symm r] :
                  Symm fun (a b : α) => Decidable.decide (r a b) = true
                  instance Std.Antisymm.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [Antisymm r] :
                  Antisymm fun (a b : α) => Decidable.decide (r a b) = true
                  instance Std.Asymm.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [Asymm r] :
                  Asymm fun (a b : α) => Decidable.decide (r a b) = true
                  instance Std.Total.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [Total r] :
                  Total fun (a b : α) => Decidable.decide (r a b) = true
                  instance Std.Trichotomous.decide {α : Sort u_1} {r : ααProp} [DecidableRel r] [Trichotomous r] :
                  Trichotomous fun (a b : α) => Decidable.decide (r a b) = true
                  @[elab_without_expected_type]
                  theorem irrefl_of {α : Sort u_1} (r : ααProp) [Std.Irrefl r] (a : α) :
                  ¬r a a
                  @[elab_without_expected_type]
                  theorem refl_of {α : Sort u_1} (r : ααProp) [Std.Refl r] (a : α) :
                  r a a
                  @[elab_without_expected_type]
                  theorem trans_of {α : Sort u_1} (r : ααProp) {a b c : α} [IsTrans α r] :
                  r a br b cr a c
                  @[elab_without_expected_type]
                  theorem symm_of {α : Sort u_1} (r : ααProp) {a b : α} [Std.Symm r] :
                  r a br b a
                  @[elab_without_expected_type]
                  theorem asymm_of {α : Sort u_1} (r : ααProp) {a b : α} [Std.Asymm r] :
                  r a b¬r b a
                  @[elab_without_expected_type]
                  theorem total_of {α : Sort u_1} (r : ααProp) [Std.Total r] (a b : α) :
                  r a b r b a
                  @[elab_without_expected_type]
                  theorem trichotomous_of {α : Sort u_1} (r : ααProp) [Std.Trichotomous r] (a b : α) :
                  r a b a = b r b a
                  @[deprecated Std.Refl (since := "2026-03-27")]
                  def Reflexive {α : Sort u_1} (r : ααProp) :

                  Std.Refl as a definition, suitable for use in proofs.

                  Equations
                  Instances For
                    @[deprecated Std.Symm (since := "2026-06-10")]
                    def Symmetric {α : Sort u_1} (r : ααProp) :

                    Std.Symm as a definition, suitable for use in proofs.

                    Equations
                    Instances For
                      theorem Equivalence.stdRefl {α : Sort u_1} (r : ααProp) (h : Equivalence r) :
                      @[deprecated Equivalence.stdRefl (since := "2026-03-27")]
                      theorem Equivalence.reflexive {α : Sort u_1} (r : ααProp) (h : Equivalence r) :

                      Alias of Equivalence.stdRefl.

                      theorem Equivalence.stdSymm {α : Sort u_1} (r : ααProp) (h : Equivalence r) :
                      @[deprecated Equivalence.stdSymm (since := "2026-06-10")]
                      theorem Equivalence.symmetric {α : Sort u_1} (r : ααProp) (h : Equivalence r) :

                      Alias of Equivalence.stdSymm.

                      theorem Equivalence.isTrans {α : Sort u_1} (r : ααProp) (h : Equivalence r) :
                      IsTrans α r
                      theorem Equivalence.isEquiv {α : Sort u_1} (r : ααProp) (h : Equivalence r) :
                      IsEquiv α r
                      instance InvImage.isTrans {α : Sort u_1} {β : Sort u_2} (r : ββProp) (f : αβ) [IsTrans β r] :
                      IsTrans α (InvImage r f)
                      instance InvImage.irrefl {α : Sort u_1} {β : Sort u_2} (r : ββProp) (f : αβ) [Std.Irrefl r] :

                      Minimal and maximal #

                      def Minimal {α : Type u_1} [LE α] (P : αProp) (x : α) :

                      Minimal P x means that x is a minimal element satisfying P.

                      Equations
                      Instances For
                        def Maximal {α : Type u_1} [LE α] (P : αProp) (x : α) :

                        Maximal P x means that x is a maximal element satisfying P.

                        Equations
                        Instances For
                          theorem Minimal.prop {α : Type u_1} [LE α] {P : αProp} {x : α} (h : Minimal P x) :
                          P x
                          theorem Maximal.prop {α : Type u_1} [LE α] {P : αProp} {x : α} (h : Maximal P x) :
                          P x
                          theorem Minimal.le_of_le {α : Type u_1} [LE α] {P : αProp} {x y : α} (h : Minimal P x) (hy : P y) (hle : y x) :
                          x y
                          theorem Maximal.le_of_ge {α : Type u_1} [LE α] {P : αProp} {x y : α} (h : Maximal P x) (hy : P y) (hle : x y) :
                          y x
                          def MinimalFor {ι : Sort u_1} {α : Type u_2} [LE α] (P : ιProp) (f : ια) (i : ι) :

                          MinimalFor P f i means that f i is minimal over all i satisfying P.

                          Equations
                          Instances For
                            def MaximalFor {ι : Sort u_1} {α : Type u_2} [LE α] (P : ιProp) (f : ια) (i : ι) :

                            MaximalFor P f i means that f i is maximal over all i satisfying P.

                            Equations
                            Instances For
                              theorem MinimalFor.prop {ι : Sort u_1} {α : Type u_2} [LE α] {P : ιProp} {f : ια} {i : ι} (h : MinimalFor P f i) :
                              P i
                              theorem MaximalFor.prop {ι : Sort u_1} {α : Type u_2} [LE α] {P : ιProp} {f : ια} {i : ι} (h : MaximalFor P f i) :
                              P i
                              theorem MinimalFor.le_of_le {ι : Sort u_1} {α : Type u_2} [LE α] {P : ιProp} {f : ια} {i j : ι} (h : MinimalFor P f i) (hj : P j) (hji : f j f i) :
                              f i f j
                              theorem MaximalFor.le_of_le {ι : Sort u_1} {α : Type u_2} [LE α] {P : ιProp} {f : ια} {i j : ι} (h : MaximalFor P f i) (hj : P j) (hji : f i f j) :
                              f j f i

                              Upper and lower sets #

                              def IsUpperSet {α : Type u_1} [LE α] (s : Set α) :

                              An upper set in an order α is a set such that any element greater than one of its members is also a member. Also called up-set, upward-closed set.

                              Equations
                              Instances For
                                def IsLowerSet {α : Type u_1} [LE α] (s : Set α) :

                                A lower set in an order α is a set such that any element less than one of its members is also a member. Also called down-set, downward-closed set.

                                Equations
                                Instances For
                                  structure UpperSet (α : Type u_1) [LE α] :
                                  Type u_1

                                  An upper set in an order α is a set such that any element greater than one of its members is also a member. Also called up-set, upward-closed set.

                                  Instances For
                                    structure LowerSet (α : Type u_1) [LE α] :
                                    Type u_1

                                    A lower set in an order α is a set such that any element less than one of its members is also a member. Also called down-set, downward-closed set.

                                    Instances For
                                      def IsRelUpperSet {α : Type u_1} [LE α] (s : Set α) (P : αProp) :

                                      An upper set relative to a predicate P is a set such that all elements satisfy P and any element greater than one of its members and satisfying P is also a member.

                                      Equations
                                      Instances For
                                        def IsRelLowerSet {α : Type u_1} [LE α] (s : Set α) (P : αProp) :

                                        A lower set relative to a predicate P is a set such that all elements satisfy P and any element less than one of its members and satisfying P is also a member.

                                        Equations
                                        Instances For
                                          structure RelUpperSet {α : Type u_1} [LE α] (P : αProp) :
                                          Type u_1

                                          An upper set relative to a predicate P is a set such that all elements satisfy P and any element greater than one of its members and satisfying P is also a member.

                                          Instances For
                                            structure RelLowerSet {α : Type u_1} [LE α] (P : αProp) :
                                            Type u_1

                                            A lower set relative to a predicate P is a set such that all elements satisfy P and any element less than one of its members and satisfying P is also a member.

                                            Instances For
                                              theorem of_eq {α : Sort u_1} {r : ααProp} [Std.Refl r] {a b : α} :
                                              a = br a b
                                              theorem comm {α : Sort u_1} {r : ααProp} [Std.Symm r] {a b : α} :
                                              r a b r b a
                                              theorem antisymm' {α : Sort u_1} {r : ααProp} [Std.Antisymm r] {a b : α} :
                                              r a br b ab = a
                                              theorem antisymm_iff {α : Sort u_1} {r : ααProp} [Std.Refl r] [Std.Antisymm r] {a b : α} :
                                              r a b r b a a = b
                                              @[elab_without_expected_type]
                                              theorem antisymm_of {α : Sort u_1} (r : ααProp) [Std.Antisymm r] {a b : α} :
                                              r a br b aa = b

                                              A version of antisymm with r explicit.

                                              This lemma matches the lemmas from lean core in Init.Algebra.Classes, but is missing there.

                                              @[elab_without_expected_type]
                                              theorem antisymm_of' {α : Sort u_1} (r : ααProp) [Std.Antisymm r] {a b : α} :
                                              r a br b ab = a

                                              A version of antisymm' with r explicit.

                                              This lemma matches the lemmas from lean core in Init.Algebra.Classes, but is missing there.

                                              theorem comm_of {α : Sort u_1} (r : ααProp) [Std.Symm r] {a b : α} :
                                              r a b r b a

                                              A version of comm with r explicit.

                                              This lemma matches the lemmas from lean core in Init.Algebra.Classes, but is missing there.

                                              theorem Std.Asymm.antisymm {α : Sort u_1} (r : ααProp) [Asymm r] :
                                              theorem Std.Asymm.irrefl {α : Sort u_1} {r : ααProp} [Asymm r] :
                                              theorem Std.Total.trichotomous {α : Sort u_1} (r : ααProp) [Total r] :
                                              @[instance 100]
                                              instance Std.Total.to_refl {α : Sort u_1} (r : ααProp) [Total r] :
                                              theorem ne_of_irrefl {α : Sort u_1} {r : ααProp} [Std.Irrefl r] {x y : α} :
                                              r x yx y
                                              theorem ne_of_irrefl' {α : Sort u_1} {r : ααProp} [Std.Irrefl r] {x y : α} :
                                              r x yy x
                                              theorem not_rel_of_subsingleton {α : Sort u_1} (r : ααProp) [Std.Irrefl r] [Subsingleton α] (x y : α) :
                                              ¬r x y
                                              theorem rel_of_subsingleton {α : Sort u_1} (r : ααProp) [Std.Refl r] [Subsingleton α] (x y : α) :
                                              r x y
                                              @[simp]
                                              theorem empty_relation_apply {α : Sort u_1} (a b : α) :
                                              theorem rel_congr_left {α : Sort u_1} {r : ααProp} [Std.Symm r] [IsTrans α r] {a b c : α} (h : r a b) :
                                              r a c r b c
                                              theorem rel_congr_right {α : Sort u_1} {r : ααProp} [Std.Symm r] [IsTrans α r] {a b c : α} (h : r b c) :
                                              r a b r a c
                                              theorem rel_congr {α : Sort u_1} {r : ααProp} [Std.Symm r] [IsTrans α r] {a b c d : α} (h₁ : r a b) (h₂ : r c d) :
                                              r a c r b d
                                              theorem trans_trichotomous_left {α : Sort u_1} {r : ααProp} [IsTrans α r] [Std.Trichotomous r] {a b c : α} (h₁ : ¬r b a) (h₂ : r b c) :
                                              r a c
                                              theorem trans_trichotomous_right {α : Sort u_1} {r : ααProp} [IsTrans α r] [Std.Trichotomous r] {a b c : α} (h₁ : r a b) (h₂ : ¬r c b) :
                                              r a c
                                              theorem extensional_of_trichotomous_of_irrefl {α : Sort u_1} (r : ααProp) [Std.Trichotomous r] [Std.Irrefl r] {a b : α} (H : ∀ (x : α), r x a r x b) :
                                              a = b

                                              In a trichotomous irreflexive order, every element is determined by the set of predecessors.