Lexicographic order #
This file defines the lexicographic relation for pairs and dependent pairs of orders, partial orders and linear orders.
Main declarations #
lex α β
: Synonym ofα × β
to equip it with lexicographic order without creating conflicting instances.lex_<pre/partial_/linear_>order
: Instances lifting the orders onα
andβ
tolex α β
See also #
Related files are:
data.finset.colex
: Colexicographic order on finite sets.data.list.lex
: Lexicographic order on lists.data.psigma.order
: Lexicographic order onΣ' i, α i
.data.sigma.order
: Lexicographic order onΣ i, α i
.
@[protected, instance]
def
lex.decidable_eq
{α : Type u}
{β : Type v}
[decidable_eq α]
[decidable_eq β] :
decidable_eq (lex α β)
Equations
@[protected, instance]
Equations
@[protected, instance]
Dictionary / lexicographic preorder for pairs.
Equations
- lex_preorder = {le := has_le.le lex_has_le, lt := has_lt.lt lex_has_lt, le_refl := _, le_trans := _, lt_iff_le_not_le := _}
@[protected, instance]
def
lex_partial_order
{α : Type u}
{β : Type v}
[partial_order α]
[partial_order β] :
partial_order (lex α β)
Dictionary / lexicographic partial_order for pairs.
Equations
- lex_partial_order = {le := preorder.le lex_preorder, lt := preorder.lt lex_preorder, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _}
@[protected, instance]
def
lex_linear_order
{α : Type u}
{β : Type v}
[linear_order α]
[linear_order β] :
linear_order (lex α β)
Dictionary / lexicographic linear_order for pairs.
Equations
- lex_linear_order = {le := partial_order.le lex_partial_order, lt := partial_order.lt lex_partial_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := id (λ (a b : lex α β), prod.cases_on a (λ (a₁ : α) (b₁ : β), prod.cases_on b (λ (a₂ : α) (b₂ : β), (linear_order.decidable_le a₁ a₂).cases_on (λ (a_lt : ¬a₁ ≤ a₂), is_false _) (λ (a_le : a₁ ≤ a₂), dite (a₁ = a₂) (λ (h : a₁ = a₂), _.mpr ((linear_order.decidable_le b₁ b₂).cases_on (λ (b_lt : ¬b₁ ≤ b₂), is_false _) (λ (b_le : b₁ ≤ b₂), is_true _))) (λ (h : ¬a₁ = a₂), is_true _))))), decidable_eq := decidable_eq_of_decidable_le (id (λ (a b : lex α β), prod.cases_on a (λ (a₁ : α) (b₁ : β), prod.cases_on b (λ (a₂ : α) (b₂ : β), (linear_order.decidable_le a₁ a₂).cases_on (λ (a_lt : ¬a₁ ≤ a₂), is_false _) (λ (a_le : a₁ ≤ a₂), dite (a₁ = a₂) (λ (h : a₁ = a₂), _.mpr ((linear_order.decidable_le b₁ b₂).cases_on (λ (b_lt : ¬b₁ ≤ b₂), is_false _) (λ (b_le : b₁ ≤ b₂), is_true _))) (λ (h : ¬a₁ = a₂), is_true _)))))), decidable_lt := decidable_lt_of_decidable_le (id (λ (a b : lex α β), prod.cases_on a (λ (a₁ : α) (b₁ : β), prod.cases_on b (λ (a₂ : α) (b₂ : β), (linear_order.decidable_le a₁ a₂).cases_on (λ (a_lt : ¬a₁ ≤ a₂), is_false _) (λ (a_le : a₁ ≤ a₂), dite (a₁ = a₂) (λ (h : a₁ = a₂), _.mpr ((linear_order.decidable_le b₁ b₂).cases_on (λ (b_lt : ¬b₁ ≤ b₂), is_false _) (λ (b_le : b₁ ≤ b₂), is_true _))) (λ (h : ¬a₁ = a₂), is_true _)))))), max := max_default (λ (a b : lex α β), id (λ (a b : lex α β), prod.cases_on a (λ (a₁ : α) (b₁ : β), prod.cases_on b (λ (a₂ : α) (b₂ : β), (linear_order.decidable_le a₁ a₂).cases_on (λ (a_lt : ¬a₁ ≤ a₂), is_false _) (λ (a_le : a₁ ≤ a₂), dite (a₁ = a₂) (λ (h : a₁ = a₂), _.mpr ((linear_order.decidable_le b₁ b₂).cases_on (λ (b_lt : ¬b₁ ≤ b₂), is_false _) (λ (b_le : b₁ ≤ b₂), is_true _))) (λ (h : ¬a₁ = a₂), is_true _))))) a b), max_def := _, min := min_default (λ (a b : lex α β), id (λ (a b : lex α β), prod.cases_on a (λ (a₁ : α) (b₁ : β), prod.cases_on b (λ (a₂ : α) (b₂ : β), (linear_order.decidable_le a₁ a₂).cases_on (λ (a_lt : ¬a₁ ≤ a₂), is_false _) (λ (a_le : a₁ ≤ a₂), dite (a₁ = a₂) (λ (h : a₁ = a₂), _.mpr ((linear_order.decidable_le b₁ b₂).cases_on (λ (b_lt : ¬b₁ ≤ b₂), is_false _) (λ (b_le : b₁ ≤ b₂), is_true _))) (λ (h : ¬a₁ = a₂), is_true _))))) a b), min_def := _}