mathlib documentation

order.grade

Graded orders #

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 #

How to grade your order #

Here are the translations between common references and our grade_order:

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]
structure grade_order (𝕆 : 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 of this typeclass
Instances of other typeclasses for grade_order
  • grade_order.has_sizeof_inst
@[class]
structure grade_min_order (𝕆 : Type u_5) (Ξ± : Type u_6) [preorder 𝕆] [preorder Ξ±] :
Type (max u_5 u_6)

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

Instances of this typeclass
Instances of other typeclasses for grade_min_order
  • grade_min_order.has_sizeof_inst
@[instance]
def grade_min_order.to_grade_order (𝕆 : Type u_5) (Ξ± : Type u_6) [preorder 𝕆] [preorder Ξ±] [self : grade_min_order 𝕆 Ξ±] :
grade_order 𝕆 Ξ±
@[instance]
def grade_max_order.to_grade_order (𝕆 : Type u_5) (Ξ± : Type u_6) [preorder 𝕆] [preorder Ξ±] [self : grade_max_order 𝕆 Ξ±] :
grade_order 𝕆 Ξ±
@[class]
structure grade_max_order (𝕆 : Type u_5) (Ξ± : Type u_6) [preorder 𝕆] [preorder Ξ±] :
Type (max u_5 u_6)

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

Instances of this typeclass
Instances of other typeclasses for grade_max_order
  • grade_max_order.has_sizeof_inst
@[class]
structure grade_bounded_order (𝕆 : Type u_5) (Ξ± : Type u_6) [preorder 𝕆] [preorder Ξ±] :
Type (max u_5 u_6)

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

Instances of this typeclass
Instances of other typeclasses for grade_bounded_order
  • grade_bounded_order.has_sizeof_inst
@[instance]
def grade_bounded_order.to_grade_min_order (𝕆 : Type u_5) (Ξ± : Type u_6) [preorder 𝕆] [preorder Ξ±] [self : grade_bounded_order 𝕆 Ξ±] :
grade_min_order 𝕆 Ξ±
@[instance]
def grade_bounded_order.to_grade_max_order (𝕆 : Type u_5) (Ξ± : Type u_6) [preorder 𝕆] [preorder Ξ±] [self : grade_bounded_order 𝕆 Ξ±] :
grade_max_order 𝕆 Ξ±
def grade (𝕆 : Type u_1) {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_order 𝕆 Ξ±] :
Ξ± β†’ 𝕆

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
@[protected]
theorem covby.grade (𝕆 : Type u_1) {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_order 𝕆 Ξ±] {a b : Ξ±} (h : a β‹– b) :
grade 𝕆 a β‹– grade 𝕆 b
theorem grade_strict_mono {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_order 𝕆 Ξ±] :
strict_mono (grade 𝕆)
theorem covby_iff_lt_covby_grade {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_order 𝕆 Ξ±] {a b : Ξ±} :
a β‹– b ↔ a < b ∧ grade 𝕆 a β‹– grade 𝕆 b
@[protected]
theorem is_min.grade (𝕆 : Type u_1) {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_min_order 𝕆 Ξ±] {a : Ξ±} (h : is_min a) :
is_min (grade 𝕆 a)
@[simp]
theorem is_min_grade_iff {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_min_order 𝕆 Ξ±] {a : Ξ±} :
is_min (grade 𝕆 a) ↔ is_min a
@[protected]
theorem is_max.grade (𝕆 : Type u_1) {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_max_order 𝕆 Ξ±] {a : Ξ±} (h : is_max a) :
is_max (grade 𝕆 a)
@[simp]
theorem is_max_grade_iff {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_max_order 𝕆 Ξ±] {a : Ξ±} :
is_max (grade 𝕆 a) ↔ is_max a
theorem grade_mono {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [partial_order Ξ±] [grade_order 𝕆 Ξ±] :
monotone (grade 𝕆)
theorem grade_injective {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [linear_order Ξ±] [grade_order 𝕆 Ξ±] :
@[simp]
theorem grade_le_grade_iff {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [linear_order Ξ±] [grade_order 𝕆 Ξ±] {a b : Ξ±} :
grade 𝕆 a ≀ grade 𝕆 b ↔ a ≀ b
@[simp]
theorem grade_lt_grade_iff {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [linear_order Ξ±] [grade_order 𝕆 Ξ±] {a b : Ξ±} :
grade 𝕆 a < grade 𝕆 b ↔ a < b
@[simp]
theorem grade_eq_grade_iff {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [linear_order Ξ±] [grade_order 𝕆 Ξ±] {a b : Ξ±} :
grade 𝕆 a = grade 𝕆 b ↔ a = b
theorem grade_ne_grade_iff {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [linear_order Ξ±] [grade_order 𝕆 Ξ±] {a b : Ξ±} :
grade 𝕆 a β‰  grade 𝕆 b ↔ a β‰  b
theorem grade_covby_grade_iff {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [linear_order Ξ±] [grade_order 𝕆 Ξ±] {a b : Ξ±} :
grade 𝕆 a β‹– grade 𝕆 b ↔ a β‹– b
@[simp]
theorem grade_bot {𝕆 : Type u_1} {Ξ± : Type u_3} [partial_order 𝕆] [preorder Ξ±] [order_bot 𝕆] [order_bot Ξ±] [grade_min_order 𝕆 Ξ±] :
@[simp]
theorem grade_top {𝕆 : Type u_1} {Ξ± : Type u_3} [partial_order 𝕆] [preorder Ξ±] [order_top 𝕆] [order_top Ξ±] [grade_max_order 𝕆 Ξ±] :

Instances #

@[protected, instance]
def preorder.to_grade_bounded_order {Ξ± : Type u_3} [preorder Ξ±] :
Equations
@[simp]
theorem grade_self {Ξ± : Type u_3} [preorder Ξ±] (a : Ξ±) :
grade Ξ± a = a

Dual #

@[protected, instance]
def order_dual.grade_order {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_order 𝕆 Ξ±] :
Equations
@[protected, instance]
def order_dual.grade_min_order {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_max_order 𝕆 Ξ±] :
Equations
@[protected, instance]
def order_dual.grade_max_order {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_min_order 𝕆 Ξ±] :
Equations
@[protected, instance]
def order_dual.grade_bounded_order {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_bounded_order 𝕆 Ξ±] :
Equations
@[simp]
theorem grade_to_dual {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_order 𝕆 Ξ±] (a : Ξ±) :
@[simp]
theorem grade_of_dual {𝕆 : Type u_1} {Ξ± : Type u_3} [preorder 𝕆] [preorder Ξ±] [grade_order 𝕆 Ξ±] (a : Ξ±α΅’α΅ˆ) :

Lifting a graded order #

def grade_order.lift_left {𝕆 : Type u_1} {β„™ : Type u_2} {Ξ± : Type u_3} [preorder 𝕆] [preorder Β«β„™Β»] [preorder Ξ±] [grade_order 𝕆 Ξ±] (f : 𝕆 β†’ Β«β„™Β») (hf : strict_mono f) (hcovby : βˆ€ (a b : 𝕆), a β‹– b β†’ f a β‹– f b) :
grade_order Β«β„™Β» Ξ±

Lifts a graded order along a strictly monotone function.

Equations
def grade_min_order.lift_left {𝕆 : Type u_1} {β„™ : Type u_2} {Ξ± : Type u_3} [preorder 𝕆] [preorder Β«β„™Β»] [preorder Ξ±] [grade_min_order 𝕆 Ξ±] (f : 𝕆 β†’ Β«β„™Β») (hf : strict_mono f) (hcovby : βˆ€ (a b : 𝕆), a β‹– b β†’ f a β‹– f b) (hmin : βˆ€ (a : 𝕆), is_min a β†’ is_min (f a)) :
grade_min_order Β«β„™Β» Ξ±

Lifts a graded order along a strictly monotone function.

Equations
def grade_max_order.lift_left {𝕆 : Type u_1} {β„™ : Type u_2} {Ξ± : Type u_3} [preorder 𝕆] [preorder Β«β„™Β»] [preorder Ξ±] [grade_max_order 𝕆 Ξ±] (f : 𝕆 β†’ Β«β„™Β») (hf : strict_mono f) (hcovby : βˆ€ (a b : 𝕆), a β‹– b β†’ f a β‹– f b) (hmax : βˆ€ (a : 𝕆), is_max a β†’ is_max (f a)) :
grade_max_order Β«β„™Β» Ξ±

Lifts a graded order along a strictly monotone function.

Equations
def grade_bounded_order.lift_left {𝕆 : Type u_1} {β„™ : Type u_2} {Ξ± : Type u_3} [preorder 𝕆] [preorder Β«β„™Β»] [preorder Ξ±] [grade_bounded_order 𝕆 Ξ±] (f : 𝕆 β†’ Β«β„™Β») (hf : strict_mono f) (hcovby : βˆ€ (a b : 𝕆), a β‹– b β†’ f a β‹– f b) (hmin : βˆ€ (a : 𝕆), is_min a β†’ is_min (f a)) (hmax : βˆ€ (a : 𝕆), is_max a β†’ is_max (f a)) :
grade_bounded_order Β«β„™Β» Ξ±

Lifts a graded order along a strictly monotone function.

Equations
def grade_order.lift_right {𝕆 : Type u_1} {Ξ± : Type u_3} {Ξ² : Type u_4} [preorder 𝕆] [preorder Ξ±] [preorder Ξ²] [grade_order 𝕆 Ξ²] (f : Ξ± β†’ Ξ²) (hf : strict_mono f) (hcovby : βˆ€ (a b : Ξ±), a β‹– b β†’ f a β‹– f b) :
grade_order 𝕆 Ξ±

Lifts a graded order along a strictly monotone function.

Equations
def grade_min_order.lift_right {𝕆 : Type u_1} {Ξ± : Type u_3} {Ξ² : Type u_4} [preorder 𝕆] [preorder Ξ±] [preorder Ξ²] [grade_min_order 𝕆 Ξ²] (f : Ξ± β†’ Ξ²) (hf : strict_mono f) (hcovby : βˆ€ (a b : Ξ±), a β‹– b β†’ f a β‹– f b) (hmin : βˆ€ (a : Ξ±), is_min a β†’ is_min (f a)) :
grade_min_order 𝕆 Ξ±

Lifts a graded order along a strictly monotone function.

Equations
def grade_max_order.lift_right {𝕆 : Type u_1} {Ξ± : Type u_3} {Ξ² : Type u_4} [preorder 𝕆] [preorder Ξ±] [preorder Ξ²] [grade_max_order 𝕆 Ξ²] (f : Ξ± β†’ Ξ²) (hf : strict_mono f) (hcovby : βˆ€ (a b : Ξ±), a β‹– b β†’ f a β‹– f b) (hmax : βˆ€ (a : Ξ±), is_max a β†’ is_max (f a)) :
grade_max_order 𝕆 Ξ±

Lifts a graded order along a strictly monotone function.

Equations
def grade_bounded_order.lift_right {𝕆 : Type u_1} {Ξ± : Type u_3} {Ξ² : Type u_4} [preorder 𝕆] [preorder Ξ±] [preorder Ξ²] [grade_bounded_order 𝕆 Ξ²] (f : Ξ± β†’ Ξ²) (hf : strict_mono f) (hcovby : βˆ€ (a b : Ξ±), a β‹– b β†’ f a β‹– f b) (hmin : βˆ€ (a : Ξ±), is_min a β†’ is_min (f a)) (hmax : βˆ€ (a : Ξ±), is_max a β†’ is_max (f a)) :
grade_bounded_order 𝕆 Ξ±

Lifts a graded order along a strictly monotone function.

Equations

fin n-graded to β„•-graded to β„€-graded #

def grade_order.fin_to_nat {Ξ± : Type u_3} [preorder Ξ±] (n : β„•) [grade_order (fin n) Ξ±] :

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

Equations
def grade_min_order.fin_to_nat {Ξ± : Type u_3} [preorder Ξ±] (n : β„•) [grade_min_order (fin n) Ξ±] :

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

Equations
@[protected, instance]
def grade_order.nat_to_int {Ξ± : Type u_3} [preorder Ξ±] [grade_order β„• Ξ±] :
Equations