Orders on a sum type #
This file defines the disjoint sum and the linear (aka lexicographic) sum of two orders and
provides relation instances for Sum.LiftRel
and Sum.Lex
.
We declare the disjoint sum of orders as the default set of instances. The linear order goes on a type synonym.
Main declarations #
Sum.LE
,Sum.LT
: Disjoint sum of orders.Sum.Lex.LE
,Sum.Lex.LT
: Lexicographic/linear sum of orders.
Notation #
α ⊕ₗ β
: The linear sum ofα
andβ
.
Unbundled relation classes #
theorem
Sum.LiftRel.refl
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsRefl α r]
[IsRefl β s]
(x : α ⊕ β)
:
Sum.LiftRel r s x x
theorem
Sum.LiftRel.trans
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsTrans α r]
[IsTrans β s]
{a : α ⊕ β}
{b : α ⊕ β}
{c : α ⊕ β}
:
Sum.LiftRel r s a b → Sum.LiftRel r s b c → Sum.LiftRel r s a c
instance
Sum.instIsAntisymmLiftRel
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsAntisymm α r]
[IsAntisymm β s]
:
IsAntisymm (α ⊕ β) (Sum.LiftRel r s)
Equations
- ⋯ = ⋯
instance
Sum.instIsAntisymmLex
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsAntisymm α r]
[IsAntisymm β s]
:
IsAntisymm (α ⊕ β) (Sum.Lex r s)
Equations
- ⋯ = ⋯
instance
Sum.instIsTrichotomousLex
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsTrichotomous α r]
[IsTrichotomous β s]
:
IsTrichotomous (α ⊕ β) (Sum.Lex r s)
Equations
- ⋯ = ⋯
instance
Sum.instIsWellOrderLex
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsWellOrder α r]
[IsWellOrder β s]
:
IsWellOrder (α ⊕ β) (Sum.Lex r s)
Equations
- ⋯ = ⋯
Disjoint sum of two orders #
Equations
- Sum.instPreorderSum = Preorder.mk ⋯ ⋯ ⋯
theorem
Sum.inl_strictMono
{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
:
StrictMono Sum.inl
theorem
Sum.inr_strictMono
{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
:
StrictMono Sum.inr
instance
Sum.instPartialOrder
{α : Type u_1}
{β : Type u_2}
[PartialOrder α]
[PartialOrder β]
:
PartialOrder (α ⊕ β)
Equations
- Sum.instPartialOrder = PartialOrder.mk ⋯
instance
Sum.noMinOrder
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[NoMinOrder α]
[NoMinOrder β]
:
NoMinOrder (α ⊕ β)
Equations
- ⋯ = ⋯
instance
Sum.noMaxOrder
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[NoMaxOrder α]
[NoMaxOrder β]
:
NoMaxOrder (α ⊕ β)
Equations
- ⋯ = ⋯
@[simp]
theorem
Sum.noMinOrder_iff
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
:
NoMinOrder (α ⊕ β) ↔ NoMinOrder α ∧ NoMinOrder β
@[simp]
theorem
Sum.noMaxOrder_iff
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
:
NoMaxOrder (α ⊕ β) ↔ NoMaxOrder α ∧ NoMaxOrder β
instance
Sum.denselyOrdered
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[DenselyOrdered α]
[DenselyOrdered β]
:
DenselyOrdered (α ⊕ β)
Equations
- ⋯ = ⋯
@[simp]
theorem
Sum.denselyOrdered_iff
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
:
DenselyOrdered (α ⊕ β) ↔ DenselyOrdered α ∧ DenselyOrdered β
Linear sum of two orders #
The linear sum of two orders
Equations
- Sum.Lex.«term_⊕ₗ_» = Lean.ParserDescr.trailingNode `Sum.Lex.term_⊕ₗ_ 30 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊕ₗ ") (Lean.ParserDescr.cat `term 29))
Instances For
theorem
Sum.Lex.toLex_strictMono
{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
:
StrictMono ⇑toLex
theorem
Sum.Lex.inl_strictMono
{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
:
StrictMono (⇑toLex ∘ Sum.inl)
theorem
Sum.Lex.inr_strictMono
{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
:
StrictMono (⇑toLex ∘ Sum.inr)
instance
Sum.Lex.partialOrder
{α : Type u_1}
{β : Type u_2}
[PartialOrder α]
[PartialOrder β]
:
PartialOrder (Lex (α ⊕ β))
Equations
- Sum.Lex.partialOrder = PartialOrder.mk ⋯
instance
Sum.Lex.linearOrder
{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[LinearOrder β]
:
LinearOrder (Lex (α ⊕ β))
Equations
- Sum.Lex.linearOrder = LinearOrder.mk ⋯ Sum.instDecidableRelSumLex instDecidableEqSum decidableLTOfDecidableLE ⋯ ⋯ ⋯
instance
Sum.Lex.noMinOrder
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[NoMinOrder α]
[NoMinOrder β]
:
NoMinOrder (Lex (α ⊕ β))
Equations
- ⋯ = ⋯
instance
Sum.Lex.noMaxOrder
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[NoMaxOrder α]
[NoMaxOrder β]
:
NoMaxOrder (Lex (α ⊕ β))
Equations
- ⋯ = ⋯
instance
Sum.Lex.noMinOrder_of_nonempty
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[NoMinOrder α]
[Nonempty α]
:
NoMinOrder (Lex (α ⊕ β))
Equations
- ⋯ = ⋯
instance
Sum.Lex.noMaxOrder_of_nonempty
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[NoMaxOrder β]
[Nonempty β]
:
NoMaxOrder (Lex (α ⊕ β))
Equations
- ⋯ = ⋯
instance
Sum.Lex.denselyOrdered_of_noMaxOrder
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[DenselyOrdered α]
[DenselyOrdered β]
[NoMaxOrder α]
:
DenselyOrdered (Lex (α ⊕ β))
Equations
- ⋯ = ⋯
instance
Sum.Lex.denselyOrdered_of_noMinOrder
{α : Type u_1}
{β : Type u_2}
[LT α]
[LT β]
[DenselyOrdered α]
[DenselyOrdered β]
[NoMinOrder β]
:
DenselyOrdered (Lex (α ⊕ β))
Equations
- ⋯ = ⋯
Order isomorphisms #
@[simp]
theorem
OrderIso.sumComm_apply
(α : Type u_4)
(β : Type u_5)
[LE α]
[LE β]
:
∀ (a : α ⊕ β), (OrderIso.sumComm α β) a = a.swap
Equiv.sumComm
promoted to an order isomorphism.
Equations
- OrderIso.sumComm α β = { toEquiv := Equiv.sumComm α β, map_rel_iff' := ⋯ }
Instances For
@[simp]
theorem
OrderIso.sumComm_symm
(α : Type u_4)
(β : Type u_5)
[LE α]
[LE β]
:
(OrderIso.sumComm α β).symm = OrderIso.sumComm β α
Equiv.sumAssoc
promoted to an order isomorphism.
Equations
- OrderIso.sumAssoc α β γ = { toEquiv := Equiv.sumAssoc α β γ, map_rel_iff' := ⋯ }
Instances For
@[simp]
theorem
OrderIso.sumDualDistrib_inl
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(a : α)
:
(OrderIso.sumDualDistrib α β) (OrderDual.toDual (Sum.inl a)) = Sum.inl (OrderDual.toDual a)
@[simp]
theorem
OrderIso.sumDualDistrib_inr
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(b : β)
:
(OrderIso.sumDualDistrib α β) (OrderDual.toDual (Sum.inr b)) = Sum.inr (OrderDual.toDual b)
@[simp]
theorem
OrderIso.sumDualDistrib_symm_inl
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(a : α)
:
(OrderIso.sumDualDistrib α β).symm (Sum.inl (OrderDual.toDual a)) = OrderDual.toDual (Sum.inl a)
@[simp]
theorem
OrderIso.sumDualDistrib_symm_inr
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(b : β)
:
(OrderIso.sumDualDistrib α β).symm (Sum.inr (OrderDual.toDual b)) = OrderDual.toDual (Sum.inr b)
@[simp]
theorem
OrderIso.sumLexDualAntidistrib_inl
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(a : α)
:
(OrderIso.sumLexDualAntidistrib α β) (OrderDual.toDual (Sum.inl a)) = Sum.inr (OrderDual.toDual a)
@[simp]
theorem
OrderIso.sumLexDualAntidistrib_inr
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(b : β)
:
(OrderIso.sumLexDualAntidistrib α β) (OrderDual.toDual (Sum.inr b)) = Sum.inl (OrderDual.toDual b)
@[simp]
theorem
OrderIso.sumLexDualAntidistrib_symm_inl
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(b : β)
:
(OrderIso.sumLexDualAntidistrib α β).symm (Sum.inl (OrderDual.toDual b)) = OrderDual.toDual (Sum.inr b)
@[simp]
theorem
OrderIso.sumLexDualAntidistrib_symm_inr
{α : Type u_1}
{β : Type u_2}
[LE α]
[LE β]
(a : α)
:
(OrderIso.sumLexDualAntidistrib α β).symm (Sum.inr (OrderDual.toDual a)) = OrderDual.toDual (Sum.inl a)
WithBot α
is order-isomorphic to PUnit ⊕ₗ α
, by sending ⊥
to Unit
and ↑a
to
a
.
Equations
- WithBot.orderIsoPUnitSumLex = { toEquiv := (Equiv.optionEquivSumPUnit α).trans ((Equiv.sumComm α PUnit.{?u.19 + 1} ).trans toLex), map_rel_iff' := ⋯ }
Instances For
@[simp]
theorem
WithBot.orderIsoPUnitSumLex_bot
{α : Type u_1}
[LE α]
:
WithBot.orderIsoPUnitSumLex ⊥ = toLex (Sum.inl PUnit.unit)
@[simp]
WithTop α
is order-isomorphic to α ⊕ₗ PUnit
, by sending ⊤
to Unit
and ↑a
to
a
.
Equations
- WithTop.orderIsoSumLexPUnit = { toEquiv := (Equiv.optionEquivSumPUnit α).trans toLex, map_rel_iff' := ⋯ }
Instances For
@[simp]
theorem
WithTop.orderIsoSumLexPUnit_top
{α : Type u_1}
[LE α]
:
WithTop.orderIsoSumLexPUnit ⊤ = toLex (Sum.inr PUnit.unit)
@[simp]