|
|
|
|
|
by mmarx
3371 days ago
|
|
> Specifically: when you have a less-than relationship "<", then
!(a<b) && !(b<a) implies that a and b are equal (a==b). And if a==b
and b==c then it must be the case that a==c, or the requirements of
the ordering predicate are not met. ¬(a<b) ∧ ¬(b<a) → a=b is not, in fact, a requirement on <. Rather, the
point is that behind the scenes, any two elements satisfying ¬(a<b) ∧
¬(b<a) are treated as equivalent by these containers. To see the difference, consider the (somewhat counter-intuitive)
behavior of NaNs: for any two NaNs m, n, we have ¬(m<n) and ¬(n<m),
yet also m≠n. If that implication were an actual requirement, then
the usual ordering < on floats would not be a suitable ordering
predicate. What happens, though, is that the containers will
implicitly treat NaNs as equivalent, i.e., the notion of equivalence
the container uses for the elements depends only on < and might not
coincide with the usual ==. |
|