Is a morphism from a quasi-affine variety to a quasi-projective variety given by globally defined regular maps? $\def\bbA{\mathbb{A}}
\def\bbP{\mathbb{P}}
\def\sO_{\mathcal{O}}$The following discussion is strictly classical. Throughout this question, I will use the notions of (i) sheaf of $k$-algebras, (ii) $k$-ringed space and (iii) morphism of $k$-ringed spaces as they are defined in Milne's book, Chapter 3, sections a, b, d. These are not the same definitions as for general ringed spaces (they are what Görtz and Wedhorn—in the first chapter of their AlgGeom book—call a space with functions and a morphism of spaces with functions). In particular, one has

Lemma. “Being a morphism” is a property of maps between $k$-ringed spaces that is locally on the target. Explicitly, let $(X,\sO_X),(Y,\sO_Y)$ be $k$-ringed spaces and let $\varphi:X\to Y$ be a function. The following are equivalent:

*

*$\varphi$ is a morphism of $k$-ringed spaces,


*for all open sets $V\subset Y$, the map $\varphi|_{\varphi^{-1}(V)}:\varphi^{-1}(V)\to V$ is a morphism, and


*there is an open cover $Y=\bigcup_iV_i$ of $Y$ such that $\varphi|_{\varphi^{-1}(V_i)}:\varphi^{-1}(V_i)\to V$ is a morphism for all $i$.

I will set up notations. Let $k$ be an arbitrary field. The $n$-dimensional affine space $\bbA_k^n=k^n$ and projective space $\bbP_k^n=\bbA_k^{n+1}/k^*$ are topological spaces where the closed sets are the vanishing sets of polynomials (homogeneous on the latter case), the "Zariski topology."
By definition, a (quasi-)affine (resp., a (quasi-)projective) variety is a locally ringed space that is isomorphic to a Zariski (locally) closed subset of $\bbA_k^n$ (resp., of $\bbP_k^n$) equipped with the sheaf of $k$-algebras of regular functions. These are the functions that are locally written as a quotient of polynomials (with non-vanishing denominator) required to be homogeneous of same degree in the projective case.
If $X$ and $Y$ are both quasi-affine varieties, both quasi-projective varieties or one of them quasi-affine and the other one quasi-projective, by definition a regular map $X\to Y$ is a morphism of $k$-ringed spaces $(X,\sO_X)\to (Y,\sO_Y)$. Thus, quasi-affine + quasi-projective varieties and the regular maps assemble into a category.
From this definition, it can be proven that

*

*If $X,Y$ are quasi-affine varieties, with $Y\subset\bbA_k^m$, then a map $\varphi=(\varphi_1,\dots,\varphi_m):X\to Y$ (where $\varphi_i=y_i\circ\varphi$) is regular if and only if $\varphi_i\in\Gamma(X,\sO_X)$ for all $i$.

*For $0\leq i\leq n$, the map
\begin{align*}
\bbA_k^n&\longrightarrow U_i=\bbP_k^n\setminus V(x_i)\\
        (a_1,\dots,a_n)&\longmapsto (a_1:\dots:a_{i-1}:1:a_i:\cdots:a_n)
\end{align*}
is an isomorphism.

Here is my problem: I am trying to characterize the regular maps that go from a quasi-affine variety into a quasi-projective variety. Using the two last facts and the lemma, one can show

Proposition. Let $X\subset\bbA_k^n$ be quasi-affine, $Y\subset\bbP_k^m$ be quasi-projective and $\varphi:X\to Y$ be a map. Then $\varphi$ is regular if and only if each point of $X$ has an open neighborhood $U$ on which there are defined regular functions $f_0,\dots,f_m\in \sO_X(U)$ with
$$
\varphi(a_1,\dots,a_n)=(f_0(a_1,\dots,a_n):\dots:f_m(a_1,\dots,a_n))
$$
for all $(a_1,\dots,a_n)\in U$.

Now, what I am trying to prove or disprove is the following

Conjecture. Let $X\subset\bbA_k^n$ be quasi-affine, $Y\subset\bbP_k^m$ be quasi-projective and $\varphi:X\to Y$ be a map. Then $\varphi$ is regular if and only if there are globally-defined regular functions $f_0,\dots,f_m\in \Gamma(X,\sO_X)$ with
$$
\varphi(a_1,\dots,a_n)=(f_0(a_1,\dots,a_n):\dots:f_m(a_1,\dots,a_n))
$$
for all $(a_1,\dots,a_n)\in X$.

I want to say in advance that I deem this conjecture to be false, by what Milne writes in section 6.l of his book. However, I don't know any counterexamples, so I would be grateful if someone could indicate some.
 A: If I have understood your question, take $Y=\{xy-zw=0\}\subset \mathbb{A}^4$ and $X=Y-\{0,0,0,0\}$. Then you have a morphism $ X\to\mathbb{P}^1$ given by $(x,z)$ on points where at least one of them do not vanish and where they both vanish, given by $(w,y)$. You can check that this is an example of what you seek.
I am adding a few more details. You have a morphism from $Y\to \mathbb{P}^1\times\mathbb{P}^1\subset \mathbb{P}^3$, since $\mathbb{P}^1\times\mathbb{P}^1$ is given by the same equation, $xy-zw=0$ in $\mathbb{P}^3$. The map I described above is just the map from $X\to\mathbb{P}^1\times\mathbb{P}^1$ composed with one of the projections to $\mathbb{P}^1$.
If this map can be defined by two regular functions $f,g\in \Gamma(X,\mathcal{O}_X)=\Gamma(Y,\mathcal{O}_Y)=k[x,yz,w]/(xy-zw)=R$, one first checks that $f,g$ are homogeneous of the same positive degree. Since the map is defined on $X$, one sees that the only common zero of $f,g$ in $Y$ is just the origin. This says that the height of the ideal $(f,g)\subset R$ must be the height of the maximal ideal, which is three. But, Krull's principal ideal theorem says that this height can be at most two, a contradiction.
