On the definition of the structure sheaf attached to $Spec A$
Let $A$ be a ring (commutative with $1$),if $X=Spec A$ we want to attach a sheaf of rings to $X$. If $f\in A$, $D(f)=X\setminus V(f)$ is an element of the base and we define $$\mathcal O_X(D(f)):=A_f$$
I've problems to show that $\mathcal O_X(\cdot)$ is well defined on the set $\mathcal B=\{D(f)\,:\, f\in A \}$. If $D(f)=D(g)$, then it is easy to show that $A_f\cong A_g$, but these two rings are not the same, so we have that $\mathcal O_X(D(f))\neq \mathcal O_X(D(g))$ even if they are isomorphic. Textbooks say "we can identify $A_f$ with $ A_g$" but what they exactly mean with the word "identify"?
Solution 1:
Since $A_f,A_g$ are localizations of $A$, there is almost one homomorphism of $A$-algebras between $A_f$ and $A_g$. Therefore all identifications between them are compatible with each other. So there is no harm to identify $A_f$ with $A_g$ when $D(f)=D(g)$.
However, I always wonder why this approach to the structure sheaf is so popular. As you observe, it is not clear at all why this is well-defined in the usual sense of this word. And it is also quite clumsy! Instead, you can do the following:
1) Define $\mathcal{O}_X(U)$ to be the set of all functions $s$ on $U$ with $s(\mathfrak{p}) \in A_{\mathfrak{p}}$, such that locally $s$ is equal to some fraction in $A_f$. Details can be found in Hartshorne's book, for example.
2) Let $S_U = A \setminus \cup_{\mathfrak{p} \in U} \mathfrak{p}$ and $\mathcal{O}'(U) = A[S_U^{-1}]$. Then $\mathcal{O}'$ is a presheaf of rings, and define $\mathcal{O}$ to be the associated sheaf. Details can be found in MO/80548.