Ordering #
OrientedCmp cmp
asserts that cmp
is determined by the relation cmp x y = .lt
.
- symm : ∀ (x y : α), (cmp x y).swap = cmp y x
The comparator operation is symmetric, in the sense that if
cmp x y
equals.lt
thencmp y x = .gt
and vice versa.
Instances
TransCmp cmp
asserts that cmp
induces a transitive relation.
- le_trans : ∀ {x y z : α}, cmp x y ≠ Ordering.gt → cmp y z ≠ Ordering.gt → cmp x z ≠ Ordering.gt
The comparator operation is transitive.
Instances
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
LTCmp cmp
asserts that cmp x y = .lt
and x < y
coincide.
- cmp_iff_lt : ∀ {x y : α}, cmp x y = Ordering.lt ↔ x < y
cmp x y = .lt
holds iffx < y
is true.
Instances
LECmp cmp
asserts that cmp x y ≠ .gt
and x ≤ y
coincide.
- cmp_iff_le : ∀ {x y : α}, cmp x y ≠ Ordering.gt ↔ x ≤ y
cmp x y ≠ .gt
holds iffx ≤ y
is true.
Instances
LawfulCmp cmp
asserts that the LE
, LT
, BEq
instances are all coherent with each other
and with cmp
, describing a strict weak order (a linear order except for antisymmetry).
- le_trans : ∀ {x y z : α}, cmp x y ≠ Ordering.gt → cmp y z ≠ Ordering.gt → cmp x z ≠ Ordering.gt
- cmp_iff_beq : ∀ {x y : α}, cmp x y = Ordering.eq ↔ (x == y) = true
- cmp_iff_lt : ∀ {x y : α}, cmp x y = Ordering.lt ↔ x < y
- cmp_iff_le : ∀ {x y : α}, cmp x y ≠ Ordering.gt ↔ x ≤ y
Instances
OrientedOrd α
asserts that the Ord
instance satisfies OrientedCmp
.
Equations
- Batteries.OrientedOrd α = Batteries.OrientedCmp compare
Instances For
TransOrd α
asserts that the Ord
instance satisfies TransCmp
.
Equations
- Batteries.TransOrd α = Batteries.TransCmp compare
Instances For
BEqOrd α
asserts that the Ord
and BEq
instances are coherent via BEqCmp
.
Equations
- Batteries.BEqOrd α = Batteries.BEqCmp compare
Instances For
LTOrd α
asserts that the Ord
instance satisfies LTCmp
.
Equations
- Batteries.LTOrd α = Batteries.LTCmp compare
Instances For
LEOrd α
asserts that the Ord
instance satisfies LECmp
.
Equations
- Batteries.LEOrd α = Batteries.LECmp compare
Instances For
LawfulOrd α
asserts that the Ord
instance satisfies LawfulCmp
.
Equations
- Batteries.LawfulOrd α = Batteries.LawfulCmp compare
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Local instance for OrientedOrd lexOrd
.
Local instance for OrientedOrd ord.opposite
.
Local instance for TransOrd ord.opposite
.
Local instance for OrientedOrd (ord.on f)
.
Local instance for TransOrd (ord.on f)
.
Local instance for OrientedOrd (oα.lex oβ)
.
Local instance for TransOrd (oα.lex oβ)
.
Local instance for OrientedOrd (oα.lex' oβ)
.
Local instance for TransOrd (oα.lex' oβ)
.
Equations
Equations
Equations
Pull back a comparator by a function f
, by applying the comparator to both arguments.
Equations
- Ordering.byKey f cmp a b = cmp (f a) (f b)
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯