Re:The Evil Within the Comparison Functions
by contravariant on Monday February 19, 2018 @08:24AM
(#16412694)
Weirdly enough in mathematics it's far more common to define <= instead of <. With a<b simply being shorthand for 'a<=b and not b<=a'. The definitions also seem to be simpler that way.
[ Parent
| on HN ]
Re:The Evil Within the Comparison Functions
by baddox on Monday February 19, 2018 @09:26AM
(#16413031)
Is that so? I thought the “equals” relation was usually well-defined in formal math. What’s an instance where this isn’t the case? Perhaps the reals?
Re:The Evil Within the Comparison Functions
by contravariant on Monday February 19, 2018 @07:47PM
(#16417009)
Equality and equivalence get murky sometimes. Often there is some sense of equivalence that's 'good enough'. Like spaces that are isomorphic or functions that are equal 'almost everywhere'.
Now in by far the majority of cases inequality is defined for partial orders, which have the property that a<=b and b<=a imply a=b, so in that case a<=b and not b<=a implies b=/=a, but (non-strict) weak orders can have a<=b and b<=a without necessarily a=b.
I'm pretty sure there are also a few cases where they just prove reflexivity and transitivity and just make a and b where a<=b and b<=a equal by definition. I think you could use this in the definition for real numbers, but usually the equivalence classes are defined first and inequality is defined afterwards (which might be more work).