I don't fully understand a step in the proof of the above-mentioned Proposition; more precisely, in part (b):
If $\varphi:A\to B$ is a homomorphism of rings, $X=\operatorname{Spec}(A)$, $Y=\operatorname{Spec}(B)$, then $\varphi$ induces a natural morphism of locally ringed spaces $(f,f^*):(Y,\mathcal{O}_Y)\to(X,\mathcal{O}_X).$
As for the proof: I understand how $f$ is constructed and why it is continuous. It's the $f^*$ part I don't quite get yet. If we localize $\varphi$ at a point $\mathfrak{p}\in Y=\operatorname{Spec}(B)$, we get a local homomorphism $\varphi_{\mathfrak{p}}:A_{\varphi^{-1}(\mathfrak{p})}\to B_{\mathfrak{p}}$. Now for an open set $U\subseteq X$ we should obtain a ring homomorphism $f^*:\mathcal{O}_X(U)\to\mathcal{O}_Y(f^{-1}(U))$.
I tried to figure out how that works: the elements of $\mathcal{O}_X(U)$ are functions $U\to\coprod_{\mathfrak{q}\in U}A_{\mathfrak{q}}$, while those of $\mathcal{O}_Y(f^{-1}(U))$ are of the form $f^{-1}(U)\to\coprod_{\mathfrak{p}\in f^{-1}(U)}B_\mathfrak{p}$. If we compose an $s\in\mathcal{O}_X(U)$ with $f$ from the left, half of what we need is there. I want to use the local homomorphisms $\varphi_\mathfrak{p}$ on the codomain of $s$, but my mind begins twisting when I try to think about the indexing set there. I'm pretty sure it's an easy 'problem'. Does maybe the first equality in $\coprod_{\mathfrak{q}\in U}A_\mathfrak{q}=\coprod_{\mathfrak{p}\in f^{-1}(U)}A_{\varphi^{-1}(\mathfrak{p})}=\coprod_{\varphi^{-1}(\mathfrak{p})\in U}A_{\varphi^{-1}(\mathfrak{p})}$ already hold (so I could use the $\varphi_\mathfrak{p}$)?
Is every point in $U$ already of the form $\varphi^{-1}(\mathfrak{p})$, and is this one-to-one? I guess my thoughts here go in the wrong direction, and maybe someone is able to understand my little crisis and help me out. This construction still confuses me, in particular the switching of directions all the time.
Thank you very much in advance!