A rigorous characterization for a ringed spaces to be isomorphic to an affine scheme. On page 21-22 of the book The Geometry of Schemes by Eisenbud and Harris there is a characterization for when a ringed spaces $(X,\mathcal{O}_X)$ is isomorphic to an affine scheme $(\text{Spec}(R),\mathcal{O}_{\text{Spec}(R)})$. He states that this is the case exactly when all of the following conditions are satisfied:


*

*$R = \mathcal{O}_X(X)$.

*$\mathcal{O}(X_f) = R[f^{-1}]$ for all $f \in R$, where $X_f := \{ x \in X: x \text{ maps to a unit in } \mathcal{O}_{X,x}\}$.

*$(X,\mathcal{O}_X)$ is a locally ringed space.

*The natural map $X \to |\text{Spec}(R)|$, which takes $x \in X$ to the prime ideal of $\mathcal{O}_X(X)$ that is the preimage of the maximal ideal of $\mathcal{O}_{X,x}$, is a homeomorphism.


Of course already the first one is supposed to be an isomorphism instead of an equality, which makes it tricky for me to wrap my head around this. Also Eisenbud and Harris do not give a proof for this characterization.
So my question is: Is there a rigorous analog characterization for $(X,\mathcal{O}_X)$ to be isomorphic to $(\text{Spec}(R),\mathcal{O}_{\text{Spec}(R)})$ as a (locally) ringed space, which one can prove and which does not involve identifications?
 A: Unless something changed significantly in later printings, the assertion is that $X$ is isomorphic to $\operatorname{Spec} R$ where $R = \Gamma(X, \mathcal{O}_X)$. I don't think there's anything imprecise about $R$. I think the things to notice are:


*

*There are no choices involved in the construction of $\alpha\colon X \to \operatorname{Spec} R$ and in fact it exists for any locally ringed $X$, regardless of whether $X$ is affine or even a scheme.

*The conditions given are so strong that there is very little to actually prove one you've got the setup right. One of them could be slightly more precise.


Let me write $\sigma_x\colon R \to \mathcal{O}_{X, x}$ for the map that takes the stalk of a global function at $x$. I would do the following. For now, $X$ is just a locally ringed space.


*

*For $f \in R$, show that $X_f$ is open.

*Show that the image of $f$ in $\Gamma(X_f, \mathcal{O}_X)$ is invertible, and deduce that there is a homomorphism $R[f^{-1}] \to \Gamma(X_f, \mathcal{O}_X)$ making a certain triangle commute.

*Show that in any case, $\alpha^{-1}(D(f)) = X_f$. Deduce that $\alpha$ is continuous.

*Use (2) and (3) to construct the required map of sheaves $\mathcal{O}_{\operatorname{Spec} R} \to \alpha_*\mathcal{O}_{X}$ on the base of distinguished open sets in $\operatorname{Spec} R$.


EH assert that if $\alpha$ is a homeomorphism and the maps in (2) are all isomorphisms, then $X$ is affine. Having done the above work this is obvious. You might also be interested in Exercise II.2.17 of Hartshorne.
