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.
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 #
DenselyOrdered: An order with no gap, i.e. for any two elementsa < bthere existscsuch 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
Tags #
preorder, order, partial order, poset, linear order, chain
Bare relations #
Alias of le_of_le_of_eq.
Alias of le_of_eq_of_le.
Alias of lt_of_lt_of_eq.
Alias of lt_of_eq_of_lt.
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
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
Instances For
The preimage of a decidable order is decidable.
Equations
Preorders #
Alias of lt_of_le_of_lt.
Alias of lt_of_lt_of_le.
Alias of lt_of_le_not_ge.
See if the term is a < b and the goal is a ≤ b.
Equations
Instances For
Partial order #
Alias of le_antisymm.
Alias of lt_of_le_of_ne.
Alias of Decidable.lt_or_eq_of_le.
Alias of Decidable.eq_or_lt_of_le.
Alias of lt_or_eq_of_le.
Alias of eq_or_lt_of_le.
Alias of eq_of_le_of_not_lt.
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.
A version of ne_iff_lt_or_gt with LHS and RHS reversed.
min/max recursors #
Implications #
A symmetric relation implies two values are equal, when it implies they're less-equal.
Extensionality lemmas #
Equations
Order instances on the function space #
Equations
Equations
Alias of le_of_strongLT.
Alias of lt_of_strongLT.
Alias of strongLT_of_strongLT_of_le.
Pullbacks of order instances #
Pull back a Preorder instance along an injective function.
See note [reducible non-instances].
Equations
Instances For
Pull back a PartialOrder instance along an injective function.
See note [reducible non-instances].
Equations
Instances For
Pull back a LinearOrder instance along an injective function.
See note [reducible non-instances].
Equations
Instances For
Lifts of order instances #
Unlike the constructions above, these construct new data fields. They should be avoided if the types already define any order or decidability instances.
Transfer a Preorder on β to a Preorder on α using a function f : α → β.
See also Function.Injective.preorder when only the proof fields need to be transferred.
See note [reducible non-instances].
Equations
Instances For
Transfer a PartialOrder on β to a PartialOrder on α using an injective
function f : α → β.
See also Function.Injective.partialOrder when only the proof fields need to be transferred.
See note [reducible non-instances].
Equations
Instances For
Transfer a LinearOrder on β to a LinearOrder on α using an injective
function f : α → β. This version takes [Max α] and [Min α] 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 also Function.Injective.linearOrder when only the proof fields need to be transferred.
See note [reducible non-instances].
Equations
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 [Max α] and [Min α], 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
Instances For
Transfer a LinearOrder on β to a LinearOrder on α using an injective
function f : α → β. This version takes [Max α] and [Min α] 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
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
Instances For
Subtype of an order #
Equations
Equations
Equations
Equations
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
Pointwise order on α × β #
The lexicographic order is defined in Data.Prod.Lex, and the instances are available via the
type synonym α ×ₗ β = α × β.
Equations
Equations
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
Additional order classes #
An order is dense if there is an element between any pair of distinct comparable elements.
An order is dense if there is an element between any pair of distinct elements.
Instances
Any ordered subsingleton is densely ordered. Not an instance to avoid a heavy subsingleton typeclass search.
Construct the trivial linear order on any type with at most one element.
Equations
Instances For
Propositions form a complete Boolean algebra, where the ≤ relation is given by implication.
Equations
Type synonym to create an instance of LinearOrder from a PartialOrder and IsTotal α (≤).
Do not use this: instead, build a LinearOrder instance directly.