Basic definitions about ≤
and <
#
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file proves basic results about orders, provides extensive dot notation, defines useful order classes and allows to transfer order instances.
Type synonyms #
order_dual α
: A type synonym reversing the meaning of all inequalities, with notationαᵒᵈ
.as_linear_order α
: A type synonym to promotepartial_order α
tolinear_order α
usingis_total α (≤)
.
Transfering orders #
order.preimage
,preorder.lift
: Transfers a (pre)order onβ
to an order onα
using a functionf : α → β
.partial_order.lift
,linear_order.lift
: Transfers a partial (resp., linear) order onβ
to a partial (resp., linear) order onα
using an injective functionf
.
Extra class #
has_sup
: type class for the⊔
notationhas_inf
: type class for the⊓
notationhas_compl
: type class for theᶜ
notationdensely_ordered
: 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 ≤
(has_le.le
) and <
(has_lt.lt
). To that end, we
provide many aliases to dot notation-less lemmas. For example, le_trans
is aliased with
has_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 has_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 le_antisymm
.
Alias of ge_antisymm
.
Alias of lt_of_le_of_ne
.
Alias of lt_of_le_of_ne'
.
Alias of lt_or_eq_of_le
.
Alias of decidable.lt_or_eq_of_le
.
Alias of lt_of_lt_of_le
.
Alias of le_of_le_of_eq
.
Alias of lt_of_lt_of_eq
.
Alias of le_of_eq_of_le
.
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.
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 rel_embedding
(assuming f
is injective).
Instances for order.preimage
The preimage of a decidable order is decidable.
Equations
- order.preimage.decidable f s = λ (x y : α), H (f x) (f y)
Order dual #
Type synonym to equip a type with the dual order: ≤
means ≥
and <
means >
. αᵒᵈ
is
notation for order_dual α
.
Instances for order_dual
- order_dual.well_founded_gt
- order_dual.well_founded_lt
- order_dual.seminormed_group
- order_dual.seminormed_add_group
- order_dual.seminormed_comm_group
- order_dual.seminormed_add_comm_group
- order_dual.normed_group
- order_dual.normed_add_group
- order_dual.normed_comm_group
- order_dual.normed_add_comm_group
- order_dual.nonempty
- order_dual.subsingleton
- order_dual.has_le
- order_dual.has_lt
- order_dual.preorder
- order_dual.partial_order
- order_dual.linear_order
- order_dual.inhabited
- order_dual.densely_ordered
- order_dual.nontrivial
- order_dual.has_one
- order_dual.has_zero
- order_dual.has_mul
- order_dual.has_add
- order_dual.has_inv
- order_dual.has_neg
- order_dual.has_div
- order_dual.has_sub
- order_dual.has_smul
- order_dual.has_vadd
- order_dual.has_smul'
- order_dual.has_vadd'
- order_dual.has_pow
- order_dual.has_pow'
- order_dual.semigroup
- order_dual.add_semigroup
- order_dual.comm_semigroup
- order_dual.add_comm_semigroup
- order_dual.left_cancel_semigroup
- order_dual.left_cancel_add_semigroup
- order_dual.right_cancel_semigroup
- order_dual.right_cancel_add_semigroup
- order_dual.mul_one_class
- order_dual.add_zero_class
- order_dual.monoid
- order_dual.add_monoid
- order_dual.comm_monoid
- order_dual.add_comm_monoid
- order_dual.left_cancel_monoid
- order_dual.left_cancel_add_monoid
- order_dual.right_cancel_monoid
- order_dual.right_cancel_add_monoid
- order_dual.cancel_monoid
- order_dual.cancel_add_monoid
- order_dual.cancel_comm_monoid
- order_dual.cancel_add_comm_monoid
- order_dual.has_involutive_inv
- order_dual.has_involutive_neg
- order_dual.div_inv_monoid
- order_dual.sub_neg_add_monoid
- order_dual.division_monoid
- order_dual.subtraction_monoid
- order_dual.division_comm_monoid
- order_dual.subtraction_comm_monoid
- order_dual.group
- order_dual.add_group
- order_dual.comm_group
- order_dual.add_comm_group
- order_dual.mul_zero_class
- order_dual.mul_zero_one_class
- order_dual.no_zero_divisors
- order_dual.semigroup_with_zero
- order_dual.monoid_with_zero
- order_dual.cancel_monoid_with_zero
- order_dual.comm_monoid_with_zero
- order_dual.cancel_comm_monoid_with_zero
- order_dual.group_with_zero
- order_dual.comm_group_with_zero
- order_dual.no_bot_order
- order_dual.no_top_order
- order_dual.no_min_order
- order_dual.no_max_order
- order_dual.is_total_le
- gt.is_well_order
- has_lt.lt.is_well_order
- order_dual.has_sup
- order_dual.has_inf
- order_dual.semilattice_sup
- order_dual.semilattice_inf
- order_dual.lattice
- order_dual.distrib_lattice
- order_dual.has_top
- order_dual.has_bot
- order_dual.order_top
- order_dual.order_bot
- order_dual.bounded_order
- complemented_lattice.order_dual.complemented_lattice
- order_dual.generalized_coheyting_algebra
- order_dual.generalized_heyting_algebra
- order_dual.coheyting_algebra
- order_dual.heyting_algebra
- order_dual.boolean_algebra
- order_dual.contravariant_class_mul_le
- order_dual.contravariant_class_add_le
- order_dual.covariant_class_mul_le
- order_dual.covariant_class_add_le
- order_dual.contravariant_class_swap_mul_le
- order_dual.contravariant_class_swap_add_le
- order_dual.covariant_class_swap_mul_le
- order_dual.covariant_class_swap_add_le
- order_dual.contravariant_class_mul_lt
- order_dual.contravariant_class_add_lt
- order_dual.covariant_class_mul_lt
- order_dual.covariant_class_add_lt
- order_dual.contravariant_class_swap_mul_lt
- order_dual.contravariant_class_swap_add_lt
- order_dual.covariant_class_swap_mul_lt
- order_dual.covariant_class_swap_add_lt
- order_dual.ordered_comm_monoid
- order_dual.ordered_add_comm_monoid
- order_dual.ordered_cancel_comm_monoid.to_contravariant_class
- ordered_cancel_add_comm_monoid.to_contravariant_class
- order_dual.ordered_cancel_comm_monoid
- order_dual.ordered_cancel_add_comm_monoid
- order_dual.linear_ordered_cancel_comm_monoid
- order_dual.linear_ordered_cancel_add_comm_monoid
- order_dual.linear_ordered_comm_monoid
- order_dual.linear_ordered_add_comm_monoid
- order_dual.ordered_comm_group
- order_dual.ordered_add_comm_group
- order_dual.linear_ordered_comm_group
- order_dual.linear_ordered_add_comm_group
- order_dual.has_nat_cast
- order_dual.add_monoid_with_one
- order_dual.add_comm_monoid_with_one
- order_dual.has_int_cast
- order_dual.add_group_with_one
- order_dual.add_comm_group_with_one
- order_dual.has_rat_cast
- order_dual.division_semiring
- order_dual.division_ring
- order_dual.semifield
- order_dual.field
- order_dual.has_Sup
- order_dual.has_Inf
- order_dual.complete_lattice
- order_dual.complete_linear_order
- order_dual.is_directed_ge
- order_dual.is_directed_le
- order_dual.coframe
- order_dual.frame
- order_dual.complete_distrib_lattice
- order_dual.fintype
- order_dual.finite
- order_dual.is_weak_lower_modular_lattice
- order_dual.is_weak_upper_modular_lattice
- order_dual.is_lower_modular_lattice
- order_dual.is_upper_modular_lattice
- order_dual.is_modular_lattice
- is_atomic.is_coatomic_dual
- is_coatomic.is_coatomic
- is_atomistic.is_coatomistic_dual
- is_coatomistic.is_atomistic_dual
- order_dual.is_simple_order
- order_dual.conditionally_complete_lattice
- order_dual.conditionally_complete_linear_order
- order_dual.locally_finite_order
- order_dual.locally_finite_order_bot
- order_dual.locally_finite_order_top
- order_dual.pred_order
- order_dual.succ_order
- order_dual.is_pred_archimedean
- order_dual.is_succ_archimedean
- order_dual.topological_space
- order_dual.discrete_topology
- order_dual.topological_space.first_countable_topology
- order_dual.topological_space.second_countable_topology
- order_dual.order_closed_topology
- order_dual.order_topology
- order_dual.archimedean
- order_dual.has_continuous_const_smul
- order_dual.has_continuous_const_vadd
- order_dual.has_continuous_const_smul'
- order_dual.has_continuous_const_vadd'
- order_dual.has_continuous_mul
- order_dual.has_continuous_add
- order_dual.Sup_convergence_class
- order_dual.Inf_convergence_class
- order_dual.smul_with_zero
- order_dual.mul_action
- order_dual.mul_action_with_zero
- order_dual.distrib_mul_action
- order_dual.ordered_smul
- order_dual.module
- order_dual.has_edist
- order_dual.pseudo_emetric_space
- order_dual.emetric_space
- order_dual.bornology
- order_dual.bounded_space
- order_dual.has_dist
- order_dual.pseudo_metric_space
- order_dual.metric_space
- order_dual.proper_space
- order_dual.has_lipschitz_mul
- order_dual.has_lipschitz_add
- order_dual.has_norm
- order_dual.has_nnnorm
- order_dual.normed_ordered_group
- order_dual.normed_ordered_add_group
- order_dual.normed_linear_ordered_group
- order_dual.normed_linear_ordered_add_group
Equations
- order_dual.preorder α = {le := has_le.le (order_dual.has_le α), lt := has_lt.lt (order_dual.has_lt α), le_refl := _, le_trans := _, lt_iff_le_not_le := _}
Equations
- order_dual.partial_order α = {le := preorder.le (order_dual.preorder α), lt := preorder.lt (order_dual.preorder α), le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _}
Equations
- order_dual.linear_order α = {le := partial_order.le (order_dual.partial_order α), lt := partial_order.lt (order_dual.partial_order α), le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := infer_instance (λ (a b : α), has_le.le.decidable b a), decidable_eq := decidable_eq_of_decidable_le infer_instance, decidable_lt := infer_instance (λ (a b : α), has_lt.lt.decidable b a), max := linear_order.min _inst_1, max_def := _, min := linear_order.max _inst_1, min_def := _}
Equations
- compl : α → α
Set / lattice complement
Instances of this typeclass
Instances of other typeclasses for has_compl
- has_compl.has_sizeof_inst
Equations
- Prop.has_compl = {compl := not}
Order instances on the function space #
Equations
- pi.partial_order = {le := preorder.le pi.preorder, lt := preorder.lt pi.preorder, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _}
min
/max
recursors #
Typeclass for the ⊔
(\lub
) notation
Instances of this typeclass
- semilattice_sup.to_has_sup
- order_dual.has_sup
- pi.has_sup
- prod.has_sup
- complementeds.has_sup
- rat.has_sup
- top_hom.has_sup
- bot_hom.has_sup
- sup_hom.has_sup
- sup_bot_hom.has_sup
- order_hom.has_sup
- part_enat.has_sup
- associates.has_sup
- upper_set.has_sup
- lower_set.has_sup
- cau_seq.has_sup
- real.has_sup
- group_seminorm.has_sup
- add_group_seminorm.has_sup
- nonarch_add_group_seminorm.has_sup
- group_norm.has_sup
- add_group_norm.has_sup
- nonarch_add_group_norm.has_sup
- topological_space.open_nhds_of.has_sup
- seminorm.has_sup
Instances of other typeclasses for has_sup
- has_sup.has_sizeof_inst
Typeclass for the ⊓
(\glb
) notation
Instances of this typeclass
- semilattice_inf.to_has_inf
- order_dual.has_inf
- pi.has_inf
- prod.has_inf
- complementeds.has_inf
- rat.has_inf
- top_hom.has_inf
- bot_hom.has_inf
- inf_hom.has_inf
- inf_top_hom.has_inf
- setoid.has_inf
- subsemigroup.has_inf
- add_subsemigroup.has_inf
- submonoid.has_inf
- add_submonoid.has_inf
- subgroup.has_inf
- add_subgroup.has_inf
- submodule.has_inf
- subsemiring.has_inf
- subring.has_inf
- order_hom.has_inf
- linear_pmap.has_inf
- associates.has_inf
- filter.has_inf
- upper_set.has_inf
- lower_set.has_inf
- uniform_space.has_inf
- group_topology.has_inf
- add_group_topology.has_inf
- subfield.has_inf
- cau_seq.has_inf
- real.has_inf
- group_seminorm.has_inf
- add_group_seminorm.has_inf
- topological_space.open_nhds_of.has_inf
- seminorm.has_inf
Instances of other typeclasses for has_inf
- has_inf.has_sizeof_inst
Lifts of order instances #
Transfer a partial_order
on β
to a partial_order
on α
using an injective
function f : α → β
. See note [reducible non-instances].
Equations
- partial_order.lift f inj = {le := preorder.le (preorder.lift f), lt := preorder.lt (preorder.lift f), le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _}
Transfer a linear_order
on β
to a linear_order
on α
using an injective
function f : α → β
. This version takes [has_sup α]
and [has_inf α]
as arguments, then uses
them for max
and min
fields. See linear_order.lift'
for a version that autogenerates min
and
max
fields. See note [reducible non-instances].
Equations
- linear_order.lift f inj hsup hinf = {le := partial_order.le (partial_order.lift f inj), lt := partial_order.lt (partial_order.lift f inj), le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := λ (x y : α), infer_instance, decidable_eq := λ (x y : α), decidable_of_iff (f x = f y) _, decidable_lt := λ (x y : α), infer_instance, max := has_sup.sup _inst_2, max_def := _, min := has_inf.inf _inst_3, min_def := _}
Transfer a linear_order
on β
to a linear_order
on α
using an injective
function f : α → β
. This version autogenerates min
and max
fields. See linear_order.lift
for a version that takes [has_sup α]
and [has_inf α]
, then uses them as max
and min
.
See note [reducible non-instances].
Equations
- linear_order.lift' f inj = linear_order.lift f inj _ _
Subtype of an order #
Equations
Equations
Equations
- subtype.decidable_le = λ (a b : subtype p), h ↑a ↑b
Equations
- subtype.decidable_lt = λ (a b : subtype p), 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
Pointwise order on α × β
#
The lexicographic order is defined in data.prod.lex
, and the instances are available via the
type synonym α ×ₗ β = α × β
.
The pointwise partial order on a product.
(The lexicographic ordering is defined in order/lexicographic.lean, and the instances are
available via the type synonym α ×ₗ β = α × β
.)
Equations
- prod.partial_order α β = {le := preorder.le (prod.preorder α β), lt := preorder.lt (prod.preorder α β), le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _}
Additional order classes #
An order is dense if there is an element between any pair of distinct comparable elements.
Instances of this typeclass
- linear_ordered_semifield.to_densely_ordered
- order_dual.densely_ordered
- prod.densely_ordered
- pi.densely_ordered
- punit.densely_ordered
- with_bot.densely_ordered
- with_top.densely_ordered
- pi.lex.densely_ordered
- set.densely_ordered
- prod.lex.lex.densely_ordered
- sum.densely_ordered
- sum.lex.densely_ordered_of_no_max_order
- sum.lex.densely_ordered_of_no_min_order
- nonneg.densely_ordered
- nnreal.densely_ordered
- ennreal.densely_ordered
- normed_field.densely_ordered_range_norm
- normed_field.densely_ordered_range_nnnorm
Equations
- punit.linear_order = {le := λ (_x _x : punit), true, lt := λ (_x _x : punit), false, le_refl := punit.linear_order._proof_1, le_trans := punit.linear_order._proof_2, lt_iff_le_not_le := punit.linear_order._proof_3, le_antisymm := punit.linear_order._proof_4, le_total := punit.linear_order._proof_5, decidable_le := λ (_x _x : punit), decidable.true, decidable_eq := punit.decidable_eq, decidable_lt := λ (_x _x : punit), decidable.false, max := λ (_x _x : punit), punit.star, max_def := punit.linear_order._proof_6, min := λ (_x _x : punit), punit.star, min_def := punit.linear_order._proof_7}
Propositions form a complete boolean algebra, where the ≤
relation is given by implication.
Equations
- Prop.has_le = {le := λ (_x _y : Prop), _x → _y}
Equations
- Prop.partial_order = {le := has_le.le Prop.has_le, lt := preorder.lt._default has_le.le, le_refl := Prop.partial_order._proof_1, le_trans := Prop.partial_order._proof_2, lt_iff_le_not_le := Prop.partial_order._proof_3, le_antisymm := Prop.partial_order._proof_4}
Linear order from a total partial order #
Type synonym to create an instance of linear_order
from a partial_order
and
is_total α (≤)
Equations
- as_linear_order α = α
Instances for as_linear_order
Equations
- as_linear_order.inhabited = {default := inhabited.default _inst_1}
Equations
- as_linear_order.linear_order = {le := partial_order.le _inst_1, lt := partial_order.lt _inst_1, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := classical.dec_rel has_le.le, decidable_eq := decidable_eq_of_decidable_le (classical.dec_rel has_le.le), decidable_lt := decidable_lt_of_decidable_le (classical.dec_rel has_le.le), max := max_default (λ (a b : as_linear_order α), classical.dec_rel has_le.le a b), max_def := _, min := min_default (λ (a b : as_linear_order α), classical.dec_rel has_le.le a b), min_def := _}