Documentation

Mathlib.Order.Grade

Graded orders #

This file defines graded orders, also known as ranked orders.

An ๐•†-graded order is an order ฮฑ equipped with a distinguished "grade" function ฮฑ โ†’ ๐•† which should be understood as giving the "height" of the elements. Usual graded orders are โ„•-graded, cograded orders are โ„•แต’แตˆ-graded, but we can also grade by โ„ค, and polytopes are naturally Fin n-graded.

Visually, grade โ„• a is the height of a in the Hasse diagram of ฮฑ.

Main declarations #

How to grade your order #

Here are the translations between common references and our GradeOrder:

Implementation notes #

One possible definition of graded orders is as the bounded orders whose flags (maximal chains) all have the same finite length (see Stanley p. 99). However, this means that all graded orders must have minimal and maximal elements and that the grade is not data.

Instead, we define graded orders by their grade function, without talking about flags yet.

References #

class GradeOrder (๐•† : Type u_5) (ฮฑ : Type u_6) [Preorder ๐•†] [Preorder ฮฑ] :
Type (max u_5 u_6)

An ๐•†-graded order is an order ฮฑ equipped with a strictly monotone function grade ๐•† : ฮฑ โ†’ ๐•† which preserves order covering (CovBy).

Instances
    theorem GradeOrder.grade_strictMono {๐•† : Type u_5} {ฮฑ : Type u_6} :
    โˆ€ {inst : Preorder ๐•†} {inst_1 : Preorder ฮฑ} [self : GradeOrder ๐•† ฮฑ], StrictMono GradeOrder.grade

    grade is strictly monotonic.

    theorem GradeOrder.covBy_grade {๐•† : Type u_5} {ฮฑ : Type u_6} :
    โˆ€ {inst : Preorder ๐•†} {inst_1 : Preorder ฮฑ} [self : GradeOrder ๐•† ฮฑ] โฆƒa b : ฮฑโฆ„, a โ‹– b โ†’ GradeOrder.grade a โ‹– GradeOrder.grade b

    grade preserves CovBy.

    class GradeMinOrder (๐•† : Type u_5) (ฮฑ : Type u_6) [Preorder ๐•†] [Preorder ฮฑ] extends GradeOrder :
    Type (max u_5 u_6)

    An ๐•†-graded order where minimal elements have minimal grades.

    Instances
      theorem GradeMinOrder.isMin_grade {๐•† : Type u_5} {ฮฑ : Type u_6} :
      โˆ€ {inst : Preorder ๐•†} {inst_1 : Preorder ฮฑ} [self : GradeMinOrder ๐•† ฮฑ] โฆƒa : ฮฑโฆ„, IsMin a โ†’ IsMin (GradeOrder.grade a)

      Minimal elements have minimal grades.

      class GradeMaxOrder (๐•† : Type u_5) (ฮฑ : Type u_6) [Preorder ๐•†] [Preorder ฮฑ] extends GradeOrder :
      Type (max u_5 u_6)

      An ๐•†-graded order where maximal elements have maximal grades.

      Instances
        theorem GradeMaxOrder.isMax_grade {๐•† : Type u_5} {ฮฑ : Type u_6} :
        โˆ€ {inst : Preorder ๐•†} {inst_1 : Preorder ฮฑ} [self : GradeMaxOrder ๐•† ฮฑ] โฆƒa : ฮฑโฆ„, IsMax a โ†’ IsMax (GradeOrder.grade a)

        Maximal elements have maximal grades.

        class GradeBoundedOrder (๐•† : Type u_5) (ฮฑ : Type u_6) [Preorder ๐•†] [Preorder ฮฑ] extends GradeMinOrder , GradeMaxOrder , GradeOrder :
        Type (max u_5 u_6)

        An ๐•†-graded order where minimal elements have minimal grades and maximal elements have maximal grades.

          Instances
            def grade (๐•† : Type u_1) {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] :
            ฮฑ โ†’ ๐•†

            The grade of an element in a graded order. Morally, this is the number of elements you need to go down by to get to โŠฅ.

            Equations
            • grade ๐•† = GradeOrder.grade
            Instances For
              theorem CovBy.grade (๐•† : Type u_1) {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] {a : ฮฑ} {b : ฮฑ} (h : a โ‹– b) :
              grade ๐•† a โ‹– grade ๐•† b
              theorem grade_strictMono {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] :
              StrictMono (grade ๐•†)
              theorem covBy_iff_lt_covBy_grade {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] {a : ฮฑ} {b : ฮฑ} :
              a โ‹– b โ†” a < b โˆง grade ๐•† a โ‹– grade ๐•† b
              theorem IsMin.grade (๐•† : Type u_1) {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeMinOrder ๐•† ฮฑ] {a : ฮฑ} (h : IsMin a) :
              IsMin (grade ๐•† a)
              @[simp]
              theorem isMin_grade_iff {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeMinOrder ๐•† ฮฑ] {a : ฮฑ} :
              IsMin (grade ๐•† a) โ†” IsMin a
              theorem IsMax.grade (๐•† : Type u_1) {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeMaxOrder ๐•† ฮฑ] {a : ฮฑ} (h : IsMax a) :
              IsMax (grade ๐•† a)
              @[simp]
              theorem isMax_grade_iff {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeMaxOrder ๐•† ฮฑ] {a : ฮฑ} :
              IsMax (grade ๐•† a) โ†” IsMax a
              theorem grade_mono {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [PartialOrder ฮฑ] [GradeOrder ๐•† ฮฑ] :
              Monotone (grade ๐•†)
              theorem grade_injective {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [LinearOrder ฮฑ] [GradeOrder ๐•† ฮฑ] :
              @[simp]
              theorem grade_le_grade_iff {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [LinearOrder ฮฑ] [GradeOrder ๐•† ฮฑ] {a : ฮฑ} {b : ฮฑ} :
              grade ๐•† a โ‰ค grade ๐•† b โ†” a โ‰ค b
              @[simp]
              theorem grade_lt_grade_iff {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [LinearOrder ฮฑ] [GradeOrder ๐•† ฮฑ] {a : ฮฑ} {b : ฮฑ} :
              grade ๐•† a < grade ๐•† b โ†” a < b
              @[simp]
              theorem grade_eq_grade_iff {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [LinearOrder ฮฑ] [GradeOrder ๐•† ฮฑ] {a : ฮฑ} {b : ฮฑ} :
              grade ๐•† a = grade ๐•† b โ†” a = b
              theorem grade_ne_grade_iff {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [LinearOrder ฮฑ] [GradeOrder ๐•† ฮฑ] {a : ฮฑ} {b : ฮฑ} :
              grade ๐•† a โ‰  grade ๐•† b โ†” a โ‰  b
              theorem grade_covBy_grade_iff {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [LinearOrder ฮฑ] [GradeOrder ๐•† ฮฑ] {a : ฮฑ} {b : ฮฑ} :
              grade ๐•† a โ‹– grade ๐•† b โ†” a โ‹– b
              @[simp]
              theorem grade_bot {๐•† : Type u_1} {ฮฑ : Type u_3} [PartialOrder ๐•†] [Preorder ฮฑ] [OrderBot ๐•†] [OrderBot ฮฑ] [GradeMinOrder ๐•† ฮฑ] :
              @[simp]
              theorem grade_top {๐•† : Type u_1} {ฮฑ : Type u_3} [PartialOrder ๐•†] [Preorder ฮฑ] [OrderTop ๐•†] [OrderTop ฮฑ] [GradeMaxOrder ๐•† ฮฑ] :

              Instances #

              instance Preorder.toGradeBoundedOrder {ฮฑ : Type u_3} [Preorder ฮฑ] :
              GradeBoundedOrder ฮฑ ฮฑ
              Equations
              @[simp]
              theorem grade_self {ฮฑ : Type u_3} [Preorder ฮฑ] (a : ฮฑ) :
              grade ฮฑ a = a

              Dual #

              instance OrderDual.gradeOrder {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] :
              Equations
              • OrderDual.gradeOrder = { grade := โ‡‘OrderDual.toDual โˆ˜ grade ๐•† โˆ˜ โ‡‘OrderDual.ofDual, grade_strictMono := โ‹ฏ, covBy_grade := โ‹ฏ }
              instance OrderDual.gradeMinOrder {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeMaxOrder ๐•† ฮฑ] :
              Equations
              instance OrderDual.gradeMaxOrder {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeMinOrder ๐•† ฮฑ] :
              Equations
              instance instGradeBoundedOrderOrderDual {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeBoundedOrder ๐•† ฮฑ] :
              Equations
              @[simp]
              theorem grade_toDual {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] (a : ฮฑ) :
              grade ๐•†แต’แตˆ (OrderDual.toDual a) = OrderDual.toDual (grade ๐•† a)
              @[simp]
              theorem grade_ofDual {๐•† : Type u_1} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] (a : ฮฑแต’แตˆ) :
              grade ๐•† (OrderDual.ofDual a) = OrderDual.ofDual (grade ๐•†แต’แตˆ a)

              Lifting a graded order #

              @[reducible, inline]
              abbrev GradeOrder.liftLeft {๐•† : Type u_1} {โ„™ : Type u_2} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder โ„™] [Preorder ฮฑ] [GradeOrder ๐•† ฮฑ] (f : ๐•† โ†’ โ„™) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ๐•†), a โ‹– b โ†’ f a โ‹– f b) :
              GradeOrder โ„™ ฮฑ

              Lifts a graded order along a strictly monotone function.

              Equations
              Instances For
                @[reducible, inline]
                abbrev GradeMinOrder.liftLeft {๐•† : Type u_1} {โ„™ : Type u_2} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder โ„™] [Preorder ฮฑ] [GradeMinOrder ๐•† ฮฑ] (f : ๐•† โ†’ โ„™) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ๐•†), a โ‹– b โ†’ f a โ‹– f b) (hmin : โˆ€ (a : ๐•†), IsMin a โ†’ IsMin (f a)) :
                GradeMinOrder โ„™ ฮฑ

                Lifts a graded order along a strictly monotone function.

                Equations
                Instances For
                  @[reducible, inline]
                  abbrev GradeMaxOrder.liftLeft {๐•† : Type u_1} {โ„™ : Type u_2} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder โ„™] [Preorder ฮฑ] [GradeMaxOrder ๐•† ฮฑ] (f : ๐•† โ†’ โ„™) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ๐•†), a โ‹– b โ†’ f a โ‹– f b) (hmax : โˆ€ (a : ๐•†), IsMax a โ†’ IsMax (f a)) :
                  GradeMaxOrder โ„™ ฮฑ

                  Lifts a graded order along a strictly monotone function.

                  Equations
                  Instances For
                    @[reducible, inline]
                    abbrev GradeBoundedOrder.liftLeft {๐•† : Type u_1} {โ„™ : Type u_2} {ฮฑ : Type u_3} [Preorder ๐•†] [Preorder โ„™] [Preorder ฮฑ] [GradeBoundedOrder ๐•† ฮฑ] (f : ๐•† โ†’ โ„™) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ๐•†), a โ‹– b โ†’ f a โ‹– f b) (hmin : โˆ€ (a : ๐•†), IsMin a โ†’ IsMin (f a)) (hmax : โˆ€ (a : ๐•†), IsMax a โ†’ IsMax (f a)) :
                    GradeBoundedOrder โ„™ ฮฑ

                    Lifts a graded order along a strictly monotone function.

                    Equations
                    Instances For
                      @[reducible, inline]
                      abbrev GradeOrder.liftRight {๐•† : Type u_1} {ฮฑ : Type u_3} {ฮฒ : Type u_4} [Preorder ๐•†] [Preorder ฮฑ] [Preorder ฮฒ] [GradeOrder ๐•† ฮฒ] (f : ฮฑ โ†’ ฮฒ) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ฮฑ), a โ‹– b โ†’ f a โ‹– f b) :
                      GradeOrder ๐•† ฮฑ

                      Lifts a graded order along a strictly monotone function.

                      Equations
                      Instances For
                        @[reducible, inline]
                        abbrev GradeMinOrder.liftRight {๐•† : Type u_1} {ฮฑ : Type u_3} {ฮฒ : Type u_4} [Preorder ๐•†] [Preorder ฮฑ] [Preorder ฮฒ] [GradeMinOrder ๐•† ฮฒ] (f : ฮฑ โ†’ ฮฒ) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ฮฑ), a โ‹– b โ†’ f a โ‹– f b) (hmin : โˆ€ (a : ฮฑ), IsMin a โ†’ IsMin (f a)) :
                        GradeMinOrder ๐•† ฮฑ

                        Lifts a graded order along a strictly monotone function.

                        Equations
                        Instances For
                          @[reducible, inline]
                          abbrev GradeMaxOrder.liftRight {๐•† : Type u_1} {ฮฑ : Type u_3} {ฮฒ : Type u_4} [Preorder ๐•†] [Preorder ฮฑ] [Preorder ฮฒ] [GradeMaxOrder ๐•† ฮฒ] (f : ฮฑ โ†’ ฮฒ) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ฮฑ), a โ‹– b โ†’ f a โ‹– f b) (hmax : โˆ€ (a : ฮฑ), IsMax a โ†’ IsMax (f a)) :
                          GradeMaxOrder ๐•† ฮฑ

                          Lifts a graded order along a strictly monotone function.

                          Equations
                          Instances For
                            @[reducible, inline]
                            abbrev GradeBoundedOrder.liftRight {๐•† : Type u_1} {ฮฑ : Type u_3} {ฮฒ : Type u_4} [Preorder ๐•†] [Preorder ฮฑ] [Preorder ฮฒ] [GradeBoundedOrder ๐•† ฮฒ] (f : ฮฑ โ†’ ฮฒ) (hf : StrictMono f) (hcovBy : โˆ€ (a b : ฮฑ), a โ‹– b โ†’ f a โ‹– f b) (hmin : โˆ€ (a : ฮฑ), IsMin a โ†’ IsMin (f a)) (hmax : โˆ€ (a : ฮฑ), IsMax a โ†’ IsMax (f a)) :
                            GradeBoundedOrder ๐•† ฮฑ

                            Lifts a graded order along a strictly monotone function.

                            Equations
                            Instances For

                              Fin n-graded to โ„•-graded to โ„ค-graded #

                              @[reducible, inline]
                              abbrev GradeOrder.finToNat {ฮฑ : Type u_3} [Preorder ฮฑ] (n : โ„•) [GradeOrder (Fin n) ฮฑ] :

                              A Fin n-graded order is also โ„•-graded. We do not mark this an instance because n is not inferrable.

                              Equations
                              Instances For
                                @[reducible, inline]
                                abbrev GradeMinOrder.finToNat {ฮฑ : Type u_3} [Preorder ฮฑ] (n : โ„•) [GradeMinOrder (Fin n) ฮฑ] :

                                A Fin n-graded order is also โ„•-graded. We do not mark this an instance because n is not inferrable.

                                Equations
                                Instances For
                                  instance GradeOrder.natToInt {ฮฑ : Type u_3} [Preorder ฮฑ] [GradeOrder โ„• ฮฑ] :
                                  Equations
                                  theorem GradeOrder.wellFoundedLT {ฮฑ : Type u_3} [Preorder ฮฑ] (๐•† : Type u_5) [Preorder ๐•†] [GradeOrder ๐•† ฮฑ] [WellFoundedLT ๐•†] :
                                  theorem GradeOrder.wellFoundedGT {ฮฑ : Type u_3} [Preorder ฮฑ] (๐•† : Type u_5) [Preorder ๐•†] [GradeOrder ๐•† ฮฑ] [WellFoundedGT ๐•†] :
                                  instance instWellFoundedLTOfGradeOrderNat {ฮฑ : Type u_3} [Preorder ฮฑ] [GradeOrder โ„• ฮฑ] :
                                  Equations
                                  • โ‹ฏ = โ‹ฏ
                                  Equations
                                  • โ‹ฏ = โ‹ฏ