TITLE: Baire space homeomorphic to irrationals
QUESTION [13 upvotes]: I try to show that the Baire space $\Bbb N^{\Bbb N}$, with regular product metric, is homeomorphic to the unit interval of irrationals $(0,1)\setminus\Bbb Q$. I already know that the needed function is using continued fractions
$$a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3+\cfrac1{a_4+\cfrac1\ddots }}}}$$
My question is how to show that this function actually fulfills what we want? - how to show it can only represent irrationals by this continued fraction? " every irrational in the unit interval? " it is 1-1?

REPLY [12 votes]: I have decided to post Arnold W. Miller's proof as a separate CW answer. The proof comes from his book Descriptive Set Theory and Forcing: How to Prove Theorems about Borel Sets the Hard Way. It is freely available here. (The same text was also published by Springer as a part Lecture Notes in Logic, here is projecteuclid link.)
I have two reasons for doing this. One is that I like the proof and in this way the proof will have more visibility than if it is just linked from comments and other answer. And also in this way some notation, which may not be familiar to all users reading this question, might be explained here.

What follows here is the exact copy of the text from Miller's notes. I have used the TeX-source which he published on his website. The only changes I have made were that I have replaced macros and I have modified it to use MarkDown.

Theorem. (Baire) $\omega^\omega$ is homeomorphic to the irrationals $\mathbb P$.
Proof. First replace $\omega$ by the integers $\mathbb Z$.  We will construct a mapping from $\mathbb Z^\omega$ to $\mathbb P$.
  Enumerate the rationals $\mathbb Q=\{q_n: n\in\omega\}$.
  Inductively construct a sequence of open intervals $\langle I_s : s\in \mathbb Z^{<\omega}\rangle$ satisfying the following:

$I_{\langle\rangle}=\mathbb R$, and for $s\not= \langle\rangle$ each $I_s$ is a nontrivial open interval in $\mathbb R$ with rational endpoints,
for every $s\in \mathbb Z^{<\omega}$ and $n\in \mathbb Z\;\;\; I_{s\widehat{\ } n}\subseteq I_s$,
the  right end point of $I_{s\widehat{\ } n}$ is the left end point of $I_{s\widehat{\ } n+1}$,
$\{I_{s\widehat{\ } n}: n\in \mathbb Z\}$ covers all of $I_s$ except for their endpoints,
the length of $I_s$ is less than $1\over |s|$ for  $s\not= \langle\rangle$, and
the $n^{th}$ rational $q_n$ is an endpoint of $I_t$ for some $|t|\leq n+1$.

Define the function $f:\mathbb Z^{\omega}\rightarrow\mathbb P$ as follows.
  Given $x\in\mathbb Z^{\omega}$ the set
  $$\bigcap_{n\in\omega}I_{x\upharpoonright n}$$
  must consist of a singleton irrational.  It is nonempty because
  $$\operatorname{closure}(I_{x\upharpoonright n+1})\subseteq I_{x\upharpoonright n}.$$
  It is a singleton because their diameters shrink to zero.
So we can define $f$ by
  $$\{f(x)\}=\bigcap_{n\in\omega}I_{x\upharpoonright n}.$$
  The function $f$ is one-to-one because if $s$ and $t$ are incomparable
  then $I_s$ and $I_t$ are disjoint.  It is onto since for every
  $u\in\mathbb P$ and $n\in\omega$ there is a unique $s$ of
  length $n$ with $u\in I_s$. It is a homeomorphism because
  $$f([s])=I_s\cap\mathbb P$$
  and the sets of the form $I_s\cap\mathbb P$ form a basis
  for $\mathbb P$.
  $\hspace{5cm}\square$
Note that the map given is also an order isomorphism from
  $\mathbb Z^\omega$ with the lexicographical order to $\mathbb P$
  with it's usual order.


Notation
Just in case someone is unfamiliar with some of the notation above.
$\omega=\{0,1,2,\dots\}$ denotes the set of all non-negative integers
The notation $A^{<\omega}$ is used for the set of all finite sequences of elements from $A$. In this proof we work with finite sequences of integers, i.e. with the set $\mathbb Z^{<\omega}$.
The symbol $s\widehat{\ }a$ stands for concatenation. I.e., if $s=\langle s_0,s_1,\dots,s_k\rangle$ is some finite sequence and $a\in\mathbb Z$, then $s\widehat{\ }a=\langle s_0,s_1,\dots,s_k,a \rangle$ is the finite sequences where $a$ is added on the end.
The symbol $|s|$ denotes length of the finite sequence $s$.
If $x=\langle x_0,x_1,\dots,x_n,\dots\in\rangle\mathbb Z^\omega$ is a sequence, then $x\upharpoonright n=\langle x_0,x_1,\dots,x_{n-1}\rangle$ is the finite sequence consisting of the first $n$ elements.
If $s\in\mathbb Z^{\omega}$, then $[s]$ denotes the set of all infinite sequences which start with $s$. I.e., if $s=\langle s_0, \dots, s_n\rangle$ then
$$[s]=\{x\in\mathbb Z^\omega; x_0=s_0, x_1=s_1,\dots,x_n=s_n\}.$$
For example for the empty sequence $\langle\rangle$ we get the whole $\mathbb Z^\omega$ in this way.
The system $\{[s]; s\in\mathbb Z^\omega\}$ is a base of the product topology on $\mathbb Z^\omega$ (i.e., of the Baire space).
Comments
I understand the phrase "$\{I_{s\widehat{\ } n}: n\in \mathbb Z\}$ covers all of $I_s$ except for their endpoints" in the way that it is supposed to say that $\bigcup\limits_{n\in\mathbb Z} I_{s\widehat{\ } n}$ contains all irrational numbers from $I_s$. (Clearly, it cannot contain the endpoints of the intervals $I_{s\widehat{\ } n}$, which belong to the interval $I_s$.) This property is precisely the reason why each irrational number must belong to one of the intervals at each step. (So this implies that the map defined above is surjective.)
The condition that $q_n$ is an endpoint of some interval in some stage is made to ensure that no rational number will belong to the intersection $\bigcap_{n\in\omega}I_{x\upharpoonright n}$. (Hence the values $f(x)$ of the function $f$ indeed belong to $\mathbb P$.)
People who are already familiar with descriptive set theory have certainly noticed that the system constructed in this proof is a Souslin scheme.