Hacker News new | past | comments | ask | show | jobs | submit login

The terminology is a little confusing. By "strong" total ordering do they really mean "strict" total ordering? If not, what's the difference?



No. The terminology is different because it refers to a different concept. In C++20 "strong" vs "weak" refers to substitutability. When two elements x and y compare to strong_ordering::equal, then it is assumed that f(x) == f(y). This is not assumed if they are just weak_ordering::equivalent. Read section "A new ordering primitive: <=>" of the article for a longer explanation.


I did read that section... that's why I said it's confusing...

It seems to me they're using different terminology for concepts that aren't different in math? In math, "equality" (=) already means the same thing as substitutability. A non-substitutable equality is already called "equivalence" (≡).

So in math we already have these:

[1a] Non-strict partial order: a binary ordering that allows incomparability (≼, ≡, ≽, ?)

[1b] Strict partial order: like [1a], but irreflexive (≺, ≡, ≻, ?)

[2a] Non-strict weak order: like [1a], but with all elements comparable (≼, ≡, ≽)

[2b] Strict weak order: like [1b], but with all elements comparable (≺, ≡, ≻)

[3a] Non-strict total order: like [2a], where the equivalence is equality (≤, =, ≥)

[3b] Strict total order: like [2b], where the equivalence is equality (<, =, >)

If I didn't make a mistake above, then:

- C++'s "strong total ordering" seems to be what in math we call "strict total ordering"

- Their "weak total ordering" seems to be what in math we call "strict weak ordering"

- Partial order is the same thing for both

Am I wrong here? If yes, how? If not, why did they randomly invent their own terminology? I haven't seen their definitions used elsewhere.


Huh, this is... not the terminology I am used to, as a mathematician?

My experience is that what C++ is calling a "weak order", and what you are calling a "weak order", is what in math is called a "pre-order" or a "quasi-order".

Meanwhile, the distinction you are making between strict and nonstrict is just ignored (except by constructivists), since they're equivalent ways of talking about the same thing. Indeed I'm not sure why you included both because, well, they're just two ways of talking about the same thing (again, unless you're a constructivist).

Really (assuming classical logic) there's just 4 possibilities here:

1. Total order (what they're calling a "strong ordering") 2. Total preorder (what they're calling a "weak ordering") 3. Partial order (which they are also calling a "partial ordering") 4. Partial preorder (which they don't account for)


You're agreeing with me?

"Preorder" is just a (better-known?) synonym for "non-strict weak order" [1] [2], so we don't disagree there.

"Strict" vs. "non-strict" I merely included because C++ comparisons return strict orders. I thought it was worth including, but feel free to ignore it.

So just as you pointed out in your own list, and just as I've been saying, "strong total order" isn't the terminology (every total order is strong), and neither is "weak total order" (it means "total preorder" which is... just a total order). Like you said, they should say "total" order, "preorder" (or "weak" order as I said), "partial" order. The "strong" and "weak total" stuff is just something they seem to have invented in contradiction with the established mathematical terminology for... no reason/gain?

[1] https://en.wikipedia.org/wiki/Weak_ordering#Total_preorders

[2] http://fitelson.org/roberts_measurement_theory.pdf#page=56


Well, I disagree that the article is confusing on this point. They say quite explicitly what they mean. I agree that the terminology is annoying, because they should just match the existing math terminology, and it's also annoying that they didn't account for partial preorders.

I'm not sure whether I agree that the terminology is confusing; on the whole I think it isn't. The reason it's not confusing is that it sufficiently different from usual math terminology so as not to interfere -- i.e., the terminology doesn't actually disagree at any point, it's not incompatible. Like, concepts get reinvented all the time and you just kind of have to get used to things having multiple terms, and be ready to translate unusual terminology into standard terminology, even as of course you should do what you can to reduce this happening. As long as you don't end up in a situation where one word means two different things, there's not really confusion, just different terminology.

And, as I said above, I definitely disagree that the article is confusing on this point, because they're very explicit about what they mean.


I said the terminology is confusing, not the article...

> the terminology doesn't actually disagree at any point, it's not incompatible

It does disagree though? I thought I just explained this... I'll do it again. "Total orders" are by their very definition in math always 'strong' -- their entire point is to use equality as the equivalence relation. That's what distinguishes them from weak orders, which can have other equivalence classes. So a "weak total order" makes no sense -- if a weak order is total, it's by definition the same as a 'strong' total order. That's in direct contradiction with their terminology.


I mean, that's like saying "A ring by definition is always associative, so saying 'a ring without associativity' is contradictory". Neither ordinary language nor technical terminology work that way; not every phrase is compositional in such a straightforward way, including in mathematics. I mean, a "fake X" is not an X.

In mathematics the word "weak" plays a similar role; e.g. in differential equations a weak solution need not be a solution; it's easy to find more examples. Similarly when one talks about a "non-Y X" or a "X without Y" where ordinarily Y is part of the definition of X. The result is not an X, but it's still (usually) clear what's meant, and these are still the terms that get used. Anyway, the point is, new terms someone is defining have to be considered on the whole.

An actual incompatibility, like I said, would be giving an existing phrase a new meaning. E.g. if they had referred to total preorders as partial orders, that would be an incompatibility.


> An actual incompatibility, like I said, would be giving an existing phrase a new meaning. E.g. if they had referred to total preorders as partial orders, that would be an incompatibility.

This is what they're doing!! They're calling pre-orders "weak total orders". That's a direct incompatibility... "weak total order" already means "total order", just like "total weak order" already means "total pre-order" which already means "total order". "Weak" and "total" are both adjectives, and they're interchangeable. If you asked anyone (who unlike you had already heard of the term "weak order" before) that's exactly how they would interpret it. Nothing in it would be left open for interpretation since everything is defined.

Whereas in your solution example, unlike here, the phrase "weak solution" didn't already mean something else, and there was no existing term for the concept either. And unlike in "ring without associativity", they use the word "total" in "weak total order" to mean nothing. They could've taken it out and "weak order" would've meant exactly what they meant.

If you want to make a comparison, what they're doing would be like using "a nonnegative positive solution" to mean "a nonnegative solution" (rather than "a positive nonnegative solution"). Or using "an fractional real number" to mean "a fractional complex number" rather than a "real fractional number" (i.e. real fraction). Which would be completely nuts.


> This is what they're doing!! They're calling pre-orders "weak total orders".

No. Giving one thing two names is not an incompatibility. Giving two things one name is an incompatibility.

> "weak total order" already means "total order"

Does it? I've never heard it called that. I think anyone on hearing the term "weak total order" would reasonably infer it refers to some notion than a total order.

> "Weak" and "total" are both adjectives, and they're interchangeable.

No. This is completely wrong. Terminology is very frequently not compositional in such a simple way.

I mean, this works perfectly fine with words that convey additional conditions. It does not work with words that convey a removal of conditions, which is what the word "weak" does!

Like, in the phrase "weak order" (meaning total preorder), the word "weak" is not imposing the conditions of reflexivity, transitivity, etc. It is starting from a baseline of "order" meaning "total order", and then weakening this to a preorder. The word "weak" only weakens!

Anyone, on seeing the phrase "weak total order", assuming they know the general usage of the word "weak", can reasonably infer that it refers to something weaker than a total order. (Likely a preorder.)

Yes, this makes "weak total order" something of a ridiculous phrase, given existing terminology. But again, remember that "weak order" is starting from a baseline where "order" means "total order"; in a sense, "weak order" is really something of an abbreviation for "weak total order".

(...of course, all of this highlights the odd way that terminology for orders themselves work. After all, "partial" is also a weakener. I haven't studied the history, but I'd bet you that "order" originally meant "total order" (it's still often used that way), then "partial order" came later as a weakener, then the meaning of "order" shifted as the study of partial orders became more common, then "total order" was coined as a retronym.)

> If you want to make a comparison, what they're doing would be like using "a nonnegative positive solution" to mean "a nonnegative solution" (rather than "a positive nonnegative solution"). Or using "an fractional real number" to mean "a fractional complex number" rather than a "real fractional number" (i.e. real fraction). Which would be completely nuts.

All of these are examples where you're using two terms that both impose conditions, rather than removing them. The word "weak" simply does not work that way.


> All of these are examples where you're using two terms that both impose conditions, rather than removing them.

All of these? Really? "Fractional" and "real" are 'imposing' conditions on 'number' rather than removing them? Like you said, I'd bet you that 'number' first meant 'natural number' rather than 'complex number'.

And before you tell me how deletion is also commutative just like addition—I could debate you the merits of that in natural language too, but that's beside my point in the last paragraph.

> Does it? I've never heard it called that.

Yes? That's precisely why I just gave you 2 links to people calling it exactly that above!! https://en.wikipedia.org/wiki/Weak_ordering#Total_preorders http://fitelson.org/roberts_measurement_theory.pdf#page=56

And I already asked you how you think a mathematician who unlike you knows 'weak' already has a definition this context would interpret 'weak total order' to mean? and you just ignored me there too. Just like you ignored my links way above where I showed you this is known terminology you're merely not aware of. I don't know why you're not cooperating but I'm tired of continuing.


Do not try too hard to compare with maths here. A programming language is different in many things from how maths is usually formalized. In C++20 there is no "strong total ordering", "weak total ordering" nor their partial counterparts. There are just "strong ordering", "weak ordering" and "partial ordering".

In a strong ordering, two objects can only by one smaller, equal or larger than the other. If they are equal, it means that they are substitutable.

In a weak ordering, two objects can only be one smaller, equivalent or larger than the other. No substitutability is implied.

In a partial ordering, two objects can be one smaller, equivalent or larger than the other, or just not comparable. Again, no substitutability is implied.

There is no point in distinguishing strict vs non-strict: depending on whether you call < or <= you will get the string or not string variant, and the same for > and >=.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: