# Extending a biholomorphic map between two Riemann surfaces

Consider the following problem:

$X$ and $Y$ are two compact Riemann surfaces, $S$ is a finite subset of $Y$ and $f:X\longrightarrow Y$ is a holomorphic map whose set of branch points is $S$. Now suppose that
$$f|_{X\setminus f^{-1}(S)}:X\setminus f^{-1}(S)\longrightarrow Y\setminus S$$ is biholomorphic. Does exist a biholomorphic map $\overline f:X\longrightarrow Y$ that extends $f|_{X\setminus f^{-1}(S)}$ in a unique way?

The answer is yes and one way to see this is by passing to the category of smooth projective curves. In fact $X$ and $Y$ considered as smooth projective curves are birational, and so they must be isomorphic.

I'd like a solution for the above problem without thinking to algebraic curves. I want to show the existence of $\overline f$ only with complex analysis tools; for example I think that it is enough the Riemann removable singularities theorem. Any idea?

Any nonconstant holomorphic map $f : X \to Y$ between compact Riemann surfaces is a finite map, meaning that the set $f^{-1}(y)$ is finite for any $y \in Y$. Standard techniques in one complex variable show that if the points in the preimage $f^{-1}(y)$ are counted with multiplicity, then the number $n:=\# f^{-1}(y)$ is constant on $Y$ if $Y$ is connected (otherwise it's constant on every connected component of $Y$; this is by a standard topology connectedness argument). We call $n$ the order of $f$.
In your situation, $f$ is of order one, as you can check on the set where it is biholomorphic, so $f^{-1}(y)$ contains exactly one point for all $y \in Y$. This means that $f : X \to Y$ is injective. It is also surjective if $X$ and $Y$ are connected, because $f(X) \subset Y$ is nonempty, connected, closed and open, the last one by the open map theorem. A holomorphic function that's injective and surjective is a biholomorphism.
If you like to use some more algebra, you can also reason as follows: The map $f:X \longrightarrow Y$ is a birational isomorphism. The genus of a Riemann surface is a birational invariant: Hence $g(X) = g(Y)$ for the genus. Now the formula of Riemann-Hurwitz gives
$$g(X) = b/2 + \ (deg \ f) (g(Y) - 1) + 1,$$
with $b$ the total ramification order of $f$. With $deg \ f = 1$ and $g(X) = g(Y)$ you get $b = 0$. Hence $f$ is unramified already, q.e.d.