Descent of holomorphism also holomorphic - hyperelliptic Riemann surfaces My question is about how to finish a proof of Lemma 1.9 from Rick Miranda's Algebraic Curves and Riemann Surfaces. Essentially, a hyperelliptic Riemann surface is the solution set of the equation $y^2=h(x)$ in $\mathbb{C}^2$ for some polynomial $h$ with distinct roots. This is a Riemann surface with chart maps given by projection onto $x$ in neighborhoods where $y\neq 0$ and projection onto $y$ in neighborhoods of $y=0.$ This surface has an involution $\sigma:Z\to Z$ given by $\sigma(x,y)=(x,-y),$ and a projection $\pi:Z\to\mathbb{C}$ onto the $x$ coordinate. Given a meromorphic function $g:X\to \mathbb{C}$ invariant under this involution, so that $g(x,y)=g(x,-y)$, Miranda constructs a function $r:\mathbb{C}\to \mathbb{C}$ with $r\circ \pi=g$ given by $r(p)=g(q)$ where $q$ is either of up to two points with $\pi(q)=p$, (that is $q=(p,y)$). The exercise asks you to check that $r$ is meromorphic.
I changed the definition of $Z$ slightly so that it is simpler and non-compact, but this should not affect this exercise. It's easy to show that $r$ is meromorphic at any non-branch point of $\mathbb{C}$ where $h(x)\neq 0$ because it is given by inverting a chart map and then applying $g$. At a branch point, my best idea is to show that $r$ is continuous at the branch point (as a map into $\mathbb{C}_{\infty}$) and then use the fact that $r$ is holomorphic in a neighborhood around the branch point to deduce it is holomorphic at that point. My background in complex analysis is not strong enough for me to know if this actually works.
I appreciate any help. Thanks.
 A: I think we can put this in more general terms. Suppose $X,$ $Y$ and $Z$ are (connected) Riemann surfaces and $\pi:X\to Y$ is a surjective holomorphism. Suppose $g:X\to Z$ is holomorphic and there is a function $r:Y\to Z$ such that $r\circ \pi=g.$ Then I claim $r$ is also a holomorphism. When $Z$ is replaced by $C_{\infty}$ we get the case of meromorphisms.
First, use the surjectivity of $\pi$ and the open mapping theorem to prove that $r$ is continuous.
Next, let $p\in X.$ Choose coordinates around $g(p)$, pick chart containing $\pi(p)$ mapping into these coordinates under $r$, and use local normal form to pick a chart centered at $p$ that looks such that $\pi$ looks like $z^n$ for some $n$, so that it suffices to solve the problem for $z^n$ in $\mathbb{C}$. To do this, suppose instead that we know $r(z^n)=g(z)$ for $g$ holomorphic. Let $\omega_n$ be the $n$th root of unity. Then
$$
g(z)=\frac{\sum_{0 \leq k \leq n}g(z)}{n}=\frac{\sum_{0\leq k \leq n-1}g(\omega_n^kz)}{n}
$$
Then if we express $g$ as a Taylor series, all coefficients of terms of degree $m$ for $n\nmid m$ cancel from the right side, showing that $g$ only has coefficients at terms of degree a multiple of $n$. Therefore $g(z)=h(z^n)$ for some holomorphic function $h$. Then for any point $x$ in the image of $z^n$ we have $h(x)=r(x).$ By the open mapping theorem, this image is an open set containing the origin, therefore $r$ is holomorphic at the origin.
