I'm unsure. Let me look at what @tczajka brought up:
PartialEq we find:
Trait for equality comparisons which are partial equivalence relations.
Now the mathematical "equality" (if I understand it right) is always an equivalence relation and never a partial equivalence relation. That is because equality is reflexive (see basic properties of equality).
So perhaps the term "equality comparisons" should be (or needs to be) interpreted more sloppy here.
Also note that there is no comma after "comparisons". The reference obviously refers to two different "equality comparisons" here (i.e. not "the" equality in the mathematical sense).
Following these thoughts, I'd say @steffahn is right with:
Now to the other traits:
Let's take a look at the return value of
PartialOrd::partial_cmp, which is
Ordering can be
Now that's pretty different from what a partial order is in the mathematical sense, which is only a binary relation (i.e.
partial_cmp should return a bool, if we stick to the mathematical definition). Let's look at the properties of a partial order. A partial order requires:
I would say
PartialOrd is a trait that denotes there is a partial order and(!) a partial equivalence relation (with some restrictions). This is also reflected by the supertrait:
PartialOrd<Rhs = Self>: PartialEq<Rhs>.
PartialOrd::partial_cmp's return type has four different values:
Along with the result of
PartialEq::eq, we have eight possible results for
(a.eq(&b), a.partial_cmp(&b)) (of which only four are legit):
(false, None) (allowed)
(false, Some(Less)) (allowed)
(false, Some(Equal)) (forbidden)
(false, Some(Greater)) (allowed)
(true, None) (forbidden)
(true, Some(Less)) (forbidden)
(true, Some(Equal)) (allowed)
(true, Some(Greater)) (forbidden)
This seems to fit the observation that we have two binary relations, which would result in 4 possible outcomes.
(Edit: There is a flaw in my reasoning, see @steffahn's response below.)
Let's put this together, assuming our partial equivalence relation is
== and the partial order relation is ≤.
a == b and
b, we get
a == b and not
b, we get…
a != b and
b, we get
a != b and not
The problem here is the second case. Now I'm really confused. I suspect that
PartialOrd thus isn't actually a partial order. I suspect that
PartialOrd's consistency rules make
PartialOrd inconsistent with the mathematical definition of a partial order.
Or maybe I overlooked something? Sorry if I caused more confusion, but I feel like there is something wrong.