So far we have assumed that the halting problem is undecidable: \[ \probHALT = \setbuild{\encoding{M, w}}{M \text{ is a Turing machine that halts on } w} \] and used this to prove that other problems are undecidable using Turing reductions.
No onto function exists, so
\(|\{1, 2\}| < |\{3, 4, 5\}|\)
We can use this approach of comparing sizes by establishing correspondences to define what it means for one set to be smaller than another:
In the previous example, we can exhibit an onto function from \(\{3, 4, 5\}\) to \(\{1, 2\}\) to conclude \(|\{3, 4, 5\}| \ge |\{1, 2\}|\). \[ f(3) = 1, \quad f(4) = 2, \quad f(5) = 2. \]
But now we can apply the definition to compare infinite sets!
Definition: For any sets \(A\) and \(B\), we write \(|A| \ge |B|\) if and only if there is an onto function \(f: A \to B\).
Observation: For any sets \(A\) and \(B\), there is an onto function \(f: A \to B\) if and only if there is a 1-1 function \(g: B \to A\).
Proof:
This justifies stating that \(|B| \le |A|\) if and only if there is a 1-1 function \(g: B \to A\).
Note: It is possible to have 1-1 functions \(f: A \to B\) and \(g: B \to A\) but for neither to be onto; e.g. \(f,g: \N \to \N\) defined by \(f(n)=g(n)=n+1\) or \(2n\).
Schröder-Bernstein Theorem: For any two sets \(A\) and \(B\), there is a bijection \(h: A \to B\) if and only if there are 1-1 functions \(f: A\) \(\to\) \(B\) and \(g: B\) \(\to\) \(A\).
Proof:
Schröder-Bernstein Theorem: For any two sets \(A\) and \(B\), there is a bijection \(h: A \to B\) if and only if there are 1-1 functions \(f: A\) \(\to\) \(B\) and \(g: B\) \(\to\) \(A\).
Proof: We must define a bijection \(h_C: A \cap C \to B \cap C\) for each connected component \(C\).
The Schröder-Bernstein Theorem, and the previous observation, justifies stating that for any sets \(A,B\),
\(|A| = |B|\) \(\iff\) \(\exists h: A \stackrel{\text{1-1,onto}}{\to} B\) \(\iff\) \(\exists f: A \stackrel{\text{1-1}}{\to} B, g: B \stackrel{\text{1-1}}{\to} A\) \(\iff\) \(\exists f: A \stackrel{\text{onto}}{\to} B, g:B \stackrel{\text{onto}}{\to} A\).
Can we find an onto function from \(\N\) to \(\Z\)? (showing \(|\N| \ge |\Z|\))
We can find an onto function \(f:\N \to \Z\) by letting \(f(0)=0\) and \(f(1), f(2), f(3), f(4), \dots\) alternate positive and negative integers. \[ \fragment{\begin{array}{cccccccccccccc} \\ & & & & & 0 & 1 & 2 & 3 & 4 & \cdots \\ \\ \cdots &\stackrel{f(8)=}{-4} & \stackrel{f(6)=}{-3} & \stackrel{f(4)=}{-2} & \stackrel{f(2)=}{-1} & \stackrel{f(0)=}{0} & \stackrel{f(1)=}{1}& \stackrel{f(3)=}{2}& \stackrel{f(5)=}{3}& \stackrel{f(7)=}{4}& \cdots \end{array}} \]
\[ \fragment{ f(n) = \begin{cases} -\frac{n}{2} & \text{ if } n \text{ is even.} \\ \left \lceil \frac{n}{2} \right \rceil & \text{ if } n \text{ is odd} \end{cases} } \]
Thus also \(|\N| \ge |\Z|\), and so \(|\N| = |\Z|\).
Let’s now consider the rational numbers \(\Q\). \[ \Q = \setbuild{\frac{n}{d}}{n \in \Z, d \in \N^+ } \]
It looks like there are way more of these!
We’ll start out with just the positive rationals \(\Q^+\).
Clearly \(|\Q^+| \ge |\N^+|\) since \(\N^+ \subsetneq \Q^+\), and thus \(|\Q^+| \ge |\N|\).
Example function showing \(|\N^+| \ge |\N|\)?
Let’s now consider the rational numbers \(\Q\). \[ \Q = \setbuild{\frac{n}{d}}{n \in \Z, d \in \N^+ } \]
It looks like there are way more of these!
We’ll start out with just the positive rationals \(\Q^+\).
Clearly \(|\Q^+| \ge |\N^+|\) since \(\N^+ \subsetneq \Q^+\), and thus \(|\Q^+| \ge |\N|\).
The following won’t work: \[ \frac{1}{1}, \; \fragment{\frac{1}{2},} \; \fragment{\frac{1}{3},} \; \fragment{\frac{1}{4}, \; \cdots,} \; \fragment{\frac{2}{1},} \; \fragment{\frac{2}{2},} \; \fragment{\frac{2}{3}, \; \frac{2}{4}, \; \cdots,} \; \fragment{\frac{3}{1}, \; \frac{3}{2}, \; \frac{3}{3}, \; \cdots} \hspace{20em} \]
Larger numerators aren’t reached at any finite step! Numerator and denominator must change together!
Let’s now consider the rational numbers \(\Q\). \[ \Q = \setbuild{\frac{n}{d}}{n \in \Z, d \in \N^+ } \]
It looks like there are way more of these!
We’ll start out with just the positive rationals \(\Q^+\).
Clearly \(|\Q^+| \ge |\N^+|\) since \(\N^+ \subsetneq \Q^+\), and thus \(|\Q^+| \ge |\N|\).