PreprintPDF Available
Preprints and early-stage research may not have been peer reviewed yet.

## Abstract

Below we introduce two theorems that show a set of real numbers is sorted if and only if (1) the distance between adjacent pairs in the resultant ordering is minimized, and (2) if and only if the amount of information required to encode the resultant ordering, when expressed as a particular class of recurrence relations, is minimized. As such, these two theorems demonstrate an equivalence between sorting and minimizing information. These theorems imply what appears to be the fastest known sorting algorithm, with a worst-case O(log(N)) runtime, when run on a parallel machine.
Sorting, Information, and Recursion
Charles Davi
April 13, 2022
Abstract
Below we introduce two theorems that show a set of real numbers
is sorted if and only if (1) the distance between adjacent pairs in the
resultant ordering is minimized, and (2) if and only if the amount of
information required to encode the resultant ordering, when expressed
as a particular class of recurrence relations, is minimized. As such, these
two theorems demonstrate an equivalence between sorting and minimizing
information. These theorems imply what appears to be the fastest known
sorting algorithm, with a worst-case O(log(N)) runtime, when run on a
parallel machine.
1
1 Introduction
In Section 2, we show that sorting a set of numbers is equivalent to minimizing
the distance between adjacent entries in the resultant sequence of numbers. In
Section 3, we show that this is in turn equivalent to minimizing the amount of
information used to encode the set as a particular class of recurrence relations
that is related to the derivative of a function. The theorem in Section 2 also
implies a more general notion of sorting that would apply to all mathematical
objects for which there is a measure of distance F:SS!R,whereSis
the set of objects in question. That is, if it is possible to compare every pair
of objects in a set, and map the dierence between each pair to the real line,
then we can deﬁne a partial order on the set in question, as a directed graph,
that is the analog of sorting the set, where node apoints to node bif ba0,
and the distance |ba|is minimized over the set. It is this latter criteria that
dierentiates this method from an arbitrary partial order on a set.
2 Sorting and Distance
Theorem 2.1. A sequence of real numbers (a1,a
2,...,a
k)is sorted if and only
if the distance |aiai+1|is minimized for all i.
Proof. Assume the sequence is sorted in ascending order, and that the theorem
is false. Note that the proof for the case of a descending sequence is analogous.
Because the sequence is sorted, the distance |a1a2|, must be minimized for
a1, since by deﬁnition, all other elements are greater than a2. By analogy, the
distance |ak1ak|must also be minimized for ak. Therefore, it follows that
there must be some am, for which either -
(1) |aiam|<|aiai+1|,
or,
(2) |ai+1 am|<|aiai+1|.
Said in words, because we have already eliminated the ﬁrst and last entries in
the sequence as entries that could cause the theorem to be false, in order for the
theorem to be false, there must be some pair of adjacent entries, and some third
entry, with a distance to one of those two entries that is less than the distance
between the pair itself. Because assuming that am<a
i, or that am>a
i+1,
simply changes the indexes, it must be the case that ai<a
m<a
i+1,whichin
2
turn contradicts the assumption that the sequence is sorted, which completes
the ﬁrst half of the proof.
Now we will prove by induction that if |aiai+1|is minimized for all i, then
the sequence is sorted:
Assume we start with a single entry, ai. Then, we want to insert some new
entry, aj, in order to generate a sequence in ascending order, since a proof for
descending order is analogous. Because there are only two entries, aiis the
nearest neighbor of the new entry aj(i.e., the distance between aiand ajis
minimized). Because the criteria of the theorem is only that adjacent entries
have minimized distances, we can place the inserted entry on either side of an
existing entry. So we choose that if aj>a
i, then we insert ajto the right of ai,
and otherwise, we insert ajto the left of ai.1
Now assume the theorem holds for some number of insertions k2. It fol-
lows that this will imply a sorted sequence (a1,a
2,...,a
k). If there is more than
one nearest neighbor for a given insert (i.e., two entries of equal distance from
the insert entry) that are both equal in value, then we ﬁnd either the leftmost
such entry, or the rightmost such entry, depending upon whether the inserted
entry is less than its nearest neighbor, or greater than its nearest neighbor,
respectively. If the insert is equidistant between two unequal adjacent entries,
then we insert it between them.
Now assume we insert entry am, which will be insertion number k+ 1.
Further, assume that following the process above causes the resultant sequence
of k+ 1 entries to be unsorted, solely as a result of this insertion (note we
assumed that the sequence is sorted beforehand), and further, assume that the
indexes are such that (a1,a
2,...,a
k) is the correct set of indexes for the sorted
sequence prior to the insertion of am.
Now assume the process above places amat the front of the sequence. Be-
cause the sequence is unsorted, it must be that am>a
1, but this is impossible,
according to the process above, which would place it to the right of a1. Now
assume the process above places amat the end of the sequence. Because the
sequence is unsorted, it must be that am<a
k, but again, the process above
dictates an insertion to the left.
Therefore, since by assumption the sequence is unsorted, it must be the case
that amis inserted between two entries in the sequence ai,a
i+1. By the process
1Note that if the application of such a rule is not done consistently, then the distance
between adjacent entries will not be minimized. For example, insert the vector (2,3,1) in that
order, minimizing distance, but alternating the rule of insertion, and we could, e.g., end up
with (2,1,3), which does not minimize the distances between adjacent entries. In order to
simplify the proof, we assume the application of certain consistent rules, since all alternatives