A journey to the world of Numbers

3 The rationals

We can now define the rationals, starting with our copy of the integers \(\mathrm{MyInt}\).

We follow a similar path to the one for \(\mathrm{MyInt}\).

3.1 The prerationals

\(\mathrm{MyRat}\) will be a quotient of a type called \(\mathrm{MyPrerat}\).

Definition 64
✓
#

Let \(\mathrm{MyPrerat}\) be \(\mathrm{MyInt}\times (\mathrm{MyInt}\setminus \{ 0\} )\).

Definition 65
✓
#

We define a relation \(R\) on \(\mathrm{MyPrerat}\) as follows: \((a,b)\) and \((c, d)\) are related if and only if

\[ a * d = b * c \]
Lemma 66
✓
#

\(R\) is a reflexive relation.

Proof ▶

Exercise.

Lemma 67
✓
#

\(R\) is a symmetric relation.

Proof ▶

Exercise.

Lemma 68
✓
#

\(R\) is a transitive relation.

Proof ▶

Exercise.

Lemma 69
✓
#

We have that \(R\) is an equivalence relation. From now on, we will write \(x \approx y\) for \(x R y\).

Proof ▶

Clear from Lemma 66, Lemma 67 and Lemma 68.

Definition 70
✓
#

We define an operation, called negation on \(\mathrm{MyPrerat}\) as follows: the negation of \(x = (a,b)\) is \((-a,b)\):

\[ -x = -(a,b) = (-a,b) \]

Note that it is automatically well defined (meaning that second component of \((-a,b)\) is different from \(0\)).

Lemma 71
✓
#

If \(x \approx x'\), then \(-x \approx -x'\).

Proof ▶

Exercise.

Definition 72
✓
#

We define an operation, called addition on \(\mathrm{MyPrerat}\) as follows: the addition of \(x = (a,b)\) and \(y = (c, d)\) is

\[ x + y = (a,b) + (c,d) = (a * d + b * c, b*d) \]

Do you see why it is well defined?

Lemma 73
✓
#

If \(x \approx x'\) and \(y \approx y'\), then \(x + y \approx x' + y'\).

Proof ▶

Exercise.

Definition 74
✓
#

We define an operation, called multiplication on \(\mathrm{MyPrerat}\) as follows: the multiplication of \(x = (a,b)\) and \(y = (c, d)\) is

\[ x * y = (a,b) * (c,d) = (a*c, b*d) \]
Lemma 75
✓
#

If \(x \approx x'\) and \(y \approx y'\), then \(x * y \approx x' * y'\).

Proof ▶

Exercise.

Definition 76
✓
#

We define an operation, called inversion on \(\mathrm{MyPrerat}\) as follows: the inverse of \(x = (a,b)\) is:

\[ \mbox{if } a \neq 0 \mbox{ then } x^{-1} = (b, a), \mbox{ otherwise } x^{-1} = (0, 1) \]

Note that \(x^{-1}\) is always defined!

Lemma 77
✓
#

If \(x \approx x'\), then \(x^{-1} \approx x'^{-1}\).

Proof ▶

Exercise.

3.2 The rationals

3.2.1 Definitions

Definition 78
✓
#

We define our rationals \(\mathrm{MyRat}\) as

\[ \mathrm{MyRat}= \mathrm{MyPrerat}\, / \approx \]

We will write \(⟦ (a, b) ⟧\) for the class of \((a,b)\).

Definition 79
✓
#

We define the zero of \(\mathrm{MyRat}\), denoted \(0\) as the class of \((0,1)\) (note that \(1 \neq 0\) in \(\mathrm{MyInt}\)).

Definition 80
✓
#

We define the one of \(\mathrm{MyRat}\), denoted \(1\) as the class of \((1,1)\) (note that \(1 \neq 0\) in \(\mathrm{MyInt}\)).

3.2.2 Commutative ring structure

Definition 81
✓
#

We define the negation of \(x = ⟦ (a, b) ⟧\) in \(\mathrm{MyRat}\) as

\[ -x = ⟦ -(a, b) ⟧ \]

Thanks to Lemma 71 this is well defined.

Definition 82
✓
#

We define the addition of \(x = ⟦ (a, b) ⟧\) and \(y = ⟦ (c, d) ⟧\) in \(\mathrm{MyRat}\) as

\[ x + y = ⟦ (a,b)+(c,d) ⟧ \]

Thanks to Lemma 73 this is well defined.

Definition 83
✓
#

We define the multiplication of \(x = ⟦ (a, b) ⟧\) and \(y = ⟦ (c, d) ⟧\) in \(\mathrm{MyRat}\) as

\[ x * y = ⟦ (a, b)*(c,d) ⟧ \]

Thanks to Lemma 75 this is well defined.

Definition 84
✓
#

We define the inverse of \(x = ⟦ (a, b) ⟧\) in \(\mathrm{MyRat}\) as

\[ x^{-1} = ⟦ (a, b)^{-1} ⟧ \]

Thanks to Lemma 77 this is well defined.

Proposition 85
✓
#

\(\mathrm{MyRat}\) with addition and multiplication is a commutative ring.

Proof ▶

We have to prove various properties, namely:

  • addition is associative

  • \(0\) works as neutral element for addition (on both sides)

  • existence of an inverse for addition (we prove that \(x + (-x) = (-x) + x = 0\))

  • addition is commutative

  • left and right distributivity of multiplication with respect to addition

  • associativity of multiplication

  • \(1\) works as neutral element for multiplication (on both sides)

All the proofs are essentially identical, going to \(\mathrm{MyInt}\), unravelling the definition and then checking the equality holds in \(\mathrm{MyInt}\).

Lemma 86
✓
#

In \(\mathrm{MyRat}\) we have \(0 \neq 1\).

Proof ▶

If \(0 = 1\) by definition we would have \(⟦ (0,1) ⟧ = ⟦ (1,1) ⟧\) so \(0*1=1*0\) in \(\mathrm{MyInt}\), that is absurd.

Lemma 87
✓
#

Let \(x \neq 0\) be in \(\mathrm{MyRat}\). Then \(x * x^{-1} = 1\).

Proof ▶

Let \(x = ⟦ (a,b) ⟧\), with \(b \neq 0\). Since \(x \neq 0\) we have \(a \neq 0\) and so \(x^{-1} = ⟦ (b,a) ⟧\). The lemma follows by definition of multiplication.

Proposition 88
✓
#

\(\mathrm{MyRat}\) with addition and multiplication is a field.

Proof ▶

Clear because of Lemma 87.

3.2.3 The inclusion \(i \colon \mathrm{MyNat}\to \mathrm{MyRat}\)

Definition 89
✓
#

We define a map

\begin{gather*} i \colon \mathrm{MyNat}\to \mathrm{MyRat}\\ n \mapsto ⟦ (\mathrm{MyInt}.i n,1) ⟧ \end{gather*}
Lemma 90
✓
#

We have that \(i(0) = 0\).

Proof ▶

Clear from the definition.

Lemma 91
✓
#

We have that \(i(1) = 1\).

Proof ▶

Clear from the definition.

Lemma 92
✓
#

For all \(a\) and \(b\) in \(\mathrm{MyNat}\) we have that

\[ i(a+b) = i(a) + i(b) \]
Proof ▶

We have \(i(a+b) = ⟦ (\mathrm{MyInt}.i (a+b), 1) ⟧ = ⟦ (\mathrm{MyInt}.i (a), 1) + (\mathrm{MyInt}.i (b), 1) ⟧\), \(i(a) = ⟦ (\mathrm{MyInt}.i(a), 1) ⟧\) and \(i(b) = ⟦ (\mathrm{MyInt}.i (b), 1) ⟧\), so we need to prove that

\[ ⟦ (\mathrm{MyInt}.i (a), 1) + (\mathrm{MyInt}.i (b), 1) ⟧ = ⟦ (\mathrm{MyInt}.i (a), 1) ⟧ + ⟦ (\mathrm{MyInt}.i (b), 1) ⟧ \]

that is obvious from the definition.

Lemma 93
✓
#

For all \(a\) and \(b\) in \(\mathrm{MyNat}\) we have that

\[ i(a*b) = i(a) * i(b) \]
Proof ▶

Similar to the proof of Lemma 92.

Lemma 94
✓
#

We have that \(i\) is injective.

Proof ▶

Let \(a\) and \(b\) be such that \(i(a)=i(b)\). This means \(⟦ (\mathrm{MyInt}.i a,1) ⟧ = ⟦ (\mathrm{MyInt}.i b,1) ⟧\), so \((\mathrm{MyInt}.i a) * 1 = 1 * (\mathrm{MyInt}.i b)\). Hence \(\mathrm{MyInt}.i a = \mathrm{MyInt}.i b\), and injectivity of \(\mathrm{MyInt}.i\) gives \(a = b\).

3.2.4 The inclusion \(j \colon \mathrm{MyInt}\to \mathrm{MyRat}\)

Definition 95
✓
#

We define a map

\begin{gather*} j \colon \mathrm{MyInt}\to \mathrm{MyRat}\\ n \mapsto ⟦ (n,1) ⟧ \end{gather*}
Lemma 96
✓
#

We have that \(j(0) = 0\).

Proof ▶

Clear from the definition.

Lemma 97
✓
#

We have that \(j(1) = 1\).

Proof ▶

Clear from the definition.

Lemma 98
✓
#

For all \(a\) and \(b\) in \(\mathrm{MyInt}\) we have that

\[ j(a+b) = j(a) + j(b) \]
Proof ▶

Exercise.

Lemma 99
✓
#

For all \(a\) and \(b\) in \(\mathrm{MyInt}\) we have that

\[ j(a*b) = j(a) * j(b) \]
Proof ▶

Exercise.

Lemma 100
✓
#

We have that \(j\) is injective.

Proof ▶

Exercise.

Lemma 101
✓
#

Let \(n\) be a natural number. Then \(\mathrm{MyRat}.j (\mathrm{MyInt}.i (n)) = \mathrm{MyRat}.i (n)\).

Proof ▶

It follows from unravelling all the definitions.

Lemma 102
✓
#

Let \(a\) and \(b\) be in \(\mathrm{MyInt}\) with \(b \neq 0\). Then \(⟦ (a, b) ⟧ = j(a)*j(b)^{-1}\).

Proof ▶

Exercise.

3.2.5 Nonnegativity

Before defining the order on \(\mathrm{MyRat}\), let’s define the notion of nonnegativity.

Definition 103
✓
#

Given \(x\) in \(\mathrm{MyRat}\), we say that \(x\) is nonnegative if it has a representative with nonnegative numerator and positive denominator: there exist \(a\) and \(b\) in \(\mathrm{MyInt}\) with \(0 \leq a\) and \(0 {\lt} b\) such that

\[ x = ⟦(a,b)⟧. \]

This is the usual condition \(0 \leq a/b\) after choosing a positive denominator.

Lemma 104
✓
#

We have that \(0\) in \(\mathrm{MyRat}\) is nonnegative.

Proof ▶

Obvious.

Lemma 105
✓
#

We have that \(1\) in \(\mathrm{MyRat}\) is nonnegative.

Proof ▶

Obvious.

Lemma 106
✓
#

Let \(x\) be in \(\mathrm{MyRat}\) such that both \(x\) and \(-x\) are nonnegative. Then \(x = 0\).

Proof ▶

Unravelling all the definitions we end up with \(a\), \(b\), \(c\) and \(d\) in \(\mathrm{MyInt}\) such that \(0 \leq a\), \(0 {\lt} b\), \(0 \leq c\), \(0 {\lt} d\) and \(-(a*d)=b*c\). This implies \(a=0\).

Lemma 107
✓

Let \(x\) be in \(\mathrm{MyRat}\) such that \(x\) is not nonnegative. Then \(-x\) is nonnegative.

Proof ▶

Annoying but easy, left as an exercise.

Lemma 108
✓

Let \(x\) and \(y\) be in \(\mathrm{MyRat}\) both nonnegative. Then \(x+y\) is nonnegative.

Proof ▶

Exercise.

Lemma 109
✓

Let \(x\) and \(y\) be in \(\mathrm{MyRat}\) both nonnegative. Then \(x*y\) is nonnegative.

Proof ▶

Exercise.

Lemma 110
✓

Let \(x\) be in \(\mathrm{MyRat}\) be nonnegative. Then \(x^{-1}\) is nonnegative.

Proof ▶

Exercise.

3.2.6 The order

Definition 111
✓
#

Let \(x\) and \(y\) in \(\mathrm{MyRat}\). We write \(x \leq y\) if \(y - x\) is nonnegative.

Lemma 112
✓

We have that \(0 \leq x\) if and only if \(x\) is nonnegative.

Proof ▶

Clear.

Lemma 113
✓
#

In \(\mathrm{MyRat}\) we have that \(0 \leq 1\).

Proof ▶

Clear because of Lemma 105.

Lemma 114
✓
#

The relation \(\leq \) on \(\mathrm{MyRat}\) is reflexive.

Proof ▶

Clear because of Lemma 104.

Lemma 115
✓
#

The relation \(\leq \) on \(\mathrm{MyRat}\) is transitive.

Proof ▶

It follows from Lemma 108.

Lemma 116
✓
#

The relation \(\leq \) on \(\mathrm{MyRat}\) is antisymmetric.

Proof ▶

It follows from Lemma 106.

It follows that \(\leq \) is an order relation.

3.2.7 Interaction between the order and the ring structure

Lemma 117
✓
#

Let \(x\), \(y\) and \(z\) in \(\mathrm{MyRat}\) be such that \(x \leq y\). Then \(x + z \leq y + z\).

Proof ▶

Clear from the definitions.

Lemma 118
✓
#

Let \(x\) and \(y\) in \(\mathrm{MyRat}\) be such that \(0 \leq x\) and \(0 \leq y\). Then \(0 \leq x * y\).

Proof ▶

It follows from Lemma 109.

We have proved that \(\mathrm{MyRat}\) is an ordered ring.

3.2.8 Interaction between the order and the inclusions

Lemma 119
✓
#

Let \(x\) and \(y\) in \(\mathrm{MyInt}\). We have that \(j(x) \leq j(y)\) if and only if \(x \leq y\).

Proof ▶

Exercise.

Lemma 120
✓
#

Let \(x\) and \(y\) in \(\mathrm{MyNat}\). We have that \(i(x) \leq i(y)\) if and only if \(x \leq y\).

Proof ▶

It follows immediately by Lemma 60, Lemma 119 and Lemma 101.

3.2.9 The linear order structure

Lemma 121
✓
#

The order \(\leq \) on \(\mathrm{MyRat}\) is a total order.

Proof ▶

This follows by Lemma 107.

Lemma 122
✓
#

We have that \(\mathrm{MyRat}\) with \(\leq \) is a linear order

Proof ▶

Clear from the lemma above.

Lemma 123
✓
#

Let \(x\) and \(y\) in \(\mathrm{MyRat}\) be such that \(0 {\lt} x\) and \(0 {\lt} y\). Then \(0 {\lt} x * y\).

Proof ▶

Exercise.

We now have that \(\mathrm{MyRat}\) is a strict ordered ring: a nontrivial ring with a partial order such that addition is strictly monotone and multiplication by a positive number is strictly monotone.

Lemma 124
✓
#

For every \(x\) in \(\mathrm{MyRat}\) there exists \(n\) in \(\mathrm{MyNat}\) such that \(x \leq i(n)\).

Proof ▶

Choose a representative \(x = a/b\) with \(0 {\lt} b\). By Lemma 63, choose a natural number \(n\) such that \(a \leq \mathrm{MyInt}.i(n)\). Since \(b\) is positive and \(\mathrm{MyInt}.i(n)\) is nonnegative, we have \(\mathrm{MyInt}.i(n) \leq b \cdot \mathrm{MyInt}.i(n)\). Thus \(a \leq b \cdot \mathrm{MyInt}.i(n)\), which is exactly \(a/b \leq n\), hence \(x \leq i(n)\).