How to formally denote a bijection formula I'm learning set theory by doing exercises from a textbook that gives a high level overview of sets theory. Unfortunately it doesn't provide a lot of examples on the formal math language that I can use to formally denote bijection formulas.
My question is how to formally define a bijection formula between two sets without resorting to a lot of explanation. Take as an example the following exercise:

Build a bijection between an interval $[0, 1]$ and half-interval $[0, 1)$

I solved this problem as follows:

Let's rewrite $M_1=[0, 1]$ as $M_1=C_1 + R_1 : R_1 = \{\frac{1}{n} \mid n \in \Bbb N \} \land C_1 = M_1 \setminus R_1$ and $M_2=[0, 1)$ as $M_2=C_2 + R_2 : R_2 = \{\frac{1}{n} \mid n \in (\Bbb N \setminus \{1\})\} \land C_2 = M_2 \setminus R_2$. A "plus" sign here means a union of non-intersecting sets.
It is easy to see that $C_1 = C_2$.
So a bijection would be a one-to-one mapping for elements of $C_1, C_2$.
For elements of $R_1, R_2$ bijection could be defined as follows:
$$g : R_1 \rightarrow R_2, g \left (\frac 1n \right ) = \frac{1}{n+1} \text{ for } n \in \Bbb N$$
and
$$g^{-1} : R_2 \rightarrow R_1, g^{-1}\left(\frac 1n \right) = \frac{1}{n-1} \text{ for } n \in (\Bbb N \setminus \{1\})$$

In the above proof I wanted to convey the idea that both intervals would have a common part  - i.e. either interval minus a set $R = \{x \mid x = \frac{1}{n}, n \in \Bbb N\}$ and then show a bijection for remaining elements, where remaining elements would be either interval minus set $R$.
Is there an easier or more accurate way to write the above?

Bear in mind that the two spaces aren't homeomorphic (one is compact and the other is not), so there's no way to do this in a bicontinuous manner.  Indeed, since a continuous image of a compact set $([0, 1])$ achieves its maximum, there's no way to do this in a continuous manner.
The easiest way I can think of is this:  Let $\{q_n \mid n \in \Bbb N \}$ enumerate the rationals in $[0, 1)$.  (It's tedious, but you can come up with an express formula to do this if you want.)  Then define $f(1)= q_0, f(q_k)=q_{k+1}$ for the rationals, and let $f$ be the identity function on the irrationals.
