I’ve referred to the integers informal and rationals a few times but haven’t defined them. The usual construction is via equivalence classes, as above.
Consider the operation \[ f ( ( a , b ) , ( c , d ) ) = ( a + c , b + d ) \] on \({ N ^ 2 }\). Note that this is a different operation than the one which I used in defining the bicyclic semigroup.
We can define an equivalence relation \({ R }\) on \({ N ^ 2 }\) by \({ ( ( a , b ) , ( c , d ) ) ∈ R }\) if and only if \({ a + d = b + c }\). It is straightforward to show that this equivalence relation is compatible in the sense we considered in the previous section so the equivalence classes form a commutative monoid. This monoid turns out to be a group, even though \({ N ^ 2 }\) itself is not a group. The inverse element to \({ ( a , b ) }\) is \({ ( b , a ) }\). This is easily verified because \[ f ( ( a , b ) , ( b , a ) ) = ( a + b , b + a ) \] and \[ ( ( a + b , b + a ) , ( 0 , 0 ) ) ∈ R . \]
The group of these equivalence classes is called the integers. The function \({ g }\) is just addition. The function \({ h }\) is just \({ h ( a , b ) = a - b }\). Of course to make this look like the integers we need not just addition but also subtraction and multiplication, and also our \({ ≤ }\) relation. We don’t need to, and indeed can’t, define \({ = }\) because it’s already defined. Equivalence classes are sets and equality of sets is determined by the Axiom of Extensionality. Subtraction is defined by adding the inverse.
Multiplication is more complicated. One would like to define it via the equation \[ ( a - b ) · ( c - d ) = [ ( a · c ) + ( b · d ) ] - [ ( a · d ) + ( b · c ) ] \] which in terms of \({ h }\) is \[ h ( a , b ) · h ( c , d ) = h ( ( a · c ) + ( b · d ) , ( a · d ) + ( b · c ) ) . \] This isn’t quite suitable as a definition though. What we really need to do is to define \({ x · y }\) where \({ x }\) and \({ y }\) are equivalence classes. There certainly are \({ a }\) and \({ b }\) such that \({ h ( a , b ) = x }\) but there are many such pairs \({ ( a , b ) }\). For example \({ h ( a + 1 , b + 1 ) = x }\). We need a definition in terms of \({ x }\) itself, not a particular element of the equivalence class. I won’t give the details, but the idea is similar to the way we defined the \({ g }\) in terms of \({ G }\) in the previous section. One first defines a binary relation and then shows that it is left total and right unique and so defines a function.
The procedure for the \({ ≤ }\) relation is similar. We would like to define it by saying that \[ a - b ≤ c - d \] i.e. \[ h ( a , b ) ≤ h ( c , d ) \] if and only if \[ a + d ≤ b + c \] but this doesn’t work because \({ a }\) and \({ b }\) are not uniquely determined by \({ h ( a , b ) }\) and \({ c }\) and \({ d }\) are not uniquely determined by \({ h ( c , d ) }\). We can resolve this in a similar way to the one used for multiplication though.
There is one thing which is quite strange about this implementation of the integers though. The natural numbers should be a subset of the integers but they aren’t. In this implementation integers are sets of ordered pairs of natural numbers. The best we can do is to define a monoid homomorphism \({ k }\) from the natural numbers to the integers, by \[ k ( n ) = h ( ( n , 0 ) ) . \] This is not just a monoid homomorphism but can be shown to preserve multiplication and the \({ ≤ }\) relation as well, so in some sense the range of \({ k }\) serves as an alternative implementation of the integers.
The usual way to deal with this problem is to ignore it. If that makes you uncomfortable then there are two more honest, but more complicated approaches. The first is declare that the range of \({ k }\) is the set of natural numbers and that the things we previously called natural numbers are a distinct set, though one with the same behaviour as the true natural numbers, and that the integers are defined in terms of this other set, and the true natural numbers are a subset of the integers. This shouldn’t be particularly alarming. We already saw multiple implementations of the natural numbers and this is just another one. An alternative approach is to keep the natural numbers unchanged but to define the integers differently, specifically as the union of the natural numbers and the complement in the set of equivalence classes above of the range of \({ k }\). Operations on this new implementation of the integers have a more complicated definition. Essentially we take the operands, apply \({ k }\) to any which are natural numbers, apply the operation on equivalence classes, check whether the result is in the range of \({ k }\), and replace it with \({ n }\) if it’s \({ k ( n ) }\). This is somewhat awkward but it works, in the sense that it gives a set and operations which behave correctly and have the natural numbers, as defined previously, as a subset.
Just as we can construct the integers from the natural numbers by a quotient construction we can construct the rationals from the integers. If \({ Z }\) is the group of integers then we define a binary operation on \({ Z × ( Z ∖ \{ 0 \} ) }\) by \[ f ( ( a , b ) , ( c , d ) ) = ( ( a · d ) + ( b · c ) , c · d ) \] and an equivalence relation by \[ ( ( a , b ) , ( c , d ) ) ∈ R \] if and only if \[ a · d = b · c . \] These definitions are designed to make the homomorphism \({ h }\) satisfy \[ h ( a , b ) = a / b , \] once we have defined division.
I will skip all the details of this construction. It does have an analogous problem to the one we encountered earlier in this section though. The integers are not a subset of the rationals. Again we can either choose to ignore the problem, or resolve it one of the ways discussed earlier, by redefining the integers or the rationals. As before this involves a homomorphism, this time from the integers to the rationals, which gives us an isomorphic copy of the integers in the rationals. This time the homomorphism is \({ k ( x ) = h ( x , 1 ) }\).
More complicated number systems are developed in a similar way. The construction of the real numbers from the rationals is particularly difficult but there are a number of standard methods and most of them use the quotient construction with some appropriate choice of group and equivalence relation. Once you have the reals you can easily construct the complex numbers, again by the quotient construction.