Prove that $f$ is one-to-one on $B$ and $f^{-1}:Y\to B$ is Borel. Let $f: X\to Y$ be a continuous and surjective map between compact metric spaces. Prove that there is a Borel set $B\subset X$ such that $f(B)=Y$, $f$ is one-to-one on $B$ and $f^{-1}:Y\to B$ is Borel.
In other words, we can select from each of the sets $f^{-1}$ exactly one point in a way that the resulting inverse function is Borel.
My attempt: For each $y \in Y$ we can pick one element $x_y \in f^{-1}(y)$ then have a collection $B'=\{x_y: y \in Y\}.$ Now $\{x_y\}$ is Borel. But we don't know $B'$ is Borel or not! Can we make it Borel?
Even if we couldn't then we can take a finite or countable subcollection B or B' and that will be Borel and $f$ is 1-1 on $B$ but we are lacking $f(B)=Y$. Please help me from here.
 A: This is a special case of some high-powered machinery in Descriptive Set Theory. I tried for a while to find an easier approach, but I was unable to.

Theorem: (cf. Theorem 6.3 here, or Section 5.2 of Srivastava's "A Course on Borel Sets")
Let $X$ and $Y$ be polish spaces, and $F : X \to 2^Y$ a function so that
$F(x)$ is $\sigma$-compact for each $x$.
Suppose moreover that $\Gamma_F = \{ (x,y) ~|~ y \in F(x) \}$ is borel in
$X \times Y$.
Then

*

*$\text{dom}(X) = \{x ~|~ F(x) \neq \emptyset \}$ is borel

*$F$ has a "borel selection function". That is, a borel function
$f : \text{dom}(X) \to Y$ such that $f(x) \in F(x)$ for every $x$.


Then, in your case, we let $G : Y \to 2^X$ with $G(y) = f^{-1}(y)$. Since $X$ is compact, $f^{-1}(y)$ is compact too (in particular $\sigma$-compact). Moreover,
$\Gamma_G$ is borel in $Y \times X$ since
$$\Gamma_G = \{(y,x) ~|~ x \in G(y) \} = \{(y,x) ~|~ x \in f^{-1}(y) \} = \{(y,x) ~|~ f(x) = y \}$$
and the graph of a borel function is a borel set.
So, proof by nuke, $\text{dom}(Y) = Y$ since $f$ was surjective, and the theorem guarantees a borel $g : Y \to X$ so that $g(y) \in G(y)$. That is, $g(y) \in f^{-1}(y)$. This is the required section.

I hope this helps ^_^
A: Theorem: If $f:X\to Y$ is a continuous mapping between compact metric spaces and $f(X)=Y$, then there is a Borel set $\mathscr{B}\subset X$ such that $f|_{\mathscr{B}}$ is one-to-one, $f(\mathscr{B})=Y$ and $f^{-1}:Y\to\mathscr{B}$ is Borel.
Proof: Suppose, initially, that $X \subset [0,1]$. Let $g:Y \to X$ be defined by
$$
g(y) = \inf\{x \in X: f(x)= y \} \, .
$$
Let $\mathscr{B} = g(Y)$. Obviously, $f(\mathscr{B}) = Y$, and $f$ is one-to-one on $\mathscr{B}$ with $g$ being its inverse.
It remains to show that $\mathscr{B}$ is a Borel set and that $g$ is a Borel map. For the former, observe that
$$
X \backslash \mathscr{B} = \{x \in X: \exists x' \in X \quad \text{s.t.} x' < x, f(x') = f(x)\} =\bigcup_{n \in \mathbb{N}} E_n \, ,
$$
where
$$
E_n = \{x \in X: \exists x' \in X \quad \text{s.t.} x' \leq x-\frac{1}{n}, f(x') = f(x)\} \, .
$$
It suffices to show each $E_n$ is closed. Suppose $x$ is a limit point of $E_n$, i.e. there exists a sequence $\{x_k\}_k$ in $E_n$ such that $x_n \to x$. By definition there exists a sequence $\{t_k\}_k$ in $X$ such that for each $k$, $t_k \leq x_k -\frac{1}{n}$ and $f(x_k)=f(t_k)$. By compactness of $X$, after passing to a subsequence if necessary, we can assume that there exists a $t \in X$ such that $t_k \to t$. Obviously,  $t \leq x - \frac{1}{n}$, and by continuity of $f$,
$$
f(t) = \lim_k f(t_k) = \lim_k f(x_k) = f(x) \, .
$$
This proves that $x \in E_n$. Therefore, $E_n$ is closed.
Now assume $X$ is any  general compact metric space. It is well-known that there exists a compact $K \subset [0,1]$ and a continuous map $\phi: K \to X$...[left to the reader :(]
