What is it called when !(a < b) and !(b < a) implies a = b?

120 Views Asked by At

I thought it would be some kind of symmetric equality but its impossible to do a google search on this, all I get are definitions of reflexive, symmetric and transitive. I'm not really sure which applies here.

To clarify: this is in a programming context, specifically, I am falling back on two less-than comparisons when equality hasn't been explicitly defined for some type. I'm looking for an accurate name for the function that performs the comparison.

edit (more details): < doesn't necessarily imply a real number comparison, (in my case, it would be a floating point anyway, and its almost always a mistake to compare floating point numbers like this).

Actually this problem came up in the context of implementing a generic binary search: I need a comparison operator to perform the search, and then some way to test for equivalence to determine whether my element was actually found.

For things like integers, obviously I can just use equality to know whether or not the element was found. But I also have a case where I search through a set of intervals, and a member-wise equality comparison between two intervals A and B

A.start = B.start and A.end = B.end

would not yield the result I want. So instead, I define comparison for the Interval type:

A < B iff A.start < B.start

and then I define equivalence as:

not (A < B) and not (B < A)

which makes the search do what I want, however my name for the generic version of this comparison function is "reflexively_equal" and I know this isn't right.

Basically my question boils down to this: If you were reading my code, what would I have to name this function in order for you to immediately guess what it does?

3

There are 3 best solutions below

0
On BEST ANSWER

a and b are asymmetrically equivalent.

Note: I think this question was misinterpreted in the other answers. GitGud posted "asymmetric" in the comments but not as an answer. After leaving it up for a week I settled on "asymmetrically_equivalent" as a function name. I'd like to credit GitGud instead of myself but it seems this question has gone stale, so I'm self-answering to remove it from the queue.

6
On

As far as I know this is just simplifying the expressions:

$\begin{align} \neg (a<b) \text{ and } \neg(b<a) \iff a \geq b \text{ and } b\geq a \iff a = b\end{align}$

This is under the assumption that $a,b$ are real numbers, which I assumed since the notation of the OP indicates use in programming languages.

0
On

It means that $\leq$ is a total relation: any two elements can be compared. To see this, look at the contrapositive: $$a \neq b \implies (a < b) \lor (b < a)$$ Equivalently, the statement is: $$(a = b) \lor (a < b) \lor (b < a)$$