# Cantor's isomorphism theorem

In order theory and model theory, branches of mathematics, Cantor's isomorphism theorem states that every two countable dense unbounded linear orders are order-isomorphic. For instance, Minkowski's question-mark function produces an isomorphism (a one-to-one order-preserving correspondence) between the numerical ordering of the rational numbers and the numerical ordering of the dyadic rationals.
The theorem is named after Georg Cantor, who first published it in 1895, using it to characterize the (uncountable) ordering on the real numbers. It can be proved by a back-and-forth method that is also sometimes attributed to Cantor but was actually published later, by Felix Hausdorff. The same back-and-forth method also proves that countable dense unbounded orders are highly symmetric, and can be applied to other kinds of structures. However, Cantor's original proof only used the "going forth" half of this method. In terms of model theory, the isomorphism theorem can be expressed by saying that the first-order theory of unbounded dense linear orders is countably categorical, meaning that it has only one countable model, up to logical equivalence.
One application of Cantor's isomorphism theorem involves temporal logic, a method for using logic to reason about time. In this application, the theorem implies that it is sufficient to use intervals of rational numbers to model intervals of time: using irrational numbers for this purpose will not lead to any increase in logical power.

## Statement and examples

Cantor's isomorphism theorem is stated using the following concepts:
* A linear order or total order is defined by a set of elements and a comparison operation that gives an ordering to each pair of distinct elements and obeys the transitive law. The familiar numeric orderings on the integers, rational numbers, and real numbers are all examples of linear orders.
* Unboundedness means that the ordering does not contain a minimum or maximum element. This is different from the concept of a bounded set in a metric space. For instance, the open interval (0,1) is unbounded as an ordered set, even though it is bounded as a subset of the real numbers, because neither its infimum 0 nor its supremum 1 belong to the interval. The integers, rationals, and reals are also unbounded.
* An ordering is dense when every pair of elements has another element between them. This is different from being a topologically dense set within the real numbers. The rational numbers and real numbers are dense in this sense, as the arithmetic mean of any two numbers belongs to the same set and lies between them, but the integers are not dense because is no other integer between any two consecutive integers.
* The integers and rational numbers both form countable sets, but the real numbers do not, by a different result of Cantor, his proof that the real numbers are uncountable.
* Two linear orders are order-isomorphic when there exists a one-to-one correspondence between them that preserves their ordering. For instance, the integers and the even numbers are order-isomorphic, under a bijection that multiplies each integer by two.
With these definitions in hand, Cantor's isomorphism theorem states that every two unbounded countable dense linear orders are order-isomorphic.
Within the rational numbers, certain subsets are also countable, unbounded, and dense. The rational numbers in the open unit interval are an example. Another example is the set of dyadic rational numbers, the numbers that can be expressed as a fraction with an integer numerator and a power of two as the denominator. By Cantor's isomorphism theorem, the dyadic rational numbers are order-isomorphic to the whole set of rational numbers. In this example, an explicit order isomorphism is provided by Minkowski's question-mark function. Another example of a countable unbounded dense linear order is given by the set of real algebraic numbers, the real roots of polynomials with integer coefficients. In this case, they are a superset of the rational numbers, but are again order-isomorphic. It is also possible to apply the theorem to other linear orders whose elements are not defined as numbers. For instance, the binary strings that end in a 1, in their lexicographic order, form another isomorphic ordering.

## Proofs

One proof of Cantor's isomorphism theorem, in some sources called "the standard proof", uses the back-and-forth method. This proof builds up an isomorphism between any two given orders, using a greedy algorithm, in an ordering given by a countable enumeration of the two orderings. In more detail, the proof maintains two order-isomorphic finite subsets $A$ and $B$ of the two given orders, initially empty. It repeatedly increases the sizes of $A$ and $B$ by adding a new element from one order, the first missing element in its enumeration, and matching it with an order-equivalent element of the other order, proven to exist using the density and lack of endpoints of the order. The two orderings switch roles at each step: the proof finds the first missing element of the first order, adds it to $A$, matches it with an element of the second order, and adds it to $B$; then it finds the first missing element of the second order, adds it to $B$, matches it with an element of the first order, and adds it to $A$, etc. Every element of each ordering is eventually matched with an order-equivalent element of the other ordering, so the two orderings are isomorphic.
Although the back-and-forth method has also been attributed to Cantor, Cantor's original publication of this theorem in 1895–1897 used a different proof. In an investigation of the history of this theorem by logician Charles L. Silver, the earliest instance of the back-and-forth proof found by Silver was in a 1914 textbook by Felix Hausdorff, his Grundzüge der Mengenlehre.
Instead of building up order-isomorphic subsets $A$ and $B$ by going "back and forth" between the enumeration for the first order and the enumeration for the second order, Cantor's original proof only uses the "going forth" half of the back-and-forth method. It repeatedly augments the two finite sets $A$ and $B$ by adding to $A$ the first missing element of the first order's enumeration, and adding to $B$ the order-equivalent element that is first in the second order's enumeration. This naturally finds an equivalence between the first ordering and a subset of the second ordering, and Cantor then argues that the entire second ordering is included.
The back-and-forth proof has been formalized as a computer-verified proof using Coq, an interactive theorem prover. This formalization process led to a strengthened result that when two computably enumerable linear orders have a computable comparison predicate, and computable functions representing their density and unboundedness properties, then the isomorphism between them is also computable.

## Model theory

One way of describing Cantor's isomorphism theorem uses the language of model theory. The first-order theory of unbounded dense linear orders consists of sentences in mathematical logic concerning variables that represent the elements of an order, with a binary relation used as the comparison operation of the ordering. Here, a sentence means a well-formed formula that has no free variables. These sentences include both axioms, formulating in logical terms the requirements of a dense linear order, and all other sentences that can be proven as logical consequences from those axioms. The axioms of this system can be expressed as:
| Axiom | Explanation |
| $\forall a\,{\bigl\lnot (a<a){\bigr )}$ | Comparison is irreflexive: no element is less than itself. |
| $\forall a\,\forall b\,(a=b\vee a<b\vee b<a)$ | Comparison is connected or total, meaning every two distinct elements are comparable. |
| $\forall a\,\forall b\,\forall c\,{\bigl(a<b\wedge b<c)\Rightarrow a<c{\bigr )}$ | Comparison is transitive: each triple of elements is consistently ordered. |
| $\forall a\,\exists b\,(b<a)$ | There is no lower bound; every element $a$ has a smaller element $b$. |
| $\forall a\,\exists b\,(a<b)$ | There is no upper bound; every element $a$ has a larger element $b$. |
| $\forall a\,\forall b\,{\bigla<b\Rightarrow \exists c\,(a<c\wedge c<b){\bigr )}$ | The order is dense: every two elements $a$ and $b$ have an element $c$ between them. |
A model of this theory is any system of elements and a comparison relation that obeys all of the axioms; it is a countable model when the system of elements forms a countable set. For instance, the usual comparison relation on the rational numbers is a countable model of this theory. Cantor's isomorphism theorem can be expressed by saying that the first-order theory of unbounded dense linear orders is countably categorical: it has only one countable model, up to logical equivalence. However, it is not categorical for higher cardinalities: for any higher cardinality, there are multiple inequivalent dense unbounded linear orders with the same cardinality.
A method of quantifier elimination in the first-order theory of unbounded dense linear orders can be used to prove that it is a complete theory. This means that every logical sentence in the language of this theory is either a theorem, that is, provable as a logical consequence of the axioms, or the negation of a theorem. This is closely related to being categorical (a sentence is a theorem if it is true of the unique countable model; see the Łoś–Vaught test) but there can exist multiple distinct models that have the same complete theory. In particular, both the ordering on the rational numbers and the ordering on the real numbers are models of the same theory, even though they are different models. Quantifier elimination can also be used in an algorithm for deciding whether a given sentence is a theorem.

## Related results

The same back-and-forth method used to prove Cantor's isomorphism theorem also proves that countable dense linear orders are highly symmetric. Their symmetries are called order automorphisms, and consist of order-preserving bijections from the whole linear order to itself. By the back-and-forth method, every countable dense linear order has order automorphisms that map any set of $k$ points to any other set of $k$ points. This can also be proven directly for the ordering on the rationals, by constructing a piecewise linear order automorphism with breakpoints at the $k$ given points. This equivalence of all $k$-element sets of points is summarized by saying that the group of symmetries of a countable dense linear order is "highly homogeneous". However, there is no order automorphism that maps an ordered pair of points to its reverse, so these symmetries do not form a 2-transitive group.
The isomorphism theorem can be extended to colorings of an unbounded dense countable linear ordering, with a finite or countable set of colors, such that each color is dense, in the sense that a point of that color exists between any other two points of the whole ordering. The subsets of points with each color partition the order into a family of unbounded dense countable linear orderings. Any partition of an unbounded dense countable linear orderings into subsets, with the property that each subset is unbounded (within the whole set, not just in itself) and dense (again, within the whole set) comes from a coloring in this way. Each two colorings with the same number of colors are order-isomorphic, under any permutation of their colors. Bhattacharjee et al. (1997) give as an example the partition of the rational numbers into the dyadic rationals and their complement; these two sets are dense in each other, and their union has an order isomorphism to any other pair of unbounded linear orders that are countable and dense in each other. Unlike Cantor's isomorphism theorem, the proof needs the full back-and-forth argument, and not just the "going forth" argument.
Cantor used the isomorphism theorem to characterize the ordering of the real numbers, an uncountable set. Unlike the rational numbers, the real numbers are Dedekind-complete, meaning that every subset of the reals that has a finite upper bound has a real least upper bound. They contain the rational numbers, which are dense in the real numbers. By applying the isomorphism theorem, Cantor proved that whenever a linear ordering has the same properties of being Dedekind-complete and containing a countable dense unbounded subset, it must be order-isomorphic to the real numbers. Suslin's problem asks whether orders having certain other properties of the order on the real numbers, including unboundedness, density, and completeness, must be order-isomorphic to the reals; the truth of this statement is independent of Zermelo–Fraenkel set theory with the axiom of choice (ZFC).
Although uncountable unbounded dense orderings may not be order-isomorphic, it follows from the back-and-forth method that any two such orderings are elementarily equivalent. Another consequence of Cantor's proof is that every finite or countable linear order can be embedded into the rationals, or into any unbounded dense ordering. Calling this a "well known" result of Cantor, Wacław Sierpiński proved an analogous result for higher cardinality: assuming the continuum hypothesis, there exists a linear ordering of cardinality $\aleph _{1}$ into which all other linear orderings of cardinality $\aleph _{1}$ can be embedded. Baumgartner's axiom, formulated by James Earl Baumgartner in 1973 to study the continuum hypothesis, concerns $\aleph _{1}$-dense sets of real numbers, unbounded sets with the property that every two elements are separated by exactly $\aleph _{1}$ other elements. It states that each two such sets are order-isomorphic, providing in this way another higher-cardinality analogue of Cantor's isomorphism theorem ($\aleph _{1}$ is defined as the cardinality of the set of all countable ordinals). Baumgartner's axiom is consistent with ZFC and the negation of the continuum hypothesis, and implied by the proper forcing axiom, but independent of Martin's axiom.
In temporal logic, various formalizations of the concept of an interval of time can be shown to be equivalent to defining an interval by a pair of distinct elements of a dense unbounded linear order. This connection implies that these theories are also countably categorical, and can be uniquely modeled by intervals of rational numbers.
Sierpiński's theorem stating that any two countable metric spaces without isolated points are homeomorphic can be seen as a topological analogue of Cantor's isomorphism theorem, and can be proved using a similar back-and-forth argument.