Construct a morphism from a nonsigular projective curve onto $\mathbb{P}^1$ from a rational function, and its quasi-finiteness (I) I'm currently doing exercise I.6.4 in Hartshorne's Algebraic Geometry. I've tried to prove this and get a so-called "proof" which full of gaps and uncertainty.
The exercise goes like this:

Let $Y$ be a nonsingular projective curve. Show that:
(1) every nonconstant rational function $f$ defined on $Y$ defines a surjective morphism $\phi: Y \rightarrow \mathbb{P}^1$,
(2) and that for every $P \in \mathbb{P}^1$, $\phi^{-1}(P)$ is a finite set of points.

"Proof" of (1): I get the inspiration from Question: Rational function and morphisms of quasiprojective varieties
By saying $f$ is a rational function on $Y$, we are actually given a regular function on an open set $U \subset Y$. WLOG, we may assume that $U$ here has already be maximal. What we need to do is actually define the desired morphsim on $Y-U$. To do that, consider any (fixed) point $P \in Y-U$ and the local ring $\mathcal{O}_{Y,P}$ with the maximal ideal $\mathfrak{m}_P$. Note that $Y$ is a nonsingular projective curve, $\mathcal{O}_{Y,P}$ is a DVR, and hence $\mathfrak{m}_P$ is principal. Let $\mathfrak{m}_P = (u)$.
Since $P \in Y-U$, $f$ is not contained in that local ring. Yet since $f$ is a rational function, $f \in \mathrm{Frac}(\mathcal{O}_{Y,P})=K(Y)$. Hence we can write $f$ as $f=\frac{\alpha}{\beta}$, where $\alpha, \beta \in \mathcal{O}_{Y,P}$ and $\beta \not\in (\mathcal{O}_{Y,P})^\times$. By definition, $\beta \in \mathfrak{m}_P$. Hence, there exists $\beta_1 \in \mathcal{O}_{Y,P}$, such that $\beta = \beta_1 u$.
Now if $\beta_1 \not\in \mathfrak{m}_P$, then $\frac{\alpha}{\beta_1}$ is regular amd nonzero at $P$ and $f$ can be expressed as $f=(\alpha / \beta_1) u^{-1}$. Else if $\beta_1 \in \mathfrak{m}_P$, we can carry on the process above and find $\beta_2 \in \mathcal{O}_{Y,P}$ such that $f=(\alpha / \beta_2) u^{-2}$. Such process will end in finitely many steps, for if not, we would obtain a chain $\beta_j \vert \beta_{j-1}$, which contradicts to the fact that $\mathcal{O}_{Y,P}$ is a UFD (since it is a DVR).
To sum up, we can express $f$ as $f= \rho u^{-\nu}$ for some $\rho$ a regular and nonzero at $p$ map, and $\nu$ a positive integer.
Now, we define $\phi(P)$ as
$$
\phi(P) = [0:1] = [u^{\nu}(P) : \rho(P)],
$$
when $P \in Y-U$. For $P \in Y$, we can define
$$
\phi(P) = [1:f(P)].
$$
This is consistent with the definition for $P \in Y-P$, if we now regard $f=u^{0} f$ by taking $\nu = 0$ in above settings.
Now, here come my Question 1: Why $\phi$ is a morphism?
If we have proved that $\phi$ is a morphism, then since $\phi$ is a morphism from a PROJECTIVE curve $Y$, the image is closed in $\mathbb{P}^1$. Since $f$ is nonconstant and $Y$ is irreducible, the image of $\phi$ must be all of $\mathbb{P}^1$. Hence $\phi$ is a surjection.
Here comes my Question 2: The "proof" above seems to be a complete one. Yet it is too complicated! Is there a better way to understand the proof? I've read some post on MSE about this question, and someone mentioned that we can use the Proposition I.6.8 in Hartshorne "directly" to get the desired result. But I do not know how to apply this theorem here. Could someone provide more details on this?
P.S.The Proposition I.6.8 in Hartshorne is:

Let $X$ be an abstract nonsigular curve, let $P$ \in $X$ and $Y$ be a projective variety. Let $\phi: X-P \rightarrow Y$ be a morphism. Then there exists a unique morphism $\bar{\phi}: X \rightarrow Y$ extending $\phi$.

I still have questions on (b), yet since this question has already been quite lengthy, I will open up another post on those.
I'm so sorry to post such a lengthy post. and thank you all for answering and commenting on this post in advance!! :)
 A: Exercise: "Let $Y$ be a nonsingular projective curve. Show that: (1) every nonconstant rational function $f$ defined on $Y$ defines a surjective morphism $ϕ:Y→P^1$, (2) and that for every $P∈P^1$, $ϕ^{−1}(P)$ is a finite set of points."
Answer: Let $C$ be an irreducible smooth projective curve over an algebraically closed field $k$ and let $K:=K(C)$ be the function field of $C$ with $x\in K$ a "non-constant" rational function. Let $P(t)\in k[t]$ and assume $P(x)=0$. Since $k$ is algebraically closed this implies $x\in k$ a contradiction, hence $x$ is "transcendental over $k$", meaning the subring $k[x] \subseteq K$ generated by $k$ and $x$ is isomorphic to a polynomial ring. You get an embedding $k \subseteq k(x) \subseteq K$ where $x$ behaves like an independent variable over $k$. This gives (by the proof of HH.I.6.12) a surjective morphism
$$\phi: C \rightarrow \mathbb{P}^1_k.$$
Since $C$ is projective and irreducible, the image is closed and irreducible and hence $Im(\phi)=\mathbb{P}^1_k$. The inverse image $\phi^{-1}(x)$ of a closed point $x\in \mathbb{P}^1_k$ is a strict closed subvariety of $C$ (since $\phi$ is non-constant) and since $C$ is irreducible it follows $\phi^{-1}(x)$ must be a finite set of points.
Note: Since $k$ is algebraically closed it follows any polynomial $P(t) \in k[t]$ factors as
$$P(t)=(t-a_1)\cdots (t-a_n)$$
with $a_i \in k$. Hence if $P(x)=0$ it follows $x=a_i\in k$ for some $i$ - a contradiction since $x$ is assumed to be "non-constant".
A: This is a nice exercise, and it should be discusses clearly in my opinion. Since you gave a reference to an exercise in Hartshorne's book, I will use the definitions and results in this book.
First of all, we have the following easy fact ( it basically follows from the first section):
If $X$ is a curve, then $C\subset X$ is closed if and only if either $C=X$ or $C$ is finite.
Let $\langle U,f \rangle$  be a rational function in $K(Y)$. Then $f: U\rightarrow \mathbb{A}^1$ is a nonconstant morphism by definition, so $f(U)$ is not a point. Observe that $f(U)$ is dense in $\mathbb{A}^1$. Indeed, if it was not dense, then it should be the set of points. But, since $f$ is regular, it is continuous by Lemma I.3.1. Thus $f(U)$ should be irreducible, so $f(U)$ would be only one point, which is a contradiction. Hence we have a dominant morphism  $f: U\rightarrow \mathbb{A}^1.$
Let $U_1$ be the open set defined by the equation $x_1\neq 0$ as in page 10. Then we have an isomorphism $\varphi_1: U_1\rightarrow \mathbb{A}^1$ by Proposition I.3.3. Note that $U_1$ is a (quasi)-projective variety. Then the map $\varphi':=\varphi_1^{-1}f:U\rightarrow U_1$ is a dominant morphism of varieties. (Here, $U_1\subset \mathbb{P}^1$) Since $U$ is nonempty, open, $Y-U$ is finite. Thus, by Proposition I.6.8 and induction, $\varphi'$ uniquely extends to a morphism $\varphi: Y\rightarrow \mathbb{P}^1$. Strictly speaking, to use Proposition I.6.8, we also need to say that $Y$ is an abstract nonsingular curve, which follows from Proposition I.6.7.
I will not discuss the second part since hm2020's answer has already discussed it in detail.
In your first question, you are saying why is $\varphi$ a morphism? Are you asking whether it is a morphism or not? Even though the idea seems true for me, I am not sure it is really a morphism. So you should either show that it is a morphism (by using the definition) or use some results. I wrote the idea seems true because you are sending point at infinity to the finite points in $Y-U$. It may work.
