Ordering #
le is total: either le a b or le b a.
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 yequals.ltthencmp y x = .gtand vice versa.
Instances
The comparator operation is symmetric, in the sense that if cmp x y equals .lt then
cmp y x = .gt and vice versa.
TransCmp cmp asserts that cmp induces a transitive relation.
- symm : ∀ (x y : α), (cmp x y).swap = cmp y x
- 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
The comparator operation is transitive.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
cmp x y = .eq holds iff x == y is true.
LTCmp cmp asserts that cmp x y = .lt and x < y coincide.
- symm : ∀ (x y : α), (cmp x y).swap = cmp y x
- cmp_iff_lt : ∀ {x y : α}, cmp x y = Ordering.lt ↔ x < y
cmp x y = .ltholds iffx < yis true.
Instances
cmp x y = .lt holds iff x < y is true.
LECmp cmp asserts that cmp x y ≠ .gt and x ≤ y coincide.
- symm : ∀ (x y : α), (cmp x y).swap = cmp y x
- cmp_iff_le : ∀ {x y : α}, cmp x y ≠ Ordering.gt ↔ x ≤ y
cmp x y ≠ .gtholds iffx ≤ yis true.
Instances
cmp x y ≠ .gt holds iff x ≤ y is true.
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).
- symm : ∀ (x y : α), (cmp x y).swap = cmp y x
- le_trans : ∀ {x y z : α}, cmp x y ≠ Ordering.gt → cmp y z ≠ Ordering.gt → cmp x z ≠ Ordering.gt
- cmp_iff_lt : ∀ {x y : α}, cmp x y = Ordering.lt ↔ x < y
cmp x y = .ltholds iffx < yis true. - cmp_iff_le : ∀ {x y : α}, cmp x y ≠ Ordering.gt ↔ x ≤ y
cmp x y ≠ .gtholds iffx ≤ yis true.
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
- ⋯ = ⋯