$
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\w}[1]{\widetilde{#1}}
\newcommand{\set}[1]{\left\{ #1 \right\}}
\newcommand{\setb}[2]{\left\{ #1 \, \middle| \, #2 \right\}}
\newcommand{\seq}[1]{\left( #1_i \right)_{i=1}^\infty}
\newcommand{\qc}{\Q^\omega_c}
$
I want to address a perhaps more general question, which was brought up in a question that was later redirected to this post. (I recognize that this ultimately won't touch on much of the computer science stuff that OP's question was geared towards.)
That question, essentially, being:
In the formal construction of the number systems, we readily see they're not subsets of each other. Yet often have this hierarchy and claim that $\N \subseteq \Z \subseteq \Q \subseteq \R \subseteq \cdots$; question being, why?
Naively, these inclusions hold. So why do they not hold in the formal construction? We can also ask the converse: why do we observe the inclusions not holding formally, but claim they do anyways?
Introduction:
Firstly, there isn't a meaningful reason to consider them not subsets of each other. There's usually not much to benefit by doing so..
Yes - formally, in the usual Peano constructions - they're not subsets. After all:
- $\N$ is just a collection of sets containing empty sets nested in a fancy manner.
- $\Z$ is just a collection of equivalence classes on $\N^2$ (sets of sets).
- $\Q$ is just a collection of equivalence classes on $\Z \times \N$ (so sets of sets of sets).
- And if you want to go even further, you can construct $\R$ in various ways, e.g. equivalence classes of sequences (so sets of sets of sets of sets).
When formally defined in this fashion, yes, there is no subset relation between them.
However, bear in mind what this construction is trying to encapsulate and formalize. The definitions of $\N,\Z,$ etc. came after the sets themselves. We simply wanted to formalize their construction. This is perhaps the most key insight here: we wanted to define something, essentially, that is isomorphic to our naive definitions, yet still grounded rigorously.
Luckily, each have a natural embedding into the one above it, as we'll discuss.
Sadly, the embeddings are not as obvious as "just look at it", because it has to be grounded rigorously. One nice thing that the Peano construction does is it starts with something we can define very easily from the $\mathsf{ZFC}$ axioms alone: the empty set, $\varnothing$. (Read more on it, e.g. here). This logical minimalism then lets us simply define structures (e.g. equivalence relations) and symbols (e.g. $+,-,1,0,3,-3,1/2$) as need be to get as far as we need. This ultimately comes at the cost of not having a "just look at it" inclusion, but instead the prospect of embeddings (something that is virtually identical to what we want contained inside).
So let's dive in to the details...
The Constructions:
First, recall the constructions. We'll speed through them for the most part and not go too deep into the woods as to how one might define operations within these (though these can be found elsewhere fairly easily).
- For simplicity, we will say $0$ is not a natural number. We define the symbol $0 := \varnothing$ and define the symbol $n$ (for $n$ one of our usual Arabic numerals) to be given by $n+1 := \set{n} \cup n$. Again, this is just defining the sets, the symbols for the Arabic numerals, i.e. we have
$$\begin{alignat*}{99}
1 &:= \set{\varnothing} &&= 0 \cup \set 0 \\
2 &:= \set{\varnothing, \set{\varnothing}} &&= 1 \cup \set{1} \\
3 &:= \set{\varnothing, \set{\varnothing}, \set{\varnothing, \set{\varnothing}}} &&= 2 \cup \set{2} \\
&\vdots
\end{alignat*}$$
$\Z$ is formed from an equivalence relation on $\N \times \N$. We'll denote this by $\sim_s$ to remind us of subtraction. Then $(a,b) \sim_s (c,d)$ iff $a+d=b+c$. $\Z$ is the collection of equivalence classes here, i.e. $\Z := \N^2/\sim_s$ from definition.
You can think of pairs $(a,b) \in \N^2$ as somehow representing the naive difference $a-b$, and we simply are setting all such pairs equivalence to each other. (Notice that $$a+d = b+c \iff a-b = c-d$$ in the naive sense.)
From here, we again begin defining symbols as shorthand. For the symbol $n$, we define $n$ to be the class of $\Z / \sim_s$ where $a-b = n$. Or put more properly, $a-b$ (be it positive or negative, and we simplify it in the naive way) represents the equivalence class of all pairs equivalent to $(a,b)$.
$\Q$ is likewise formed from an equivalence relation on $\Z \times \N$. Call this $\sim_d$ to remind us of division. Then $(a,b) \sim_d (c,d)$ iff $ad=bc$. The equivalence classes of this give us $\Q$, i.e. we define $\Q := (\Z \times \N) / \sim_d$.
Again, similar to the previous, pairs $(a,b) \in \Z \times \N$ are representative of the fractions $a/b$. I'll leave the justification to you.
And again, similar to the previous, we define symbols as shorthand. The symbol $a/b$ represents the equivalence class of all pairs equivalent to $(a,b)$.
$\R$ can be defined in several ways. Perhaps the simplest is by taking equivalence classes of Cauchy sequences in $\Q$, and saying they have equivalent limits. Define
$$\Q^\omega := \setb{ (q_i)_{i=1}^\infty }{ q_i \in \Q } = \text{all rational sequences}$$
Define the subspace
$$\Q^\omega_c := \setb{ q := \seq q \in \Q^\omega }{ q \text{ is Cauchy}}$$
Let $a := \seq a, b := \seq b \in \qc$ be two such sequences. We say they are equivalent, denoted $\sim_\ell$ (to bring to mind limits) if they converge to the same value, i.e.
$$a \sim_\ell b \iff \lim_{n \to \infty} a_n = \lim_{n \to \infty} b_n$$
Then $\R := \qc / \sim_\ell$, the equivalence classes of these sequences.
The Embeddings:
Now:
$\N$ embeds into $\Z$ naturally by letting $b=d=0$ in the previous statements. That is, we can define the set
$$\w \N := \setb{ (a,b) \in \N^2 }{ b = 0 } = \set{ (a,0) \in \N^2} \subseteq \N^2$$
Notice how, consequently, each $a \in \N$ is associated to a pair in $\w\N$, and any pair $(c,d)$ is related to something in $\w\N$, i.e. $(a,0) \sim_s (c,d)$ iff $c-d=a$ (in the naive sense). We can then, in $\Z := \N^2 /\sim_s$ associate each $a \in \N$ to some equivalence class, one which contains $(a,0)$, giving our embedding.
Similarly consider embedding $\Z$ into $\Q$. This largely arises from associating $b=d=1$. That is, we may define
$$\w\Z := \setb{ (a,b) \in \Z \times \N }{ b = 1 } = \setb{ (a,1) }{ a \in \Z } \subseteq \Z \times \N$$
$\w\N$ likewise has an association within this, but it's not necessary owing to the previous embedding. Thus, like before, any $(a,1) \in \w\Z$ has its own equivalence class in $\Q := (\Z \times \N)/\sim_d$, those where (naively) we have the fractions which (naively) simplify to $a/1$, or simply $a$.
The embedding $\Q$ into $\R$ is similarly obvious. We simply take
$$
\w\Q := \setb{ q := \seq q \in \qc }{ q_i = q_1 \; \forall i \ge 1, q_1 \in \Q } \subseteq \qc
$$
That is, $\w\Q$ is just all of the constant rational sequences. Clearly the uniqueness of limits in $\R$ ensures that each $q \in \w\Q$ thus has its own equivalence class.
You can proceed even further with this with other constructions of $\Bbb C$, etc., as you deem necessary but I'll leave it here.
What does this give us?
In summary, what we have seen is that, in a given structure ($\Z,\Q,\R$), there are substructures like those below them in the hierarchy:
- $\Z$ has an analogue of $\N$ in it, which we called $\w\N$
- $\Q$ has an analogue of $\Z$ in it, dubbed $\w\Z$
- $\R$ has an analogue of $\Q$ in it, dubbed $\w\Q$
These substructures are isomorphic to what they were originally, in the sense they have all of the same properties as well.
The key point being that, by the time we have all of these analogous structures in $\R$, there are already copies within $\R$ that behave like the original objects $\N,\Z$, etc., which are subsets (even if the originals are not), and still satisfy all of the properties we want.
So when we then get to the point of wanting to use these in mathematics, we find no issue tying this loop all back together and simplify refer to $\w\N$ as $\N$, $\w\Q$ as $\Q$, and so on. Perhaps it overloads the notation a bit to do so, but since these isomorphic copies follow the same rules as both the naive counterparts we love and know, and as the formal counterparts too, there's rarely ever any issue in doing this -- except when, perhaps, dealing with all of these constructions directly.
1 / 3 = 0
but1. / 3. = 0.333...
. This breaks the Liskov substitution principle. $\endgroup$