On Wed, Mar 4, 2020 at 9:26 AM Steve Jorgensen <stevej@stevej.name> wrote:
Chris Angelico wrote:
> On Wed, Mar 4, 2020 at 6:04 PM Steve Jorgensen stevej@stevej.name wrote:
<snip>
> https://en.wikipedia.org/wiki/Partially_ordered_set
> "Partially ordered" means you can compare pairs of elements and find
> which one comes first. "Totally ordered" means you can compare ANY
> pair of elements, and you'll always know which comes first.
> ChrisA

Ah. Good to know. I don't think "Partially ordered" actually applies, then, because that still seems to imply that transitivity would apply to comparisons between any given pair of objects. Simply having implementations of all the rich comparison operators does not make that true, however, and in particular, that's not true for sets.

Set comparison is transitive. If A is a subset of B and B is a subset of C, A is a subset of C. Furthermore, Wikipedia gives sets as an example of a partial ordering.

An ABC which means nothing more than "the comparison operators are implemented" is not very useful. ABCs are most useful when they tell the user that the implementations satisfy some contract.

If we consider just the sets `{1, 2}` and `{1, 3}`, …
```
In [1]: {1, 2} < {1, 3}
Out[1]: False

In [2]: {1, 2} >= {1, 3}
Out[2]: False
```
Neither is a subset of the other, so both of those tests return `False`.

From Wikipedia:

"For a, b, elements of a partially ordered set P, if a ≤ b or b ≤ a, then a and b are comparable. Otherwise they are incomparable. In the figure on top-right, e.g. {x} and {x,y,z} are comparable, while {x} and {y} are not. A partial order under which every pair of elements is comparable is called a total order or linear order;"