The functor $\displaystyle X \rightarrow A(X)$ induces an arrow-reversing equivalence of categories between the category of affine varieties over $\displaystyle k$ and the category of finitely generated integral domains over $\displaystyle k$.

My textbook (Hartshorne) says that this is a corollary to the following proposition:

Let $\displaystyle X$ be any variety and let $\displaystyle Y$ be an affine variety. Then there is a natural bijective mapping of sets

$\displaystyle \alpha : \text{Hom}(X, Y) \overset{\sim}{\rightarrow} \text{Hom}(A(Y), \mathcal{O}(X))$

where the left $\displaystyle \text{Hom}$ means morphisms of varieties, and the right $\displaystyle \text{Hom}$ means homomorphisms of $\displaystyle k$-algebras.

I do not see how to apply the proposition to prove this corollary. I would appreciate advice on this. Thanks.