-----
> [!proposition] Proposition. ([[the category of affine schemes is dual to that of rings]])
> The [[category]] $\mathsf{Aff}$ of [[affine scheme|affine schemes]] is [[category equivalence|equivalent]] to the [[opposite category]] of $\mathsf{CRing}$. Specifically, the [[spec functor]] witnesses this.
^proposition
> [!proof]- Proof. ([[the category of affine schemes is dual to that of rings]])
> We will define a [[covariant functor|functor]] $\mathsf{CRing}^{\text{op}} \to \mathsf{Aff}$, then show it is [[essentially surjective functor|essentially surjective]] and [[fully faithful functor|fully faithful]].
>
> *except that's not what he did, so I am wrong. also, it seems easy to just prove the equivalence directly from the definition*,
>
> **Defining the functor.** We define a (covariant) [[covariant functor|functor]] $\text{Spec}:\mathsf{CRing}^{\text{op}} \to \mathsf{Aff}$ by assigning a [[ring]] $A$ to $\text{Spec }A$ and a [[ring homomorphism]] $\varphi:A \to B$ to a [[morphism of locally ringed spaces]] $(f, f^{\sharp}):(\text{Spec }B, \mathcal{O}_{\text{Spec }B}) \to (\text{Spec }A, \mathcal{O}_{\text{Spec } A})$ defined as follows:
>
> **1.** The [[continuous]] map $f:\text{Spec }B \to \text{Spec }A$ comes from the [[prime ideal|construction]] of $\text{Spec}$ as a [[contravariant functor]] $\mathsf{CRing} \to \mathsf{Top}$: $f=\text{Spec }(A \xrightarrow{\varphi}B)$. Specifically, $f(\mathfrak{q}):=\varphi ^{-1}(\mathfrak{q})$.
>
> **2.** Obtaining the [[morphism of (pre)sheaves|morphism of]] [[structure sheaf on a ring spectrum|structure sheaves]] $\begin{align}
> f^{\sharp}:\mathcal{O}_{\text{Spec }A} &\to f_{*}\mathcal{O}_{\text{Spec }B} \\
> f^{\sharp}_{V}:\mathcal{O}_{\text{Spec }A}(V) &\to (f_{*}\mathcal{O}_{\text{Spec }A})(V)= \mathcal{O}_{\text{Spec }B}\big( f ^{-1}(V) \big)
> \end{align}$
> (such that $f^{\sharp}_{\mathfrak{p}}$ is a [[homomorphism of local rings|local homomorphism]]) is more involved. To begin, note that for any $\mathfrak{p} \in \text{Spec }B$, there is a ring map $\begin{align}
> \varphi_{\mathfrak{p}}:A_{\varphi ^{-1}(\mathfrak{p})} &\to B_{\mathfrak{p}} \\
> \frac{a}{s} & \mapsto \frac{\varphi(a)}{\varphi(s)}
> \end{align}$
> defined so as to fit into the following commutative diagram:
> ```tikz
> \usepackage{tikz-cd}
> \usepackage{amsmath}
> \usepackage{amsfonts}
> \begin{document}
> % https://tikzcd.yichuanshen.de/#N4Igdg9gJgpgziAXAbVABwnAlgFyxMJZABgBpiBdUkANwEMAbAVxiRAEEQBfU9TXfIRQBGclVqMWbAELdeIDNjwEiZYePrNWiDgH1gAHQP0ATmgAWWAHrAAtMK4AKIwFs6OcwDMTdANbA0LgBKLjk+JUEiUXVqTSkdaX1Xdy8ff0DQrnEYKABzeCJQbwgXJDIQHAgkUQktNiNTCywwkGLSxHLKpAAmHiKTEurqLsQAZj7Wgfbu4aqx2MltEAa6M0skgzcPbz8ArlDqBjoAIxgGAAV+ZSEQEyxc8xxuCi4gA
> \begin{tikzcd}
> A \arrow[r, "\varphi"] \arrow[d] & B \arrow[d] \\
> A_{\varphi^{-1}(\mathfrak{p})} \arrow[r, "\varphi_{\mathfrak{p}}"'] & B_{\mathfrak{p}}
> \end{tikzcd}
> \end{document}
> ```
>
> It can be checked that $\varphi_{\mathfrak{p}}$ is a [[homomorphism of local rings|local homomorphism]].[^1] We want to construct $f^{\sharp}$ so that $f^{\sharp}_{\mathfrak{p}}$ is essentially just $\varphi_{\mathfrak{p}}$. $\begin{align}
> f^{\sharp}_{V}: \mathcal{O}_{\text{Spec }A}(V) &\to (f_{*}\mathcal{O}_{\text{Spec }A})(V) \\
> \big( \ \mathfrak{p} \mapsto s(\mathfrak{p}) \ \big) &\mapsto \big( \ \mathfrak{q} \mapsto \varphi_{\mathfrak{q}} \circ s \circ f(\mathfrak{q}) \ \big), \text{ where } \varphi_{\mathfrak{q}}:A_{\varphi ^{-1}(\mathfrak{q})} \to B_{\mathfrak{q}},
> \end{align}$
> and observe that $f^{\sharp}_{\mathfrak{p}}$ is given by $\varphi_{\mathfrak{p}}$.[^2]
>
> See also handwritten notes.
>
[^1]: todo (in notes)
[^2]: Follows from the general fact that $\mathcal{O}_{\text{Spec }A, f(\mathfrak{p})} \simeq A_{f(\mathfrak{p})}$ via the map $[U,s] \mapsto s(f(\mathfrak{p}))=s \circ f(\mathfrak{p})$, so that meh i don't know how to explain it nicely here, i drew a diagram in my notes. maybe there is an easier way to see it.
-----
####
[^3]: Recall from [[contraction of an ideal#^properties]] that [[prime ideal|prime ideals]] contract to prime ideals. So we indeed have a map. [[continuous|Continuity]] is checked in [[prime ideal|spectrum of a ring]].
[^4]: Continuity of $f$ is checked
----
## Legacy:
He will not spell out all the category-theoretic details. What will be shown:
1. A [[ring homomorphism]] $\varphi:A \to B$ gives rise to a [[morphism of locally ringed spaces]] $(f, f^{\sharp}):(\text{Spec }B, \mathcal{O}_{\text{Spec }B}) \to (\text{Spec }A, \mathcal{O}_{\text{Spec } A})$.
2. Any [[morphism of locally ringed spaces]] $(f,f^{\sharp}):(\text{Spec }A, \mathcal{O}_{\text{Spec }A}) \to (\text{Spec }B, \mathcal{O}_{\text{Spec }B})$ is induced by a [[ring homomorphism]] via the construction in $(1)$.
**(1).** Fix $\varphi:A \to B$ a [[ring homomorphism]]. We want a morphism $(f, f^{\sharp}):(\text{Spec }B, \mathcal{O}_{\text{Spec }B}) \to (\text{Spec }A, \mathcal{O}_{\text{Spec } A})$. First we need to define a [[continuous]] map $f:\text{Spec }B \to \text{Spec }A$. Do it with [[contraction of an ideal|contraction]]: define $f(\mathfrak{b}):=\mathfrak{b}^{c}=\varphi ^{-1}(\mathfrak{b})$. ([[prime ideal|This is as in the definition of Spec as a (contravariant) functor]].)[^1]
Next, we have to define a [[morphism of (pre)sheaves|morphism of]] [[structure sheaf on a ring spectrum|structure sheaves]] $\begin{align}
f^{\sharp}:\mathcal{O}_{\text{Spec }A} &\to f_{*}\mathcal{O}_{\text{Spec }B} \\
f^{\sharp}_{V}:\mathcal{O}_{\text{Spec }A}(V) &\to (f_{*}\mathcal{O}_{\text{Spec }A})(V)= \mathcal{O}_{\text{Spec }B}\big( f ^{-1}(V) \big)
\end{align}$
such that $f^{\sharp}_{\mathfrak{p}}$ is a [[homomorphism of local rings|local homomorphism]].
#### References
> [!backlink]
> ```dataview
> TABLE rows.file.link as "Further Reading"
> FROM [[]]
> FLATTEN file.tags as Tag
> WHERE Tag = "#definition" OR Tag = "#theorem" OR Tag = "#MOC" OR Tag = "#proposition" OR Tag = "#axiom"
> GROUP BY Tag
> ```
> [!frontlink]
> ```dataview
> TABLE rows.file.link as "Further Reading"
> FROM outgoing([[]])
> FLATTEN file.tags as Tag
> WHERE Tag = "#definition" OR Tag = "#theorem" OR Tag = "#MOC" OR Tag = "#proposition" OR Tag = "#axiom"
> GROUP BY Tag
> ```
- [ ] See also david's notes (*apparently this is not hard to show, using directly the definition of category equivalence. to be honest, it is not clear how what we did in class relates to the category theory*)