The category of affine schemes is anti-equivalent to the category of commutative rings.
Let $F$ be the contravariant functor from the category of commutative rings (with identity) to affine schemes such that $F(R)=(\text{Spec}R,\mathscr{O}_{\text{Spec}R})$ and $F(\phi)=(π,\pi^{\#}):(\text{Spec}R,\mathscr{O}_{\text{Spec}R})\to (\text{Spec}S,\mathscr{O}_{\text{Spec}S})$ for a homomorphism $\phi :S \to R$.
Where $$\pi \colon \text{Spec}R \longrightarrow \text{Spec}S,\ P \longmapsto \phi^{-1}(P)$$ is a continuous map from topological space $\text{Spec}R$ to topological space $\text{Spec}S$ and $\pi^{\#}$ is a sheaf morphism $$\pi^{\#}: \mathscr{O}_{\text{Spec}S} \to \pi_{\ast}\mathscr{O}_{\text{Spec}R}$$ which is induced by the ring homeomorphism.
$\phi_f:R_f\to S_{\phi (f)}$, for an open set $X_f$ of $\text{Spec}S$
- $ \pi_{\ast}\mathscr{F} := \mathscr{F}(\pi^{-1}(V)), \: \text{for every open} \: V\subset Y.$
- $ R_f \: \text{is the ring localization of }R\text{ at } f$
Now we define the contravariant functor $G$ from the category of affine schemes to the category of commutative rings such that $$G((\text{Spec}R,\mathscr{O}_{\text{Spec}R}))=\Gamma (\text{Spec}R,\mathscr{O}_{\text{Spec}R})=R.$$
This is where I stuck:
and for a morphism $(π,\pi^{\#}):(\text{Spec}R,\mathscr{O}_{\text{Spec}R})\to (\text{Spec}S,\mathscr{O}_{\text{Spec}S})$,
$G((π,\pi^{\#}))=?$
somehow we need to induce a ring homomorphism $\phi^{\ast} :\Gamma(\text{Spec}S,\mathscr{O}_{\text{Spec}S})=S\to R= \Gamma(\text{Spec}R,\mathscr{O}_{\text{Spec}R})$
I just don't know how to produce $\phi^{\ast} $ from a given morphism of affine schemes.
Can someone explain to me how we do this?
Can I find somewhere an explicit proof of the theorem ?