2
$\begingroup$

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?

$\endgroup$
  • 3
    $\begingroup$ If $a,b$ are in a totally ordered set and $!$ means $\neg$, it's called anti-symmetry. $\endgroup$ – Git Gud Jul 23 '14 at 18:52
  • 3
    $\begingroup$ I seem to remember it being called trichotomy, but I may have spelled it wrong. Anti-symmetry means (IIRC) that if a<b then not b<a. $\endgroup$ – Ned Jul 23 '14 at 18:56
  • 1
    $\begingroup$ @Ned You're right, it is trichotomy in general (which doesn't invalidate my comment since trichotomy 'is the same' as a totally ordered set). I had missed that. You're wrong about anti-symmetry though. $\endgroup$ – Git Gud Jul 23 '14 at 19:00
  • $\begingroup$ I suppose the assumptions allow for both $a \lt b$ and $b \lt a$ to hold, as far as the Q statement goes. $\endgroup$ – hardmath Jul 23 '14 at 19:08
  • $\begingroup$ Process of elimination? :) $\endgroup$ – D_S Jul 23 '14 at 20:19
3
$\begingroup$

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)$$

$\endgroup$
0
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ There are instances in which $\neg (a<b)$ does not imply $b\leq a$. For instance if $\leq$ means $\subseteq$ it's easy to find examples. $\endgroup$ – Git Gud Jul 23 '14 at 19:01
  • $\begingroup$ Have you ever seen using someone $<$ instead of $\subset$? For me it is pretty clear that $<$ and $\leq$ is only used for real numbers and $\subset$ etc is used for sets, and the use of $<$ instead of $\subset$ is just wrong. But I'd be happy if you could tell me where that is the case! $\endgroup$ – flawr Jul 23 '14 at 19:10
  • 2
    $\begingroup$ Yes, I have, any time a person is talking about a Poset in general, and thus might be talking about a poset of sets under inclusion... @flawr $\endgroup$ – Thomas Andrews Jul 23 '14 at 19:12
  • $\begingroup$ See: en.wikipedia.org/wiki/Partially_ordered_set $\endgroup$ – Thomas Andrews Jul 23 '14 at 19:16
  • 2
    $\begingroup$ This answer still doesn't address the question: What is this property called? In general, we name a property when it comes up again and again, and thus the question is about all contexts where it comes up, and the search is for a name, not a restatement of the property in one particular case. $\endgroup$ – Thomas Andrews Jul 23 '14 at 19:20
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.