## Hartshorne Definition Question

I have a question from Algebraic Geometry by Robin Hartshorne. Here is a proof in the textbook:

Theorem. Let $\displaystyle X$ be a variety and $\displaystyle Y \subseteq \mathbb{A}^n$ be an affine variety. Let $\displaystyle x_1, \ldots, x_n$ be the coordinate functions on $\displaystyle \mathbb{A}^n$. A map of sets $\displaystyle \psi : X \rightarrow Y$ is a morphism if and only if $\displaystyle x_i \circ \psi$ is a regular function on $\displaystyle X$ for each $\displaystyle i=1, \ldots, n$.

Proof
$\displaystyle (\Rightarrow)$ If $\displaystyle \psi$ is a morphism then the $\displaystyle x_i \circ \psi$ are regular functions. This is by the definition of a morphism.

$\displaystyle (\Leftarrow)$ Suppose the $\displaystyle x_i \circ \psi$ are regular. Let $\displaystyle f=f(x_1, \ldots, x_n)$ be any polynomial. Then $\displaystyle f \circ \psi$ is also regular on $\displaystyle X$. Now because the closed sets of $\displaystyle Y$ are defined by the vanishing of polynomial functions and because regular functions are continuous, $\displaystyle \psi^{-1}$ takes closed sets to closed sets. So $\displaystyle \psi$ is continuous. Recall that regular functions on open subsets of $\displaystyle Y$ are locally quotients of polynomials. Hence $\displaystyle g \circ \psi$ is regular where $\displaystyle g$ is a regular function on any open subset of $\displaystyle Y$. Therefore $\displaystyle \psi$ is a morphism.

There is no definition for the $\displaystyle i$-th coordinate function given in this textbook. I looked in Ideals, Varieties, and Algorithms and it gives the following definition:

Definition
(i) Given a polynomial $\displaystyle f \in k[x_1, \ldots, x_n]$, we let $\displaystyle \overline{f}$ denote the polynomial function in $\displaystyle A(X)$ represented by $\displaystyle f$.

(ii) Each variable $\displaystyle x_i$ gives a polynomial function $\displaystyle \overline{x_i} : X \rightarrow k$ whose value at a point $\displaystyle p \in X$ is the $\displaystyle i$-th coordinate of $\displaystyle p$. We call $\displaystyle \overline{x_i} \in A(X)$ the $\displaystyle i$-th coordinate function on $\displaystyle X$.

Is this the same definition that Hartshorne is using? If it is different, what is the correct definition? Thanks.