In Hartshorne chapter 2 proposition 2.6, Hartshorne shows that there is a fully faithful functor $t:\mathcal{Var}\rightarrow \mathcal{Sch}(k)$ from the category of varieties over $k$ to the category of schemes over $k$. He proceeds as follows:
First, for any topological space $X$, define $t(X)$ to be the set of irreducible closed subsets of $X$. We can define a topology on $t(X)$ by taking as closed sets the subsets of the form $t(Y)$, where $Y$ is closed subset of $X$. If $f:X_1\rightarrow X_2$ is continuous, then define a map $$t(f):t(X_1)\rightarrow t(X_2)\\ Y\mapsto \overline{f(Y)},$$ where $Y$ is a irreducible closed subset of $X_1$. And, for any topological space $X$, define $\alpha :X\rightarrow t(X)$ by $\alpha(p)=\overline{\{p\}}$.
Question 1: Why is $\overline{f(Y)}$ a irreducible closed subset of $X_2$?
Next, let $V$ be an affine variety over $k$ with coordinate ring $A$, and $O_V$ its sheaf of regular functions, he then shows that $(t(V), \alpha_*(O_V))$ is isomorphic to the affine scheme $(X,O_X)$, where $X=\operatorname{Spec}A$.
Question 2: Why is $(t(V),\alpha_*(O_V))$ a locally ringed spaces, I mean why is $(\alpha_*(O_V))_Y$ a local ring for any $Y\in t(V)$?
Now define a morphism of locally ringed spaces $\beta:(V,O_V)\rightarrow X=\operatorname{Spec}A,$by $\beta(p)=m_p$. And for any open set $U\subset X$,define a homomorphism of rings $O_X(U)\rightarrow \beta_*(O_V)(U)$:given $s\in O_X(U)$,$p\in \beta^{-1}(U)$, we get a regular function $g$ on $\beta^{-1}(U)$ by $g(p):=\overline{s_{\beta(p)}}\in A_{m_p}/m_p=k$,where $s_{\beta(p)}\in O_{X,\beta(p)}$ and we identify the stalk $O_{X,\beta(p)}$ with the local ring $A_{m_p}$.
Question 3: Why is $g$ a regular function? It seems to me that $g$ is locally constant, is this true?
Then he claims that the above homomorphism $O_X(U)\rightarrow \beta_*(O_V)(U)$ is an isomorphism and uses the fact that there is a 1-1 correspondence $t(V)\leftrightarrow \operatorname{Spec}A=X$, then $(X,O_X)\cong (t(V),\alpha_*(O_V))$ as locally ringed spaces. I can't follow this part of proof.
Question 4: What is this $\beta$ used for? Shouldn't we construct a morphism $(t(V),\alpha_*(O_V))\rightarrow (X,O_X)$? And why is $O_X(U)\rightarrow \beta_*(O_V)(U)$ an isomorphism?