Orders #
Defines classes for preorders, partial orders, and linear orders and proves some basic lemmas about them.
Unbundled classes #
IsAntisymm X r
means the binary relation r
on X
is antisymmetric.
- antisymm : ∀ (a b : α), r a b → r b a → a = b
Instances
Equations
- ⋯ = ⋯
IsPreorder X r
means that the binary relation r
on X
is a pre-order, that is, reflexive
and transitive.
Instances
IsPartialOrder X r
means that the binary relation r
on X
is a partial order, that is,
IsPreorder X r
and IsAntisymm X r
.
Instances
IsLinearOrder X r
means that the binary relation r
on X
is a linear order, that is,
IsPartialOrder X r
and IsTotal X r
.
Instances
IsStrictWeakOrder X lt
means that the binary relation lt
on X
is a strict weak order,
that is, IsStrictOrder X lt
and ¬lt a b ∧ ¬lt b a → ¬lt b c ∧ ¬lt c b → ¬lt a c ∧ ¬lt c a
.
- trans : ∀ (a b c : α), lt a b → lt b c → lt a c
Instances
IsTrichotomous X lt
means that the binary relation lt
on X
is trichotomous, that is,
either lt a b
or a = b
or lt b a
for any a
and b
.
Instances
IsStrictTotalOrder X lt
means that the binary relation lt
on X
is a strict total order,
that is, IsTrichotomous X lt
and IsStrictOrder X lt
.
- trichotomous : ∀ (a b : α), lt a b ∨ a = b ∨ lt b a
- trans : ∀ (a b c : α), lt a b → lt b c → lt a c
Instances
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
IsTrans
as a definition, suitable for use in proofs.
Equations
- Transitive r = ∀ ⦃x y z : α⦄, r x y → r y z → r x z
Instances For
IsIrrefl
as a definition, suitable for use in proofs.
Equations
- Irreflexive r = ∀ (x : α), ¬r x x
Instances For
IsAntisymm
as a definition, suitable for use in proofs.
Equations
- AntiSymmetric r = ∀ ⦃x y : α⦄, r x y → r y x → x = y
Instances For
Minimal and maximal #
Bundled classes #
A preorder is a reflexive, transitive relation ≤
with a < b
defined in the obvious way.
- le_refl : ∀ (a : α), a ≤ a
Instances
Alias of not_le_of_lt
.
Alias of not_lt_of_le
.
<
is decidable if ≤
is.
Equations
Instances For
Definition of PartialOrder
and lemmas about types with a partial order #
A partial order is a reflexive, transitive, antisymmetric relation ≤
.
Instances
Alias of le_antisymm
.
Equality is decidable if ≤
is.
Equations
Instances For
Definition of LinearOrder
and lemmas about types with a linear order #
This attempts to prove that a given instance of compare
is equal to compareOfLessAndEq
by
introducing the arguments and trying the following approaches in order:
- seeing if
rfl
works - seeing if the
compare
at hand is nonetheless essentiallycompareOfLessAndEq
, but, because of implicit arguments, requires us to unfold the defs and split theif
s in the definition ofcompareOfLessAndEq
- seeing if we can split by cases on the arguments, then see if the defs work themselves out
(useful when
compare
is defined via amatch
statement, as it is forBool
)
Equations
- tacticCompareOfLessAndEq_rfl = Lean.ParserDescr.node `tacticCompareOfLessAndEq_rfl 1024 (Lean.ParserDescr.nonReservedSymbol "compareOfLessAndEq_rfl" false)
Instances For
A linear order is reflexive, transitive, antisymmetric and total relation ≤
.
We assume that every linear ordered type has decidable (≤)
, (<)
, and (=)
.
- le_antisymm : ∀ (a b : α), a ≤ b → b ≤ a → a = b
- min : α → α → α
- max : α → α → α
A linear order is total.
- decidableLE : DecidableRel fun (x1 x2 : α) => x1 ≤ x2
In a linearly ordered type, we assume the order relations are all decidable.
- decidableEq : DecidableEq α
In a linearly ordered type, we assume the order relations are all decidable.
- decidableLT : DecidableRel fun (x1 x2 : α) => x1 < x2
In a linearly ordered type, we assume the order relations are all decidable.
The minimum function is equivalent to the one you get from
minOfLe
.The minimum function is equivalent to the one you get from
maxOfLe
.- compare_eq_compareOfLessAndEq : ∀ (a b : α), compare a b = compareOfLessAndEq a b
Comparison via
compare
is equal to the canonical comparison given decidable<
and=
.
Instances
Equations
Equations
Equations
Equations
- ⋯ = ⋯
Deprecated properties of inequality on Nat
Equations
- Nat.ltGeByCases h₁ h₂ = Decidable.byCases h₁ fun (h : ¬a < b) => h₂ ⋯
Instances For
Equations
- Nat.ltByCases h₁ h₂ h₃ = Nat.ltGeByCases h₁ fun (h₁ : b ≤ a) => Nat.ltGeByCases h₃ fun (h : a ≤ b) => h₂ ⋯
Instances For
Equations
- ⋯ = ⋯
Upper and lower sets #
The type of upper sets of an order.
An upper set in an order α
is a set such that any element greater than one of its members is
also a member. Also called up-set, upward-closed set.
- carrier : Set α
The carrier of an
UpperSet
. - upper' : IsUpperSet self.carrier
The carrier of an
UpperSet
is an upper set.
Instances For
The type of lower sets of an order.
A lower set in an order α
is a set such that any element less than one of its members is also
a member. Also called down-set, downward-closed set.
- carrier : Set α
The carrier of a
LowerSet
. - lower' : IsLowerSet self.carrier
The carrier of a
LowerSet
is a lower set.