Does an inclusion of ring spectra induce a morphism of rings? My question regards proposition 3.2 in Hartshornes Algebraic Geometry, the statement that a scheme is locally noetherian if and only if for every affine open subset $\operatorname{spec}(A)$, the ring $A$ is noetherian.
One part of the proof is unclear to me: We take an open subset $U = \operatorname{spec}(B)$ of an affine scheme $X = \operatorname{spec}(A)$, where $B$ is a noetherian ring. Then there exists some $f \in A$ with $D(f) \subset U$, which is clear. But how can we take the image of $f$ in $B$?
The terminology leads me to believe that we have a morphism from $A$ to $B$, but I don't know where this should come from. If $U \hookrightarrow X$ was a morphism of schemes, this would of course be clear (by the fact that the categories of rings and affine schemes are equivalent), but I was under the impression that we merely have an inclusion of open sets, and not additionally a morphism of sheaves of rings, as in the definition of a morphism of locally ringed spaces. Thanks in advance!
 A: Yes. The easy answer is restriction. Part of the data of the structure sheaf is a restriction map $\rho_{XU}:\mathcal{O}_X(X)\rightarrow \mathcal{O}_X(U)$, which is a map of rings $A\rightarrow B$, since $\mathcal{O}_X(X) = A$ and $\mathcal{O}_X(U) = B$.
Here's a more general answer: if $U$ is any open subset of a scheme $X$, the inclusion map $i:U\hookrightarrow X$ can be viewed as a morphism of schemes in a natural way. Here $U$ is viewed as an open subscheme: its topology is the subspace topology, and its structure sheaf is the restriction of $\mathcal{O}_X$ ($\mathcal{O}_U(V) = \mathcal{O}_X(V)$ for $V\subseteq U$).
A morphism of schemes is given by a continuous map of topological spaces together with a morphism of sheaves $\mathcal{O}_X \rightarrow i_*\mathcal{O}_U$. $i$ is continuous by the definition of the subspace topology, and for any $V\subseteq X$ open, we have a map $\mathcal{O}_X(V) \rightarrow i_*\mathcal{O}_U(V) = \mathcal{O}_U(U\cap V) = \mathcal{O}_X(U\cap V)$, given by the restriction map $\rho_{V,U\cap V}$ of $\mathcal{O}_X$. Now you just have to check that this is a morphism of sheaves.
