In Section 6.3.6
we defined the notion of sorted list requiring a totally ordered set
of elements, but this requirement can be relaxed.
In principle, it is enough to have a transitive and antisymmetric order
on a set
of elements (which are the requirements in the theory TAOSET
from Section 6.3.1) to be able to define a sorted list
over
as a list such that for every pair
of members in
with
occurring
before
and with
, it is the case that
is false.
However, in what follows we are not interested in defining sorted
lists, but in specifying a sorting algorithm (more specifically, the mergesort
algorithm) in a deterministic way. We require the sorting algorithm to be
stable, so that incomparable elements remain in the same relative order
as in the list provided as argument. For this notion to be well defined, we need
to require either a strict weak order or a total preorder.