Basic definitions about ≤
and <
#
This file proves basic results about orders, provides extensive dot notation, defines useful order classes and allows to transfer order instances.
Type synonyms #
OrderDual α
: A type synonym reversing the meaning of all inequalities, with notationαᵒᵈ
.AsLinearOrder α
: A type synonym to promotePartialOrder α
toLinearOrder α
usingIsTotal α (≤)
.
Transferring orders #
Order.Preimage
,Preorder.lift
: Transfers a (pre)order onβ
to an order onα
using a functionf : α → β
.PartialOrder.lift
,LinearOrder.lift
: Transfers a partial (resp., linear) order onβ
to a partial (resp., linear) order onα
using an injective functionf
.
Extra class #
Sup
: type class for the⊔
notationInf
: type class for the⊓
notationHasCompl
: type class for theᶜ
notationDenselyOrdered
: An order with no gap, i.e. for any two elementsa < b
there existsc
such thata < c < b
.
Notes #
≤
and <
are highly favored over ≥
and >
in mathlib. The reason is that we can formulate all
lemmas using ≤
/<
, and rw
has trouble unifying ≤
and ≥
. Hence choosing one direction spares
us useless duplication. This is enforced by a linter. See Note [nolint_ge] for more infos.
Dot notation is particularly useful on ≤
(LE.le
) and <
(LT.lt
). To that end, we
provide many aliases to dot notation-less lemmas. For example, le_trans
is aliased with
LE.le.trans
and can be used to construct hab.trans hbc : a ≤ c
when hab : a ≤ b
,
hbc : b ≤ c
, lt_of_le_of_lt
is aliased as LE.le.trans_lt
and can be used to construct
hab.trans hbc : a < c
when hab : a ≤ b
, hbc : b < c
.
TODO #
- expand module docs
- automatic construction of dual definitions / theorems
Tags #
preorder, order, partial order, poset, linear order, chain
Alias of lt_of_le_of_lt
.
Alias of lt_of_le_of_lt'
.
Alias of le_antisymm
.
Alias of ge_antisymm
.
Alias of lt_of_le_of_ne
.
Alias of lt_of_le_of_ne'
.
Alias of lt_of_le_not_le
.
Alias of lt_or_eq_of_le
.
Alias of Decidable.lt_or_eq_of_le
.
Alias of lt_of_lt_of_le
.
Alias of lt_of_lt_of_le'
.
Alias of le_of_le_of_eq
.
Alias of le_of_le_of_eq'
.
Alias of lt_of_lt_of_eq
.
Alias of lt_of_lt_of_eq'
.
Alias of le_of_eq_of_le
.
Alias of le_of_eq_of_le'
.
Alias of lt_of_eq_of_lt
.
Alias of lt_of_eq_of_lt'
.
Alias of not_le_of_lt
.
Alias of not_lt_of_le
.
Alias of Decidable.eq_or_lt_of_le
.
Alias of eq_or_lt_of_le
.
Alias of eq_or_gt_of_le
.
Alias of gt_or_eq_of_le
.
Alias of eq_of_le_of_not_lt
.
Alias of eq_of_ge_of_not_gt
.
A version of ne_iff_lt_or_gt
with LHS and RHS reversed.
A symmetric relation implies two values are equal, when it implies they're less-equal.
To prove commutativity of a binary operation ○
, we only to check a ○ b ≤ b ○ a
for all a
,
b
.
To prove associativity of a commutative binary operation ○
, we only to check
(a ○ b) ○ c ≤ a ○ (b ○ c)
for all a
, b
, c
.
Given a relation R
on β
and a function f : α → β
, the preimage relation on α
is defined
by x ≤ y ↔ f x ≤ f y
. It is the unique relation on α
making f
a RelEmbedding
(assuming f
is injective).
Instances For
Given a relation R
on β
and a function f : α → β
, the preimage relation on α
is defined
by x ≤ y ↔ f x ≤ f y
. It is the unique relation on α
making f
a RelEmbedding
(assuming f
is injective).
Equations
- «term_⁻¹'o_» = Lean.ParserDescr.trailingNode `term_⁻¹'o_ 80 80 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⁻¹'o ") (Lean.ParserDescr.cat `term 81))
Instances For
The preimage of a decidable order is decidable.
Equations
- Order.Preimage.decidable f s x x = H (f x) (f x)
Order dual #
Type synonym to equip a type with the dual order: ≤
means ≥
and <
means >
. αᵒᵈ
is
notation for OrderDual α
.
Equations
- «term_ᵒᵈ» = Lean.ParserDescr.trailingNode `term_ᵒᵈ 1024 0 (Lean.ParserDescr.symbol "ᵒᵈ")
Instances For
Equations
- (_ : Subsingleton αᵒᵈ) = h
Equations
- OrderDual.instLEOrderDual α = { le := fun x y => y ≤ x }
Equations
- OrderDual.instLTOrderDual α = { lt := fun x y => y < x }
Equations
- OrderDual.instPreorder α = Preorder.mk (_ : ∀ (x : αᵒᵈ), x ≤ x) (_ : ∀ (x x_1 x_2 : αᵒᵈ), x ≤ x_1 → x_1 ≤ x_2 → x_2 ≤ x)
Equations
- OrderDual.instPartialOrder α = let src := inferInstanceAs (Preorder αᵒᵈ); PartialOrder.mk (_ : ∀ (a b : αᵒᵈ), a ≤ b → b ≤ a → a = b)
Equations
- OrderDual.instLinearOrder α = let src := inferInstanceAs (PartialOrder αᵒᵈ); LinearOrder.mk (_ : ∀ (a b : α), b ≤ a ∨ a ≤ b) inferInstance decidableEqOfDecidableLE inferInstance
Set / lattice complement
Equations
- «term_ᶜ» = Lean.ParserDescr.trailingNode `term_ᶜ 1024 1024 (Lean.ParserDescr.symbol "ᶜ")
Instances For
Equations
Equations
Order instances on the function space #
Equations
- Pi.preorder = let src := inferInstanceAs (LE ((i : ι) → α i)); Preorder.mk (_ : ∀ (a : (i : ι) → α i) (i : ι), a i ≤ a i) (_ : ∀ (a b c : (i : ι) → α i), a ≤ b → b ≤ c → ∀ (i : ι), a i ≤ c i)
Equations
- Pi.partialOrder = let src := Pi.preorder; PartialOrder.mk (_ : ∀ (x x_1 : (i : ι) → π i), x ≤ x_1 → x_1 ≤ x → x = x_1)
Alias of le_of_strongLT
.
Alias of lt_of_strongLT
.
Alias of strongLT_of_strongLT_of_le
.
Alias of strongLT_of_le_of_strongLT
.
min
/max
recursors #
Least upper bound (\lub
notation)
Equations
- «term_⊔_» = Lean.ParserDescr.trailingNode `term_⊔_ 68 68 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊔ ") (Lean.ParserDescr.cat `term 69))
Instances For
Greatest lower bound (\glb
notation)
Equations
- «term_⊓_» = Lean.ParserDescr.trailingNode `term_⊓_ 69 69 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊓ ") (Lean.ParserDescr.cat `term 70))
Instances For
Lifts of order instances #
Transfer a Preorder
on β
to a Preorder
on α
using a function f : α → β
.
See note [reducible non-instances].
Equations
- Preorder.lift f = Preorder.mk (_ : ∀ (x : α), f x ≤ f x) (_ : ∀ (x x_1 x_2 : α), f x ≤ f x_1 → f x_1 ≤ f x_2 → f x ≤ f x_2)
Instances For
Transfer a PartialOrder
on β
to a PartialOrder
on α
using an injective
function f : α → β
. See note [reducible non-instances].
Equations
- PartialOrder.lift f inj = let src := Preorder.lift f; PartialOrder.mk (_ : ∀ (x x_1 : α), x ≤ x_1 → x_1 ≤ x → x = x_1)
Instances For
Transfer a LinearOrder
on β
to a LinearOrder
on α
using an injective
function f : α → β
. This version takes [Sup α]
and [Inf α]
as arguments, then uses
them for max
and min
fields. See LinearOrder.lift'
for a version that autogenerates min
and
max
fields, and LinearOrder.liftWithOrd
for one that does not auto-generate compare
fields. See note [reducible non-instances].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Transfer a LinearOrder
on β
to a LinearOrder
on α
using an injective
function f : α → β
. This version autogenerates min
and max
fields. See LinearOrder.lift
for a version that takes [Sup α]
and [Inf α]
, then uses them as max
and min
. See
LinearOrder.liftWithOrd'
for a version which does not auto-generate compare
fields.
See note [reducible non-instances].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Transfer a LinearOrder
on β
to a LinearOrder
on α
using an injective
function f : α → β
. This version takes [Sup α]
and [Inf α]
as arguments, then uses
them for max
and min
fields. It also takes [Ord α]
as an argument and uses them for compare
fields. See LinearOrder.lift
for a version that autogenerates compare
fields, and
LinearOrder.liftWithOrd'
for one that auto-generates min
and max
fields.
fields. See note [reducible non-instances].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Transfer a LinearOrder
on β
to a LinearOrder
on α
using an injective
function f : α → β
. This version auto-generates min
and max
fields. It also takes [Ord α]
as an argument and uses them for compare
fields. See LinearOrder.lift
for a version that
autogenerates compare
fields, and LinearOrder.liftWithOrd
for one that doesn't auto-generate
min
and max
fields. fields. See note [reducible non-instances].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Subtype of an order #
Equations
- Subtype.preorder p = Preorder.lift fun a => ↑a
Equations
- Subtype.partialOrder p = PartialOrder.lift (fun a => ↑a) (_ : Function.Injective fun a => ↑a)
Equations
- Subtype.decidableLE a b = h ↑a ↑b
Equations
- Subtype.decidableLT a b = h ↑a ↑b
A subtype of a linear order is a linear order. We explicitly give the proofs of decidable equality and decidable order in order to ensure the decidability instances are all definitionally equal.
Equations
- One or more equations did not get rendered due to their size.
Pointwise order on α × β
#
The lexicographic order is defined in Data.Prod.Lex
, and the instances are available via the
type synonym α ×ₗ β = α × β
.
Equations
- Prod.instPreorderProd α β = let src := inferInstanceAs (LE (α × β)); Preorder.mk (_ : ∀ (x : α × β), x ≤ x) (_ : ∀ (x x_1 x_2 : α × β), x ≤ x_1 → x_1 ≤ x_2 → x ≤ x_2)
The pointwise partial order on a product.
(The lexicographic ordering is defined in Order.Lexicographic
, and the instances are
available via the type synonym α ×ₗ β = α × β
.)
Equations
- Prod.instPartialOrder α β = let src := inferInstanceAs (Preorder (α × β)); PartialOrder.mk (_ : ∀ (x x_1 : α × β), x ≤ x_1 → x_1 ≤ x → x = x_1)
Additional order classes #
Equations
- One or more equations did not get rendered due to their size.
Equations
Linear order from a total partial order #
Type synonym to create an instance of LinearOrder
from a PartialOrder
and IsTotal α (≤)
Equations
- AsLinearOrder α = α
Instances For
Equations
- instInhabitedAsLinearOrder = { default := default }
Equations
- One or more equations did not get rendered due to their size.