Hartshorne exercise 1.6.4 : Is it true that $\mathcal{O}_{P,X} \cong \mathcal{O}_{\varphi(P),\Bbb{P}^1}$? Let us work over a fixed algebraically closed field $k$ and consider a non-singular projective curve $X$ and $\varphi : X \to \Bbb{P}^1$  a non-constant morphism.


My question is: For $P \in X$, do we have an isomorphism
    $$\mathcal{O}_{P,X} \cong \mathcal{O}_{\varphi(P),\Bbb{P}^1}?$$


The reason I ask this question is because I want to prove that $\varphi$ is surjective. I believe I have almost done this, and this is the last part in the proof that I basically need. Now I have determined that $\varphi$ is actually a dominant morphism (by topological considerations and using that the cardinality of $X$ is necessarily infinite). So actually I already know that 
$$\varphi_P^\ast : \mathcal{O}_{\varphi(P),\Bbb{P}^1} \to \mathcal{O}_{P,X}$$
is injective. How can I prove that it has to be surjective? Do I know that $\mathcal{O}_{P,X}$ is finitely generated (as a module) over the image of $\mathcal{O}_{\varphi(P),\Bbb{P}^1}$?
 A: These local rings are not isomorphic, unless $\varphi$ itself is an isomorphism.  The situation, from an algebraic perspective, is similar to the inclusion of $\mathbb Z$ into $\mathbb Z[i]$.  This is not an isomorphism, and does not become one if you localize at $2$ and at the prime above $2$.
One way to see it is that if this were an isomorphism, it would induce an isomorphism on fraction fields, i.e. an isomorphism $K(\mathbb P^1) \cong K(X)$,
but such an isomorphism implies that $X$ itself is isomorphic to $\mathbb P^1$ (since a smooth projective curve is determined by its function field).
A: To complement Matt E's nice answer (+1), let me just observe that you know $\phi$ is surjective because its domain is proper, and hence its image is closed---you know it is dense already.
Here, in more detail, is the proof that a map whose domain is a projective variety is closed (this is the consequence of properness that you need): after unwinding the definitions, Thm 5.7A says precisely that the projection
$$\mathbb{P}^n \times \mathbb{A}^m \rightarrow \mathbb{A}^m$$ is a closed map. It follows that the same is true for the projection
$$\mathbb{P}^n \times X \rightarrow X$$ onto any affine variety $X$. Since an arbitrary variety has a covering by open affines, it follows also for an arbitrary variety $X$. Furthermore, we may replace $\mathbb{P}^n$ by a closed subvariety $V$. Now given a map $\phi:V \rightarrow X$ from a projective variety $V$ to a variety $X$, we may factor it as
$$V \rightarrow V \times X \rightarrow X$$ where the first map is the graph $v \mapsto (v,\phi(v))$ of $\phi$ (a closed embedding, and hence closed) and the second is the projection (a closed map by the above). It follows that $\phi$ is closed. The same argument works for projective schemes, given the appropriate statement of the elimination theorem.
