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?
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:
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.
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.