Peter Stuifzand

StrictWeakOrdering

I always forget what strict weak ordering means, but it’s quite simple, actually.

My explanation is based on the Programming Conversation of last week and I hope this will help me remember the next time I hear about this.

Let’s start with ordering. A relation is an ordering if it is transitive.

ordering -->  for all a, b, c: r(a, b) and r(b, c) => r(a, c)

And now strict.

strict  -->   for all a:  !r(a, a)

This means that for a strict relation comparing a with itself will never be true. An example of r that is strict is <. A value will never be less than itself.

The complement of strict is reflexive.

reflexive -->  for all a: r(a, a)

This means that for a strict relation comparing a with itself will always be true. An example of relation that is reflexive is equality.

total   -->  for all a, b: r(a, b) or r(b, a) or a = b
weak    -->  for all a, b: r(a, b) or r(b, a) or (!r(a, b) and !(r(b, a))

Total ordering means that two objects relate to each other in one of three ways: a < b or b < a or a = b.

Weak ordering means the two objects relatie to each other in one of three ways: a < b or b < a or ( !(a < b) && !(b < a) ).

© 2023 Peter Stuifzand