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.instIsAntisymmSumLiftRel
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsAntisymm α r]
[IsAntisymm β s]
:
IsAntisymm (α ⊕ β) (Sum.LiftRel r s)
Equations
- ⋯ = ⋯
instance
Sum.instIsAntisymmSumLex
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsAntisymm α r]
[IsAntisymm β s]
:
IsAntisymm (α ⊕ β) (Sum.Lex r s)
Equations
- ⋯ = ⋯
instance
Sum.instIsTrichotomousSumLex
{α : Type u_1}
{β : Type u_2}
(r : α → α → Prop)
(s : β → β → Prop)
[IsTrichotomous α r]
[IsTrichotomous β s]
:
IsTrichotomous (α ⊕ β) (Sum.Lex r s)
Equations
- ⋯ = ⋯
instance
Sum.instIsWellOrderSumLex
{α : 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 = let __src := Sum.instLESum; let __src_1 := Sum.instLTSum; 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.instPartialOrderSum
{α : Type u_1}
{β : Type u_2}
[PartialOrder α]
[PartialOrder β]
:
PartialOrder (α ⊕ β)
Equations
- Sum.instPartialOrderSum = let __src := Sum.instPreorderSum; 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 = let __src := Sum.Lex.preorder; PartialOrder.mk ⋯
instance
Sum.Lex.linearOrder
{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[LinearOrder β]
:
LinearOrder (Lex (α ⊕ β))
Equations
- Sum.Lex.linearOrder = let __src := Sum.Lex.partialOrder; LinearOrder.mk ⋯ Sum.instDecidableRelSumLex Sum.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_5)
(β : Type u_6)
[LE α]
[LE β]
:
∀ (a : α ⊕ β), (OrderIso.sumComm α β) a = Sum.swap a
Equiv.sumComm
promoted to an order isomorphism.
Equations
- OrderIso.sumComm α β = let __src := Equiv.sumComm α β; { toEquiv := __src, map_rel_iff' := ⋯ }
Instances For
@[simp]
theorem
OrderIso.sumComm_symm
(α : Type u_5)
(β : Type u_6)
[LE α]
[LE β]
:
OrderIso.symm (OrderIso.sumComm α β) = OrderIso.sumComm β α
Equiv.sumAssoc
promoted to an order isomorphism.
Equations
- OrderIso.sumAssoc α β γ = let __src := Equiv.sumAssoc α β γ; { toEquiv := __src, map_rel_iff' := ⋯ }
Instances For
@[simp]
theorem
OrderIso.sumAssoc_symm_apply_inl
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[LE α]
[LE β]
[LE γ]
(a : α)
:
(OrderIso.symm (OrderIso.sumAssoc α β γ)) (Sum.inl a) = Sum.inl (Sum.inl a)
@[simp]
theorem
OrderIso.sumAssoc_symm_apply_inr_inl
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[LE α]
[LE β]
[LE γ]
(b : β)
:
(OrderIso.symm (OrderIso.sumAssoc α β γ)) (Sum.inr (Sum.inl b)) = Sum.inl (Sum.inr b)
@[simp]
theorem
OrderIso.sumAssoc_symm_apply_inr_inr
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[LE α]
[LE β]
[LE γ]
(c : γ)
:
(OrderIso.symm (OrderIso.sumAssoc α β γ)) (Sum.inr (Sum.inr c)) = Sum.inr c
@[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.symm (OrderIso.sumDualDistrib α β)) (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.symm (OrderIso.sumDualDistrib α β)) (Sum.inr (OrderDual.toDual b)) = OrderDual.toDual (Sum.inr b)
Equiv.SumAssoc
promoted to an order isomorphism.
Equations
- OrderIso.sumLexAssoc α β γ = let __src := Equiv.sumAssoc α β γ; { toEquiv := __src, map_rel_iff' := ⋯ }
Instances For
@[simp]
theorem
OrderIso.sumLexAssoc_symm_apply_inl
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[LE α]
[LE β]
[LE γ]
(a : α)
:
(OrderIso.symm (OrderIso.sumLexAssoc α β γ)) (Sum.inl a) = Sum.inl (Sum.inl a)
@[simp]
theorem
OrderIso.sumLexAssoc_symm_apply_inr_inl
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[LE α]
[LE β]
[LE γ]
(b : β)
:
(OrderIso.symm (OrderIso.sumLexAssoc α β γ)) (Sum.inr (Sum.inl b)) = Sum.inl (Sum.inr b)
@[simp]
theorem
OrderIso.sumLexAssoc_symm_apply_inr_inr
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[LE α]
[LE β]
[LE γ]
(c : γ)
:
(OrderIso.symm (OrderIso.sumLexAssoc α β γ)) (Sum.inr (Sum.inr c)) = Sum.inr c
OrderDual
is antidistributive over ⊕ₗ
up to an order isomorphism.
Equations
- OrderIso.sumLexDualAntidistrib α β = let __src := Equiv.sumComm α β; { toEquiv := __src, map_rel_iff' := ⋯ }
Instances For
@[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.symm (OrderIso.sumLexDualAntidistrib α β)) (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.symm (OrderIso.sumLexDualAntidistrib α β)) (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_5 + 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]
theorem
WithBot.orderIsoPUnitSumLex_symm_inl
{α : Type u_1}
[LE α]
(x : PUnit.{u_5 + 1} )
:
(OrderIso.symm WithBot.orderIsoPUnitSumLex) (toLex (Sum.inl x)) = ⊥
@[simp]
theorem
WithBot.orderIsoPUnitSumLex_symm_inr
{α : Type u_1}
[LE α]
(a : α)
:
(OrderIso.symm WithBot.orderIsoPUnitSumLex) (toLex (Sum.inr a)) = ↑a
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]
theorem
WithTop.orderIsoSumLexPUnit_symm_inr
{α : Type u_1}
[LE α]
(x : PUnit.{u_5 + 1} )
:
(OrderIso.symm WithTop.orderIsoSumLexPUnit) (toLex (Sum.inr x)) = ⊤
@[simp]
theorem
WithTop.orderIsoSumLexPUnit_symm_inl
{α : Type u_1}
[LE α]
(a : α)
:
(OrderIso.symm WithTop.orderIsoSumLexPUnit) (toLex (Sum.inl a)) = ↑a