# Documentation

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

A 𝕆-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 #

• GradeOrder: Graded order.
• GradeMinOrder: Graded order where minimal elements have minimal grades.
• GradeMaxOrder: Graded order where maximal elements have maximal grades.
• GradeBoundedOrder: Graded order where minimal elements have minimal grades and maximal elements have maximal grades.
• grade: The grade of an element. Because an order can admit several gradings, the first argument is the order we grade by.

Here are the translations between common references and our GradeOrder:

• [Stanley][stanley2012] defines a graded order of rank n as an order where all maximal chains have "length" n (so the number of elements of a chain is n + 1). This corresponds to GradeBoundedOrder (Fin (n + 1)) α.
• [Engel][engel1997]'s ranked orders are somewhere between GradeOrder ℕ α and GradeMinOrder ℕ α, in that he requires ∃ a, IsMin a ∧ grade ℕ a = 0∃ a, IsMin a ∧ grade ℕ a = 0∧ grade ℕ a = 0 rather than ∀ a, IsMin a → grade ℕ a = 0∀ a, IsMin a → grade ℕ a = 0→ grade ℕ a = 0. He defines a graded order as an order where all minimal elements have grade 0 and all maximal elements have the same grade. This is roughly a less bundled version of GradeBoundedOrder (Fin n) α, assuming we discard orders with infinite chains.

## 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.

## References #

• [Richard Stanley, Enumerative Combinatorics][stanley2012]
class GradeOrder (𝕆 : Type u_1) (α : Type u_2) [inst : ] [inst : ] :
Type (maxu_1u_2)

• grade is strictly monotonic.

• grade preserves Covby.

An 𝕆-graded order is an order α equipped with a strictly monotone function grade 𝕆 : α → 𝕆→ 𝕆 which preserves order covering (Covby).

Instances
class GradeMinOrder (𝕆 : Type u_1) (α : Type u_2) [inst : ] [inst : ] extends :
Type (maxu_1u_2)
• Minimal elements have minimal grades.

is_min_grade : ∀ ⦃a : α⦄,

A 𝕆-graded order where minimal elements have minimal grades.

Instances
class GradeMaxOrder (𝕆 : Type u_1) (α : Type u_2) [inst : ] [inst : ] extends :
Type (maxu_1u_2)
• Maximal elements have maximal grades.

is_max_grade : ∀ ⦃a : α⦄,

A 𝕆-graded order where maximal elements have maximal grades.

Instances
class GradeBoundedOrder (𝕆 : Type u_1) (α : Type u_2) [inst : ] [inst : ] extends :
Type (maxu_1u_2)
• Maximal elements have maximal grades.

is_max_grade : ∀ ⦃a : α⦄,

A 𝕆-graded order where minimal elements have minimal grades and maximal elements have maximal grades.

Instances
def grade (𝕆 : Type u_1) {α : Type u_2} [inst : ] [inst : ] [inst : ] :
α𝕆

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
theorem Covby.grade (𝕆 : Type u_2) {α : Type u_1} [inst : ] [inst : ] [inst : ] {a : α} {b : α} (h : a b) :
theorem grade_strictMono {𝕆 : Type u_2} {α : Type u_1} [inst : ] [inst : ] [inst : ] :
theorem covby_iff_lt_covby_grade {𝕆 : Type u_2} {α : Type u_1} [inst : ] [inst : ] [inst : ] {a : α} {b : α} :
theorem IsMin.grade (𝕆 : Type u_2) {α : Type u_1} [inst : ] [inst : ] [inst : ] {a : α} (h : ) :
@[simp]
theorem isMin_grade_iff {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] {a : α} :
theorem IsMax.grade (𝕆 : Type u_2) {α : Type u_1} [inst : ] [inst : ] [inst : ] {a : α} (h : ) :
@[simp]
theorem isMax_grade_iff {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] {a : α} :
theorem grade_mono {𝕆 : Type u_2} {α : Type u_1} [inst : ] [inst : ] [inst : ] :
theorem grade_injective {𝕆 : Type u_2} {α : Type u_1} [inst : ] [inst : ] [inst : ] :
@[simp]
theorem grade_le_grade_iff {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] {a : α} {b : α} :
@[simp]
theorem grade_lt_grade_iff {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] {a : α} {b : α} :
@[simp]
theorem grade_eq_grade_iff {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] {a : α} {b : α} :
theorem grade_ne_grade_iff {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] {a : α} {b : α} :
theorem grade_covby_grade_iff {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] {a : α} {b : α} :
@[simp]
theorem grade_bot {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] [inst : ] [inst : ] :
@[simp]
theorem grade_top {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] [inst : ] [inst : ] :

### Instances #

instance Preorder.toGradeBoundedOrder {α : Type u_1} [inst : ] :
Equations
@[simp]
theorem grade_self {α : Type u_1} [inst : ] (a : α) :

#### Dual #

instance OrderDual.gradeOrder {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] :
Equations
• One or more equations did not get rendered due to their size.
instance OrderDual.gradeMinOrder {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] :
Equations
instance OrderDual.gradeMaxOrder {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] :
Equations
instance instGradeBoundedOrderOrderDualOrderDualPreorderPreorder {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] :
Equations
• One or more equations did not get rendered due to their size.
@[simp]
theorem grade_toDual {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] (a : α) :
@[simp]
theorem grade_ofDual {𝕆 : Type u_1} {α : Type u_2} [inst : ] [inst : ] [inst : ] (a : αᵒᵈ) :

#### Lifting a graded order #

def GradeOrder.liftLeft {𝕆 : Type u_1} {ℙ : Type u_2} {α : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : 𝕆) (hf : ) (hcovby : ∀ (a b : 𝕆), a bf a f b) :

Lifts a graded order along a strictly monotone function.

Equations
• One or more equations did not get rendered due to their size.
def GradeMinOrder.liftLeft {𝕆 : Type u_1} {ℙ : Type u_2} {α : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : 𝕆) (hf : ) (hcovby : ∀ (a b : 𝕆), a bf a f b) (hmin : ∀ (a : 𝕆), IsMin (f a)) :

Lifts a graded order along a strictly monotone function.

Equations
def GradeMaxOrder.liftLeft {𝕆 : Type u_1} {ℙ : Type u_2} {α : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : 𝕆) (hf : ) (hcovby : ∀ (a b : 𝕆), a bf a f b) (hmax : ∀ (a : 𝕆), IsMax (f a)) :

Lifts a graded order along a strictly monotone function.

Equations
def GradeBoundedOrder.liftLeft {𝕆 : Type u_1} {ℙ : Type u_2} {α : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : 𝕆) (hf : ) (hcovby : ∀ (a b : 𝕆), a bf a f b) (hmin : ∀ (a : 𝕆), IsMin (f a)) (hmax : ∀ (a : 𝕆), IsMax (f a)) :

Lifts a graded order along a strictly monotone function.

Equations
• One or more equations did not get rendered due to their size.
def GradeOrder.liftRight {𝕆 : Type u_1} {α : Type u_2} {β : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : αβ) (hf : ) (hcovby : ∀ (a b : α), a bf a f b) :

Lifts a graded order along a strictly monotone function.

Equations
• One or more equations did not get rendered due to their size.
def GradeMinOrder.liftRight {𝕆 : Type u_1} {α : Type u_2} {β : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : αβ) (hf : ) (hcovby : ∀ (a b : α), a bf a f b) (hmin : ∀ (a : α), IsMin (f a)) :

Lifts a graded order along a strictly monotone function.

Equations
def GradeMaxOrder.liftRight {𝕆 : Type u_1} {α : Type u_2} {β : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : αβ) (hf : ) (hcovby : ∀ (a b : α), a bf a f b) (hmax : ∀ (a : α), IsMax (f a)) :

Lifts a graded order along a strictly monotone function.

Equations
def GradeBoundedOrder.liftRight {𝕆 : Type u_1} {α : Type u_2} {β : Type u_3} [inst : ] [inst : ] [inst : ] [inst : ] (f : αβ) (hf : ) (hcovby : ∀ (a b : α), a bf a f b) (hmin : ∀ (a : α), IsMin (f a)) (hmax : ∀ (a : α), IsMax (f a)) :

Lifts a graded order along a strictly monotone function.

Equations
• One or more equations did not get rendered due to their size.

#### fin n-graded to ℕ-graded to ℤ-graded #

def GradeOrder.finToNat {α : Type u_1} [inst : ] (n : ) [inst : GradeOrder (Fin n) α] :

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

Equations
def GradeMinOrder.finToNat {α : Type u_1} [inst : ] (n : ) [inst : GradeMinOrder (Fin n) α] :

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

Equations
instance GradeOrder.natToInt {α : Type u_1} [inst : ] [inst : ] :
Equations