Type classes related to Ord
#
This file provides several typeclasses encode properties of an Ord
instance. For each typeclass,
there is also a variant that does not depend on an Ord
instance and takes an explicit comparison
function cmp : α → α → Ordering
instead.
A typeclass for comparison functions cmp
for which cmp a a = .eq
for all a
.
Comparison is reflexive.
Instances
A typeclasses for ordered types for which compare a a = .eq
for all a
.
Equations
Instances For
A typeclass for functions α → α → Ordering
which are oriented: flipping the arguments amounts
to applying Ordering.swap
to the return value.
Swapping the arguments to
cmp
swaps the outcome.
Instances
A typeclass for types with an oriented comparison function: flipping the arguments amounts to
applying Ordering.swap
to the return value.
Equations
Instances For
A typeclass for functions α → α → Ordering
which are transitive.
Transitivity of
cmp
, expressed viaOrdering.isLE
.
Instances
A typeclass for types with a transitive ordering function.
Equations
Instances For
A typeclass for comparison functions satisfying cmp a b = .eq
if and only if the logical equality
a = b
holds.
This typeclass distinguishes itself from LawfulBEqCmp
by using logical equality (=
) instead of
boolean equality (==
).
- eq_of_compare {a b : α} : cmp a b = Ordering.eq → a = b
If two values compare equal, then they are logically equal.
Instances
A typeclass for types with a comparison function that satisfies compare a b = .eq
if and only if
the logical equality a = b
holds.
This typeclass distinguishes itself from LawfulBEqOrd
by using logical equality (=
) instead of
boolean equality (==
).
Equations
Instances For
A typeclass for comparison functions satisfying cmp a b = .eq
if and only if the boolean equality
a == b
holds.
This typeclass distinguishes itself from LawfulEqCmp
by using boolean equality (==
) instead of
logical equality (=
).
If two values compare equal, then they are logically equal.
Instances
A typeclass for types with a comparison function that satisfies compare a b = .eq
if and only if
the boolean equality a == b
holds.
This typeclass distinguishes itself from LawfulEqOrd
by using boolean equality (==
) instead of
logical equality (=
).
Equations
Instances For
Internal funcion to derive a BEq
instance from an Ord
instance in order to connect the
verification machinery for tree maps to the verification machinery for hash maps.
Equations
- Std.Internal.beqOfOrd = { beq := fun (a b : α) => compare a b == Ordering.eq }