I have a question from Algebraic geometry by Robin Hartshorne. My question is regarding a proof in this book. The proof is the following:

Lemma. Let be a variety and be an affine variety. Let be the coordinate functions on . A map of sets is a morphism if and only if is a regular function on for each .

Theorem. Let be a variety and be an affine variety. Then there is a natural bijective mapping of sets

. Here the leftside indicates morphisms of varieties and the rightside indicates homomorphisms of -algebras.

Proof. Let be a morphism. Then takes regular functions on to regular functions on . So induces a map to . This is clearly a homomorphism of -algebras. However, by a result in Hartshorne, . So we get a homomorphism . This defines .

Conversely, let be a homomorphism of -algebras. Suppose is a closed subset of such that . Let be the image of in . Now consider the elements . The are global functions on . So we can define a map by where .

Now we need to show that the image of is contained in . Because , it suffices to show that for any and any , . However, . Note that is a polynomial and is a homomorphism of -algebras, so we have because . So defines a map from to that induces the homomorphism . It now remains to show that is a morphism. This is a consequence of the lemma.

I don't understand this part of the proof:

It now remains to show that is a morphism. This is a consequence of the lemma.

Why is a morphism? How is this a consequence of the lemma? I can't figure this out. Thank you.