\documentclass[10pt,ngerman,a4paper, fancyfoot, git]{mkessler-script}

\course{Algebra I}
\lecturer{Prof.~Dr.~Jens Franke}
\author{Josia Pietsch}

\title{title}

\usepackage{algebra}

\begin{document}

\maketitle
\cleardoublepage

\tableofcontents
\cleardoublepage


\begin{warning}
    This is not an official script!
    This document was written in preparation for the oral exam. It mostly follows the way \textsc{Prof. Franke} presented the material in his lecture rather closely.
    There are probably errors.
\end{warning}

\noindent The \LaTeX template by \textsc{Maximilian Kessler} is published under the MIT-License and can be obtained from \url{https://github.com/kesslermaximilian/LatexPackages}. % TODO
\newline

\noindent $\mathfrak{k}$ is {\color{red} always} an algebraically closed field and $\mathfrak{k}^n$ is equipped with the Zariski-topology.
Fields which are not assumed to be algebraically closed have been renamed (usually to $\mathfrak{l}$).
\pagebreak


\subsection{Finiteness conditions}

\subsection{Finitely generated and Noetherian modules}

\begin{definition}[Generated submodule]
    Let $R$ be a ring, $M$ an $R$-module, $S \subseteq M$.
    Then the following sets coincide
    \begin{enumerate}
        \item $\left\{ \sum_{s \in S'} r_{s} \cdot s ~ |~ S \subseteq S' \text{finite}, r_s \in R, \right\}$
        \item $\bigcap_{\substack{S \subseteq N \subseteq M\\N \text{submodule}}} N$ 
        \item The $\subseteq$-smallest submodule of $M$ containing $S$
    \end{enumerate}

    This subset of $N \subseteq M$ is called the \vocab[Module!Submodule]{submodule of $M $ generated by $S$}. If $N= M$ we say that  \vocab[Module!generated by subset $S$]{$ M$ is generated by $S$}.
    $M$ is finitely generated $:\iff \exists S \subseteq M$ finite such that $M$ is generated by $S$.
\end{definition}

\begin{definition}[Noetherian $R$-module]
    $M$ is a \vocab{Noetherian}  $R$-module if the following equivalent conditions hold:
    \begin{enumerate}
        \item Every submodule  $N \subseteq M$ is finitely generated.
        \item Every sequence $N_0 \subset N_1 \subset \ldots$ of submodules terminates
        \item Every set $\fM \neq \emptyset$ of submodules of $M$ has a $\subseteq$-largest element.
    \end{enumerate}
\end{definition}
\begin{proposition}[Hilbert's Basissatz]\label{basissatz}
    If $R$ is a Noetherian ring, then the polynomial rings $R[X_1,\ldots, X_n]$ in finitely many variables are Noetherian.
\end{proposition}
\subsubsection{Properties of finite generation and Noetherianness}

\begin{fact}[Properties of Noetherian modules]
    \begin{enumerate}
        \item Every Noetherian module over an arbitrary ring is finitely generated.
        \item If $R$ is a Noetherian ring, then an $R$-module is Noetherian iff it is finitely generated.
        \item Every submodule of a Noetherian module is Noetherian.
    \end{enumerate}
\end{fact}
\begin{proof}

    \begin{enumerate}
        \item By definition, $M$ is a submodule of itself. Thus it is finitely generated.
        \item Since $M$ is finitely generated, there exists a surjective homomorphism $R^n \to M$. As $R$ is Noetherian, $R^n$ is Noethrian as well. 
        \item trivial
    \end{enumerate}
\end{proof}

\begin{fact}
    Let $M, M', M''$ be $R$-modules.
    \begin{enumerate}
        \item Suppose $M \xrightarrow{p} M''$ is surjective. If $M$ is finitely generated (resp. Noetherian), then so is $M''$.
        \item  Let  $M' \xrightarrow{f}  M \xrightarrow{p} M'' \to 0$ be exact. If $M'$ and $M ''$ are finitely generated (reps. Noetherian), so is $M$.
    \end{enumerate}
\end{fact}
\begin{proof}
    \begin{enumerate}
        \item Consider a sequence $M_0'' \subset M_1'' \subset \ldots \subset M''$. Then $p\inv M_i''$ yields a strictly ascending sequence.
            If $M$ is generated by $S, |S| < \omega$, then $M''$ is generated by $p(S)$.
        \item Because of 1. we can replace $M'$ by $f(M')$ and assume $0 \to M' \xrightarrow{f} M \xrightarrow{p} M'' \to 0$ to be exact. The fact about finite generation follows from EInführung in die Algebra.

            If  $M', M''$ are Noetherian, $N \subseteq M$ a submodule, then $N' \coloneqq f\inv(N)$ and $N''\coloneqq p(N)$ are finitely generated. Since $0 \to N' \to  N \to  N'' \to  0$ is exact, $N$ is finitely generated.

    \end{enumerate}
\end{proof}
\subsection{Ring extensions of finite type}

\begin{definition}[$R$-algebra]
    Let $R$ be a ring. An $R$-algebra $(A, \alpha)$ is a ring $A$ with a ring homomorphism $R \xrightarrow{\alpha} A$.
    $\alpha$ will usually be omitted. In general  $\alpha$ is not assumed to be injective.\\
    \\
    An $R$-subalgebra is a subring $\alpha(R) \subseteq A' \subseteq A$.\\
A morphism of $R$-algebras $A \xrightarrow{f} \tilde{A}$ is a ring homomorphism with $\tilde{\alpha} = f \alpha$.
\end{definition}

\begin{definition}[Generated (sub)algebra, algebra of finite type]
    Let $(A, \alpha)$ be an $R$-algebra.
    \begin{align}
        \alpha: R[X_1,\ldots,X_m] &\longrightarrow A[X_1,\ldots,X_m] \\
        P = \sum_{\beta \in \N^m} p_\beta X^{\beta} &\longmapsto \sum_{\beta \in \N^m}  \alpha(p_\beta) X^{\beta}
    \end{align}
    is a ring homomorphism. We will sometimes write $P(a_1,\ldots,a_m)$ instead of  $(\alpha(P))(a_1,\ldots,a_m)$.

    Fix $a_1,\ldots,a_m \in A^m$. Then we get a ring homomorphism $R[X_1,\ldots,X_m] \to A$. The image of this ring homomorphism is the  $R$-subalgebra of $A$ \vocab[Algebra!generated subalgebra]{generated by the $a_i$}.
    $A$ is \vocab[Algebra!of finite type]{of finite type}  if it can be generated by finitely many $a_i \in I$.

    For arbitrary $S \subseteq A$ the subalgebra generated by $S$ is the intersection of all subalgebras containing $S$ \\
    $=$ the union of subalgebras generated by finite  $S' \subseteq S$\\
    $= $ the image of  $R[X_s | s \in S]$ under $P \mapsto (\alpha(P))(S)$.
    
\end{definition}
\subsection{Finite ring extensions} % LECTURE 2
\begin{definition}[Finite ring extension]
    Let $R$ be a ring and $A$ an $R$-algebra. $A$ is a module over itself and the ringhomomorphism $R \to  A$ allows us to derive an $R$-module structure on $A$.
    $A$ \vocab[Algebra!finite over]{is finite over} $R$  / the $R$-algebra $A$ is finite / $A / R$ is finite if $A$ is finitely generated as an $R$-module.
\end{definition}
\begin{fact}[Basic properties of finiteness]
    \begin{enumerate}[A]
        \item Every ring is finite over itself.
        \item A field extension is finite as a ring extension iff it is finite as a field extension.
        \item $A$ finite $\implies$ $A$ of finite type.
        \item $A / R$ and $B / A$ finite $\implies$ $B / R$ finite.
    \end{enumerate}
\end{fact}
\begin{proof}
    \begin{enumerate}[A]
    \item $1$ generates $R$ as a module
    \item trivial
    \item Let $A $ be generated by $a_1,\ldots,a_n$ as an $R$-module. Then $A$ is generated by $a_1,\ldots,a_n$ as an $R$-algebra.
    \item Let $A$ be generated by $a_1,\ldots,a_m$ as an $R$-module and $B$ by $b_1,\ldots,b_n$ as an $A$-module.
        For every $b$ there exist $\alpha_j  \in A$ such that $b = \sum_{j=1}^{n} \alpha_j b_j$. We have $\alpha_j = \sum_{i=1}^{m} \rho_{ij} a_i$ for some $\rho_{ij} \in R$ thus
        $b = \sum_{i=1}^{m} \sum_{j=1}^{n} \rho_{ij} a_i b_j$ and the  $a_ib_j$ generate $B$ as an $R$-module.
\end{enumerate}
    
\end{proof}

\subsection{Determinants and Caley-Hamilton} %LECTURE 2 TODO: move to int. elements?
This generalizes some facts about matrices to matrices with elements from commutative rings with $1$. 
\footnote{Most of this even works in commutative rings without $ 1$, since $1$ simply can be adjoined.}
\begin{definition}[Determinant]
    Let $A = (a_{ij}) \Mat(n,n,R)$. We define the determinant by the Leibniz formula \[
        \det(A) \coloneqq \sum_{\pi \in S_n} \sgn(\pi) \prod_{i=1}^{n} a_{i, \pi(i)} 
    \]

    Define $\text{Adj}(A)$ by $\text{Adj}(A)^{T}_{ij} \coloneqq (-1)^{i+j} \cdot M_{ij}$, where $M_{ij}$ is the determinant of the matrix resulting from $A$ after deleting the $i^{\text{th}}$ row and the $j^{\text{th}}$ column.
\end{definition}
\begin{fact}
    \begin{enumerate}
        \item $\det(AB) = \det(A)\det(B)$
        \item Development along a row or column works.
        \item Cramer's rule:  $A \cdot \text{Adj}(A) = \text{Adj}(A) \cdot  A = \det(A) \cdot \mathbf{1}_n$. $A$ is invertible iff $\det(A)$ is a unit.
        \item Caley-Hamilton: If $P_A = \det(T \cdot \mathbf{1}_n - A)$ \footnote{$T \cdot \mathbf{1}_n -A \in  \Mat(n,n,A[T])$}, then $P_A(A) = 0$.
    \end{enumerate}
    
\end{fact}
\begin{proof}
    All rules hold for the image of a matrix under a ring homomorphism if they hold for the original matrix. The converse holds in the case of injective ring homomorphisms.
    Caley-Hamilton was shown for algebraically closed fields in LA2 using the Jordan normal form. 
    Fields can be embedded into their algebraic closure, thus Caley-Hamilton holds for fields. Every domain can be embedded in its field of quotients $\implies$ Caley-Hamilton holds for domains.
    
    In general, $A$ is the image of $(X_{i,j})_{i,j = 1}^{n} \in  \Mat(n,n,S)$ where $S \coloneqq \Z[X_{i,j} | 1 \le  i, j \le n]$ (this is a domain) under the morphism $S \to A$ of evaluation defined by $X_{i,j} \mapsto a_{i,j}$. Thus Caley-Hamilton holds in general.
\end{proof} %TODO: lernen

\subsection{Integral elements and integral ring extensions} %LECTURE 2
\begin{proposition}[on integral elements]\label{propinte}
    Let $A$ be an $R$-algebra, $a \in A$. Then the following are equivalent:
    \begin{enumerate}[A]
        \item $\exists n \in \N, (r_i)_{i=0}^{n-1}, r_i \in R: a^n = \sum_{i=0}^{n-1} r_i a^i$
        \item  There exists a subalgebra  $B \subseteq A$ finite over $R$ and containing $a$.
    \end{enumerate}
    If $a_1, \ldots, a_k \in A$ satisfy these conditions, there is a  subalgebra of $A$ finite over $R$ and containing all $a_i$.
\end{proposition}
\begin{definition}\label{intclosure}
    Elements that satisfy the conditions from \ref{propinte} are called \vocab{integral over} $R$.
    $A / R$ is \vocab[Algebra!integral]{integral}, if all $a \in A$ are integral over $R$.
    The set of elements of  $A$ integral over $R$ is called the \vocab{integral closure} of $R$ in $A$.
\end{definition}
\begin{proof}
    \hskip 10pt
    \begin{enumerate}
        {\color{gray} \item[B $\implies$ A] Let $a \in A$ such that there is a subalgebra $B \subseteq A$ containing $a$ and finite over $R$.
            Let $(b_i)_{i=1}^{n}$ generate $B$ as an $R$-module.
            \begin{align}
                q: R^n &\longrightarrow B \\
                (r_1,\ldots,r_n) &\longmapsto \sum_{i=1}^{n} r_i b_i
            \end{align}
            is surjective. Thus there are $\rho_{i} = \left( r_{i,j} \right)_{j=1}^n \in  R^n$ such that $a b_i = q(\rho_i)$. Let $\fA$ be the matrix with the $\rho_i$ as columns.
            Then for all $v \in R^n: q(\fA \cdot v) = a \cdot  q(v)$. By induction it follows that $q(P(\fA) \cdot v) = P(a)q(v)$ for all $P \in R[T]$. Applying this to $P(T) = \det(T\cdot \mathbf{1}_n - \fA)$ and using Caley-Hamilton, we obtain $P(a) \cdot q(v) = 0$.  $P$ is monic. Since $q$ is surjective, we find $v \in R^{n} : q(v) = 1$. Thus $P(a) = 0$  and $a$ satisfies A.
        }
        \item[B $\implies$ A] if $R$ is Noetherian.\footnote{This suffices in the exam.}
            Let $a \in A$ satisfy B. Let $B$ be a subalgebra of $A$ containing $b$ and finite over $R$. Let $M_n \subseteq B$  be the $R$-submodule generated by the $a^i$ with $0 \le  i < n$. As a finitely generated module over the Noetherian ring $R$, $B$ is a Noetherian $R$-module. Thus the ascending sequence $M_n$ stabilizes at some step $d$ and $a^d \in  M_d$. Thus there are $(r_i)_{i=0}^{d-1} \in  R^d$ such that $a^d = \sum_{i=0}^{d-1} r_ia^i$.
        \item[A $\implies$ B] Let $a = (a_i)_{i=1}^n$ where all $a_i$ satisfy A, i.e. $a_i^{d_i} = \sum_{j=0}^{d_i -  1} r_{i,j}a_i^j$ with $r_{i,j} \in R$. Let $B \subseteq A$ be the sub-$R$-module generated by $a^\alpha = \prod_{i=1}^n a_i^{\alpha_i}$ with $0 \le  \alpha_i < d_i$.
            $B$ is closed under $a_1 \cdot $ since \[a_1a^{\alpha} = \begin{cases}
                a^{(\alpha_1 + 1, \alpha')} &\text{if } \alpha = (\alpha_1, \alpha'), 0 \le \alpha_1 < d_1 - 1\\
                \sum_{j=0}^{d_1 - 1} r_{i_1,j} a^{(j, \alpha')} &\text{if } \alpha_1 = d_1 - 1
            \end{cases}\]
            By symmetry, this hold for all $a_i$. By induction on $|\alpha| = \sum_{i=1}^{n} \alpha_i$, $B$ is invariant under $a^{\alpha}\cdot $. Since these generate $B$ as an $R$-module, $B$ is multiplicatively closed. Thus A holds. Furthermore we have shown the final assertion of the proposition.
    \end{enumerate}
\end{proof}
\begin{corollary}\label{cintclosure}
    \begin{enumerate}
        \item[Q] Every finite $R$-algebra $A$ is integral.
        \item[R] The integral closure of $R$ in $A$ is an $R$-subalgebra of $A$ 
        \item[S] If $A$ is an $R$-algebra, $B$ an $A$-algebra and $b \in B$ integral over $R$, then it is integral over $A$.
        \item[T] If $A$ is an integral $R$-algebra and $B$ any $A$-algebra, $b \in B$ integral over $A$, then $b$ is integral over  $R$.
    \end{enumerate}
\end{corollary}
\begin{proof}
    \begin{enumerate}
        \item[Q] Put $ B = A $ in B. 
        \item[R] For every $r \in R$ $\alpha(r)$ is a solution to $T - r = 0$, hence integral over  $R$.
            From B it follows, that the integral closure is closed under ring operations.
        \item[S] trivial
        \item[T] Let $b \in B$ such that $b^n = \sum_{i=0}^{n-1} a_ib^{i}$. Then there is a subalgebra $\tilde{A} \subseteq A$ finite over $R$, such that all $a_i \in \tilde{A}$.
            $b$ is integral over $\tilde{A} \implies \exists \tilde{B} \subseteq B$ finite over $\tilde{A}$ and  $b \in \tilde{B}$. Since  $\tilde{B} / \tilde{A} $ and  $\tilde{A} / R$ are finite, $\tilde{B} / R$ is finite and $b$ satisfies B.
    \end{enumerate}
\end{proof}

\subsection{Finiteness, finite generation and integrality} %some more remarks on finiteness, finite generation and integrality

\begin{fact}[Finite type and integral $\implies$ finite]\label{ftaiimplf}
    If $A$ is an integral $R$-algebra of finite type, then it is a finite $R$-algebra.
\end{fact}
\begin{proof}
    Let $A $ be generated by $\left( a_i \right) _{i=1}^{n}$ as an $R$- algebra. By the proposition on integral elements (\ref{propinte}), there is a finite $R$-algebra $B \subseteq A$ such that all $a_i \in B$.
    We have $B = A$, as $A$ is generated by the $a_i$ as an $R$-algebra.
\end{proof}
\begin{fact}[Finite type in tower]
    If $A$ is an $R$-algebra of finite type and $B$ an $A$-algebra of finite type, then $B$ is an $R$-algebra of finite type.
\end{fact}
\begin{proof}
    If $A / R$ is generated by $(a_i)_{i=1}^m$ and $B / A$ by $(b_j)_{j=1}^{n}$, then $B /R$ is generated by the $b_j$ and the images of the $a_i$ in $B$.
\end{proof}
{\color{red}
    \begin{fact}[About integrality and fields] \label{fintaf}
    Let $B$ be a domain integral over its subring $A$. Then $B$ is a field iff $A$ is a field.
\end{fact}
}
\begin{proof}
    Let $B$ be a field and $a \in A \sm \{0\} $. Then $a\inv \in  B$ is integral over $A$, hence $a^{-d} = \sum_{i=0}^{d-1} \alpha_i a^{-i}$ for some $\alpha_i \in A$. Multiplication by $a^{d-1}$ yields
    $a\inv = \sum_{i=0}^{d-1} \alpha_i a^{d-1-i} \in A$.

    On the other hand, let $B$ be integral over the field $A$. Let $b \in  B \sm \{0\}$. As $B$ is integral over $A$, there is a sub-$A$-algebra $\tilde{B} \subseteq B, b \in \tilde{B}$ finitely generated as an $A$-module, i.e. a finite-dimensional  $A$-vector space.  Since $B$ is a domain, $\tilde{B} \xrightarrow{b\cdot } \tilde{B}$ is injective, hence surjective, thus $\exists x \in \tilde{B} : b \cdot  x \cdot  1$.
\end{proof}
\subsection{Noether normalization theorem}
\begin{lemma}\label{nntechlemma}
    Let $S \subseteq \N^n$ be finite. Then there exists $\vec k \in  \N^n$ such that $k_1 =1$ and $w_{\vec k}(\alpha) \neq w_{\vec k}(\beta)$ for $\alpha \neq \beta \in S$,
    where $w_{\vec k}(\alpha) = \sum_{i=1}^{n} k_i \alpha_i$.
\end{lemma}
\begin{proof}
    Intuitive:
    For $\alpha \neq \beta$ the equation $w_{(1, \vec \kappa)}(\alpha) = w_{(1, \vec \kappa)}(\beta)$ ($\kappa \in  \R^{n-1}$)
    defines a codimension $1$ affine hyperplane in $\R^{n-1}$. It is possible to choose $\kappa$ such that all $\kappa_i$ are $> \frac{1}{2}$ and with Euclidean distance $> \frac{\sqrt{n-1} }{2}$ from the union of these hyperplanes. By choosing the closest $\kappa'$ with integral coordinates, each coordinate will be disturbed by at most $\frac{1}{2}$, thus at Euclidean distance $\le \frac{\sqrt{n-1} }{2}$. 

    More formally:\footnote{The intuitive version suffices in the exam.}
    Define $M \coloneqq \max \{\alpha_i | \alpha \in S, 1 \le  i \le  n\} $. We can choose $k$ such that $k_i > (i-1) M k_{i-1}$.
    Suppose $\alpha \neq \beta$. Let $i$ be the maximal index such that $\alpha_i \neq  \beta_i$. Then the contributions of $\alpha_j$ (resp.  $\beta_j$) with $1 \le j  < i$ to $w_{\vec k}(\alpha)$ (resp. $w_{\vec k}(\beta)$) cannot undo the difference $k_i(\alpha_i - \beta_i)$.
\end{proof}

\begin{theorem}[Noether normalization] \label{noenort}
 Let $K$ be a field and $A$ a $K$-algebra of finite type. Then there are $a = (a_i)_{i=1}^{n} \in A$ which are algebraically independent over $K$, i.e. the ring homomorphism \begin{align}
    \ev_a: K[X_1,\ldots,X_n] &\longrightarrow A \\
    P &\longmapsto P(a_1,\ldots,a_n)
\end{align}
is injective. $n$ and the $a_i$ can be chosen such that $A$ is finite over the image of $\ev_a$.
\end{theorem}
\begin{proof}

    Let $(a_i)_{i=1}^n$ be a minimal number of elements such that $A$ is integral over its $K$-subalgebra generated by $a_1, \ldots, a_n$. (Such $a_i$ exist, since $A$ is of finite type).
    Let $\tilde{A}$ be the $K$-subalgebra generated by the $a_i$.
    If suffices to show that the $a_i$ are algebraically independent.
    Since $A$ is of finite type  over $K$ and thus over $\tilde{A}$, by fact \ref{ftaiimplf} (integral and finite type $\implies$ finite) $A$ is finite over $\tilde{A}$.
    Thus we only need to show that the  $a_i$ are algebraically independent over $K$.
    Assume there is $P \in  K[X_1,\ldots,X_n] \sm \{0\} $ such that $P(a_1,\ldots,a_n) = 0$. Let $P = \sum_{\alpha \in \N^n} p_\alpha X^{\alpha}$ and $S = \{ \alpha \in \N^n | p_\alpha \neq 0\}$. For $\vec{k} = (k_i)_{i=1}^{n} \in  \N^n$ and $\alpha \in \N^n$ we define $w_{\vec{k}}(\alpha) \coloneqq \sum_{i=1}^{n} k_i\alpha_i$.

    By \ref{nntechlemma} it is possible to choose $\vec{k} \in \N^n$ such that
    $k_1 = 1$ and for $\alpha \neq  \beta \in  S$ we have $w_{\vec{k}}(\alpha) \neq  w_{\vec{k}}(\beta)$.

    Define $b_i \coloneqq a_{i+1} - a^{k_{i+1}}_1$ for $1 \le  i < n$.
    \begin{claim}
        $A$ is integral over the subalgebra $B$ generated by the $b_i$.
    \end{claim}
    \begin{subproof}
        By the transitivity of integrality, it is sufficient to show that the $a_i$ are integral over $B$.
        For $i > 1$ we have $a_i = b_{i-1} + a_1^{k_i}$. Thus it suffices to show this for $a_1$.
        Define $Q(T) \coloneqq P(T, b_1 + T^{k_2}, \ldots, b_{n-1} + T^{k_n}) \in  B[T]$.
        We have $0 = P(a_1,\ldots, a_n) = Q(a_1)$. Hence it suffices to show that the leading coefficient of $Q$ is a unit.

        We have 
        \[
            T^{\alpha_1} \prod_{i=1}^{n-1} (b_i + T^{k_i + 1})^{\alpha_{i+1}} = T^{w_{\vec k}(\alpha)} + \sum_{l = 0}^{w_{\vec k}(\alpha) - 1}  \beta_{\alpha, l} T^l
        \] 
        with suitable $\beta_{\alpha, l} \in B$.

        By the choice of $\vec k$, we have \[
            Q(T) = p_{\alpha} T^{w_{\vec k}(\alpha)} + \sum_{j=0}^{w_{\vec k}(\alpha) - 1} q_j T^j 
        \] 
        with $q_j \in  B$ and $\alpha$ such that $w_{\vec k }(\alpha)$ is maximal subject to the condition $p_\alpha \neq 0$.
        Thus the leading coefficient of $Q$ is a unit.
    \end{subproof}

    This contradicts the minimality of $n$, as $B$ can be generated by $< n$ elements $b_i$.

\end{proof}
\subsection{The Nullstellensatz and the Zariski topology}
\subsection{The Nullstellensatz} %LECTURE 1
Let $\mathfrak{k}$ be a field, $R \coloneqq \mathfrak{k}[X_1,\ldots,X_n], I \subseteq R$ an ideal.

\begin{definition}[zero]
    $x \in \mathfrak{k}^n$ is \vocab[Ideal!zero]{a zero of $I$} if $\A x \in I: P(x) = 0$. Let $\Va(I)$ denote the set of zeros if $I$ in $\mathfrak{k}^n$.

    The \vocab[Ideal!zero]{zero in a field extension $\mathfrak{i}$ of $\mathfrak{k}$} is defined similarly.
\end{definition}

\begin{remark}[Set of zeros and generators]
    Let $I$ be generated by $S$. Then $\{x \in R | \A s \in S: s(x) = 0\} = \Va(I)$. Thus zero sets of ideals correspond to solutions sets to systems of polynomial equations.
    If $S, \tilde{S}$ generate the same ideal  $I$ they have the same set of solutions. Therefore we only consider zero sets of ideals.
\end{remark}

\begin{theorem}[Hilbert's Nullstellensatz (1)]\label{hns1}
    If $\mathfrak{k}$ is algebraically closed and $I \subsetneq R$ a proper ideal, then $I$ has a zero in $\mathfrak{k}^n$.
\end{theorem}

\begin{remark}
    Will be shown later (see proof of \ref{hns1b}).
    Trivial if $n = 1$:  $R$ is a PID, thus $I = pR$ for some $p \in R$. Since $I \neq R$ $p = 0$ or $P$ is non-constant. $\mathfrak{k}$ algebraically closed $\leadsto$ there exists a zero of $p$.\\

    If $\mathfrak{k}$ is not algebraically closed and $n > 0$, the theorem fails (consider $I = p(X_1) R$).
\end{remark}

Equivalent\footnote{used in a vague sense here} formulation:

\begin{theorem}[Hilbert's Nullstellensatz (2)] \label{hns2}
    Let $L / K$ be an arbitrary field extension. Then $L / K$ is a finite field extension ($\dim_K L < \infty$) iff $L $ is a $K$-algebra of finite type.
\end{theorem}
\begin{proof}
    \begin{itemize}
        \item[$\implies$] If $(l_i)_{i=1}^{m}$ is a base of $L$ as a $K$-vector space, then $L$ is generated by the $l_i$ as a $K$-algebra.
        \item[$\impliedby$ ] Apply the Noether normalization theorem (\ref{noenort}) to $A = L$. This yields an injective ring homomorphism $\ev_a: K[X_1,\ldots,X_n] \to  A$ such that $A$ is finite over the image of $\ev_a$.
            By the fact about integrality and fields (\ref{fintaf}), the isomorphic image of $\ev_a$ is a field. Thus $K[X_1,\ldots, X_n]$ is a field $\implies n = 0$. Thus $L / K$ is a finite ring extension, hence a finite field extension.
    \end{itemize}
\end{proof}
\begin{remark}
    We will see several additional proofs of this theorem. See \ref{hns2unc} and \ref{rfuncnft}.
    All will be accepted in the exam.

    \ref{hns3} and \ref{hnsp} are closely related.
\end{remark}

\begin{theorem}[Hilbert's Nullstellensatz (1b)] \label{hns1b}
    Let $\mathfrak{l}$ be a field and $I \subset R = \mathfrak{l}[X_1,\ldots,X_m]$ a proper ideal. Then there are a finite field extension $\mathfrak{i}$ of $\mathfrak{l}$ and a zero of $I$ in $\mathfrak{i}^m$.
\end{theorem}

\begin{proof} (HNS2 (\ref{hns2}) $\implies$ HNS1b (\ref{hns1b}))
    $I \subseteq \mathfrak{m}$ for some maximal ideal. $R / \mathfrak{m}$ is a field, since $\mathfrak{m}$ is maximal.
    $R / \mathfrak{m}$ is of finite type, since the images of the $X_i$ generate it as a $\mathfrak{l}$-algebra.
    There are thus a field extension $\mathfrak{i} / \mathfrak{l}$ and an isomorphism $R / \mathfrak{m} \xrightarrow{\iota} \mathfrak{i}$ of $\mathfrak{l}$-algebras.
    By HNS2 (\ref{hns2}), $\mathfrak{i} / \mathfrak{l}$ is a finite field extension.
    Let $x_i \coloneqq \iota (X_i \mod \mathfrak{m})$.
    \[
        P(x_1,\ldots,x_m) = \iota(P \mod \mathfrak{m})
    \] 
    Both sides are morphisms $R \to  \mathfrak{i}$ of $\mathfrak{l}$-algebras. For for $P = X_i$ the equality is trivial. It follows in general, since the $X_i$ generate $R$ as a $\mathfrak{l}$-algebra.

    Thus $(x_1,\ldots,x_m)$ is a zero of $I$ (since $P \mod \mathfrak{m} = 0$ for  $P \in I \subseteq \mathfrak{m}$).
    HNS1 (\ref{hns1}) can easily be derived from HNS1b.
\end{proof}

\subsubsection{Nullstellensatz for uncountable fields} % from lecture 5 Yet another proof of the Nullstellensatz
The following proof of the Nullstellensatz only works for uncountable fields, but will be accepted in the exam.


\begin{lemma}\label{dimrfunc}
    If $K$ is an uncountable field, then $\dim_K K(T)$ is uncountable.
\end{lemma}
\begin{proof}
    We will show, that $S \coloneqq \left\{ \frac{1}{T - \kappa} | \kappa \in  K\right\} $ is $K$-linearly independent. It follows that $\dim_K K(T) \ge \#S > \aleph_0$.

    Suppose $(x_{\kappa})_{\kappa \in K}$ is a selection of coefficients from $K$ such that $I \coloneqq \{\kappa \in  K | x_{\kappa} \neq 0\} $ is finite and 
    \[
        g \coloneqq \sum_{\kappa \in K} \frac{x_\kappa}{T-\kappa} = 0
    \]
    Let $d \coloneqq \prod_{\kappa \in  I} (T - \kappa) $. Then for $\lambda \in I$ we have
    \[
        0 = (dg)(\lambda) = x_\lambda \prod_{\kappa \in  I \sm \{\lambda\} } (\lambda - \kappa)
    \] 
    This is a contradiction as $x_\lambda \neq 0$.
\end{proof}

\begin{theorem}[Hilbert's Nullstellensatz for uncountable fields]\label{hns2unc}
    If $K$ is an uncountable field and $L / K$ a field extension and $L$ of finite type as a $K$-algebra, then this field extension is finite.
\end{theorem}
\begin{proof}
    If $(x_i)_{i=1}^{n}$ generate $L$ as an $K$-algebra, then the countably many monomials $x^{\alpha} = \prod_{i = 1}^{n} x_i^{\alpha_i} $ in the $x_i$ with $\alpha \in \N^n$ generate $L$ as a $K$-vector space.
    Thus $\dim_K L \le \aleph_0$ and the same holds for any intermediate field $K \subseteq M \subseteq L$ . If $l \in L$ is transcendent over $K$ and $M = K(l)$, then $M \cong K(T)$ has uncountable dimension by \ref{dimrfunc}. Thus $L / K$ is algebraic, hence integral, hence finite (\ref{ftaiimplf}).
\end{proof}

\subsection{The Zariski topology}
\subsubsection{Operations on ideals and \texorpdfstring{$\Va\left( I \right) $}{V(I)}}
Let $R$ be a ring and $I,J, I_\lambda \subseteq R$  ideals, $\lambda \in \Lambda$.
\begin{definition}[Radical, product and sum of ideals]
    \[
    \sqrt{I}  \coloneqq \bigcap_{n=0} ^{\infty} \{ f \in  R | f^n \in  I\} 
    \] 
    \[
        I \cdot  J \coloneqq \langle\{ i \cdot j | i \in  I , j \in J\}\rangle_R
    \] 

    \[
        \sum_{\lambda \in \Lambda} I_\lambda \coloneqq \left\{\sum_{\lambda \in \Lambda'} i_\lambda | \Lambda' \subseteq \Lambda \text{ finite}\right\} 
    \] 
\end{definition}
\begin{fact}
    The radical is an ideal in $R$ and $\sqrt{\sqrt{I} } = \sqrt{I}$.\\
    $I \cdot J$ is an ideal.\\
    $\sum_{\lambda \in \Lambda} I_\lambda$ coincides with the ideal generated by $\bigcap_{\lambda \in  \Lambda} I_\lambda$ in $R$.\\
    $\bigcap_{\lambda \in \Lambda} I_\lambda$ is an ideal.
\end{fact}

Let $R = \mathfrak{k}[X_1,\ldots,X_n]$ where $\mathfrak{k}$ is an algebraically closed field.

\begin{fact} \label{fvop}
    Let $I, J, (I_{\lambda})_{\lambda \in  \Lambda}$ be ideals in $R$.  $\Lambda$ may be infinite.
    \begin{enumerate}[A]
        \item $\Va(I) = \Va(\sqrt{I})$ 
        \item $\sqrt{J} \subseteq \sqrt{I} \implies \Va(I) \subseteq \Va(J)$
        \item $\Va(R) = \emptyset, \Va(\{0\} =\mathfrak{k}^n$
        \item $\Va(I \cap J) = \Va(I\cdot J) = \Va(I) \cup \Va(J)$ 
        \item $\Va(\sum_{\lambda \in \Lambda} I_\lambda) = \bigcap_{\lambda \in \Lambda} \Va(I_{\lambda})$
    \end{enumerate}
\end{fact}
\begin{proof}
   \begin{enumerate}
       \item[A-C] trivial
       \item[D] $I \cdot J \subseteq I \cap J \subseteq I$. Thus $\Va(I) \subseteq \Va(I \cap J) \subseteq \Va(I \cdot J)$. By symmetry we have $\Va(I) \cup \Va(J) \subseteq \Va(I \cap J) \subseteq \Va(I \cdot J)$.
           Let $x \not\in \Va(I) \cup \Va(J)$. Then there are $f \in I, g \in  J$ such that $f(x) \neq 0, g(x) \neq 0$ thus $(f \cdot g)(x) \neq  0  \implies x \not\in  \Va(I\cdot J)$.
           Therefore \[
               \Va(I) \cup \Va(J) \subseteq \Va(I \cap J) \subseteq \Va(I \cdot J) \subseteq \Va(I) \cup \Va(J)
           \] 
       \item[E] $I_\lambda \subseteq \sum_{\lambda \in \Lambda} I_\lambda \implies \Va(\sum_{\lambda \in \Lambda} I_\lambda) \subseteq \Va(I_\lambda)$.
           Thus $\Va(\sum_{\lambda \in \Lambda} I_\lambda) \subseteq \bigcap_{\lambda \in \Lambda} \Va(I_\lambda)$.
           On the other hand if $f \in  \sum_{\lambda \in \Lambda} I_\lambda$ we have $f = \sum_{\lambda \in \Lambda} f_\lambda$. Thus $f$ vanishes on $\bigcap_{\lambda \in \Lambda} \Va(I_{\lambda})$ and we have $\bigcap_{\lambda \in \Lambda} \Va(I_\lambda) \subseteq \Va(\sum_{\lambda \in \Lambda} I_\lambda)$.
   \end{enumerate} 
\end{proof}
\begin{remark}
    There is no similar way to describe $\Va(\bigcap_{\lambda \in  \Lambda} I_\lambda)$ in terms of the $\Va(I_{\lambda})$ when $\Lambda$ is infinite.
    For instance if $n = 1, I_k \coloneqq X_1^k R$ then $\bigcap_{k=0}^\infty I_k = \{0\} $ but $\bigcup_{k=0}^{\infty} \Va(I_k) = \{0\}$.
\end{remark}
\subsubsection{Definition of the Zariski topology}
Let $\mathfrak{k}$ be algebraically closed, $R = \mathfrak{k}[X_1,\ldots,X_n]$.
\begin{corollary} (of \ref{fvop})
    There is a topology on $\mathfrak{k}^n$ for which the set of closed sets coincides with the set $\fA$ of subsets of the form $\Va\left(I \right) $ for ideals $I \subseteq R$.
    This topology is called the \vocab{Zariski-Topology} 
\end{corollary}

\begin{example}\label{zariskinothd}
    Let $n = 1$. Then $R$ is a PID. Hence every ideal is a principal ideal and the Zariski-closed subsets of $\mathfrak{k}$ are the subsets of the form $\Va(P)$ for $P \in R$.
As $\Va(0) = \mathfrak{k}$ and $\Va(P)$ finite for $P \neq 0$ and $\{x_1,\ldots,x_n\} = \Va(\prod_{i=1}^{n}(T-x_i))$ the Zariski-closed subsets of $\mathfrak{k}$ are $\mathfrak{k}$ and the finite subsets.
    Because $\mathfrak{k}$ is infinite, this topology is not Hausdorff.
\end{example}

\subsubsection{Separation properties of topological spaces}
\begin{definition}
    Let $X$ be a topological space. $X$ satisfies the separation properties $T_{0-2}$ if for any $x \neq  y \in X$ 
    \begin{enumerate}
        \item[$T_0$ ] $\exists U \subseteq X$ open such that $|U \cap \{x,y\}| = 1$
        \item[$T_1$ ] $\exists U \subseteq X$ open such that $x \in U, y \not\in U$.
        \item[$T_2$ ] There are disjoined open sets $U, V \subseteq X$ such that $x \in U, y \in V$. (Hausdorff)
    \end{enumerate}
\end{definition}
\begin{remark}
    Let $x \sim y :\iff$ the open subsets of $X$ containing  $x$ are precisely the open subsets of $X$ containing $y$. Then $T_0$ holds iff $x \sim y \implies x  =y$.
\end{remark}
\begin{fact}
    $T_0 \iff$ every point is closed.
\end{fact}
\begin{fact}
    The Zariski topology on $\mathfrak{k}^n$ is $T_1$ but for $n \ge 1$ not Hausdorff. For $n \ge 1$ the intersection of two non-empty  open subsets of $\mathfrak{k}^n$ is always non-empty.
\end{fact}
\begin{proof}
    $\{x\} $ is closed, as $\{x\}  = V(\Span{X_1 - x_1,  \ldots, X_n - x_n}_R)$. If $A = V(I), B = V(J)$ are two proper closed subsets of $\mathfrak{k}^n$ then $I \neq  \{0\} , J \neq  \{0\} $ and thus $IJ \neq \{0\} $. Therefore $A \cup B = V(IJ)$ is a proper closed subset of $\mathfrak{k}^n$.
\end{proof}


\subsubsection{Compactness properties of topological spaces}
Let $X$ be a topological space.
\begin{definition}[Compact, quasi-compact]
    $X$ is called \vocab[Topological space!quasi-compact]{quasi-compact} if every open covering of $X$ has a finite subcovering.
    It is called \vocab[Topological space!compact]{compact}, if it is quasi-compact and Hausdorff.
\end{definition}
\begin{definition}[Noetherian topological spaces]
    $X$ is called \vocab{Noetherian}, if the following equivalent conditions hold:
    \begin{enumerate}[A]
        \item Every open subset of $X$ is quasi-compact.
        \item Every descending sequence $A_0 \supseteq A_1 \supseteq \ldots$ of closed subsets of $X$ stabilizes.
        \item Every non-empty set $\cM$ of closed subsets of $X$ has a $\subseteq$-minimal element.
    \end{enumerate}
\end{definition}
\begin{proof}\,
    \begin{enumerate}
        \item[A $\implies$ B] Let $A_j$ be a descending chain of closed subsets. Define $A \coloneqq \bigcap_{j = 0}^{\infty} A_j$. If A holds, the covering $X \sm A = \bigcup_{j = 0}^{\infty} (X \sm A_j)$ has a finite subcovering.
        \item[B  $\implies$ C] Suppose $\cM$ does not have a $\subseteq$-minimal element. Using DC, one can construct a counterexample $A_1 \subsetneq A_2 \supsetneq \ldots$ to B.
        \item[C $\implies$ A] Let $\bigcup_{i \in  I} V_i$ be an open covering of an open subset $U \subseteq X$.
            By C, the set $\cM \coloneqq \{X \sm \bigcup_{i \in F} V_i | F \subseteq I \text{ finite} \}$ has a $\subseteq$-minimal element.
    \end{enumerate}
\end{proof}

\subsection{Another form of the Nullstellensatz and Noetherianness of \texorpdfstring{$\mathfrak{k}^n$}{kn}}
Let $\mathfrak{k}$ be algebraically closed, $R = \mathfrak{k}[X_1,\ldots,X_n]$.
For $f \in R$ let $V(f) = V(fR)$.
\begin{theorem}[Hilbert's Nullstellensatz (3)] \label{hns3}
    Let $I \subseteq R$ be an ideal. Then $V(I) \subseteq V(f)$ iff $f \in \sqrt{I}$.
\end{theorem}
\begin{proof}
    Suppose $f$ vanishes on all zeros of $I$. Let $R' \coloneqq \mathfrak{k}[X_1,\ldots,X_n,T]$,
    $g(X_1,\ldots,X_n,T) \coloneqq 1 - T \cdot f(X_1,\ldots,X_n)$
    and $J \subseteq R'$ the ideal generated by $g$ and the elements of $I$ (viewed as elements of $R'$ which are constant in the $T$-direction).

    If $f$ vanishes on all zeros of $I$, then $J$ has no zeros in $\mathfrak{k}^{n+1}$.

    Thus there exist $p_i \in I, i=1,\ldots,n, q_i \in \mathfrak{k}[X_1,\ldots,X_n,T], i = 1,\ldots,n$ and $q \in \mathfrak{k}[X_1,\ldots,X_n,T]$ such that
    \[
    1 = g \cdot q + \sum_{i=1}^{n} p_{i}q_i
    \]
    Formally substituting $\frac{1}{f(x_1,\ldots,x_n)}$ for $Y$, one obtains:
    \[
        1 = \sum_{i=1}^{n} p_{i}\left(x_1,\ldots,x_n\right) q_i\left( x_1,\ldots,x_n, \frac{1}{f(x_1,\ldots,x_n)} \right) 
    \] 
    Multiplying by a sufficient power of $f$, this yields an equation in $R$ :
    \[
        f^d = \sum_{i=1}^{n} p_{i}(x_1,\ldots,_n) \cdot q_i'(x_1,\ldots,x_n) \in I
    \] 
    Thus $f \in \sqrt{I}$.
\end{proof}

\begin{corollary}\label{antimonbij}
    \begin{align}
        f: \{I \subseteq R | I \text{ ideal}, I = \sqrt{I} \}  &\longrightarrow \{A \subseteq \mathfrak{k}^n | A \text{ Zariski-closed}\}  \\
        I &\longmapsto  V(I)\\
        \{f \in R | A  \subseteq V(f)\} &\longmapsfrom A 
    \end{align}
    is a $\subseteq$-antimonotonic bijection.
\end{corollary}
\begin{corollary}
    The topological space $\mathfrak{k}^n$ is Noetherian.
\end{corollary}
\begin{proof}
    Because the map from \ref{antimonbij} is antimonotonic, strictly decreasing chains of closed subsets of $\mathfrak{k}^n$ are mapped to strictly increasing chains of ideals in $R$.
    By the Basissatz (\ref{basissatz}), $R$ is Noetherian.
\end{proof}

% Lecture 04


\subsection{Irreducible spaces}

Let $X$ be a topological space.

\begin{definition}
    $X$ is called \vocab[Topological space!irreducible]{irreducible}, if $X \neq \emptyset$ and the following equivalent conditions hold:
    \begin{enumerate}[A]
        \item Every open $\emptyset \neq  U \subseteq X$ is dense.
        \item The intersection of non-empty, open subsets $U, V \subseteq X$ is non-empty.
        \item If $A, B \subseteq X$ are closed, $X = A \cup B$ then $X = A$ or $X = B$.
        \item Every open subset of $X$ is connected.
    \end{enumerate}
\end{definition}
\begin{proof}\,
    \begin{itemize}
        \item[$A \iff B$] by definition of denseness.
        \item[B $\iff$ C] Let $U \coloneqq X \sm A, V \coloneqq X \sm B$.
        \item[B $\implies$ D] Suppose $W$  is a non-connected open subset. Then there exists a decomposition $W = U \cup V$ into disjoint open subsets.
        \item[D $\implies$ B] If $U,V \neq \emptyset$ are disjoint open subsets, then $U \cup V$ is non-connected.
    \end{itemize}
\end{proof}
\begin{corollary}
    Every irreducible topological space is connected.
\end{corollary}
\begin{example}
    $\mathfrak{k}^n$ is irreducible as shown in \ref{zariskinothd}.
\end{example}

\begin{fact}
    \begin{enumerate}[A]
        \item A single point is always irreducible.
        \item If $X$ is Hausdorff then it is irreducible iff it has precisely one point.
        \item $X$ is irreducible iff it cannot be written as a finite union of proper closed subsets.
        \item $X$ is irreducible iff any finite intersection of non-empty open subsets is non-empty. ($\bigcap \emptyset \coloneqq X$)
    \end{enumerate}
\end{fact}
\begin{proof}
    \begin{enumerate}
        \item[A,B] trivial
        \item[C]  $\implies$ : Induction on the cardinality of the union. $\impliedby $: $\bigcap \emptyset = X$ is non-empty and any intersection of two non-empty open subsets is non-empty.
        \item[D] Follows from C.
    \end{enumerate}
\end{proof}

\subsubsection{Irreducible components}

\begin{fact}
 If $D \subseteq X$ is dense, then $X$ is irreducible iff $D$ is irreducible with its induced topology. 
\end{fact}
\begin{proof}
    $X = \emptyset$ iff $D = \emptyset$.
    Suppose $B$ is the union of its proper closed subsets $A,B$. Then $X = \overline{A} \cup \overline{B}$. These are proper closed subsets of $X$, as $\overline{A} \cap D = A \cap D$ (by closedness of $D$) and thus $\overline{A} \cap D \neq  D$.

    On the other hand, if $U$ and $V$ are disjoint non-empty open subsets of $X$, then $U \cap D$ and $V \cap D$ are disjoint non-empty open subsets of $D$.
\end{proof}
\begin{definition}[Irreducible subsets]
    A subset $Z \subseteq X$ is called \vocab[Topological space!irreducible]{irreducible} if it is irreducible with its induced topology.
    $Z$ is called an \vocab{irreducible component}  of $X$, if it is irreducible and if every irreducible subset $Z \subseteq Y \subseteq X$ coincides with  $Z$.
\end{definition}
\begin{corollary}
    \begin{enumerate}
        \item $Z \subseteq X$ is irreducible iff $\overline{Z} \subseteq X$ is irreducible.
        \item Every irreducible component of $X$ is a closed subset of $X$.
    \end{enumerate}
\end{corollary}
\begin{notation}
    From now on, irreducible means irreducible and closed.
\end{notation}

\subsubsection{Decomposition into irreducible subsets}
\begin{proposition}
    Let $X$ be a Noetherian topological space. Then $X$ can be written as a finite union $X = \bigcup_{i = 1}^n Z_i$ of irreducible closed subsets of $X$.
    One may additionally assume that $i \neq j \implies Z_i \not\subseteq Z_i$. With this minimality condition, $n$ and the $Z_i$ are unique (up to permutation) and $\{Z_1,\ldots,Z_n\}$ is the set of irreducible components of $X$.
\end{proposition}

\begin{proof}
    % i = ic
    Let $\fM$ be the set of closed subsets of $X$ which cannot be decomposed as a union of finitely many irreducible subsets.
    Suppose $\fM \neq  \emptyset$. Then there exists a $\subseteq$-minimal $Y \in \fM$. $Y$ cannot be empty or irreducible. Hence  $Y = A \cup  B$ where $A,B$ are proper closed subsets of $ Y$. By the minimality of $Y$, $A$ and $B$ can be written as a union of proper closed subsets  $\lightning$.

    Let $X = \bigcup_{i = 1}^n Z_i$, where there are no inclusions between the $Z_i$. If $Y$ is an irreducible subsets of $X$, $Y = \bigcup_{i = 1}^n (Y \cap Z_i)$ and there exists $1 \le i \le n$ such that $Y = Y \cap Z_i$.
    Hence $Y \subseteq Z_i$. Thus the $Z_i$ are irreducible components. Conversely, if $Y$ is an irreducible component of $X$, $Y \subseteq Z_i$ for some $i$ and $Y = Z_i$ by the definition of irreducible component.
\end{proof}
\begin{remark}
    The proof of existence was an example of \vocab{Noetherian induction} : If $E$ is an assertion about closed subsets of a Noetherian topological space $X$ and $E$ holds for $A$ if it holds for all proper subsets of $A$, then $E(A)$ holds for every closed subset $A \subseteq X$.
\end{remark}

\begin{proposition}\label{bijiredprim}
    By \ref{antimonbij} there exists a bijection
    \begin{align}
        f: \{I \subseteq R | I \text{ ideal}, I = \sqrt{I} \}  &\longrightarrow \{A \subseteq \mathfrak{k}^n | A \text{ Zariski-closed}\}  \\
        I &\longmapsto  V(I)\\
        \{f \in R | A  \subseteq V(f)\} &\longmapsfrom A 
    \end{align}

    Under this correspondence $A \subseteq \mathfrak{k}^n$ is irreducible iff $I \coloneqq f\inv(A)$ is a prime ideal.
    Moreover, $\#A = 1$ iff $I$ is a maximal ideal.
\end{proposition}
\begin{proof}
    By the Nullstellensatz (\ref{hns1}), $A = \emptyset \iff I = R$. Suppose $A = B \cup C$ is a decomposition into proper closed subsets $A = V(J), B = V(K)$ where  $J = \sqrt{J}. K = \sqrt{K}$.
    Since $A \neq B$ and $A \neq C$, there are $f \in  J \sm I, g \in K \sm I$. $fg$ vanishes on $A = B \cup C$. By the Nullstellensatz (\ref{hns3}) $fg \in \sqrt{I}  = I$ and $I$ fails to be prime.

    On the other hand suppose that $fg \in I, f \notin I, g \not\in I$. By the Nullstellensatz (\ref{hns3}) and $I = \sqrt{I} $ neither $f$ nor $g$ vanishes on all of $A$. Thus $(A \cap V(f)) \cup (A \cap V(g))$ is a decomposition and $A$ fails to be irreducible.

    The remaining assertion follows from the fact, that the bijection is $\subseteq$-antimonotonic and thus maximal ideals correspond to minimal irreducible closed subsets, which are the one-point subsets as $\mathfrak{k}^n$ is T${}_1$.
\end{proof}
\subsection{Krull dimension}
\begin{definition}
    Let $Z $ be an irreducible subset of the topological space $X$. Let $\codim(Z,X)$ be the maximum of the length $n$ of strictly increasing chains $Z \subseteq Z_0 \subsetneq Z_1 \subsetneq \ldots \subsetneq Z_n$ of irreducible closed subsets of $X$ containing $Z$ or $\infty$ if such chains can be found for arbitrary $n$.
    Let 
    \[
    \dim X \coloneqq \begin{cases}
        - \infty &\text{if } X = \emptyset\\
        \sup_{\substack{Z \subseteq X\\ Z \text{ irreducible}}} \codim(Z,X) & \text{otherwise} 
    \end{cases}
    \] 
\end{definition}
\begin{remark}
    \begin{itemize}
        \item In the situation of the definition $\overline{Z}$ is irreducible. Hence $\codim(Z,X)$ is well-defined and one may assume without losing much generality that $Z$ is closed.
        \item Because a point is always irreducible, every non-empty topological space has an irreducible subset and for $X \neq \emptyset$, $\dim X$ is $\infty$ or $\max_{x \in X} \codim(\{x\}, X)$.
        \item Even for Noetherian $X$, it may happen that $\codim(Z,X) = \infty$.
        \item Even for if $X$ is Noetherian and $\codim(Z,X)$ is finite for all irreducible subsets $Z$ of $X$, $\dim X$ may be infinite.
    \end{itemize}
\end{remark}
\begin{fact}
    If $X = \{x\}$, then $\dim X = 0$.
\end{fact}
\begin{fact}
    For every $x \in \mathfrak{k}$, $\codim( \{x\} ,\mathfrak{k}) = 1$. The only other irreducible closed subset of $\mathfrak{k}$ is $\mathfrak{k}$ itself, which has codimension zero. Thus $\dim \mathfrak{k} = 1$.
\end{fact}
\begin{fact}
    Let $Y \subseteq X$ be irreducible and $U \subseteq X$ an open subset such that $U \cap Y \neq  \emptyset$. Then we have a bijection
    \begin{align}
        f: \{A \subseteq X | A \text{ irreducible, closed and } Y \subseteq A\}  &\longrightarrow  \{B \subseteq U | B \text{ irreducible, closed and } Y \cap U \subseteq B\} \\
    A&\longmapsto A \cap U\\
    \overline{B}&\longmapsfrom B
    \end{align}
    where $\overline{B}$ denotes the closure in $X$.
\end{fact}
\begin{proof}
    If $A$ is given and $B = A \cap U$, then $B \neq  \emptyset$ and B is open hence (irreducibility of $A$) dense in $A$, hence $A = \overline{B}$. The fact that $B = \overline{B} \cap U$ is a general property of the closure operator.
\end{proof}
\begin{corollary}[Locality of Krull codimension] \label{lockrullcodim}
    Let $Y \subseteq X$ be irreducible and $U \subseteq X$ an open subset such that $U \cap Y \neq  \emptyset$.
    Then $\codim(Y,X) = \codim(Y \cap U, U)$.
\end{corollary}
\begin{fact}
    Let $Z \subseteq Y \subseteq X$ be irreducible closed subsets of the topological space $X$. Then
    \[
        \codim(Z,Y) + \codim(Y,X) \le  \codim(Z,X) \tag{CD+}\label{eq:cdp}
    \]
\end{fact}
\begin{proof}
    A chain of irreducible closed subsets between $Z$ and $Y$ and a chain of irreducible closed between $Y$ and $X$ can be spliced together.
\end{proof}
Taking the supremum over all $Z$ we obtain:
\begin{fact}
    If $Y$ is an irreducible closed subset of the topological space $X$, then
    \[
        \dim(Y) + \codim(Y,X) \le  \dim(X) \tag{D+}\label{eq:dp}
    \] 
\end{fact}
In general, these inequalities may be strict.
\begin{definition}[Catenary topological spaces]
    A topological space $T$ is called \vocab[Topological space!catenary]{catenary} if equality holds in \eqref{eq:cdp} whenever $X$ is an irreducible closed subset of $T$. 
\end{definition}

\subsubsection{Krull dimension of  \texorpdfstring{$\mathfrak{k}^n$}{kn}} % from lecture 04
\begin{theorem}\label{kdimkn}
    $\dim \mathfrak{k}^n = n$ and $\mathfrak{k}^n$ is catenary. Moreover, if $X$ is  an irreducible closed subset of $\mathfrak{k}^n$, then equality occurs in \eqref{eq:dp}.
\end{theorem}
\begin{proof}
    Considering
    \[
    \{0\}  \subsetneq \mathfrak{k} \times  \{0\}  \subsetneq \mathfrak{k}^2 \times \{0\} \subsetneq \ldots \subsetneq \mathfrak{k}^n
    \]
    it is clear that $\codim(\{0\}, \mathfrak{k}^n) \ge n$.Translation by $x \in \mathfrak{k}^n$ gives us $\codim(\{x\} , \mathfrak{k}^n) \ge n$.

    The opposite inequality follows from \ref{upperbounddim} ($Z = \mathfrak{k}^n$ $\dim \mathfrak{k}^n \le \trdeg(\fK(Z) / \mathfrak{k}) = \trdeg(Q(\mathfrak{k}[X_1,\ldots,X_n]) / \mathfrak{k}) = n$).

    The theorem is a special case of \ref{htandtrdeg}.
     % DIMT
\end{proof}

\begin{lemma}\label{ufdprimeideal}
    Every non-zero prime ideal $\fp$ of a UFD $R$ contains a prime element.
\end{lemma}
\begin{proof}
    Let $p \in  \fp \sm \{0\} $ with the minimal number of prime factors, counted by multiplicity.
    If $p $ was a unit, then $\fp \supseteq pR = R$. If  $p = ab$ with non-units $a,b$, it follows that $a \in \fp$ or $b \in \fp$ contradicting the minimality assumption.
    Thus $p$ is a prime element of $R$.
\end{proof}

\begin{proposition}[Irreducible subsets of codimension one]\label{irredcodimone}
    Let $p \in  R = \mathfrak{k}[X_1,\ldots, X_n]$ be a prime element. Then the irreducible subset $X = V(p) \subseteq \mathfrak{k}^n$ has codimension one, and every codimension one subset of $\mathfrak{k}^n$ has this form.
\end{proposition}
\begin{proof}
    Since $pR$ is a prime ideal, $X = V(p)$ is irreducible. Since $p \neq 0$, $X$ is a proper subset of $\mathfrak{k}^n$. 
    If $X \subseteq Y \subseteq \mathfrak{k}^n$ is irreducible and closed, then $Y = V(\fq)$ for some prime ideal $\fp \subseteq pR$.
    If $Y \neq \mathfrak{k}^n$, then $\fp \neq \{0\}$. By \ref{ufdprimeideal} there exists a  prime element $q \in \fq$. As $\fq \subseteq pR$ we have $p \divides q$.
    By the irreducibility of $p$ and $q$ it follows that $p \sim q$. Hence $\fq = pR$ and $X = Y$.

    Suppose $X = V(\fp) \subseteq \mathfrak{k}^n$ is closed, irreducible and of codimension one.
    Then $\fp \neq  \{0\}$, hence $X \neq  \mathfrak{k}^n$. By \ref{ufdprimeideal} there is a prime element $p \in  \fp$. If $\fp \neq  pR$, then 
    $X \subsetneq V(p) \subsetneq \mathfrak{k}^n$ contradicts $\codim(X, \mathfrak{k}^n) = 1$.
\end{proof}

% Lecture 05
\subsection{Transcendence degree}
\subsubsection{Matroids}
\begin{definition}[Hull operator]
    
    Let $X$ be a set, $\cP(X)$ the power set of $X$. A \vocab{Hull operator}  on $X$ is a map $\cP(X) \xrightarrow{\cH} \cP(X)$ such that
    \begin{enumerate}
        \item[H1] $\A A \in \cP(X) ~ A \subseteq \cH(A)$.
        \item[H2]  $A \subseteq B \subseteq X \implies \cH(A) \subseteq \cH(B)$.
        \item[H3] $\cH(\cH(X)) = \cH(X)$.
    \end{enumerate}

    We call $\cH$ \vocab{matroidal}  if in addition the following conditions hold: 
    \begin{enumerate}
        \item[M] If $m,n \in X$ and $A \subseteq X$ then $m \in \cH( \{n\}  \cup  A) \sm \cH(A) \iff n \in \cH(\{m\}  \cup A) \sm \cH(A).$ 
            \item[F] $\cH(A) = \bigcup_{F \subseteq A \text{ finite}} \cH(F)$.
    \end{enumerate}
    In this case, $S \subseteq X$ is called \vocab{Independent subset}, if $s \not\in  \cH(S \sm \{s\})$ for all $s \in S$ and
    \vocab[Generating subset]{generating}  if $X = \cH(S)$.
    $S$ is called a \vocab{base}, if it is both generating and independent.
\end{definition}

\begin{theorem}
    If $\cH$ is a matroidal hull operator on $X$, then a basis exists, every independent set is contained in a base and two arbitrary bases have the same cardinality.
\end{theorem}


\begin{example}
    Let $K$ be a field, $V$ a $K$-vector space and $\cL(T)$ the $K$-linear hull of $T$ for $T \subseteq V$.
    Then  $\cL$ is a matroidal hull operator on $V$.
\end{example}

\subsubsection{Transcendence degree}
\begin{lemma}
    Let $L / K$ be a field extension and let $\cH(T)$ be the algebraic closure in $L$ of the subfield of $L$ generated by $K$ and $T$.\footnote{This is the intersection of all subfields of $L$ containing $K \cup T$, or the field of quotients of the sub-$K$-algebra of  $L$ generated by $T$.}
    Then $\cH$ is a matroidal hull operator.
\end{lemma}
\begin{proof}
    H1, H2 and F are trivial. For an algebraically closed subfield $K \subseteq M \subseteq L$ we have $\cH(M) = M$. Thus $\cH(\cH(T)) = \cH(T)$ (H3).

    Let $x,y \in L$, $T \subseteq L$ and $x \in  \cH(T \cup \{y\}) \sm \cH(T)$. We have to show that $y \in  \cH(T \cup \{x\}) \sm \cH(T)$.
    If $y \in  \cH(T)$ we have $\cH(T \cup \{y\}) \subseteq \cH(\cH(T)) = \cH(T) \implies x \in  \cH(T) \sm \cH(T) \lightning$.
    Hence it is sufficient to show $y \in  \cH(T \cup  \{x\})$. \Wlog $T = \emptyset$ (replace $K$ be the subfield generated by $K \cup T$).
    Then $x$ is algebraic over the subfield $M$ of $L$ generated by $K \cup \{y\}$. Thus there exists $0 \neq P \in  M[T]$ with $P(x) = 0$.
    The coefficients $p_i$ of $P$ belong to the field of quotients of the $K$-subalgebra of $L$ generated by $y$. There are thus polynomials $Q_i, R \in K[Y]$ such that $p_i = \frac{Q_i(y)}{R(y)}$, $R(y) \neq 0$.
    Let
    \[
        Q(X,Y) \coloneqq \sum_{i=0}^{\infty} X^i Q_i(Y) = \sum_{i,j=0}^{\infty} q_{i,j}X^i Y^j = \sum_{j=0}^{\infty} Y^j \hat{Q_j}(X) \in  K[X,Y]
    \].
    Then $Q(x,y) = 0$.
    Let $\hat{p_j} \coloneqq \hat{Q_j}(x)$. Then $\hat{P}(y) = 0$. As $Q \neq 0$ there is $(i,j) \in  \N^2$ such that $q_{i,j} \neq 0$ and then $\hat{p_j} \neq 0$ as $x \not\in \cH(\emptyset)$. Thus $\hat{P} \in  \hat{M}[X] \sm \{0\} $, where $\hat{M}$ is the subfield of $L$ generated by $K$ and $x$. Thus $y$ is algebraic over $\hat{M}$ and $y \in \cH(\{x\})$,
\end{proof}
\begin{definition}[Transcendence Base]
    Let $L / K$ be a field extension and $\cH(T)$ the algebraic closure in $L$ of the subfield  generated by $K$ and $T$. A base for $(L, \cH)$ is called a \vocab{transcendence base} and the \vocab{transcendence degree}  $\trdeg(L / K)$ is defined as the cardinality of any transcendence base of  $L / K$. 
\end{definition}
\begin{remark}
    $L / K$ is algebraic iff $\trdeg(L / K) = 0$.
\end{remark}

\subsection{Inheritance of Noetherianness and of finite type by subrings and subalgebras / Artin-Tate}
The following will lead to another proof of the Nullstellensatz, which uses the transcendence degree.
\begin{remark}
    There exist non-Noetherian domains, which are subrings of Noetherian domains (namely the field of quotients is Noetherian).
\end{remark}

\begin{theorem}[Eakin-Nagata]
    Let $A$ be a subring of the Noetherian ring $B$. If the ring extension $B / A$ is finite (i.e. $B$ finitely generated as an $A$-module) then $A$ is Noetherian.
\end{theorem}
\begin{dfact}\label{noethersubalg}
    Let $R$ be Noetherian and let $B$ be a finite $R$-algebra. Then every $R$-subalgebra $A \subseteq B$ is finite over $R$.
\end{dfact}
\begin{proof}
    Since $B$ a finitely generated $R$-module and $R$ a Noetherian ring, $B$ is a Noetherian $R$-module (this is a stronger assertion than Noetherian algebra).
    Thus the sub- $R$-module $A$ is finitely generated.
\end{proof}

\begin{proposition}[Artin-Tate]
    \label{artintate}
    Let $A$ be a subalgebra of the $R$-algebra $B$, where $R$ is Noetherian. If $ B / R$ is of finite type and $B / A$ is finite, then $A / R$ is also of finite type.

    \begin{figure}[H]
        \centering
        \begin{tikzcd}
            A \arrow[hookrightarrow]{rr}{\subseteq}& & B  \\
                            &R \arrow{ul}{\alpha} \arrow{ur}{\alpha} \text{~(Noeth.)}
        \end{tikzcd}
    \end{figure}
    
\end{proposition}
\begin{proof}
    Let $(b_i)_{i=1}^{m}$ generate $B$ as an $A$-module and $(\beta_j)_{j=1}^m$ as an $R$-algebra.
    There are $a_{ijk} \in A$ such that $b_i b_j = \sum_{k=1}^{m} a_{ijk}b_k$. And $\alpha_{ij} \in A$ such that $\beta_i = \sum_{j=1}^{m} \alpha_{ij}b_j$. Let $\tilde{A}$ be the sub- $R$-algebra of $A$ generated by the $a_{ijk}$ and $\alpha_{ij}$. $\tilde{A}$ is of finite type over $ R$, hence Noetherian. The $\tilde{A}$-submodule generated by  $1$ and the $b_i$ is a sub-$R$-algebra containing the $\beta_i$ and thus coincides with $B$.
    Hence $B / \tilde{A}$ is finite. Since $A \subseteq B, A / \tilde{A}$ is finite (\ref{noethersubalg}).
    Hence $A / \tilde{A}$ is of finite type. By the transitivity of ``of finite type'', it follows that $A / R$ is of finite type.
    \begin{figure}[H]
        \centering
        \begin{tikzcd}
            \tilde A \arrow[hookrightarrow]{r}{\subseteq}& A \arrow[hookrightarrow]{r}{\subseteq} & B \\
                                                   &R \arrow[bend left, swap]{ul}{\alpha} \arrow{u}{\alpha} \arrow[bend right]{ur}{\alpha}
        \end{tikzcd}
    \end{figure}
    
\end{proof}
\subsubsection{Artin-Tate proof of the Nullstellensatz}
Let $K$ be a field and $R = K[X_1,\ldots,X_n]$. 
\begin{definition}[Rational functions]
    Let $K(X_1,\ldots,X_n) \coloneqq Q(R)$ be the field of quotients of $R$.

    $K(X_1,\ldots,X_n)$ is called the \vocab{field of rational functions}  in $n$ variables over $K$.
\end{definition}
\begin{lemma}[Infinitely many prime elements]
    There are infinitely many multiplicative equivalence classes of prime elements in $R$.
\end{lemma}
\begin{proof}
    Suppose $(P_i)_{i =1}^m$ is a complete (up to multiplicative equvialence) lsit of prime elements of $R$.
    $m > 0$, as $X_1$ is prime. The polynomial $f \coloneqq 1 + \prod_{i=1}^{m} P_i $ is non-constant, hence not a unit in $R$. Hence there exists a prime divisor $P \in R$. As no $P_i$ divides $f$, $P$ cannot be multiplicatively equivalent to any $P_i \lightning$. 
\end{proof}
\begin{lemma}[Ring of rational functions not of finite type]\label{rfuncnft}
    If $n > 0$, then $K(X_1,\ldots,X_n) / K$ is not of finite type.
\end{lemma}
\begin{proof}
    Suppose $(f_i)_{i=1}^m$ generate $K(X_1,\ldots,X_n)$ as a $K$-algebra. Let $f_i = \frac{a_i}{b}, a_i \in R, b \in R \sm \{0\}$.
    Then $bf_i \in R$, and as the $f_i$ generate $K(X_1,\ldots,X_n)$ as a $K$-algebra, for every $g \in K(X_1,\ldots,X_n)$ there is $N \in \N$ with
    \[
        b^Ng \in R \tag{+} \label{bNginR}
    \]
    However, if $b = \eps \prod_{i=1}^{l} P_i$ is a decomposition of $b$ into prime factors $P_i$ and a unit $\eps$ in $R$ and $g = \frac{1}{P}$, wehere $P \in R$ is a prime element not multiplicatively equvalent to any $P_i$, 
    then \eqref{bNginR} fails for any $N \in \N$.
\end{proof}

The Nullstellensatz (\ref{hns2}) can be reduced to the case of \ref{rfuncnft}:

\begin{proof}(Artin-Tate proof of HNS)
    Let $(l_i)_{i=1}^n$ be a transcendence base of $L / K$. If $n = 0$ then $L / K$ is algebraic, hence an integral ring extension, hence a finite ring extension (\ref{ftaiimplf}).

    Suppose $n > 0$. Let $\tilde R \subseteq L$ be the $K$-subalgebra generated by the $l_i$. $\tilde R \cong R \coloneqq K[X_1,\ldots,X_n]$, as the $l_i$ are algebraically independent.
    As they are a transcendence base, $L$ is algebraic over the field of quotients $Q(\tilde R)$, hence integral over $Q(\tilde R)$.

    As $L / K$ is of finite type, so is $L / Q(\tilde R)$ and it follows that $L / Q(\tilde R)$ is a finite ring extension.
    By Artin-Tate (\ref{artintate}), $Q(\tilde K)$ is of finite type over $K$. This contradicts \ref{rfuncnft}, as $R \cong \tilde R \implies K(X_1,\ldots,X_n) \cong Q(\tilde R)$.
\end{proof}


\subsection{Transcendence degree and Krull dimension}
Let $R = \mathfrak{k}[X_1,\ldots,X_n]$.
%i = ic
\begin{notation}
    Let $X \subseteq \mathfrak{k}^n$ be an irreducible closed subset. Then $X = V(\fp)$ for a unique prime ideal $\fp \subseteq R$.
    Let $\fK(X) \coloneqq Q(R / \fp)$ denote the field of quotients of $R / \fp$.
\end{notation}
\begin{remark}
    As the elements of $\fp$ vanish on $X$, $R / \fp$ may be viewed as the ring of polynomials and $\fK(X)$  as the field of rational functions on $X$.
\end{remark}
\begin{theorem}\label{trdegandkdim}
    If $X \subseteq \mathfrak{k}^n$ is irreducible, then $\dim X = \trdeg (\mathfrak{k}(X) / \mathfrak{k})$ and $\codim(X, \mathfrak{k}^n) = n - \trdeg(\fK(X) / \mathfrak{k})$.
    More generally if $Y \subseteq \mathfrak{k}^n$ is irreducible and $X \subseteq Y$, then $\codim(X,Y) = \trdeg(\fK(Y) / \mathfrak{k}) - \trdeg(\fK(X) / \mathfrak{k})$.
\end{theorem}
\begin{proof}
    % DIMT
    One part will be shown in "A first result on dimension theory" (\ref{upperboundcodim}) 
    and other one in "Aplication to dimension theory: Proof of $\dim Y = \trdeg(\fK(Y) / \mathfrak{k})$" (\ref{lowerbounddimy}).
    The theorem is a special case of \ref{htandtrdeg}.
\end{proof}
\begin{remark}
    Loosely speaking, the Krull dimension of $X$ is equal to the maximal number of $\mathfrak{k}$-algebraically independent rational functions on $X$.
    This is yet another indication that the notion of dimension is the ``correct'' one.
\end{remark}
\begin{remark}
    \ref{kdimkn} follows.
\end{remark}





% Lecture 06

\subsection{The spectrum of a ring}
\begin{definition}[Spectrum]
    Let $R$ be a commutative ring.
    \begin{itemize}
        \item Let $\Spec R$ denote the set of prime ideals and $\mSpec R \subseteq \Spec R$ the set of maximal ideals of $R$.
        \item For an ideal $I \subseteq R$ let $V(I)  \coloneqq \{\fp \in \Spec R | I \subseteq \fp\}$
        \item We equip $\Spec R$ with the \vocab{Zariski-Topology} for which the closed subsets are the subsets  of the form $V(I)$, where $I$ runs over the set of ideals in $R$.
    \end{itemize}
\end{definition}

\begin{remark}
    When $R = \mathfrak{k}[X_1,\ldots,X_n]$, the notation $V(I)$ clashes with the previous notation. When several types of  $V(I)$ will be in use, they will be distinguished using indices.
\end{remark}
\begin{remark}
    Let $(I_{\lambda})_{\lambda \in \Lambda}$ and $(l_j)_{j=1}^n$ be ideals in $R$, where $\Lambda$ may be infinite. We have $V(\sum_{\lambda \in \Lambda} I_\lambda ) = \bigcap_{\lambda \in  \Lambda} V(I_\lambda)$ and $V(\bigcap_{j=1}^n I_j) = V(\prod_{j=1}^{n} I_j) = \bigcup_{j = 1}^n V(I_j)$.
    Thus, the Zariski topology on $\Spec R$ is a topology.
\end{remark}
\begin{remark}
    Let $R = \mathfrak{k}[X_1,\ldots,X_n]$. Then there exists a bijection (\ref{antimonbij}, \ref{bijiredprim}) between $\Spec R$ and the set of irreducible closed subsets of $\mathfrak{k}^n$ sending $\fp \in  \Spec R$ to $V_{\mathfrak{k}^n}(\fp)$ and identifying the one-point subsets with  $\mSpec R$.
    This  defines a bijection $\mathfrak{k}^n \cong \mSpec R$ which is a homeomorphism  if $\mSpec R$ is equipped with the induced topology from the Zariski topology on $\Spec R$.
\end{remark}

\subsection{Localization of rings}
\begin{definition}[Multiplicative subset]
    A \vocab{multiplicative subset} of a ring $R$ is a subset $S \subseteq R$ such that $\prod_{i=1}^{n} f_i \in S $ when $n \in \N$ and all $f_i \in S$. 
\end{definition}
\begin{proposition}
    Let $S \subseteq R$  be a multiplicative subset. Then there is a ring homomorphism $R \xrightarrow{i} R_S$ such that $i(S) \subseteq R_S^{\times }$ and $i$ has the \vocab{universal property}  for such ring homomorphisms:
    If $R \xrightarrow{j} T$ is a ring homomorphism with $j(S) \subseteq T^{\times }$, then there is a unique ring homomorphism $R_S \xrightarrow{\iota} T$ with $j = \iota i$.

    \begin{figure}[H]
        \centering
        \begin{tikzcd}
            R \arrow{r}{i}\arrow{d}{j}& R_S \arrow[dotted]{ld}{\existsone \iota}\\
            T 
        \end{tikzcd}
    \end{figure}
    
\end{proposition}
\begin{proof}
    The construction is similar to the construction of the field of quotients:

    Let $R_S \coloneqq (R \times S) / \sim $, where $(r,s) \sim (\rho, \sigma) : \iff \exists t \in  S ~ t \sigma r = ts\rho$.\footnote{$t$ does not appear in the construction of the field of quotients, but is important if $S$ contains zero divisors.}
        $[r,s] + [\rho, \sigma] \coloneqq [r\sigma + \rho s, s \sigma]$, $[r,s] \cdot [\rho, \sigma] \coloneqq [r \cdot \rho, s \cdot  \sigma]$.
        
        In order proof the universal property define $\iota([r,s]) \coloneqq \frac{j(r)}{j(s)}$.
    The universal property characterizes $R_S$ up to unique isomorphism.

\end{proof}
\begin{remark}
    $i$ is often not injective and $\Ker(i) = \{r \in R | \exists s \in S ~ s \cdot r = 0\} $.
    In particular $(r = 1)$, $R_S$ is the null ring iff $0 \in S$.
\end{remark}
\begin{notation}
    Let $S \subseteq R$ be a multiplicative subset of $R$. We write $\frac{r}{s}$ for $[r,s]$.
    The ring homomorphism  $R \xrightarrow{i} R_S$ i given by $i(r) = \frac{r}{1}$.
    For $X \subseteq R_S$ let $X \sqcap R$ denote $i\inv(X)$.
\end{notation}
\begin{definition}[$S$-saturated ideal]
    An ideal $I \subseteq R$ is called \vocab[Ideal!S-saturated]{$S$-saturated} if for all  $s \in S, r \in R$
    $rs \in I \implies r \in I$.
\end{definition}
\begin{fact}\label{primeidealssat}
    A prime ideal $\fp \subseteq \Spec R$ is $S$-saturated iff $\fp \cap S = \emptyset$.
\end{fact}
Because the elements of $S$ become units in $R_S$, $J \sqcap R$ is an $S$-saturated ideal in $R$ when $J$ is an ideal in $R_S$.

\begin{fact}\label{ssatiis}
    Let $I \subseteq R$ be an $S$-saturated ideal and let $I_S$ denote the ideal $\{\frac{r}{s}  | r \in R, s \in S\} \subseteq R_S$.
    Then for all $r \in R, s \in S$
    we have $\frac{r}{s} \in I_S \iff r \in I$.
\end{fact}
\begin{proof}
    Clearly $i \in  I \implies \frac{i}{s} \in I_S$. If $\frac{i}{s} \in J$ there are $\iota \in I$, $\sigma \in S$ such that $\frac{i}{s} = \frac{\iota}{\sigma}$ in $R_S$.
    This equation holds iff there exists $t \in S$ such that $ts\iota = t \sigma i$. But $ts \iota \in I$ hence $i \in I$, as $I$ is $S $-saturated.
\end{proof}
\begin{fact}\label{invimgprimeideal}
    The inverse image of a prime ideal under any ring homomorphism is a prime ideal.
\end{fact}

\begin{proposition}\label{idealslocbij}
    \begin{align}
        f:  \{I \subseteq R | I  \text{ $S$-saturated ideal}\}  &\longrightarrow \left\{J \subseteq R_S | J \text{ ideal}\right\} \\
        I &\longmapsto I_S \coloneqq \left\{\frac{i}{s} | i \in I, s \in S\right\}\\
        J \sqcap R &\longmapsfrom J\\
    \end{align}
    is a bijection. Under this bijection $I$ is a prime ideal iff $f(I)$ is.
\end{proposition}

\begin{proof}
    Applying \ref{ssatiis} to $s = 1$ gives $I_S \sqcap R = I$, when $I$ is $S$-saturated.

    Conversely, if $J$ is given and $I = J \sqcap R, \frac{r}{s} \in R_S$, then by \ref{ssatiis} $\frac{r}{s} \in IR_S \iff r \in I$.
    But as $\frac{r}{1} = s \cdot  \frac{r}{s}$ and $s \in R_S^{\times }$, we have $r \in I \iff \frac{r}{1} \in J \iff \frac{r}{s} \in J$ .
    We have thus shown that the two maps between sets of ideals are well-defined and inverse to each other.

    By \ref{invimgprimeideal},  $J \in \Spec R_S \implies  f\inv(J) = J \cap R \in \Spec R_S$.
    Suppose $I \in \Spec R$, $\frac{a}{s} \cdot \frac{b}{t} \in I_S$ for some $a,b \in R, s,t \in S$.
    By \ref{ssatiis} $ab \in I$. Thus $a \in I \lor b \in I$, hence $\frac{a}{s} \in I_S \lor \frac{b}{t} \in I_S$ and we have $I_S \in \Spec R_S$.



\end{proof}

% Some more remarks on localization

\begin{remark}\label{locandquot}
    Let $R$ be a domain. If $S = R \sm \{0\}$, then $R_S$ is the field of quotients $Q(R)$.
    If $S \subseteq R \sm \{0\} $, then
     \[
    R_S \cong \left\{ \frac{a}{s} \in  K | a \in R, s \in S\right\} 
    \] 
    In particular $Q(R) \cong Q(R_S)$.
\end{remark}

\begin{definition}[$S$-saturation]\label{ssaturation}
    Let $R$ be any ring, $I \subseteq R$ an ideal. Even if $I$ is not $S$-saturated, $J = I_S \coloneqq \{\frac{i}{s} | i \in I, s \in S\}$ is an ideal in $R_S$, and $I_S \sqcap R = \{r \in  R | s\cdot r \in  I, s \in S\}$ is called the  \vocab[Ideal!$S$-saturation]{$S$-saturation of $I$ } which is the smallest $S$-saturated ideal containing $I$.


\end{definition}
\begin{lemma}\label{locandfactor}
    In the situation of \ref{ssaturation}, if $\overline{S}$ denotes the image of $S$ in $R / I$, there is a canonical isomorphism $R_S / I_S \cong (R / I)_{\overline{S}}$.
\end{lemma}
\begin{proof}
    We show that both rings have the universal property for ring homomorphisms $R \xrightarrow{\tau}  T$ with $\tau(I) = \{0\}  $ and $\tau(S) \subseteq T^{\times }$.
    For such $\tau$, by the fundamental theorem on homomorphisms (Homomorphiesatz) there is a unique $R/I \xrightarrow{\tau_1} T$ such that $\tau = \tau_1 \pi_{R,I}$.
    We have $\tau_1(\overline{S}) = \tau(S) \subseteq T^{\times }$, hence there is a unique $(R / I)_{\overline{S}} \xrightarrow{\tau_2} T$ such that the composition $R / I \to  (R / I)_{\overline{S}} \xrightarrow{\tau_2} T $ equals $\tau_1$. It is easy to see that this is the only one for which $R \to  R / I \to  (R / I)_{\overline{S}} \xrightarrow{\tau_2} T$ equals $\tau$.


    Similarly, by the universal property of  $R_S$ there is a unique $R_S \xrightarrow{\tau_3} T$ whose composition with $R \to R_S$ equals $\tau$.
    $\tau_3(I_{S}) = 0$, hence a unique $R_S / I_S \xrightarrow{\tau_4} T$ whose composition with $\pi_{R_S, I_S}$ equals $\tau_3$ exists.
    This is the only one for which the composition $R \to  R_S \to  R_S / I_S \xrightarrow{\tau_4} T$ equals $\tau$. 

\begin{figure}[H]
    \centering
    \begin{tikzcd}
        R \arrow{r}{\tau}\arrow[swap]{d}{\pi_{R,I}}& T &  R\arrow[swap]{l}{\tau}\arrow{d}{}\\
        R / I \arrow[dotted]{ru}{\existsone \tau_1}\arrow{d}{} & & R_S \arrow[dotted, swap]{lu}{\existsone \tau_3}\arrow{d}{\pi_{R_S, I_S}}\\
        (R / I)_{\overline{S}} \arrow[dotted,bend right]{ruu}{\existsone \tau_2} & & R_S / I_S \arrow[dotted, bend left, swap]{luu}{\existsone \tau_4}\\
    \end{tikzcd}
\end{figure}


\end{proof}



\subsection{A first result of dimension theory}

\begin{notation}
    Let $R$ be a ring, $\fp \in \Spec R$. Let $\mathfrak{k}(\fp)$ denote the field of quotients of the domain $R / \fp$. This is called the \vocab{residue field}  of $\fp$.
\end{notation}

% i = ic
\begin{proposition}\label{trdegresfield}
    Let $\mathfrak{l}$ be a %% ??
field, $A$ a $\mathfrak{l}$-algebra of finite type and $\fp, \fq \in \Spec A$ with $\fp \subsetneq \fq$.
Then \[
    \trdeg(\mathfrak{k}(\fp) / \mathfrak{l}) > \trdeg(\mathfrak{k}(\fq) / \mathfrak{l})
\] 
\end{proposition}
\begin{proof}
    Replacing $A$ by $A / \fp$, we may assume $\fp = \{0\} $ and $A$ to be a domain. Then $\mathfrak{k}(\fp) = Q(A / \fp) = Q(A)$.

    If $\fq$ is a maximal ideal, $\mathfrak{k}(\fq) = A / \fq$ is of finite type over $\mathfrak{l}$, hence a finite field extension of $\mathfrak{l}$ by the Nullstellensatz (\ref{hns2}).
    Thus,  $\trdeg(\mathfrak{k}(\fq) / \mathfrak{l}) = 0$.
    If $\trdeg(Q(A) / \mathfrak{l}) = 0$,  $A$ would be integral over $\mathfrak{l}$, hence a field (fact about integrality and fields, \ref{fintaf}). But if $A$ is a field, $\fp = \{0\}$ is a maximal ideal of $A$, hence $\fq = \fp \lightning$.
    This finishes the proof for $\fq \in \mSpec A$.
    We will use the following lemma to reduce the general case to this case:
    \begin{lemma}\label{ltrdegresfieldtrbase}
        There are algebraically independent $a_1,\ldots,a_n \in A$ whose images  in $A / \fq$ form a transcendence base for $\mathfrak{k}(\fq) / \mathfrak{l}$.
    \end{lemma}
    \begin{subproof}
        There exist $a_1,\ldots,a_n \in A$ such that $\mathfrak{k}(\fq)$ is algebraic over the subfield generated by $\mathfrak{l}$ and their images $\overline{a_i}$ (for instance generators of $A$ as a $\mathfrak{l}$-algebra).
        We may assume that $n$ is minimal. If the $a_i$ are $\mathfrak{l}$-algebraically dependent, then w.l.o.g. $\overline{a_n}$ can be assumed to be algebraic over the subfield generated  by $\mathfrak{l}$ and the $\overline{a_i}, 1\le i <n$. Thus, $a_n$ could be removed, contradicting the minimality.
    \end{subproof}

    Let $\fq$ be any prime ideal.
    Take $a_1,\ldots,a_n \in A$ as in the lemma. As the $a_i \mod \fq$ are $\mathfrak{l}$-algebraically independent, the same holds for the $a_i$ themselves.
    Thus $\trdeg(Q(A) / \mathfrak{l}) \ge n$ and the inequality is strict, if it can be shown that the $a_i$ fail to be a transcendence base of $Q(A) / \mathfrak{l}$.
    Let $R \subseteq A$ denote the $\mathfrak{l}$-subalgebra generated by $a_1,\ldots,a_n$ and $S \coloneqq R \sm \{0\} $.
    We must show, that $Q(A)$ fails to be algebraic over $\mathfrak{l}_1 \coloneqq R_S = Q(R)$.
    Let $A_1 \coloneqq A_S$ and $\fq_S$ the prime ideal corresponding to $\fq$ as in \ref{idealslocbij}.
    We have $\fq_S \neq  \{0\} $ as $\{0_{A}\}_S = \{0_{A_S}\}$.
    $A_1$ is a domain with $Q(A_1) \cong Q(A)$ (\ref{locandquot}) and $A_1 / \fq_S$ is isomorphic to the localization of $A / \fq$ with respect to the image of $S$ in $A/\fq$ (\ref{locandfactor}).
    $\mathfrak{k}(\fq_S)$ is algebraic over $\mathfrak{l}_1$ because the image of $\mathfrak{l}_1$ in $\mathfrak{k}(\fq_S)$ contains the images of $\mathfrak{l}$ and the $a_i$, and the images of the $a_i$ form a transcendence base for $\mathfrak{k}(\fq) / \mathfrak{l}$.
    By the fact about integrality and fields (\ref{fintaf}) it follows that $A_1 / \fq_S$ is a field, hence $\fq_S \in  \mSpec(A_1)$ and the special case of $\fq \in \mSpec(A)$
    can be applied to $\fq_S$ and $A_1 / \mathfrak{l}_1$ showing that $Q(A)$ cannot be algebraic over  $\mathfrak{l}_1$.
\end{proof}

\begin{corollary}\label{upperboundcodim}
    Let $X, Y \subseteq \mathfrak{k}^n$ be irreducible and closed. Then $\codim(X,Y) \le \trdeg(\fK(Y) / \mathfrak{k}) - \trdeg(\fK(X) / \mathfrak{k})$.
\end{corollary}
\begin{proof}
    Let $X = X_0 \subsetneq X_1 \subsetneq \ldots \subsetneq X_c = Y$ be a chain of irreducible closed subsets between $X$ and $Y$.
    Then $X_i = V(\fp_i)$ for prime ideals $\fp_0 \supsetneq \fp_1 \supsetneq \ldots \supsetneq \fp_c$ in $R = \mathfrak{k}[X_1,\ldots,X_n]$.
    By \ref{trdegresfield} we have $\trdeg(\mathfrak{k}(\fp_i) / \mathfrak{k}) < \trdeg(\mathfrak{k}(\fp_{i+1}) / \mathfrak{k})$ for all $0 \le i < c$. Thus
    \[
        c + \trdeg(\fK(X) / \mathfrak{k}) = c + \trdeg(\mathfrak{k}(\fp_0) / \mathfrak{k}) \le  \trdeg(\mathfrak{k}(\fp_c) / \mathfrak{k}) = \trdeg(\fK(Y) / \mathfrak{k})
    \]
    As $\codim(X,Y) = \sup \{c \in \N | \exists X = X_0 \subsetneq \ldots \subsetneq X_c = Y \text{ irreducible, closed}\}$ it follows that
    $$\codim(X,Y) \le \trdeg(\fK(Y) / \mathfrak{k}) - \trdeg(\fK(X) / \mathfrak{k})$$
\end{proof}
\begin{corollary}\label{upperbounddim}
    Let $Z \subseteq \mathfrak{k}^n$ be irreducible and closed. 
    Then \[\dim Z \le  \trdeg(\fK(Z) / \mathfrak{k})\] and \[\codim(Z, \mathfrak{k}^n) \le  n - \trdeg(\fK(Z) / \mathfrak{k}\]
\end{corollary}
\begin{proof}
    Take $X = \{z\} $ and $Y = Z$ or $X = Z$ and $Y = \mathfrak{k}^n$ in \ref{upperboundcodim}.
\end{proof}

% Lecture 07
\subsection{Local rings}
\begin{definition}[Local ring]\label{localring}
    Let $R$ be a ring.  $R$ is called a \vocab{local ring}, if the following equivalent conditions hold:
    \begin{itemize}
        \item $\#\mSpec R = 1$
        \item  $R \sm R^{\times }$ is an ideal.
    \end{itemize}
    If this holds, $\mathfrak{m}_R \coloneqq R \sm R^{\times }$ is the unique maximal ideal of $R$.
\end{definition}
\begin{proof}
    Suppose $\mSpec R = \{\mathfrak{m}\}$. If $x \in  \mathfrak{m}$, then $x \not\in R^{\times }$ as otherwise $xR = R \implies \mathfrak{m} = R$.
    If $x \not\in  R^{\times }$ then $xR$ is a proper ideal, hence contained in some maximal ideal. Thus $x \in \mathfrak{m}$.

    Assume that $\mathfrak{m} = R \sm R^{\times }$ is an ideal in $R$. As $1 \in R^{\times }$ this is a proper ideal. If $I$ is any proper ideal and $x \in I$, then $x \in \mathfrak{m}$. Hence $R = xR \subseteq I \subseteq \mathfrak{m}$. It follows that $\mathfrak{m}$ is the only maximal ideal of $R$.
\end{proof}
\begin{remark}
    \begin{itemize}
        \item Any field is a local ring ($\mathfrak{m}_K = \{0\}$).
        \item The null ring is not local as it has no maximal ideals.
    \end{itemize}
\end{remark}
\subsubsection{Localization at a prime ideal}
Many questons of commutative algebra are easier in the case of local rings. Localization at a prime ideal is a technique to reduce a problem to this case.

\begin{proposition}[Localization at a prime ideal]\label{locatprime}
    Let $A$ be a ring and $\fp \in  \Spec A$. Then $S \coloneqq A \sm \fp$ is a multiplicative subset, $A_S$ is a local ring with maximal ideal $\mathfrak{m} = \fp_S =\{\frac{p}{s}| p \in  \fp, s \in S\} $.

    We have a bijection
    \begin{align}
        f: \Spec A_S &\longrightarrow \{\fq \in  \Spec A | \fq \subseteq \fp\}  \\
        \fr &\longmapsto \fr \sqcap A\\
        \fq_S \coloneqq \left\{\frac{q}{s} | q \in  \fq, s \in S\right\} &\longmapsfrom \fq 
    \end{align}
\end{proposition}
\begin{proof}
    It is clear that $S$ is a multiplicative subset and that $\fp_S$ is an ideal. By \ref{ssatiis} $\frac{a}{s} \in \fp_S \iff a \in  \fp \iff a \in A \sm S$ for all $a \in A, s \in S$.
    Thus, if $\frac{a}{s} \not\in  \fp_S$ then it is a unit in $A_S$ with inverse $\frac{s}{a}$. Hence $A_S$ is a local ring with maximal ideal $\fp_S$.

    The claim about $\Spec A_S$ follows from \ref{idealslocbij} using the fact (\ref{primeidealssat}) that a prime ideal $\fr \in \Spec A$ is $S$-saturated iff it is disjoint from $S = A \sm \fp$ iff $\fr \subseteq \fp$.
\end{proof}
\begin{definition}
    The ring $A_S$ as in \ref{locatprime} is called the \vocab[Localization]{localization of $A$ at the prime ideal $\fp$} and denoted $A_\fp$. 
\end{definition}
\begin{remark}
    This introduces no ambiguity because a prime ideal is never a multiplicative subset.
\end{remark}
% More remarks on localization at a prime ideal

\begin{remark}
    Let $B = \mathfrak{k}[X_1,\ldots,X_n]$, $x \in \mathfrak{k}^n$ and $\mathfrak{m}$ the maximal ideal such that $V(\mathfrak{m}) = \{x\}$.
    The elements of $B_\mathfrak{m}$ are the fractions $\frac{b}{s}, b \in B, s \in B \sm \mathfrak{m}$, i.e. $s(x) \neq 0$.
    These are precisely the rational functions which are well-defined in some neighbourhood of $x$.
    This will be rigorously formulated in \ref{proplocalring}.
    %Hence the name localization.
\end{remark}
\begin{remark}
    Let $Y = V(\fp) \subseteq \mathfrak{k}^n$ be an irreducible subset of $\mathfrak{k}^n$. Elements of $B_\fp$ are the fractions $\frac{b}{s}, s \not\in \fp$, i.e. $s$ does not vanish identically on $Y$.
    Thus, $B_\fp$ is the ring of rational functions on $\mathfrak{k}^n$ which are well defined on some open subset $U$ intersecting $Y$. As $Y$ is irreducible, the intersection of two such subsets still intersects $Y$.
\end{remark}
\begin{remark}
    For arbitrary $A$, we have a bijection $\Spec A_\fp \cong N = \{\fq  \in  \Spec A | \fp \subseteq \fp\} $. One can show that $N$ is the intersection of all neighbourhoods of $\fp$ in $\Spec A$, confirming the intuition that ``the localization sees things which go on in arbitrarily small neighbourhoods of $\fp$''.
\end{remark}

\begin{remark}
    If $A$ is a domain and $\fp  =\{0\} $, then $A_\fp = Q(A)$.
\end{remark}


\subsection{Going-up and going-down}
\begin{definition}[Going-up and going-down]\label{goupgodown}
    Let $R$ be a ring and $A$ an $R$-algebra.

    \vocab{Going-up}  holds for $A / R$ if for arbitrary $\fq \in \Spec A$ and arbitrary $\tilde \fp \in\Spec R$ with $\tilde \fp \supseteq \fq \sqcap R$ there exists $\tilde \fq \in \Spec A$ with $\fq \subseteq \tilde \fq$ and $\tilde \fp = \tilde \fq \sqcap R$.

    (We are given $\fp \subseteq \tilde \fp$ and  $\fq$ such that  $\fp = \fq \sqcap R$ and must make $\fq$ larger).

    \begin{figure}[H]
        \centering
        \begin{tikzcd}
            \fq \arrow[mapsto]{d}{\cdot \sqcap R}& \subseteq &{\color{blue}\tilde\fq}\arrow[mapsto]{d}{\cdot \sqcap R}  & \in \Spec A\\
            \fq \sqcap R = \fp & \subseteq & \tilde \fp & \in \Spec R
        \end{tikzcd}
    \end{figure}


\vocab{Going-down} holds for $A / R$ if for arbitrary $\tilde \fq \in  \Spec A$ and arbitrary $\fp \in \Spec R$ with $\fp \subseteq \tilde \fq \sqcap R$, there exists $\fq \in \Spec A$ with $\fq \subseteq \tilde \fq$ and $\fp = \fq \sqcap R$.

(We are given $\fp \subseteq \tilde \fp$ and  $\tilde \fq$ such that $\tilde \fp = \tilde \fq \sqcap R$ and must make $\tilde \fq$ smaller).
    \begin{figure}[H]
        \centering
        \begin{tikzcd}
            {\color{blue}\fq} \arrow[mapsto]{d}{\cdot \sqcap R}& \subseteq &\tilde\fq\arrow[mapsto]{d}{\cdot \sqcap R}  & \in \Spec A\\
            \fp & \subseteq & \tilde \fp = \tilde \fq \sqcap R & \in \Spec R
        \end{tikzcd}
    \end{figure}
\end{definition}
\begin{remark}
    In the situation of \ref{goupgodown}, we say $\fq \in \Spec A$ \vocab[Primeideal!lies above]{lies above} $\fp \in \Spec R$ if $\fq \sqcap R = \fp$.
\end{remark}

\subsubsection{Going-up for integral ring extensions}
\begin{theorem}[Krull, Cohen-Seidenberg]
    \label{cohenseidenberg}
    Let $A$ be a ring and $R \subseteq A$ a subring such that  $A$ is integral over $R$.
    \begin{enumerate}[A]
        \item The map $\Spec A \xrightarrow{\fq \mapsto \fq \cap R}  \Spec R$ is surjective.
        \item For $\fp \in \Spec R$, there are no inclusions between the prime ideals $\fp \in \Spec A$ lying over $\fp$.
        \item Going-up holds for $A / R$.
        \item $\fq \in \Spec A$ is maximal iff $\fp \coloneqq \fq \cap R$ is a maximal ideal of $R$.
    \end{enumerate}
\end{theorem}
\begin{proof}
    % uses localization at prime ideals
    \begin{enumerate}
         \item[D] Consider the ring extension $A / \fq$ of $R / \fp$. Both rings are domains and the extension is integral.
            By the fact about integrality and fields (\ref{fintaf}) $A / \fq$ is a field iff $R / \fp$ is a field. Thus $\fq \in \mSpec A \iff \fp \in \mSpec R$.
        \item[A] Suppose $\fp \in \Spec R$ and let $S \coloneqq R \sm \fp$. Then $S$ is a multiplicative subset of both $R$ and $A$, and we may consider the localizations $R \xrightarrow{\rho} R_\fp, A \xrightarrow{\alpha} A_\fp$ with respect to $S$. By the universal property of $\rho$, there exists a unique homomorphism $R_\fp \xrightarrow{i} A_\fp$ such that $i\rho = \alpha \defon{R}$.
            We have $j(\frac{r}{s}) = \frac{r}{s}$ and $j$ is easily seen to be injective.

            \begin{figure}[H]
                \centering
                \begin{tikzcd}
            R \arrow{r}{\rho}\arrow[hookrightarrow]{d}{\subseteq}&  R_\fp \arrow[hookrightarrow, dotted]{d}{\existsone i}\\
                    A \arrow{r}{\alpha} & A_\fp
                \end{tikzcd}
            \end{figure}
           \begin{claim}
               $A_\fp$ is integral over $R_\fp$.
           \end{claim} 
           \begin{subproof}
               An element $x \in  A_\fp$ has the form $x = \frac{a}{s}$ for some $s \in  R \sm \fp$ and where $a \in  A$ is integral over $R$.
               Hence $a^n = \sum_{i=0}^{n-1} r_ia^i$ for some $r_i \in R$. Thus $x^n = \sum_{i=0}^{n-1} \rho_i x^i$ with $\rho_i \coloneqq s^{i-n} r_i \in R_\fp$.
           \end{subproof}
           As $i$ is injective and $R_\fp \neq  \{0\} $ ($R_\fp$ is local!) $A_\fp \neq  \{0\}$, there is $\mathfrak{m} \in \mSpec A_\fp$.
           D has already been shown and applies to $A_\fp / R_\fp$, hence $i\inv(\mathfrak{m}) = \fp_\fp$ is the only maximal ideal of the local ring $R_\fp$. Hence $\fq = \alpha\inv(\mathfrak{m})$ satisfies
           \[
               \fq \cap R = \alpha\inv(\mathfrak{m}) \cap R = \rho\inv(i\inv (\mathfrak{m})) = \rho\inv(\fp_\fp) = \fp
           \] 
       \item[B] The map $\Spec A_\fp \xrightarrow{\alpha\inv}  \Spec A$ is injective with image equal to $\{\fq \in  \Spec A | \fq \cap R \subseteq \fp\}$. In particular, it contains the set of all $\fq$ lying over $\fp$.
           If $\fq = \alpha\inv(\fr)$ lies over $\fp$, then \[\rho\inv(i\inv(\fr)) = (\alpha\inv(\fr)) \cap R = \fq \cap R = \fp = \rho\inv(\fp_\fp)\]
           hence $i\inv(\fr) = \fp_\fp$ by the injectivity of $\Spec R_\fp \xrightarrow{\rho\inv} \Spec R$.

           Because D applies to the integral ring extension  $A_\fp / R_\fp$ and $\fp_\fp \in \mSpec R_\fp$, $\fr$ is a maximal ideal.
           There are thus no inclusions between different such $\fr$. Because $\Spec A_\fp \xrightarrow{\alpha\inv} \Spec A$ is $\subseteq$-monotonic and injective, there are no inclusions between different $\fp \in  \Spec A$ lying over $\fp$.

       \item[C] Let $\fp \subseteq \tilde \fp$ be prime ideals of  $R$ and $\fq \in \Spec A$ such that $\fq \cap R = \fp$.
            By applying A to the ring extension  $A / \fq$ of $R / \fp$, there is $\fr \in \Spec A /\fq$ such that $\fr \sqcap R / \fp = \tilde \fp / \fp$.
            The preimage $\tilde \fq$ of $\fr$ under $A \to  A / \fq$ satisfies $\fq \subseteq \tilde \fq$ and $\tilde \fq \cap R = \tilde \fp$.
   \end{enumerate}
\end{proof}
\begin{remark}
    The proof of \ref{cohenseidenberg} does not use Noetherianness, as this is not an assumption.
\end{remark}
\subsubsection{Application to dimension theory: Proof of \texorpdfstring{$\dim Y = \trdeg(\fK(Y) / \mathfrak{k})$}{dim Y = trdeg(K(Y) / k)}}
\label{lowerbounddimy}
This is part of the proof of \ref{trdegandkdim}. 
%It uses going-up.
%TODO: relate to  \ref{htandcodim}
\begin{proof}
    Let $B = \mathfrak{k}[X_1,\ldots,X_n]$ and let $X \subseteq Y \subseteq \mathfrak{k}^n$ be irreducible closed subsets of $\mathfrak{k}^n$.
    We have to show $\codim(X,Y) = \trdeg(\fK(Y) / \mathfrak{k}) - \trdeg(\fK(X) \sm \mathfrak{k})$.
    The inequality
     \[
         \codim(X,Y) \le  \trdeg(\fK(Y) \sm \mathfrak{k}) - \trdeg(\fK(X) \sm \mathfrak{k})
    \] 
    has been shown in \ref{upperboundcodim}.
    In the case of $X = \{0\} , Y = \mathfrak{k}^n$, equality holds because the chain of irreducible subsets $\{0\}  \subsetneq \{0\}  \times \mathfrak{k} \subsetneq \ldots \subsetneq \{0\} \times \mathfrak{k}^n\subsetneq \mathfrak{k}^n$
    can be written down explicitely.

    We have $Y = V(\fp)$ for a unique $\fp \in \Spec B$. Let $A = B / \fp$ be the ring of polynomials on $Y$. 
    Apply the Noether normaization theorem to $A$. This yields $(f_i)_{i=1}^d \in A^d$ which are algebraically independent over $\mathfrak{k}$ and such that $A$ is finite over the subalgebra generated by the $f_i$.
    Let $L$ be the algebraic closure in $\fK(Y)$ of the subfield of $\fK(Y)$ generated by $\mathfrak{k}$ and the $f_i$. We have  $A \subseteq L$ and since $\fK(Y) = Q(B / \fp) = Q(A)$\footnote{by definition} it follows that $\fK(Y) = L$. Hence $(f_i)_{i=1}^d$ is a transcendence base for $\fK(y) / \mathfrak{k}$ and $d = \trdeg \fK(Y) / \mathfrak{k}$. 

    
    \begin{align}
        \mathfrak{k}[X_1,\ldots,X_d]  &\longrightarrow R \\
        P &\longmapsto P(f_1,\ldots,f_d)
    \end{align}
    is an isomorphism and in $\mathfrak{k}[X_1,\ldots,X_d]$ there is a strictly ascending chain of prime ideals corresponding to $\mathfrak{k}^d \supsetneq \{0\} \times  \mathfrak{k}^{d-1} \supsetneq \ldots \supsetneq \{0\}$. Thus there is a strictly ascending chain $\{0\}  = \fp_0 \subsetneq \fp_1 \subsetneq \ldots \subsetneq \fp_d$ of elements of $\Spec R$.
    Let $\fq_0 = \{0\} \in \Spec A$. If $0 < i \le d$ and a chain  $\fq_0 \subsetneq \ldots \subsetneq \fq_{i-1}$ in $\Spec A$ with $\fq_j \cap R = \fp_j$ for $0 \le j <  i$ has been selected, we may apply going-up (\ref{cohenseidenberg}) to $A / R$ to extend this chain by a $\fq_i \in  \Spec A$ with $\fq_{i-1} \subseteq \fq_i$ and $\fq_i \cap R = \fp_i$ (thus $\fq_{i-1} \subsetneq \fq_i$ as $\fp-i \neq  \fp_{i-1})$.
    Thus, we have a chain $\fq_0 = \{0\} \subsetneq \ldots \subsetneq \fq_d$ in $\Spec A$.
    Let $\tilde \fq_i \coloneqq \pi_{B,\fp}\inv(\fq_i), Y_i \coloneqq V(\tilde \fq_i)$.
    This is a chain $Y = Y_0 \supsetneq Y_1 \supsetneq \ldots \supsetneq Y_d$ of irreducible subsets of $\mathfrak{k}^n$.

    Hence $\dim(Y) \ge \trdeg(\fK(Y) / \mathfrak{k})$.

    The general case of $\codim(X,Y)  \ge \trdeg(\fK(Y) / \mathfrak{k}) - \trdeg(\fK(X) \sm \mathfrak{k})$ is shown in \ref{proofcodimletrdeg}.
    % TODO: reorder
    % TODO: Motivation: "Morphism" (AlGeo) and Lift of {0} x k \subseteq \ldots



\end{proof}


% Lecture 08


\subsubsection{Prime avoidance}

\begin{proposition}[Prime avoidance]\label{primeavoidance}
    Let $A$ be a ring and $I \subseteq A$ a subset which is closed under arbitrary finite sums and non-empty products, for instance, an ideal in $A$. Let $(\fp_i)_{i=1}^n$ be a finite list of ideals in $A$ of which at most two fail to be prime ideals and such that there is no $i$ with $I \subseteq \fp_i$. Then $I \not\subseteq \bigcup_{i=1}^n \fp_i$.
\end{proposition}
\begin{proof}
    Induction on $n$. The case of $n < 2$ is trivial.
    Let $n \ge 2$ and the assertion be shown for a list of $n-1$ ideals one wants to avoid.
    If $n \ge 3$ we may, by reordering the $\fp_i$ assume that $\fp_1$ is a prime ideal.
    By the induction assumption, there is $f_k \in I \sm \bigcup_{j \neq k} \fp_j$. If there is $k$ with $1 \le k\le n$ and $f_k \not\in \fp_k$, then the proof is finished.
    Otherwise 
    \[
    f_1 + \prod_{j=2}^{n} f_j \in  I \sm \bigcup_{j=1}^n \fp_j 
    \] 
\end{proof}


\subsubsection{The fixed field of the automorphism group of a normal field extension}

Recall the definition of a normal field extension in the case of finite field extensions:
\begin{definition}
    A finite field extension $L / K$ is called \vocab{normal}, if the following equivalent conditions hold:
    \begin{enumerate}
        \item[A] Let  $\overline{K} / K$ be an algebraic closure of $K$. Then any two expansions of $\Id_K$ to a ring homomorphism $L \to  \overline{K}$ have the same image.
        \item[B] If $P \in K[T]$ is an irreducible polynomial and $P$ has a zero in $L$, then $P$ splits into linear factors.
        \item[C] $L$ is the splitting field of a $P \in K[T]$.
    \end{enumerate}
\end{definition}


\begin{fact}\label{fnormalfe}
    For an arbitrary algebraic field extension $L / K$, the following conditions are equivalent:
    \begin{itemize}
        \item $L$ is the union of its subfields which contain $K$ and are finite and normal over $K$.
        \item If  $P \in K[T]$ is normed, irreducible over $K$ and has a zero in $L$, then it splits into linear factors in $L$.
        \item If $\overline{L}$ is an algebraic closure of $L$, then all extensions of $\Id_K$ to a ring homomorphism $L \to  \overline{L}$ have the same image.
    \end{itemize}
\end{fact}

\begin{definition}[Normal field extension]
    An algebraic field extension\footnote{not necessarily finite} $L / K$ is called \vocab{normal} if 
    the equivalent conditions from \ref{fnormalfe} hold. 
\end{definition}

\begin{definition}
    Suppose $L / K$ is an arbitrary field extension. Let $\Aut( L / K)$ be the set of automorphisms of $L$ leaving all elements of (the image in $L$ of) $K$ fixed.
    Let $G \subseteq \Aut(L / K)$ be a subgroup. Then the \vocab{fixed field } is definied as
    \[
        L^G \coloneqq \{l \in L | \A g \in G : g(l) = l\} 
    \] 
\end{definition}

\begin{proposition}\label{characfixnormalfe}
    Let $L / K$ be a normal field extension. If the characteristic of the fields is $O$, then $L^{\Aut( L / K)} = K$.
    If the characteristic is $p > 0$, then $L^{\Aut(L / K)} = \{l \in L | \exists n \in \N ~ l^{p^n} \in K\}$. 
\end{proposition}
\begin{proof}
    In both cases $L^G \supseteq$ is easy to see.

    If $K \subseteq M \subseteq L$ is an intermediate field, then $L$ is normal over $M$. If $\sigma \in  \Aut(M /K)$, an application of Zorn's lemma to the set of all $(N, \vartheta)$ where $N$ is an intermediate field $M \subseteq N \subseteq L$ and $N \xrightarrow{\vartheta} L$ a ring homomorphism such that $\vartheta\defon{M} = \sigma$ shows that $\sigma$ has an extension to an element of $\Aut(L / K)$. % TODO make this rigorous
    If $M$ is normal over $K$, it is easily seen to be $\Aut(L / K)$ invariant. 
    Thus $L^G$ is the union of $M^{\Aut(M / K)}$ over all intermediate fields which are finite and normal over $K$, and it is sufficient to show the proposition for finite normal extensions $L / K$.

    \begin{itemize}
        \item Characteristic $0$: The extension is normal, hence Galois, and the assertion follows from Galois theory.
        \item  Characteristic $p > 0$: Let  $l \in L^G$ and $P \in K[T]$ be the minimal polynomial of $l$ over $K$.
            We show that $l^{p^n} \in K$ for some $n \in \N$ by induction on $\deg(l / K) \coloneqq \deg(P)$.

            If $\deg(l / K) = 1$, we have $l \in K$.
            Otherwise, assume that the assertion has been shown for elements of $L^G$ whose degree over $K$ is smaller than $\deg( l / K)$.
            Let $\overline{L}$ be an algebraic closure of $L$ and $\lambda$ a zero of $P$ in $\overline{L}$.
            If $M = K(l) \subseteq L$, then there is a ring homomorphism $M - \overline{L}$ sending $l$ to $\lambda$. This can be extended to a ring homomorphism $L \xrightarrow{\sigma} \overline{L}$. We have $\sigma \in G$ because $L / K$ is normal. Hence $\lambda = \sigma(l) = l$, as $l \in L^G$. Thus $l$ is the only zero of $P$ in $\overline{L}$ and because $\deg P >1$ it is a multiple zero.
            It is shown in the Galois theory lecture % TODO: link to EinfAlg
            that this is possible only when $P(T) = Q(T^p)$ for some $Q \in K[T]$. Then $Q(l^p) = 0$ and the induction assumption can be applied to $x = l^p$ showing $x^{p^m} \in K$ hence $l^{p^{m+1}} \in  K$ for some $m \in \N$.
    \end{itemize} 
\end{proof}
\subsubsection{Integral closure and normal domains}

\begin{definition}[Integral closure, normal domains]
    Let $A$ be a domain with field of quotients $Q(A)$ and let $L$ be a field extension of $Q(A)$.
    By \ref{intclosure} the set of elements of $L$ integral over $A$ is a subring of $L$, the \vocab{integral closure}  of $A$ in $L$.
    $A$ is \vocab{Domain!integrally closed} in $L$ if the integral closure of $A$ in $L$ equals $A$.
    $A$ is \vocab{Domain!normal} if it is integrally closed in $Q(A)$.
\end{definition}

\begin{proposition}\label{ufdnormal}
    Any factorial domain (UFD) is normal.
\end{proposition}
\begin{proof}
    Let $x \in Q(A)$ be integral over $A$. Then there is a normed polynomial $P \in A[T]$ with $P(x) = 0$.
    In EInführung in die Algebra it was shown that $A[T]$ is a UFD and that the prime elements of $A[T]$ are the elements which are irreducible in $Q(A)[T]$ and for which the $\gcd$ of the coefficients is $\sim 1$. % TODO reference
    The prime factors of a normed polynomial are all normed up to multiplicative equivalence. We may thus assume $P$ to be irreducible in $Q(A)[T]$.
    But then $\deg P = 1$ as $x$ is a zero of $P$ in $Q(A)$, hence $P(T) = T - x$ and $x \in A$ as $P \in A[T]$.
    

    Alternative proof\footnote{\url{http://www.math.lsa.umich.edu/~tfylam/Math221/2.pdf}}:
    Let $x = \frac{a}{b} \in Q(A)$ be integral over $A$. \Wlog $\gcd(a,b) = 1$.  Then $x^n + c_{n-1} x^{n-1} + \ldots + c_0 = 0$ for some $c_i \in A$.
    Multiplication with $b^n$ yields $a^n + c_{n-1} b a^{n-1} + \ldots +c_0 b^n = 0$. Thus $b | a^n$. Since $\gcd(a,b) = 1$ it follows that $b$ is a unit, hence $x \in  A$.
\end{proof}

\begin{remark}
    It follows from \ref{cintclosure} and \ref{locandquot}  that the integral closure of $A$ in some field extension $L$ of $Q(A)$ is always normal.
\end{remark}
\begin{remark}
    A finite field extension of $\Q$ is called an \vocab{algebraic number field} (ANF). If $K$ is an ANF, let  $\cO_K$ (the \vocab[Ring of integers in an ANF]{ring of integers in $K$}) be the integral closure of $\Z$ in $K$.
    One can show that this is a finitely generated (hence free, by results of EInführung in die Algebra % EINFALG
    ) abelian group.
    We have $\cO_{\Q} = \Z$ by the proposiiton.
\end{remark}

\subsubsection{Action of \texorpdfstring{$\Aut(L / K)$}{Aut(L / K)} on prime ideals of a normal ring extension}

\begin{theorem}\label{autonprime}
    Let $A$ be a normal domain, $L$ a normal field extension of $K \coloneqq Q(A)$, $B$ the integral closure of $A$ in $L$ and $\fp \in \Spec A$.
    Then $G \coloneqq \Aut(L / K)$ transitively acts on $\{\fq \in \Spec B | \fq \cap A  = \fp\}$.
\end{theorem}


\begin{proof}
    Let $\fq, \fr$ be prime ideals of $B$ above the given $\fp \in \Spec A$.
    We must show that there exists $\sigma \in G$ such that $\fq = \sigma(\fr)$.
    This is equivalent to $\fq \subseteq \sigma(\fr)$, since the Krull going-up theorem (\ref{cohenseidenberg}) applies to the integral ring extension $B / A$, showing that there are no inclusions between different elements of $\Spec B$ lying above $\fp \in \Spec A$.

    If $L / K$ is finite and there is no such $\sigma$, then by prime avoidance (\ref{primeavoidance}) there is $ x \in \fq \sm \bigcup_{\sigma \in G}  \sigma(\fr)$.
    As $\fr$ is a prime ideal, $y = \prod_{\sigma \in  G} \sigma(x) \in  \fq \sm \fr$.\footnote{$\prod_{\sigma \in G} \sigma(x) = \prod_{\sigma \in G} \sigma\inv(x)$}
    By the characterization of $L^G$ for normal field extensions (\ref{characfixnormalfe}), there is a positive integer $k$ with $y^k \in K$. 
    As $A$ is normal, we have $y^k \in  K \cap B = A$.
    Thus $y^k \in (A \cap \fq) \sm (A \cap \fr) = \fp \sm \fp = \emptyset \lightning$.

    If $L / K$ is not finite, one applies Zorn's lemma to the poset of pairs $(M, \sigma)$ where $M$ is an intermediate field and $\sigma \in \Aut(M / K)$ such that $\sigma(\fr \cap M) = \fq \cap M$.

\end{proof}
\begin{remark}
    The theorem is very important for its own sake. For instance, if $K$ is an ANF which is a Galois extension of $\Q$ it shows that $\Gal(K / \Q)$ transitively acts on the set of prime ideals of $\cO_K$ over a given prime number $p$. More generally, if $L / K$ is a Galois extension of ANF then $\Gal(L / K)$ transitively acts on the set of $\fq \in \Spec \cO_L$ for which $\fq \cap K$ is a given $\fp \in \Spec \cO_K$.
\end{remark}

\subsubsection{A going-down theorem}
\begin{theorem}[Going-down for integral extensions of normal domains (Krull)]\label{gdkrull}
    Let $B$ be a domain which is integral over its subring $A$. If $A$ is a normal domain, then going-down holds for $B  / A$.
\end{theorem}

\begin{proof}
    It follows from the assumptions that the field of quotients $Q(B)$ is an algebraic field extension of $Q(A)$.
    There is an algebraic extension $L$ of $Q(B)$ such that $L / Q(A)$ is normal (for instance an algebraic closure of $Q(B)$).
    Let  $C$ be the integral closure of $A$ in $L$. Then $B \subseteq C$ and $C / B$ is integral.
\begin{figure}[H]
    \centering
    \begin{tikzcd}
        Q(A) \arrow[hookrightarrow]{r}{} &    Q(B) \arrow[hookrightarrow]{r}{} & L \coloneqq \overline{Q(B)} \\
        A \arrow[hookrightarrow]{u}{}\arrow[hookrightarrow]{r}{} & B \arrow[hookrightarrow]{r}{}\arrow[hookrightarrow]{u}{}& C \arrow[hookrightarrow]{u}{}\\	
    \end{tikzcd}
\end{figure}

    \begin{claim}
        Going-down holds for $C / A$.
    \end{claim}
    \begin{subproof}
        Let $\fp \subseteq \tilde \fp$ be an inclusion of prime ideals of $A$ and $\tilde \fr \in \Spec C$ with  $\tilde \fr \cap A = \tilde \fp$.
        By going-up for integral ring extensions (\ref{cohenseidenberg}), $\Spec C \xrightarrow{\cdot  \cap A}  \Spec A$ is surjectiv. Thus there is $\fr' \in \Spec C$ such that $\fr' \cap A = \fp$. By going up for $C / A$ there is $\tilde \fr' \in \Spec C$ with $\tilde \fr' \cap A = \tilde \fp, \fr' \subseteq \tilde \fr'$.
        By the theorem about the action of the automorphism group on prime ideals of a normal ring extension (\ref{autonprime}) there exists a $\sigma \in \Aut(L / Q(A))$ with $\sigma(\tilde \fr') = \tilde \fr$. Then $\fr \coloneqq \sigma(\fr')$ satisfies $\fr \subseteq \tilde \fr$ and $\fr \cap A = \fp$.
    \end{subproof}
    If $\fp \subseteq \tilde \fp$ is an inclusion of elements of $\Spec A$ and $\tilde \fq \in \Spec B$ with $\tilde \fp \cap A = \tilde \fp$, by the surjectivity of $\Spec C \xrightarrow{\cdot  \cap B}   \Spec B$ (\ref{cohenseidenberg}) there is $\tilde \fr \in \Spec C$ with $\tilde \fr \cap B = \fq$.
    By going-down for $C / A$, there is $\fr \in \Spec C$ with $\fr \subseteq \tilde \fr$ and $\fr \cap A = \fp$.
    Then $\fq \coloneqq \fr \cap B \in \Spec B, \fq \subseteq \tilde \fq$ and  $\fq \cap A = \fp$. Thus going-down holds for $B / A$.
\end{proof}

\begin{remark}[Universally Japanese rings]
    A Noetherian ring $A$ is called universally Japanese if for every $\fp \in \Spec A$ and every finite field extension $L$ of $\mathfrak{k}(\fp)$, the integral closure of  $A / \fp$ in $L$ is a finitely generated $A$-module. This notion was coined by Grothendieck because the condition was extensively studied by the Japanese mathematician Nataga Masayoshji.
    By a hard result of Nagata, algebras of finite type over a universally Japanese ring are universally Japanese.
    Every field is universally Japanese, as is every PID of characteristic $0$.
    There are, however, examples of Noetherian rings which fail to be universally Japanese.
\end{remark}

\begin{dexample}[Counterexample to going down]
    Let $R = \mathfrak{k}[X,Y]$ and $A = \mathfrak{k}[X,Y, \frac{X}{Y}]$. Then going down does not hold for $A / R$:

    For any ideal $Y \in \fq \subseteq A$ we have $X = \frac{X}{Y} \cdot Y \in \fq$.
    Consider $(Y)_R \subsetneq (X,Y)_R \subseteq \fq \cap R$. As $(X,Y)_R$ is maximal and the preimage of a prime ideal is prime and thus proper, we have $(X,Y)_R = \fq \cap R$.
    The prime ideal  $(\frac{X}{Y},Y)_A = (\frac{X}{Y}, X,Y)_A$ is lying over $(X,Y)_R$, so going down is violated.
\end{dexample}


\subsubsection{Proof of \texorpdfstring{$\codim(\{y\},Y) = \trdeg(\fK(Y) / \mathfrak{k})$}{codim(\{y\},Y) = trdeg(K(Y) /k)}}
\label{proofcodimletrdeg}
This is part of the proof of \ref{trdegandkdim}. %TODO: reorder

\begin{proof}
    % DIMT
    Let $B = \mathfrak{k}[X_1,\ldots,X_n]$ and $X \subseteq Y = V(\fp) \subseteq \mathfrak{k}^n$ irreducible closed subsets of  $\mathfrak{k}^n$.
    We want to show that $\codim(X,Y) = \trdeg(\fK(Y) / \mathfrak{k}) - \trdeg(\fK(X) / \mathfrak{k})$.
    $\le $ was shown in \ref{upperboundcodim}.
    $\dim Y \ge  \trdeg(\fK(Y) / \mathfrak{k})$ was shown in \ref{lowerbounddimy} by 

    Applying Noether normalization to $A \coloneqq B / \fp$, giving us $(f_i)_{i=1}^d \in A^d$ such that the $f_i$ are algebraically independent and $A$ finite over the subalgebra generated by them.
    We then used going-up to lift  a chain of prime ideals corresponding to $\mathfrak{k}^d \supsetneq \{0\}  \times \mathfrak{k}^{n-1} \supsetneq \ldots \supsetneq \{0\}$ under $Y \xrightarrow{F = (f_1,\ldots,f_d)} \mathfrak{k}^d$ to a chain of prime ideals in $A$.
    This was done left-to-right as going-up was used to make prime ideals larger. In particular, when $\{0\} \in \mathfrak{k}^d$ has several preimages under $F$ we cannot control to which of them the maximal ideal terminating the lifted chain belongs. Thus, we can show that in the inequality
    \[
        \codim(\{y\}, Y) \le  d = \trdeg(\fK(Y) \sm \mathfrak{k})
    \] 
    (see \ref{upperboundcodim})
    equality holds for at least one pint $y \in F\inv(\{0\})$ but cannot rule out that there are other $y \in F\inv(\{0\})$ for which the inequality becomes strict.
    However using going-down (\ref{gdkrull}) for $F$, we can use a similar argument, but start lifting of the chain at the right end for the point $y \in Y$ for which we would like to show equality.
    From this $\codim(X,Y) \ge  \trdeg(\fK(Y) / \mathfrak{k}) - \trdeg(\fK(X) / \mathfrak{k})$ can be derived similarly to \ref{upperboundcodim}.
    Thus 
     \[
         \codim(X,Y) = \trdeg(\fK(Y) / \mathfrak{k}) -  \trdeg(\fK(X) / \mathfrak{k})
    \] 
    follows (see \ref{htandcodim} and \ref{htandtrdeg}).
\end{proof}
\begin{remark}
    The going-down theorem used to prove this is somewhat more general, as it does not depend on $\mathfrak{k}$ being algebraically closed.
\end{remark}




% Lecture 09
% i = ic

\subsection{The height of a prime ideal}
In order to complete the proof of \ref{proofcodimletrdeg} and show $\codim(X,Y) = \trdeg(\fK(Y) / \mathfrak{k}) -  \trdeg(\fK(X) / \mathfrak{k})$,
we need to localize the $\mathfrak{k}$-algebra with respect to a multiplicative subset and replace the ground field by a larger subfield of that localization which is no longer algebraically closed.
To formulate a result which still applies in this context, we need the following:
\begin{definition}[Height of a prime ideal]
    Let $A$ be a ring, $\fp \in \Spec A$. We define the \vocab[Height of a prime ideal]{height of the prime ideal $\fp$}, $\hght(\fp)$, to be the largest  $k \in \N$ such that there is a strictly decreasing sequence $\fp = \fp_0 \supsetneq \fp_1 \supsetneq \ldots \supsetneq \fp_k$ of prime ideals of $A$, or $\infty$ if there is no finite upper bound on the length of such sequences. 
\end{definition}
\begin{example}
    Let $A = \mathfrak{k}[X_1,\ldots,X_n]$, $X = V(\fp)$ for a prime ideal $\fp$.
    By the correspondence between irreducible subsets of $\mathfrak{k}^n$ and prime ideals in $A$ (\ref{bijiredprim}),
    the $\fp_i$ correspond to irreducible subsets $X_i \subseteq \mathfrak{k}^n$ containing $X$. Thus $\hght(\fp) = \codim(X, \mathfrak{k}^n)$.
\end{example}

\begin{example}\label{htandcodim}
    Let $B = \mathfrak{k}[X_1,\ldots,X_n], \fq \in \Spec B$ and let $A \coloneqq B / \fp$.
    Let $Y \coloneqq V(\fq) \subseteq \mathfrak{k}^n$, $\tilde \fp \coloneqq \pi_{B, \fq}\inv(\fp)$, where $B \xrightarrow{\pi_{B, \fp}} A $ is the projection to the ring of residue classes, and let $X = V(\tilde \fp)$.
    By \ref{idealslocbij} we have a bijection between the prime ideals $\fr \subseteq \fp$ of $A$ contained in $\fp$ and the prime ideals and the prime ideals $\tilde \fr \in \Spec B$ with $\fq \subseteq \tilde \fr \subseteq \tilde \fp$:
    \begin{align}
        f: \{\fr \in \Spec A | \fr \subseteq \fp \}  &\longrightarrow  \{\tilde \fr \in \Spec B | \fq \subseteq \tilde \fr \subseteq \tilde \fp\} \\
        \fr &\longmapsto \pi_{B, \fq}\inv(\fr)\\
        \tilde \fr / \fq &\longmapsfrom \tilde \fr
    \end{align}
    By \ref{bijiredprim}, the $\tilde \fr$ are in canonical bijection with the irreducible subsets $Z$ of $Y$ containing $X$.
    Thus, the chains $\fp = \fp_0 \supsetneq \ldots \supsetneq \fp_k$ are in canonical bijection with the chains $X = X_0 \subsetneq X_1 \subsetneq \ldots \subsetneq X_k \subseteq Y$  of irreducible subsets and 
    $\hght(\fp) = \codim(X,Y)$.
\end{example}


\begin{remark}
    Let $A$ be an arbitrary ring. One can show that there is a bijection between $\Spec A$ and the set of irreducible subsets $Y \subseteq \Spec A$:
     \begin{align}
        f: \Spec A  &\longrightarrow \{Y \subseteq \Spec A | Y\text{irreducible}\}  \\
        \fp &\longmapsto \Vs(\fp)\\
        \bigcup_{\fp \in Y} \fp &\longmapsfrom Y 
    \end{align}
    Thus, the chains $\fp = \fp_0 \supsetneq \ldots \supsetneq \fp_k$ are in canonical bijection with the chains $V(\fp) = X_0 \subsetneq X_1 \subsetneq \ldots \subsetneq X_k \subseteq \Spec A$ of irreducible subsets, and $\hght(\fp) = \codim(V(\fp), \Spec A)$.
\end{remark}


\subsubsection{The relation between \texorpdfstring{$\hght(\fp)$}{ht(p)} and \texorpdfstring{$\trdeg$}{trdeg}}
We will use the following
\begin{lemma}\label{extendtotrbase}
    Let $\mathfrak{l}$ be an arbitrary field, $A$ a $\mathfrak{l}$-algebra of finite type which is a domain, $K \coloneqq Q(A)$ the field of quotients and let $(a_i)_{i=1}^n$ be $\mathfrak{l}$-algebraically independent elements of $A$. Then there exist a natural number $m \ge n$ and a transcendence base $(a_i)_{i = 1}^m$ for $K / \mathfrak{l}$ with $a_i \in A$ for $1 \le i \le m$.
\end{lemma}
\begin{proof}
    The proof is similar to the proof of \ref{ltrdegresfieldtrbase}.
    There are a natural number $m \ge n$ and elements $(a_i)_{i = n+1}^m \in A^{m-n}$ which generate $K$ in the sense of a matroid used in the definition of $\trdeg$.
    For instance, one can use generators of the $\mathfrak{l}$-algebra $A$. We assume $m$ to be minimal and claim that $(a_i)_{i=1}^m$ are $\mathfrak{l}$-algebraically independent.
    Otherwise there is $j \in \N$, $1 \le j \le m$ such that $a_j$ is algebraic over the subfield of $K$ generated by $\mathfrak{l}$ and the $(a_i)_{i=1}^{j-1}$. We have $j > n$ by the algebraic independence of $(a_i)_{i=1}^n$.
    Exchanging $x_j$ and $x_m$, we may assume $j = m$. But then $K$ is algebraic over its subfield generated by $\mathfrak{l}$ and the $(a_i)_{i=1}^{m-1} $, contradicting the minimality of $m$.
\end{proof}

\begin{theorem}\label{htandtrdeg}
    Let $\mathfrak{l}$ be an arbitrary field, $A$ a $\mathfrak{l}$-algebra of finite type which is a domain, and $\fp \in \Spec A$.
    Let $K \coloneqq Q(A)$ be the field of quotients of $A$. Then
    \[
        \hght(\fp) = \trdeg(K /\mathfrak{l}) - \trdeg(\mathfrak{k}(\fp) / \mathfrak{l})
    \] 
\end{theorem}
\begin{remark}
    By example \ref{htandcodim}, theorem \ref{trdegandkdim} is a special case of this theorem. %(\ref{htandtrdeg}).
\end{remark}
\begin{proof}
    If $\fp = \fp_0 \supsetneq \fp_1 \supsetneq \ldots \supsetneq \fp_k$ is a chain of prime ideals in $A$, we have $\trdeg(\mathfrak{k}(\fp_i) / \mathfrak{l}) < \trdeg(\mathfrak{k}(\fp_{i+1}) / \mathfrak{l})$  by \ref{trdegresfield} (``A first result of dimension theory'').
Thus
\[
    k \le  \trdeg(\mathfrak{k}(\fp_k) / \mathfrak{l}) - \trdeg(\mathfrak{k}(\fp) / \mathfrak{l}) \le  \trdeg(K / \mathfrak{l}) - \trdeg(\mathfrak{k}(\fp) / \mathfrak{l})
\] 
where the last inequality is another application of \ref{trdegresfield} (using  $K = Q(A) = Q(A / \{0\}) = \mathfrak{k}(\{0\})$ and the fact that $\{0\} \subseteq \fp_k$ is a prime ideal).
Hence \[
    \hght(\fp) \le  \trdeg( K / \mathfrak{l}) - \trdeg(\mathfrak{k}(\fp) / \mathfrak{l})
\] 
and it remains to show the opposite inequality.

\begin{claim}
    For any maximal ideal $\fp \in \mSpec A$ \[
        \hght(\mathfrak{m}) \ge \trdeg(K / \mathfrak{l})
    \] 
\end{claim}
\begin{subproof}
    By the Noether normalization theorem (\ref{noenort}), there are $(x_i)_{i=1}^d \in  A^d$ which are algebraically independent over $\mathfrak{l}$ such that $A$ is finite over the subalgebra $S$ generated by the $x_i$. We have $d = \trdeg(K / \mathfrak{l})$ as the $x_i$ form a transcendence base of $K / \mathfrak{l}$.
\begin{claim}
    We can choose $x_i \in \mathfrak{m}$
\end{claim}
\begin{subproof}
     By the Nullstellensatz (\ref{hns2}), $\mathfrak{k}(\mathfrak{m}) = A / \mathfrak{m}$ is a finite field extension of $\mathfrak{l}$. Hence there exists a normed polynomial $P_i \in  \mathfrak{l}[T]$  with $P_i(x_i \mod \mathfrak{m}) = 0$ in $\mathfrak{k}(\mathfrak{m})$.
    Let $\tilde x_i  \coloneqq P_i(x_i) \in  \mathfrak{m}$ and $\tilde S$ the subalgebra generated by the $\tilde x_i$. As $P_i(x_i) - \tilde x_i = 0$, $x_i$ is integral over $\tilde S$ and so is $S / \tilde S$. It follows that $A / \tilde S$ is integral, hence finite by \ref{ftaiimplf}. Replacing $x_i$ by $\tilde x_i$, we may thus assume that $x_i \in \mathfrak{m}$.

    
\end{subproof}
% TODO: fix names A_1 = A_S, k_1 = R_S 
   The ring homomorphism $\ev_x : R = \mathfrak{l}[X_1,\ldots,X_d] \xrightarrow{P \mapsto P(x_1,\ldots,x_d)} A$ is injective. Because $R$ is a UFD, $R$ is normal (\ref{ufdnormal}). Thus the going-down theorem (\ref{gdkrull}) applies to the integral $R$-algebra $A$.
    For $0 \le  i \le  d$, let $\fp_i \subseteq R$ be the ideal generated by $(X_j)_{j=i+1}^d$. We have $\mathfrak{m} \sqcap R = \fp_0$ as all $X_i \in \mathfrak{m}$, hence $X_i \in \mathfrak{m} \sqcap R$ and $\fp_0$ is a maximal ideal.
    By applying going-down and induction on $i$, there is a chain $\mathfrak{m} = \fq_0 \supsetneq \fp_1 \supsetneq \ldots \supsetneq \fp_d$ of elements of $\Spec A$ such that $\fq_i \sqcap R = \fp_i$.
    It follows that $\hght(\mathfrak{m}) \ge  d$.
\end{subproof}
This finishes the proof in the case of $\fp \in \mSpec A$.

To reduce the general case to that special case, we proceed as in  \ref{trdegresfield}:
By lemma \ref{ltrdegresfieldtrbase} there are $a_1,\ldots,a_n \in A$ whose images in $A / \fp$ form a transcendence base for $\mathfrak{k}(\fp) / \mathfrak{l}$.
As these images are $\mathfrak{l}$-algebraically independent, the same holds for the $a_i$ themselves.

By lemma \ref{extendtotrbase} we can extend $(a_{i})_{i=1}^n$ to a transcendence base $(a_i)_{i=1}^m \in  A^m$ of  $K / \mathfrak{l}$.
Let  $R \subseteq A$ denote the $\mathfrak{l}$-subalgebra generated by $a_1,\ldots,a_n$ and let $S \coloneqq R \sm \{0\}$.
Let $A_1 \coloneqq A_S$ and $\fp_S$ the prime ideal corresponding to $\fp$ under $\Spec(A_1) \cong \{\fr \in \Spec A | \fr \cap S = \emptyset\}$ (\ref{idealslocbij}).
As in \ref{locandquot}, $A_1$ is a domain with $Q(A_1) \cong K = Q(A)$ and by \ref{locandfactor} $A_1 / \fp_S \cong (A / \fp)_{\overline{S}}$, where $\overline{S}$ denotes the image of $S$ in $A / \fp$.
As in \ref{trdegresfield}, $\mathfrak{k}(\fp_S) \cong \mathfrak{k}(\fp)$ is integral over $A_1 / \fp_S$.
From the fact about integrality and fields (\ref{fintaf}), it follows that $A_1 / \fp_S$ is a field. Hence $\fp_S \in \mSpec(A_1)$ and the special case can be applied to $\fp_S$ and $A_1 / \mathfrak{l}_1$, showing that $\hght(\fp_S) \ge  e = \trdeg(K / \mathfrak{l}_1)$. We have $\trdeg(K / \mathfrak{l}_1) = m - n$, as $(a_i)_{i = n+1}^m$ is a transcendence base for $K / \mathfrak{l}_1$. By the description of $\Spec A_S$ (\ref{idealslocbij}), a chain  $\fp_S = \fq_0 \supsetneq \ldots \supsetneq \fp_e$  of prime ideals in $A_S$ defines a similar chain $\fp_i \coloneqq \fq_i \sqcap A$ in $A$ with $\fp_0 = \fp$. Thus $\hght(\fp) \ge e$.
\end{proof}

\begin{remark}
    As a consequence of his principal ideal theorem, Krull has shown the finiteness of $\hght(\fp)$ for $\fp \in \Spec A$ when $A$ is a Noetherian ring. But $\dim A = \sup_{\fp \in \Spec A} \hght(\fp) = \sup_{\mathfrak{m} \in \mSpec A} \hght(\mathfrak{m})$, the Krull dimension of the Noetherian topological space $\Spec A$ may nevertheless be infinite.
\end{remark}
\begin{dexample}[Noetherian ring with infinite dimension]\footnote{\url{https://math.stackexchange.com/questions/1109732/noetherian-ring-with-infinite-krull-dimension-nagatas-example}}
    Let $A = \mathfrak{k}[X_i | i \in \N]$ and $m_1, m_2, \ldots \in \N$ an increasing sequence such that $m_{i+1}-m_i > m_i - m_{i-1}$.
    Let $\fp_i \coloneqq (X_{m_{i}+1},\ldots,X_{m_{i+1}})$ and $S \coloneqq A \sm \bigcup_{i \in \N}  \fp_i$.
    $S$ is multiplicatively closed.
    $A_S$ is Noetherian but $\hght((\fp_i)_S) = m_{i+1}- m_{i}$ hence $\dim(A_S) = \infty$.
\end{dexample}

% Lecture 10


\subsection{Dimension of products}


\begin{proposition}\label{dimprod}
    Let $X \subseteq \mathfrak{k}^n$ and $Y \subseteq \mathfrak{k}^n$ be irreducible and closed. Then $X \times  Y$ is also an irreducible closed subset of $\mathfrak{k}^{m+n}$.
    Moreover, $\dim(X \times  Y) = \dim(X) + \dim(Y)$ and $\codim(X \times  Y, \mathfrak{k}^{m+n}) = \codim(X, \mathfrak{k}^m) + \codim(Y, \mathfrak{k}^n)$.
\end{proposition}
\begin{proof}
    Let $X = V(\fp)$ and $Y = V(\fq)$ where $\fp \in \Spec \mathfrak{k}[X_1,\ldots,X_m]$ and $\fq \in \Spec \mathfrak{k}[X_1,\ldots,X_n]$.
    We denote points of $\mathfrak{k}^{m+n}$ as $x = (x',x'')$ with $x' \in \mathfrak{k}^m, x''\in\mathfrak{k}^n$. Then  $X \times Y$ is the set of zeroes of the ideal in $\mathfrak{k}[X_1,\ldots,X_{m+n}]$ generated by the polynomials $f(x) = \phi(x')$, with $\phi$ running over $\fp$ and $g(x) = \gamma(x'')$ with $\gamma$ running over $\fq$.
    Thus $X \times Y$ is closed in $\mathfrak{k}^{m+n}$.
    We must also show irreducibility. $X \times Y \neq \emptyset$ is obvious.

    Assume that $X \times Y = A_1 \cup A_2$, where the $A_i \subseteq \mathfrak{k}^{m+n}$ are closed.
    For $x' \in \mathfrak{k}^m, x' \times Y$ is homeomorphic to the irreducible $Y$. Thus $X = X_1 \cup X_2$ where $X_i = \{x \in X | \{x\}  \times Y \subseteq A_i\} $.
    Because $X_i = \bigcap_{y \in Y} \{x \in  X | (x,y) \in  A_i\}$, this is closed. As $X$ is irreducible, there is  $i \in \{1;2\} $ which $X_i = X$. Then $X \times  Y = A_i$ confirming the irreducibility of $X \times Y$.

    Let $a = \dim X$ and $b = \dim Y$ and $X_0 \subsetneq X_1 \subsetneq \ldots \subsetneq X_a = X$,$Y_0 \subsetneq Y_1 \subsetneq \ldots \subsetneq Y_b = Y$ be chains of irreducible subsets. By the previous result,
    $X_0 \times  Y_0 \subsetneq X_1 \times Y_0 \subsetneq \ldots \subsetneq X_a \times  Y_0 \subsetneq X_a \times Y_1 \subsetneq \ldots \subsetneq X_a \times  Y_a = X \times Y$ is a chain of irreducible subsets.
    Thus  $\dim(X \times  Y) \ge  a + b = \dim X + \dim Y$.
    Similarly one derives $\codim(X \times  Y, \mathfrak{k}^{m+n}) \ge  \codim(X, \mathfrak{k}^m) + \codim(Y, \mathfrak{k}^n)$.
    By \ref{trdegandkdim} we have $\dim(A) + \codim(A, \mathfrak{k}^l) = l$ for irreducible subsets of $\mathfrak{k}^l$. Thus equality must hold in the previous two inequalities.

\end{proof}
\subsection{The nil radical}
\begin{notation}
    Let $\Vspec(I)$ denote the set of  $\fp \in \Spec A$ containing $I$.
\end{notation}

\begin{proposition}[Nil radical]
    For a ring $A$, $\bigcap_{\fp \in \Spec A}  \fp = \sqrt{\{0\} } = \{a \in A | \exists k \in \N ~ a^k = 0\} \text{\reflectbox{$\coloneqq$}} \nil(A)$, the set of nilpotent elements of $A$.
    This is called the \vocab{nil radical} of $A$. 
\end{proposition}
\begin{proof}
    It is clear that elements of $\sqrt{\{0\} } $ must belong to all prime ideals. Conversely, let $a \in  A \sm \sqrt{\{0\} }$. Then  $S = a^{\N}$ is a multiplicative subset of $A$ not containing $0$.
    The localisation $A_S$ of $A$ is thus not the null ring. Hence $\Spec A_S \neq \emptyset$. If $\fq \in  \Spec A_S$, then by the description of $\Spec A_S$ (\ref{idealslocbij}), $\fp \coloneqq \fq \sqcap A$ is a prime ideal of $A$ disjoint from $S$, hence $a \not\in \fp$.
\end{proof}

\begin{corollary}\label{sqandvspec}
    For an ideal $I$ of $R$, $\sqrt{I}  = \bigcap_{\fp \in \Vspec(I)} \fp$.
\end{corollary}
\begin{proof}
    This is obtained by applying the proposition to $A = R / I $ and using the bijection $\Spec( R / I) \cong V(I)$ sending  $\fp \in  V(I)$ to $\fp \coloneqq \fp / I$ and $\fq \in \Spec(R / I)$ to its inverse image $\fp$ in $R$.
\end{proof}
\subsubsection{Closed subsets of \texorpdfstring{$\Spec R$}{Spec R}}
\begin{proposition}\label{bijspecideal}
    There is a bijection
    \begin{align}
        f: \{A \subseteq \Spec R | A\text{ closed}\}  &\longrightarrow \{I \subseteq R | I \text{ ideal and } I = \sqrt{I} \}  \\
        A &\longmapsto \bigcap_{\fp \in A}  \fp\\
        \Vspec(I) &\longmapsfrom I
    \end{align}
    Under this bijection, the irreducible subsets correspond to the prime ideals and the closed points $\{\mathfrak{m}\}, \mathfrak{m} \in \Spec A$ to the maximal ideals.
\end{proposition}
\begin{proof}
    If $A = \Vspec(I)$, then by \ref{sqandvspec} $\sqrt{I}  = \bigcap_{\fp \in A}  \fp$. Thus, an ideal with $\sqrt{I}  = I$ can be recovered from $\Vspec( I)$. Since $\Vspec(J) = \Vspec(\sqrt{J})$, the map from ideals with $\sqrt{I}  = I$ to closed subsets is surjective.

    Sine $R$ corresponds to $\emptyset$, the proper ideals correspond to non-empty subsets of $\Spec R$. Assume that $\Vspec(I) = \Vspec(J_1) \cup \Vspec(J_2)$, where the decomposition is proper and the ideals coincide with their radicals.
    Let $g = f_1f_2$ with $f_k \in  J_k \sm I$. Since $\Vspec(g) \supseteq \Vspec(f_k) \supseteq \Vspec(I_k), \Vspec(I) \subseteq \Vspec(g)$. Hence $g \in \sqrt{I}  = I$.
    As $f_k \not\in I$, $I$ fails to be a prime ideal.
    Conversely, assume that $f_1f_2 \in I$ while the factors are not in $I$. Since $I = \sqrt{I}, \Vspec(f_k) \not\supseteq \Vspec(I)$. But $\Vspec(f_1) \cup \Vspec(f_2) = \Vspec(f_1f_2) \supseteq \Vspec(I)$.
    The proper decomposition $\Vspec(I) = \left( \Vspec(I) \cap \Vspec(f_1) \right) \cup \left( \Vspec(I) \cap \Vspec(f_2) \right) $ now shows that $\Vspec(I)$ fails to be irreducible.
    The final assertion is trivial.
\end{proof}

\begin{corollary}
    If $R$ is a Noetherian ring, then $\Spec R$ is a Noetherian topological space.
\end{corollary}
\begin{remark}
    It is not particularly hard to come up with examples which show that the converse implication does not hold.
\end{remark}
\begin{dexample}
    Let $A = \mathfrak{k}[X_n | n \in \N] / I$ where $I$ denotes the ideal generated by $\{X_i^2 | i \in \N\}$.
    $A$ is not Noetherian, since the ideal $J$ generated by $\{X_i | i \in \N\} $ is not finitely generated.
    $A / J \cong \mathfrak{k}$, hence $J$ is maximal. As every prime ideal must contain $\nil(A) \supseteq J$, $J$ is the only prime ideal.
    Thus $\Spec A$ contains only one element and is hence Noetherian.
\end{dexample}

\begin{corollary}[About the smallest prime ideals containing $I$ ]\label{smallestprimesvi}
    If $R$ is Noetherian and $I \subseteq R$ an ideal, then the set $\Vspec(I) = \{\fp \in  \Spec R | I \subseteq \fp\}$ has finitely many $\subseteq$-minimal elements $(\fp_i)_{i=1}^k$ and every element of $V(I)$ contains at least one $\fp_i$.
    The $\Vspec(\fp_i)$ are precisely the irreducible components of $V(I)$. Moreover $\bigcap_{i=1}^k \fp_i = \sqrt{I}$ and $k > 0$ if $I$ is a proper ideal.
\end{corollary}
\begin{proof}
    If $\Vspec(I) = \bigcup_{i=1}^k \Vspec(\fp_i)$ is the decomposition into irreducible components then every $\fq \in \Vspec(I)$ must belong to at least one $\Vspec(\fp_i)$, hence $\fp_i \subseteq \fq$. Also $\fp_i \in  \Vspec(\fp_i) \subseteq \Vspec(I)$.
    It follows that the sets of $\subseteq$-minimal elements of $\Vspec(I)$ and of $\{\fp_1,\ldots,\fp_k\} $ coincide.
    As there are no non-trivial inclusions between the $\Vspec(\fp_i)$, there are no non-trivial inclusions between the $\fp_i$ and the assertion follows.
    The final remark is trivial.
\end{proof}
\begin{corollary}
    If $R$ is any ring, $\hght(\fp) = \codim(\Vspec(\fp), \Spec R)$.
\end{corollary}


\subsection{The principal ideal theorem}
Krull was able to show:
\begin{theorem}[Principal ideal theorem / Hauptidealsatz]\label{pitheorem}
    Let $A$ be a Noetherian ring, $a \in A$ and $\fp \in \Spec A$ a $\subseteq$-minimal element of $\Vspec(a)$. Then $\hght(\fp) \le 1$.
\end{theorem}
\begin{proof}
    Probably not relevant for the exam.
\end{proof}
\begin{remark}
    Intuitively, the theorem says that by imposing a single equation one ends up in codimension at most $1$. This would not be true in real analysis (or real algebraic geometry) as the equation $\sum_{i=1}^{n} X_i^2 = 0$ shows. By \ref{smallestprimesvi}, if $a$ is a non-unit then a $\fp \in \Spec A$ to which the theorem applies can always be found.
    Using induction on $k$, Krull was able to derive:
\end{remark}

\begin{theorem}[Generalized principal ideal theorem]
    Let $A$ be a Noetherian ring, $(a_i)_{i=1}^k \in A$ and $\fp \in \Spec A$ a $\subseteq$-minimal element of $\bigcap_{i=1}^k V(a_i)$, the set of prime ideals containing all $a_i$.
    Then $\hght(\fp) \le k$.
\end{theorem}
Modern approaches to the principal ideal theorem usually give a direct proof of this more general theorem.

\begin{corollary}
    If $R$ is a Noetherian ring and $\fp \in  \Spec R$, then $\hght(\fp) < \infty$.
\end{corollary}
\begin{proof}
    If $\fp$ is generated by $(f_i)_{i=1}^k$, then $\hght(\fp) \le k$.
\end{proof}
\subsubsection{Application to the dimension of intersections}

\begin{remark}\label{smallestprimeandirredcomp}
Let $R = \mathfrak{k}[X_1,\ldots,X_n]$ and $I \subseteq R$ an ideal.

    If $(\fp_i)_{i=1}^k$ are the smallest prime ideals of $R$ containing $I$, then $(\Va(\fp_i))_{i=1}^k$ are the irreducible components of $\Va(I)$.
\end{remark}
\begin{proof}
    The $\Va(\fp_i)$ are irreducible, there are no non-trivial inclusions between them and $ \Va(I) = \Va(\sqrt{I}) = \Va(\bigcap_{i=1}^k \fp_i) = \bigcup_{i=1}^k \Va(\fp_i)$.
\end{proof}

\begin{corollary}[of the principal ideal theorem]
    \label{corpithm}
    Let $X \subseteq \mathfrak{k}^n$ be irreducible, $(f_i)_{i=1}^k$ elements of $R = \mathfrak{k}[X_1,\ldots,X_n]$ and $Y$ an irreducible component of $A = X \cap \bigcap_{i=1}^k V(f_i)$.
    Then $\codim(Y,X) \le  k$.
\end{corollary}
\begin{remark}
    This confirms the naive geometric intuition that by imposing $k$ equations one ends up in codimension at most $k$.
\end{remark}
\begin{proof}
    If $X = v(\fp), X \cap \bigcap_{i=1}^k V(f_i) = V(I)$ where $I \subseteq R$ is the ideal generated by $\fp$ and the $f_i$.
    By \ref{smallestprimeandirredcomp}, $Y = V(\fq)$ where $\fq$ is the smallest prime ideal containing $I$.
    Then $\fq / \fp$ is a smallest prime ideal of $R / \fp$ containing all $(f_i \mod \fp)_{i=1}^k$.
    By the principal ideal theorem (\ref{pitheorem}), $\hght(\fq / \fp) \le k$ and the assertion follows from example \ref{htandcodim}.
\end{proof}
\begin{remark}\label{affineproblem}
    Note that the intersection $X \cap \bigcap_{i=1}^k V(f_i)$ can easily be empty, even when $k$ is much smaller than $\dim X$.
\end{remark}

\begin{corollary}\label{codimintersection}
    Let $A$ and $B$ be irreducible subsets of $\mathfrak{k}^n$. If $C$ is an irreducible component of $A \cap B$, then $\codim(C, \mathfrak{k}^n) \le  \codim(A, \mathfrak{k}^n) + \codim(B, \mathfrak{k}^n)$.
\end{corollary}
\begin{dremark}
    Equivalently, $\dim(C) \ge \dim(A) + \dim(B)-n$. 
\end{dremark}
\begin{proof}
    Let $X = A \times  B \subseteq \mathfrak{k}^{2n}$, where we use $(X_1,\ldots,X_n,Y_1,\ldots,Y_n)$ as coordinates of $\mathfrak{k}^{2n}$.
    Let $\Delta \coloneqq \{(x_1,\ldots,x_n,x_1,\ldots,x_n) | x \in \mathfrak{k}^n\} $ be the diagonal in $\mathfrak{k}^n \times  \mathfrak{k}^n$.
    The projection $\mathfrak{k}^{2n}\to \mathfrak{k}^n$ to the $X$-coordinates defines a homeomorphism between $(A \times B) \cap \Delta$ and $A \cap B$.
    Thus, $C$ is homeomorphic to an irreducible component  $C'$ of $(A \times B) \cap \Delta$ and
    \begin{align}
        \codim(C, \mathfrak{k}^n) = n - \dim(C) = n - \dim(C') = n - \dim(A \times B) + \codim(C', A \times B)\\
        \overset{\text{\ref{corpithm}}}{\le }2n - \dim(A \times B) \overset{\text{\ref{dimprod}}}{=} 2n - \dim(A) - \dim(B) = \codim(A,\mathfrak{k}^n) + \codim(B, \mathfrak{k}^n)
    \end{align}
    by the general properties of dimension and codimension, \ref{corpithm} applied to $(X_i - Y_i)_{i=1}^n$,
    the result about the dimension of products (\ref{dimprod}) and again the general properties of dimension and codimension.

\end{proof}
\begin{remark}
    As in \ref{affineproblem}, $A \cap B$ can easily be empty, even when $A$ and $B$ have codimension $1$ and $n$ is very large.
\end{remark}

\subsubsection{Application to the property of being a UFD}
\begin{proposition}\limrel
    Let $R$ be a Noetherian domain. Then $R$ is a UFD iff every $\fp \in \Spec R$ with $\hght(\fp)= 1$\footnote{In other words, every  $\subseteq$-minimal element of the set of non-zero prime ideals of $R$ } is a principal ideal.
\end{proposition}
\begin{proof}
    Every element of every Noetherian domain can be written as a product of irreducible elements.\footnote{Consider the set of principal ideals $rR$ where $r$ is not a product of irreducible elements.}
    Thus, $R$ is a UFD iff every irreducible element of $R$ is prime.


    Assume that this is the case. Let $\fp \in \Spec R, \hght(\fp) = 1$.
    Let $p \in  \fp \sm \{0\}$. Replacing $p$ by a prime factor of $p$, we may assume $p$ to be prime. Thus $\{0\}  \subsetneq pR \subseteq \fp$ is a chain of prime ideals and since $\hght(\fp) = 1$ it follows that $\fp = pR$.

    Conversely, assume that every $\fp \in \Spec R$ with $\hght(\fp)=1$ is a principal ideal. Let $f \in R$ be irreducible.
    Let $\fp \in \Spec R$ be a $\subseteq$-minimal element  of $V(f)$. By the principal ideal theorem (\ref{pitheorem}), $\hght(\fp)=1$.
    Thus $\fp = pR$ for some prime element $p$. We have $p | f$ since $f \in \fp$. As $f$ is irreducible, $p$ and $f$ are multiplicatively equivalent. Thus $f$ is a prime element.
\end{proof}

\subsection{The Jacobson radical}\limrel
\begin{proposition}
    For a ring $A, \bigcap_{\mathfrak{m} \in \mSpec A} \mathfrak{m} = \{a \in A | \A x \in  A ~ 1 - ax \in A^{\times }\} \text{\reflectbox{$\coloneqq$}} \rad(A)$, the \vocab{Jacobson radical}  of $A$.
\end{proposition}
\begin{proof}
    Suppose $\mathfrak{m} \in \mSpec A$ and $a \in  A \sm \mathfrak{m}$. Then $a \mod \mathfrak{m} \neq 0$ and $A / \mathfrak{m}$ is a field. Hence $a \mod \mathfrak{m}$ has an inverse $x \mod \mathfrak{m}$.
    $1 - ax \in \mathfrak{m}$, hence $1 - ax \not\in A^{\times}$ and $a $ is not al element of the RHS.

    Conversely, let $a \in A$ belong to all $\mathfrak{m} \in \mSpec A$. If there exists $x \in  A$ such that $1 - ax \not\in  A^{\times }$ then $(1-ax) A$ was a proper ideal in $A$, hence contained in a maximal ideal $\mathfrak{m}$. As $a \in \mathfrak{m}, 1 = (1-ax) + ax \in  \mathfrak{m}$, a  contradiction.
    Hence every element of $\bigcap_{\mathfrak{m} \in \mSpec A} \mathfrak{m}$ belongs to the right hand side.
\end{proof}

\begin{example}
    If $A$ is a local ring, then $\rad(A) = \mathfrak{m}_A$.
\end{example}
\begin{example}
    If $A$ is a PID with infinitely many multiplicative equivalence classes of prime elements (e.g.  $\Z$ of $\mathfrak{k}[X]$), then $\rad(A) = \{0\}$:
    Prime ideals of a PID are maximal. Thus if $x \in \rad(A)$, every prime element divides $x$. If $x \neq 0$, it follows that $x$ has infinitely many prime divisors.
    However every PID is a UFD.
\end{example}
\begin{example}
If $A$ is a PID for which $p_1,\ldots,p_n$ is a list of representatives of the multiplicative equivalence classes of prime elements, then 
$\rad(A) = f A$ where $f = \prod_{i=1}^{n} p_i$.
\end{example}

%   proof of the pitheorem probably won't be relevant in the exam
%   last 2 slides are of "limited relevance" (3 option questions), and may improve grade, but 1.0 can be obtained without it



% Lecture 11

\subsection{Projective spaces}
Let $\mathfrak{l}$ be any field.
\begin{definition}
    For a $\mathfrak{l}$-vector space $V$, let $\bP(V)$ be the set of one-dimensional subspaces of $V$.
    Let $\bP^n(\mathfrak{l}) \coloneqq \bP(\mathfrak{l}^{n+1})$, the \vocab[Projective space]{$n$-dimensional projective space over $\mathfrak{l}$}.

    If $\mathfrak{l}$ is kept fixed, we will often write $\bP^n$ for $\bP^n(\mathfrak{l})$.
    
    When dealing with $\bP^n$, the usual convention is to use $0$ as the index of the first coordinate.
    
    We denote the one-dimensional subspace generated by $(x_0,\ldots,x_n) \in \mathfrak{k}^{n+1} \sm \{0\}$ by $[x_0,\ldots,x_n] \in \bP^n$.
    If $x = [x_0,\ldots,x_n] \in \bP^n$, the $(x_{i})_{i=0}^n$ are called \vocab{homogeneous coordinates}  of $x$.
    At least one of the $x_{i}$ must be $\neq 0$.
\end{definition}
\begin{remark}
    There are points $[1,0], [0,1] \in \bP^1$ but there is no point $[0,0] \in  \bP^1$.
\end{remark}
\begin{definition}[Infinite hyperplane]
    For $0 \le  i \le n$ let $U_i \subseteq \bP^n$ denote the set of $[x_0,\ldots,x_{n}]$ with $x_{i}\neq 0$.
    This is a correct definition since two different sets $[x_0,\ldots,x_{n}]$ and $[\xi_0,\ldots,\xi_n]$ of homogeneous coordinates for the same point $x \in \bP^n$ differ by scaling with a $\lambda \in  \mathfrak{l}^{\times}$, $x_i = \lambda \xi_i$. Since not all $x_i$ may be $0$, $\bP^n = \bigcup_{i=0}^n U_i$. We identify $\bA^n = \bA^n(\mathfrak{l}) = \mathfrak{l}^n$ with $U_0$ by identifying $(x_1,\ldots,x_n) \in \bA^n$ with $[1,x_1,\ldots,x_n] \in \bP^n$.
    Then $\bP^1 = \bA^1 \cup \{\infty\} $ where $\infty=[0,1]$. More generally, when $n > 0$ $\bP^n \sm \bA^n$ can be identified with $\bP^{n-1}$ identifying $[0,x_1,\ldots,x_n] \in \bP^n \sm \bA^n$ with $[x_1,\ldots,x_n] \in \bP^{n-1}$.

    Thus $\bP^n$ is $\bA^n \cong \mathfrak{l}^n$ with a copy of $\bP^{n-1}$ added as an \vocab{infinite hyperplane} .
\end{definition}

\subsubsection{Graded rings and homogeneous ideals}
\begin{notation}
    Let $\bI = \N$ or $\bI = \Z$.
\end{notation}
\begin{definition}
    By an \vocab[Graded ring]{$\bI$-graded ring} $A_\bullet$ we understand a ring $A$ with a collection $(A_d)_{d \in \bI}$ of subgroups of the additive group $(A, +)$ such that $A_a \cdot  A_b \subseteq A_{a + b}$ for $a,b \in \bI$ and such that $A = \bigoplus_{d \in \bI} A_d$ in the sense that every $r \in A$ has a unique decomposition $r = \sum_{d \in \bI}  r_d$ with $r_d \in A_d$ and but finitely many  $r_d \neq 0$.

    We call the $r_d$ the \vocab{homogeneous components} of $r$.

    An ideal $I \subseteq A$ is called \vocab{homogeneous}  if $r \in I \implies \A d \in \bI ~ r_d \in  I_d$ where $I_d \coloneqq I \cap A_d$.

    By a \vocab{graded ring}  we understand an $\N$-graded ring. Tin this case, $A_{+} \coloneqq \bigoplus_{d=1}^{\infty} A_d = \{r \in A | r_0 = 0\} $ is called the \vocab{augmentation ideal}  of $A$.
\end{definition}
\begin{remark}[Decomposition of $1$]
    If $1 = \sum_{d \in \bI}  \eps_d$ is the decomposition into homogeneous components, then $\eps_a = 1 \cdot \eps_a = \sum_{b \in \bI}  \eps_a\eps_b$ with $\eps_a\eps_b \in A_{a+b}$.
    By the uniqueness of the decomposition into homogeneous components, $\eps_a \eps_0 = \eps_a$ and $b \neq 0 \implies \eps_a \eps_b = 0$.
    Applying the last equation with $a = 0$ gives $b\neq 0 \implies \eps_b = \eps_0 \eps _b = 0$.
    Thus $1 = \eps_0 \in A_0$.
\end{remark}
\begin{remark}
    The augmentation ideal of a graded ring is a homogeneous ideal.
\end{remark}

% Graded rings and homogeneous ideals (2)

\begin{proposition}\footnote{This holds for both $\Z$-graded and $\N$-graded rings.}
    \begin{itemize}
        \item A principal ideal generated by a homogeneous element is homogeneous.
        \item The operations $\sum, \bigcap, \sqrt{}$ preserve homogeneity.
        \item An ideal is homogeneous iff it can be generated by a family of homogeneous elements.
    \end{itemize}
\end{proposition}
\begin{proof}
    Most assertions are trivial. We only show that $J$ homogeneous $\implies \sqrt{J} $ homogeneous.
    Let $A$ be $\bI$-graded, $f \in \sqrt{J} $ and $f = \sum_{d \in \bI} f_d$ the decomposition.
    To show that all $f_d \in \sqrt{J} $, we use induction on $N_f \coloneqq \# \{d \in \bI | f_d \neq 0\}$.
    $N_f = 0$ is trivial. Suppose $N_f > 0$ and $e \in \bI$ is maximal with $f_e \neq 0$.
    For $l \in \N$, the $le$-th homogeneous component of $f^l$ is $f_e^l$. Choosing $l$ large enough such that $f^l \in J$ and using the homogeneity of $J$, we find $f_e \in \sqrt{J}$.
    As  $\sqrt{J} $ is an ideal, $\tilde f \coloneqq f - f_e \in \sqrt{J} $. As $N_{\tilde f} = N_f -1$, the induction assumption may be applied to $\tilde f$ and shows $f_d \in \sqrt{J} $ for $d \neq e$.
\end{proof}
\begin{fact}
    A homogeneous ideal is finitely generated iff it can be generated by finitely many of its homogeneous elements.
    In particular, this is always the case when $A$ is a Noetherian ring.
\end{fact}


\subsubsection{The Zariski topology on $\bP^n$}
\begin{notation}
    Recall that for $\alpha \in \N^{n+1}$ $|\alpha| = \sum_{i=0}^{n}  \alpha_i$ and $x^\alpha = x_0^{\alpha_0} \cdot \ldots \cdot x_n^{\alpha_n}$.
\end{notation}
\begin{definition}[Homogeneous polynomials]
    Let $R$ be any ring and $f = \sum_{\alpha \in \N^{n+1}} f_\alpha X^{\alpha}\in R[X_0,\ldots,X_n]$.
    We say that $f$ is \vocab{homogeneous of degree $d$} if $|\alpha| \neq  d \implies f_\alpha = 0$ .
    We denote the subset of homogeneous polynomials of degree $d$  by $R[X_0,\ldots,X_n]_d \subseteq R[X_0,\ldots,X_n]$.
\end{definition}
\begin{remark}
    This definition gives $R$ the structure of a graded ring.
\end{remark}
\begin{definition}[Zariski topology on $\bP^n(\mathfrak{k})$]\label{ztoppn}
    Let $A = \mathfrak{k}[X_0,\ldots,X_n]$.\footnote{As always, $\mathfrak{k}$ is algebraically closed}
    For $f \in A_d = \mathfrak{k}[X_0,\ldots,X_n]_d$, the validity of the equation $f(x_0,\ldots,x_{n}) = 0$ does not depend on the choice of homogeneous coordinates, as
     \[
         f(\lambda x_0,\ldots, \lambda x_n) 0 \lambda^d f(x_0,\ldots,x_n)
    \] 
    Let $\Vp(f) \coloneqq \{x \in  \bP^n | f(x) = 0\}$.

    We call a subset $X \subseteq \bP^n$ Zariski-closed if it can be represented as 
    \[
        X = \bigcap_{i=1}^k \Vp(f_i)
    \] 
    where the $f_i \in A_{d_i}$ are homogeneous polynomials.
\end{definition}
\pagebreak
\begin{fact}
    If $X = \bigcap_{i = 1}^k \Vp(f_i) \subseteq \bP^n$  is closed, then $Y = X \cap \bA^n$ can be identified with the closed subset
    \[
        \{(x_1,\ldots,x_n) \in  \mathfrak{k}^n | f_i(1,x_1,\ldots,x_n) = 0, 1 \le i \le k\}  \subseteq \mathfrak{k}^n
    \]
    Conversely, if $Y \subseteq \mathfrak{k}^n$ is closed it has the form
    \[
        \{(x_1,\ldots,x_n) \in  \mathfrak{k}^n | g_i(x_1,\ldots,x_n) = 0, 1 \le i \le k\} 
    \] 
    and can thus be identified with $X \cap \bA^n$ where $X \coloneqq \bigcap_{i=1}^k \Vp(f_i)$ is given by \[f_i(X_0,\ldots,X_n) \coloneqq X_0^{d_i} g_i(X_1 / X_0,\ldots, X_n / X_0), d_i \ge \deg(g_i)\]
    Thus, the Zariski topology on $\mathfrak{k}^n$ can be identified with the topology induced by the Zariski topology on $\bA^n = U_0$, and the same holds for $U_i$ with $0 \le i \le n$.

    In this sense, the Zariski topology on $\bP^n$ can be thought of as gluing the Zariski topologies on the $U_i \cong \mathfrak{k}^n$.
\end{fact}

% The Zariski topology on P^n (2)

\begin{definition}
    Let $I \subseteq A = \mathfrak{k}[X_0,\ldots,X_n]$ be a homogeneous ideal.
    Let $\Vp(I) \coloneqq \{[x_0,\ldots,_n] \in \bP^n | \A f \in I ~ f(x_0,\ldots,x_n) = 0\}$ 
    As $I$ is homogeneous, it is sufficient to impose this condition for the homogeneous elements $f \in I$.
    Because $A$ is Noetherian, $I$ can finitely generated by homogeneous elements $(f_i)_{i=1}^k$ and $\Vp(I)=\bigcap_{i=1}^k \Vp(f_i)$ as in \ref{ztoppn}.
    Conversely, if the homogeneous $f_i$ are given, then $I = \langle f_1,\ldots,f_k \rangle_A$ is homogeneous.
\end{definition}
\begin{remark}
    Note that $V(A) = V(A_+) = \emptyset$.
\end{remark}
\begin{fact}
    For homogeneous ideals in $A$ and $m \in \N$, we have:
     \begin{itemize}
         \item $\Vp(\sum_{\lambda \in \Lambda} I_\lambda) = \bigcap_{\lambda \in \Lambda} \Vp(I_\lambda)$ 
         \item $\Vp(\bigcap_{k=1}^m I_k) = \Vp(\prod_{k=1}^{m} I_k) = \bigcup_{k=1}^m \Vp(I_k)$ 
         \item $\Vp(\sqrt{I}) = \Vp(I)$
    \end{itemize}
\end{fact}
\begin{fact}
    If $X = \bigcup_{\lambda \in \Lambda} U_\lambda$ is an open covering of a topological space then $X$ is Noetherian iff there is a finite subcovering and all $U_\lambda$ are Noetherian.
\end{fact}
\begin{proof}
    By definition, a topological space is Noetherian $\iff$  all open subsets are quasi-compact.
\end{proof}
\begin{corollary}
    The Zariski topology on $\bP^n$ is indeed a topology.
    The induced topology on the open set $\bA^n = \bP^n \sm \Vp(X_0) \cong \mathfrak{k}^n$ is the Zariski topology on $\mathfrak{k}^n$.
    The same holds for all $U_i = \bP^n \sm \Vp(X_i) \cong \mathfrak{k}^n$.
    Moreover, the topological space $\bP^n$ is Noetherian.
\end{corollary}

\subsection{Noetherianness of graded rings}
\begin{proposition}
    For a graded ring $R_{\bullet}$, the following conditions are equivalent:
    \begin{enumerate}[A]
        \item $R$ is Noetherian.
        \item Every homogeneous ideal of $R_{\bullet}$ is finitely generated.
        \item Every chain $I_0\subseteq I_1 \subseteq \ldots$ of homogeneous ideals terminates.
        \item Every set $\fM \neq \emptyset$ of homogeneous ideals has a $\subseteq$-maximal element.
        \item $R_0$  is Noetherian and the ideal $R_+$ is finitely generated.
        \item $R_0$ is Noetherian and $R / R_0$ is of finite type.
    \end{enumerate}
\end{proposition}
\begin{proof}
    \noindent\textbf{A $\implies$ B,C,D} trivial.

    \noindent\textbf{B $\iff$ C $\iff$ D} similar to the proof about Noetherianness.

        \noindent\textbf{B $\land$ C $\implies $E} B implies that $R_+$ is finitely generated. Since $I \oplus R_+$ is homogeneous for any homogeneous ideal $I \subseteq R_0$, C implies the Noetherianness of $R_0$.

\noindent\textbf{E $\implies$ F} Let $R_+$ be generated by $f_i \in R_{d_i}, d_i > 0$ as an ideal.
            \begin{claim}
                The $R_0$-subalgebra $\tilde R$ of $R$ generated by the $f_i$ equals $R$.
            \end{claim}
            \begin{subproof}
                It is sufficient to show that every homogeneous $f \in R_d$ belongs to $\tilde R$. We use induction on $d$. The case of $d = 0$ is trivial.
                Let $d > 0$ and $R_e \subseteq \tilde R$ for all $e < d$.
                as $f \in  R_+$, $f = \sum_{i=1}^{k} g_if_i$. Let $f_a = \sum_{i=1}^{k} g_{i, a-d_i} f_i$, where $g_i = \sum_{b=0}^{\infty} g_{i,b}$ is the decomposition into homogeneous components.
                Then $f = \sum_{a=0}^{\infty} f_a$ is the decomposition of $f$ into homogeneous components, hence $a \neq d \implies f_a = 0 $. Thus we may assume $g_i \in  R_{d-d_i}$.
                As $d_i > 0$, the induction assumption may now be applied to $g_i$, hence $g_i \in  \tilde R$, hence $f \in \tilde R$.
            \end{subproof}

            \noindent\textbf{F  $\implies$ A} Hilbert's Basissatz (\ref{basissatz})

\end{proof}



% Lecture 12

\subsection{The projective form of the Nullstellensatz and the closed subsets of $\bP^n$}
Let $A = \mathfrak{k}[X_0,\ldots,X_n]$.
\begin{proposition}[Projective form of the Nullstellensatz]\label{hnsp}
    If $I \subseteq A$ is a homogeneous ideal and $f \in A_d$ with $d>0$, then $\Vp(I) \subseteq \Vp(f) \iff f \in \sqrt{I}$.
\end{proposition}
\begin{proof}
    $\impliedby$ is clear. Let $\Vp(I) \subseteq \Vp(f)$. If $x = (x_0,\ldots,x_n) \in \Va(I)$, then either $x = 0$ in which case $f(x) = 0$ since $d > 0$
    or the point $[x_0,\ldots,x_n] \in \bP^n$ is well-defined and belongs to $\Vp(I) \subseteq \Vp(f)$, hence $f(x) = 0$.
    Thus $\Va(I) \subseteq \Va(f)$ and $f \in  \sqrt{I}$ be the Nullstellensatz (\ref{hns3}).
\end{proof}

\begin{definition}\footnote{This definition is not too important, the characterization in the following remark suffices.}.
    For a graded ring $R_\bullet$, let $\Proj(R_\bullet)$ be the set of  $\fp \in \Spec R$ such that $\fp$ is a homogeneous ideal and $\fp \not\supseteq R_+$.
\end{definition}
\begin{remark}\label{proja}
    As the elements of $A_0 \sm \{0\}$ are units in $A$ it follows that for every homogeneous ideal $I$ we have $I \subseteq A_+$ or $I = A$.
    In particular, $\Proj(A_\bullet) = \{\fp \in  \Spec A \sm A_+ |  \fp \text{ is homogeneous}\} $.
\end{remark}
\begin{proposition}\label{bijproj}
    There is a bijection 
    \begin{align}
        f: \{I \subseteq A_+ | I \text{ homogeneous ideal}, I = \sqrt{I}\}  &\longrightarrow \{X \subseteq \bP^n | X \text{ closed}\}  \\
        I &\longmapsto \Vp(I)\\
        \langle \{f \in  A_d | d >  0,  X \subseteq \Vp(f)\} \rangle & \longmapsfrom X
    \end{align}
    Under this bijection, the irreducible subsets correspond to the elements of $\Proj(A_\bullet)$.
\end{proposition}
\begin{proof}
    From the projective form of the Nullstellensatz it follows that $f$ is injective and that $f\inv(\Vp\left( I \right)) = \sqrt{I} = I$.
    If $X \subseteq \bP^n$ is closed, then $X = \Vp(J)$ for some homogeneous ideal $J \subseteq A$. \Wlog $J = \sqrt{J}$. If $J \not\subseteq A_+$, then $J = A$ (\ref{proja}), hence $X = \Vp(J) = \emptyset = \Vp(A_+)$.
    Thus we may assume $J \subseteq A_+$, and $f$ is surjective.


    Suppose $\fp \in \Proj(A_\bullet)$. Then $\fp \neq  A_+$ hence $X = \Vp(\fp) \neq \emptyset$ by the proven part of the proposition.
    Assume $X = X_1 \cup X_2$ is a decomposition into proper closed subsets, where $X_k = \Vp(I_k)$ for some $I_k \subseteq A_+, I_k = \sqrt{I_k}$. Since $X_k$ is a proper subset of $X$, there is $f_k \in I_k \sm \fp$.
    We have $\Vp(f_1f_2) \supseteq \Vp(f_k) \supseteq \Vp(I_k)$ hence $\Vp(f_1f_2) \supseteq \Vp(I_1) \cup \Vp(I_2) = X = \Vp(\fp)$ and it follows that $f_1f_2\in  \sqrt{\fp} = \fp \lightning$.

    Assume $X = \Vp(\fp)$ is irreducible, where $\fp = \sqrt{\fp}  \in A_+$ is homogeneous. The $\fp \neq  A_+$ as $X = \emptyset$ otherwise. Assume that $f_1f_2 \in  \fp$ but $f_i \not\in  A_{d_i} \sm \fp$.
    Then $X \not \subseteq \Vp(f_i)$ by the projective Nullstellensatz when $d_i > 0$ and because $\Vp(1) = \emptyset$ when $d_i = 0$.
    Thus $X = (X \cap \Vp\left( f_1 \right)) \cup (X \cap \Vp(f_2))$ is a proper decomposition $\lightning$.
    By lemma \ref{homprime}, $\fp$ is a prime ideal.

\end{proof}
\begin{remark}
    It is important that $I \subseteq A_{\color{red} +}$, since $\Vp(A) = \Vp(A_+) =  \emptyset$ would be a counterexample.
\end{remark}
\begin{corollary}
    $\bP^n$ is irreducible.
\end{corollary}
\begin{proof}
    Apply \ref{bijproj} to $\{0\}  \in \Proj(A_\bullet)$.
\end{proof}

\subsection{Some remarks on homogeneous prime ideals}
\begin{lemma}\label{homprime}
    Let $R_\bullet$ be an $\bI$ graded ring ($\bI = \N$ or $\bI = \Z$).
    A homogeneous ideal $I \subseteq R$ is a prime ideal iff $1 \not\in I$ and for homogeneous elements $f, g \in R , fg \in I \implies f \in I \lor g \in I$.
\end{lemma}
\begin{proof}
    $\implies$ is trivial.
    It suffices to show that for arbitrary $f,g \in R fg \in I \implies f \in I \lor g \in I$.
    Let $f = \sum_{d \in \bI} f_d, g = \sum_{d \in \bI} g_d $ be the decompositions into homogeneous components.
    If $f \not\in  I$ and $g \not\in  I$ there are $d,e \in I$ with $f_d \in I, g_e \in I$, and they may assumed to be maximal with this property.
    As $I$ is homogeneous and $fg \in I$, we have $(fg)_{d+e} \in I$ but
    \[
        (fg)_{d+e} = f_dg_e + \sum_{\delta = 1}^{\infty} (f_{d + \delta} g_{e - \delta} + f_{d - \delta} g_{e + \delta})
    \] 
    where $f_dg_e \not\in I$ by our assumption on $I$ and all other summands on the right hand side are $\in I$ (as $f_{d+ \delta} \in I$ and $g_{e + \delta} \in I$ by the maximality of $d$ and $e$), a contradiction.
\end{proof}

\begin{remark}
    If $R_\bullet$ is $\N$-graded and $\fp \in \Spec R_0$, then $\fp \oplus R_+ = \{r \in R | r_0 \in  \fp\} $ is a homogeneous prime ideal of $R$.
    \[\{\fp  \in \Spec R | \fp \text{ is a homogeneous ideal of } R_\bullet\} = \Proj(R_\bullet) \sqcup \{\fp \oplus R_+ | \fp \in \Spec R_0\}\]
\end{remark}

\subsection{Dimension of $\bP^n$}
\begin{proposition}
    \begin{itemize}
        \item $\bP^n$ is catenary.
        \item $\dim(\bP^n) = n$. Moreover, $\codim(\{x\} ,\bP^n) = n$ for every $x \in \bP^n$.
        \item If  $X \subseteq \bP^n$ is irreducible and $x \in X$, then $\codim(\{x\}, X) = \dim(X) = n - \codim(X, \bP^n)$.
        \item If $X \subseteq Y \subseteq \bP^n$ are irreducible subsets, then $\codim(X,Y) = \dim(Y) - \dim(X)$.
    \end{itemize}
\end{proposition}
\begin{proof}
    Let $X \subseteq \bP^n$ be irreducible. If $x \in X$, there is an integer $0 \le i \le n$ and $X \in  U_i = \bP^n \sm \Vp(X_i)$.
    \Wlog $i = 0$. Then $\codim(X, \bP^n) = \codim(X \cap \bA^n, \bA^n)$ by the locality of Krull codimension (\ref{lockrullcodim}).
    Applying this with $X = \{x\}$ and our results about the affine case gives the second assertion.
    If $Y$ and $Z$ are also irreducible with $X \subseteq Y \subseteq Z$, then $\codim(X,Y) = \codim(X \cap \bA^n, Y \cap \bA^n)$, $\codim(X,Z) = \codim(X \cap \bA^n, Z \cap \bA^n)$ and $\codim(Y,Z) = \codim(Y \cap \bA^n, Z \cap \bA^n)$.
    Thus
    \begin{align}
        \codim(X,Y) + \codim(Y,Z) &= \codim(X \cap \bA^n, Y \cap \bA^n) + \codim(Y \cap \bA^n, Z \cap \bA^n)\\
                                  &= \codim(X \cap \bA^n, Z \cap \bA^n)\\
                                  &= \codim(X, Z)
    \end{align}
    because $\mathfrak{k}^n$ is catenary and the first point follows.
    The remaining assertions can easily be derived from the first two.
\end{proof}

\subsection{The cone $C(X)$}
\begin{definition}
    If $X \subseteq \bP^n$ is closed, we define the \vocab{affine cone over $X$}
    \[
        C(X) = \{0\} \cup \{(x_0,\ldots,x_n) \in  \mathfrak{k}^{n+1} \sm \{0\}  | [x_0,\ldots,x_n] \in X\} 
    \] 
    If $X = \Vp(I)$ where $I \subseteq A_+ = \mathfrak{k}[X_0,\ldots,X_n]_+$ is homogeneous, then $C(X) = \Va(I)$.
\end{definition}
\begin{proposition}\label{conedim}
    \begin{itemize}
        \item $C(X)$ is irreducible iff  $X$ is irreducible or $X = \emptyset$.
        \item If $X$ is irreducible, then

            $\dim(C(X)) = \dim(X) + 1$ and
            
            $\codim(C(X), \mathfrak{k}^{n+1}) = \codim(X, \bP^n)$
    \end{itemize}
\end{proposition}
\begin{proof}
    The first assertion follows from \ref{bijproj} and \ref{bijiredprim} (bijection of irreducible subsets and prime ideals in the projective and affine case).

    Let $d = \dim(X)$ and
    \[
    X_0 \subsetneq \ldots \subsetneq X_d = X \subsetneq X_{d+1} \subsetneq \ldots \subsetneq X_n = \bP^n
    \] 
    be a chain of irreducible subsets of $\bP^n$. Then
    \[
        \{0\}  \subsetneq C(X_0) \subsetneq \ldots \subsetneq C(X_d) = C(X) \subsetneq \ldots \subsetneq C(X_n) = \mathfrak{k}^{n+1}
    \] 
    is a chain of irreducible subsets of $\mathfrak{k}^{n+1}$. Hence $\dim(C(X)) \ge  1 + d$ and $\codim(C(X), \mathfrak{k}^{n+1}) \ge n-d$. Since $\dim(C(X)) + \codim(C(X), \mathfrak{k}^{n+1}) = \dim(\mathfrak{k}^{n+1}) = n+1$, the two inequalities must be equalities.
\end{proof}
\subsubsection{Application to hypersurfaces in $\bP^n$}
\begin{definition}[Hypersurface]
    Let $n > 0$.
    By a \vocab{hypersurface}  in $\bP^n$ or $\bA^n$ we understand an irreducible closed subset of codimension $1$.
\end{definition}

\begin{corollary}
    If $P \in A_d$ is a prime element, then $H = \Vp(P)$ is a hypersurface in $\bP^n$ and every hypersurface $H$ in $\bP^n$ can be obtained in this way.
\end{corollary}
\begin{proof}
    If $H = \Vp(P)$ then $C(H) = \Va(P)$ is a hypersurface in $\mathfrak{k}^{n+1}$ by \ref{irredcodimone}. By \ref{conedim}, $H$ is irreducible and of codimension $1$.

    Conversely, let $H$ be a hypersurface in $\bP^n$. By \ref{conedim}, $C(H)$ is a hypersurface in $\mathfrak{k}^{n+1}$, hence $C(H) = \Vp(P)$ for some prime element $P \in  A$ (again by \ref{irredcodimone}).
    We have $H = \Vp(\fp)$ for some $\fp \in \Proj(A)$ and $C(H) = \Va(\fp)$. By the bijection between closed subsets of $\mathfrak{k}^{n+1}$ and ideals $I = \sqrt{I}  \subseteq A$ (\ref{antimonbij}), $\fp = P \cdot A$.
Let $P = \sum_{k=0}^{d}P_k$ with $P_d \neq 0$ be the decomposition into homogeneous components.
If $P_e $ with $e < d$ was $\neq 0$, it could not be a multiple of $P$ contradicting the homogeneity of $\fp = P \cdot A$. Thus, $P$ is homogeneous of degree $d$.
\end{proof}
\begin{definition}
    A hypersurface $H \subseteq \bP^n$ has \vocab{degree $d$} if $H = \Vp(P)$ where $P \in A_d$ is an irreducible polynomial.
\end{definition}

\subsubsection{Application to intersections in $\bP^n$ and Bezout's theorem}
\begin{corollary}
    Let $A \subseteq \bP^n$ and $B \subseteq \bP^n$ be irreducible subsets of dimensions $a$ and $b$. If $a+ b \ge n$, then $A \cap B \neq \emptyset$ and every irreducible component of $A \cap B$ as dimension $\ge a + b - n$.
\end{corollary}

\begin{remark}
    This shows that $\bP^n$ indeed fulfilled the goal of allowing for nicer results of algebraic geometry because ``solutions at infinity'' to systems of algebraic equations are present in $\bP^n$
    (see \ref{affineproblem}).
\end{remark}

\begin{proof}
    The lower bound on the dimension of irreducible components of $A \cap B$ is easily derived from the similar affine result (corollary of the principal ideal theorem, \ref{codimintersection}).
    From the definition of the affine cone it follows that $C(A \cap B) = C(A) \cap C(B)$.
    We have $\dim(C(A)) = a+1$ and $\dim(C(B)) = b + 1$ by \ref{conedim}.
    If $A \cap B = \emptyset$, then $C(A) \cap C(B) = \{0\}$ with $\{0\} $ as an irreducible component, contradicting the lower bound $a + b + 1 - n > 0$ for the dimension of irreducible components of $C(A) \cap C(B)$ (again \ref{codimintersection}).
\end{proof}
\begin{remark}[Bezout's theorem]
    If $A \neq B$ are hypersurfaces of degree $a$ and $b$ in  $\bP^2$, then $A \cap B$ has $ab$ points counted by (suitably defined) multiplicity.
\end{remark}


%TODO Proof of "Dimension of P^n"
% SLIDE APPLICATION TO HYPERSURFACES IN $\P^n$
%ERROR: C(H) = V_A(P)
%If n = 0, P = 0, V_P(P) = \emptyset is a problem!



% Lecture 13
\subsection{Varieties}

\subsection{Sheaves}

\begin{definition}[Sheaf]
    Let $X$ be any topological space.

    A \vocab{presheaf} $\cG$ of sets (or rings, (abelian) groups) on $X$ associates a set (or rings, or (abelian) group) $\cG(U)$ to every open subset  $U$ of $X$, and a map  (or ring or group homomorphism)  $\cG(U) \xrightarrow{r_{U,V}} \cG(V)$ to every inclusion $V \subseteq U$ of open subsets of $X$ such that $r_{U,W} = r_{V,W} r_{U,V}$ for inclusions $U \subseteq V \subseteq W$ of open subsets.

    Elements of $\cG(U)$ are often called \vocab{sections}  of $\cG$ on $U$ or \vocab{global sections} when $U = X$.

    Let $U \subseteq X$ be open and $U = \bigcup_{i \in  I} U_i$ an open covering.
    A family $(f_i)_{i \in I} \in \prod_{i \in I} \cG(U_i)$ is called \vocab[Sections!compatible]{compatible}  if $r_{U_i, U_i \cap U_j}(f_i) = r_{U_j, U_i \cap U_j}(f_j)$ for all $i,j \in I$.

    Consider the map 
    \begin{align}
        \phi_{U, (U_i)_{i \in I}}: \cG(U) &\longrightarrow \{(f_i)_{i \in I} \in \prod_{i \in I} \cG(U_i) | r_{U_i, U_i \cap U_j}(f_i) = r_{U_j, U_i \cap U_j}(f_j) \text{ for } i,j \in I  \}  \\
    f &\longmapsto (r_{U, U_i}( f))_{i \in I}
    \end{align}

    A presheaf is called \vocab[Presheaf!separated]{separated}  if $\phi_{U, (U_i)_{i \in I}}$ is injective for all such $U$ and $(U_i)_{i \in I}$.\footnote{This also called ``locality''.}
    It satisfies \vocab{gluing} if $\phi_{U, (U_i)_{i \in I}}$ is surjective. 

    A presheaf is called a \vocab{sheaf}  if it is separated and satisfies gluing. 

    The bijectivity of the $\phi_{U, (U_i)_{i \in I}}$ is called the \vocab{sheaf axiom}. 
\end{definition}
\begin{dtrivial}
    A presheaf is a contravariant functor $\cG : \cO(X) \to C$ where $\cO(X)$ denotes the category of open subsets of $X$ with inclusions as morphisms and $C$ is the category of sets, rings or (abelian) groups.
\end{dtrivial}
\begin{definition}
    A subsheaf $\cG'$ is defined by subsets (resp. subrings or subgroups) $\cG'(U) \subseteq \cG(U)$ for all open $U \subseteq X$ such that the sheaf axioms still hold.
\end{definition}
\begin{remark}
    If $\cG$ is a sheaf on $X$ and $\Omega \subseteq X$ open, then $\cG\defon{\Omega}(U) \coloneqq \cG(U)$ for open $U \subseteq \Omega$ and $r_{U,V}^{(\cG\defon{\Omega})}(f) \coloneqq r_{U,V}^{(\cG)}(f)$ is a sheaf of the same kind as $\cG$ on $\Omega$.
\end{remark}
\begin{remark}
    The notion of restriction of a sheaf to a closed subset, or of preimages under general continuous maps, can be defined but this is a bit harder.
\end{remark}
\begin{notation}
    It is often convenient to write $f \defon{V}$ instead of $r_{U,V}(f)$.
\end{notation}
\begin{remark}
    Applying the \vocab{sheaf axiom} to the empty covering of $U = \emptyset$, one finds that $\cG(\emptyset) = \{0\} $.
\end{remark}




\subsubsection{Examples of sheaves}
\begin{example}
    Let $G$ be a set and let $\fG(U)$ be the set of arbitrary maps $U \xrightarrow{f} G$. We put $r_{U,V}(f) = f\defon{V}$.
    It is easy to see that this defines a sheaf.
    If $\cdot $ is a group operation on $G$, then $(f\cdot g)(x) \coloneqq f(x)\cdot g(x)$ defines the structure of a sheaf of group on $\fG$.
    Similarly, a ring structure on $G$ can be used to define the structure of a sheaf of rings on  $\fG$.
\end{example}
\begin{example}
    If in the previous example $G$ carries a topology and $\cG(U) \subseteq \fG(U)$ is the subset (subring, subgroup) of continuous functions $U \xrightarrow{f} G$, then $\cG$ is a subsheaf of  $\fG$, called the sheaf of continuous $G$-valued functions on (open subsets of) $X$.
\end{example}

\begin{example}
    If $X = \R^n$, $\bK \in  \{\R, \C\}$ and $\cO(U)$ is the sheaf of $\bK$-valued $C^{\infty}$-functions on $U$, then $\cO$ is a subsheaf of the sheaf (of rings) of $\bK$-valued continuous functions on $X$.
\end{example}
\begin{example}
    If $X = \C^n$  and  $\cO(U)$ the set of holomorphic functions on $X$, then $\cO$ is a subsheaf of the sheaf of $\C$-valued $C^{\infty}$-functions on $X$.
\end{example}
\subsubsection{The structure sheaf on a closed subset of $\mathfrak{k}^n$}

Let $X \subseteq \mathfrak{k}^n$ be open. Let $R = \mathfrak{k}[X_1,\ldots,X_n]$.
\begin{definition}\label{structuresheafkn}
    For open subsets $U \subseteq X$, let $\cO_X(U)$ be the set of functions $U \xrightarrow{\phi} \mathfrak{k}$ such that every $x \in U$ has a neighbourhood $V$ such that there are $f,g \in  R$  such that for $y \in V$ we have $g(y) \neq 0$ and $\phi(y) = \frac{f(y)}{g(y)}$.
\end{definition}

\begin{remark}\label{structuresheafcontinuous}
    $\cO_X$ is a subsheaf (of rings) of the sheaf of $\mathfrak{k}$-valued functions on $X$.
    The elements of $\cO_X(U)$ are continuous:
    Let $M \subseteq \mathfrak{k}$ be closed. We must show the closedness of $N \coloneqq \phi\inv(M)$ in $U$. For $M = \mathfrak{k}$ this is trivial. Otherwise $M$ is finite and we may assume $M = \{t\} $ for some $t \in \mathfrak{k}$. For $x \in U$, there are open $V_x \subseteq U$ and $f_x, g_x \in R$ such that $\phi = \frac{f_x}{g_x}$ on $V_x$.
    Then $N \cap V_x = V(f_x - t\cdot g_x) \cap V_x)$ is closed in $V_x$. As the $V_x$ cover $U$ and $U$ is quasi-compact, $N$ is closed in $U$.
\end{remark}

\begin{proposition}\label{structuresheafri}
    Let $X = V(I)$ where $I = \sqrt{I}  \subseteq R$ is an ideal. Let $A = R / I$. Then
    \begin{align}
        \phi: A &\longrightarrow \cO_X(X) \\
        f \mod I &\longmapsto f\defon{X}
    \end{align}
is an isomorphism.
\end{proposition}

\begin{proof}
    It is easy to see that the map $A \to \cO_X(X)$ is well-defined and a ring homomorphism.
    Its injectivity follows from the Nullstellensatz and $I = \sqrt{I}$ (\ref{hns3}).


    Let $\phi \in  \cO_X(X)$. for $x \in X$, there are an open subset $U_x \subseteq X$ and $f_x, g_x \in R$ such that $\phi = \frac{f_x}{g_x}$ on $U_x$.
    \begin{claim}
        \Wlog we can assume $U_x = X \sm V(g_x)$.
    \end{claim}
    \begin{subproof}
        The closed subsets $(X \sm U_x) \subseteq \mathfrak{k}^n$ has the form $X\sm U_x = V(J_x)$ for some ideal $J_x \subseteq R$.
        As $x \not\in  X \sm V_x$ there is $h_x \in J_x$ with $h_x(x) \neq 0$.
        Replacing $U_x$ by $X \sm V(h_x)$, $f_x$ by $f_xh_x$ and $g_x$ by $g_xh_x$, we may assume $U_x = X \sm V(g_x)$.
    \end{subproof}
    \begin{claim}
        \Wlog we can assume $V(g_x)  \subseteq V(f_x)$.
    \end{claim}
    \begin{subproof}
        Replace $f_x$ by $f_xg_x$ and $g_x$ by $g_x^2$.
    \end{subproof}
    As $X$ is quasi-compact, there are finitely many points $(x_i)_{i=1}^m$ such that the $U_{x_i}$ cover $X$.
    Let $U_i \coloneqq U_{x_i}, f_i \coloneqq f_{x_i}, g_i \coloneqq g_{x_i}$.

    As the $U_i = X \sm V(g_i)$ cover $X$, $V(I) \cap \bigcap_{i=1}^m V(g_i) = X \cap \bigcap_{i=1}^m V(g_i) = \emptyset$.
    By the Nullstellensatz (\ref{hns1}) the ideal of $R$ generated by $I$ and the $a_i$ equals $R$. 
    There are thus $n \ge m \in \N$ and elements $(g_i)_{i = m+1}^n$ of $I$ and $(a_i)_{i=1}^n \in R^n$ such that $1 = \sum_{i=1}^{n} a_ig_i$.
    Let for $i > m$ $f_i \coloneqq 0$, $F = \sum_{i=1}^{n} a_if_i = \sum_{i=1}^{m} a_if_i \in R$.
    
    \begin{claim}
        For all $x \in X $ ~ $f_i(x) = \phi(x) g_i(x)$.
    \end{claim}
    \begin{subproof}
        If $x \in V_i$ this follows by our choice of $f_i$ and $g_i$.
        If $x \in X \sm V_i$ or $i > m$ both sides are zero.
    \end{subproof}
    It follows that
    \[
        \phi(x) = \phi(x) \cdot  1 = \phi(x) \cdot \sum_{i=1}^{n} a_i(x) g_i(x) = \sum_{i=1}^{n} a_i(x) f_i(x) = F(x)
    \] 
    Hence $\phi = F\defon{X}$.
\end{proof}
\subsubsection{The structure sheaf on closed subsets of $\bP^n$}
Let $X \subseteq \bP^n$ be closed and $R_\bullet = \mathfrak{k}[X_0,\ldots,X_n]$ with its usual grading.

\begin{definition}\label{structuresheafpn}
    For open $U \subseteq X$, let $\cO_X(U)$ be the set of functions $U \xrightarrow{\phi} \mathfrak{k}$ such that for every $x \in U$, there are an open subset $W \subseteq U$, a natural number $d$ and $f,g \in R_d$ such that $W \cap \Vp(g) = \emptyset$ and $\phi(y) = \frac{f(y_0,\ldots,y_n)}{g(y_0,\ldots,y_n)}$ for $y = [y_0,\ldots,y_n] \in  W$.
\end{definition}

\begin{remark}
    This is a subsheaf of rings of the sheaf of $\mathfrak{k}$-valued functions on $X$.
Under the identification $\bA^n =\mathfrak{k}^n$ with $\bP^n \sm \Vp(X_0)$, one has $\cO_X \defon{X \sm \Vp(X_0)} = \cO_{X \cap \bA^n}$ as subsheaves of the sheaf of $\mathfrak{k}$-valued functions, where the second sheaf is a sheaf on a closed subset of $\mathfrak{k}^n$:

Indeed, if $W$ is as in the definition then $\phi([1,y_1,\ldots,y_n]) = \frac{f(1,y_1,\ldots,y_n)}{g(1,y_1,\ldots,y_n)}$ for $[1,y_1,\ldots,y_n] \in  W$.
Conversely  if $\phi([1,y_1,\ldots,y_n]) = \frac{f(y_1,\ldots,y_n)}{g(y_1,\ldots,y_n)}$ on an open subset $W $ of $X \cap \bA^n$ then 
$\phi([y_0,\ldots,y_n]) = \frac{F(y_0,\ldots,y_n)}{G(y_0,\ldots,y_n)}$ on $W$ where $F(X_0,\ldots,X_n) \coloneqq X_0^d f(\frac{X_1}{X_0}, \ldots, \frac{X_n}{X_0})$ and $G(X_0,\ldots,X_n) = X_0^d g(\frac{X_1}{X_0},\ldots, \frac{X_n}{X_0})$ with a sufficiently large $d \in \N$.
\end{remark}
\begin{remark}
    It follows from the previous remark and the similar result in the affine case that the elements of $\cO_X(U)$ are continuous on $U \sm V(X_0)$.
    Since the situation is symmetric in the homogeneous coordinates, they are continuous on all of $U$.
\end{remark}
The following is somewhat harder than in the affine case:
\begin{proposition}
    If $X$ is connected (e.g. irreducible), then the elements of $\cO_X\left( X \right) $ are constant functions on $X$.
\end{proposition}



% Lecture 14

\subsection{The notion of a category}
\begin{definition}
    A \vocab{category}  $\cA$ consists of:
    \begin{itemize}
        \item A class  $\Ob \cA$ of \vocab[Objects]{objects of $\cA$}.
        \item For two arbitrary objects $A, B \in \Ob \cA$, a \textbf{set}  $\Hom_\cA(A,B)$ of \vocab[Morphism]{morphisms for $A$ to $B$ in $\cA$}.
        \item A map $\Hom_\cA(B,C) \times  \Hom_\cA(A,B) \xrightarrow{\circ} \Hom_\cA(A,C)$, the composition of morphisms, for arbitrary triples $(A,B,C)$ of objects of $\cA$.
    \end{itemize}
    The following conditions must be satisfied:
    \begin{enumerate}[A]
        \item For morphisms $A \xrightarrow{f} B\xrightarrow{g} C \xrightarrow{h} D$, we have $h \circ (g \circ f) = (h \circ g) \circ f$.
        \item For every  $A \in \Ob(\cA)$, there is an $\Id_A \in  \Hom_{\cA}(A,A)$ such that $\Id_A \circ f = f$ (reps. $g \circ \Id_A = g$) for arbitrary morphisms $B \xrightarrow{f} A$ (reps. $A \xrightarrow{g} C).$
    \end{enumerate}

    A morphism $X \xrightarrow{f} Y$ is called an \vocab[Isomorphism]{isomorphism (in $\cA $)} if there is a morphism $Y \xrightarrow{g} X$ (called the \vocab[Inverse morphism]{inverse $f\inv$ of $f$)} such that $g \circ f = \Id_X$ and $f \circ g = \Id_Y$.  
\end{definition}
\begin{remark}
    \begin{itemize}
        \item The distinction between classes and sets is important here.
        \item We will usually omit the composition sign $\circ$.
        \item It is easy to see that $\Id_A$ is uniquely determined by the above condition $B$, and that the inverse $f\inv$ of an isomorphism $f$ is uniquely determined.
    \end{itemize}
\end{remark}
\subsubsection{Examples of categories}
\begin{example}
    \begin{itemize}
        \item The category of sets.
        \item The category of groups.
        \item The category of rings.
        \item If $R$ is a ring, the category of $R$-modules and the category $\Alg_R$ of $R$-algebras
        \item The category of topological spaces
        \item The category $\Var_\mathfrak{k}$ of varieties over $\mathfrak{k}$ (see \ref{defvariety})
        \item If $\cA$ is a category, then the \vocab{opposite category}  or \vocab{dual category}  is defined by $\Ob(\cA\op) = \Ob(\cA)$ and $\Hom_{\cA\op}(X,Y) = \Hom_\cA(Y,X)$.
    \end{itemize}
    In most of these cases, isomorphisms in the category were just called `isomorphism'. The isomorphisms in the category of topological spaces are the homeomophisms.
\end{example}
\subsubsection{Subcategories}
\begin{definition}[Subcategories]
    A \vocab{subcategory}  of $\cA$ is a category $\cB$ such that $\Ob(\cB) \subseteq \Ob(\cA)$, such that $\Hom_\cB(X,Y) \subseteq \Hom_\cA(X,Y)$ for objects $X$ and $Y$ of $\cB$, such that for every object $X \in \Ob(\cB)$, the identity $\Id_X$ of $X$ is the same in $\cB$ as in $\cA$, and such that for composable morphisms in $\cB$, their compositions in $\cA$ and $\cB$ coincide.
    We call $\cB$ a \vocab{full subcategory}  of $\cA$ if in addition $\Hom_\cB(X,Y) = \Hom_\cA(X,Y)$ for arbitrary $X,Y \in \Ob(\cB)$.
\end{definition}
\begin{example}
    \begin{itemize}
        \item The category of abelian groups is a full subcategory of the category of groups.
            It can be identified with the category of $\Z$-modules.
        \item The category of finitely generated $R$-modules as a full subcategory of the category of $R$-modules.
        \item The category of $R$-algebras of finite type as a full subcategory of $\Alg_R$.
        \item The category of affine varieties over $\mathfrak{k}$ as a full subcategory of the category of varieties over $\mathfrak{k}$.
    \end{itemize}
\end{example}

\subsubsection{Functors and equivalences of categories}
\begin{definition}
    A \vocab[Functor!covariant]{(covariant) functor} (resp.  \vocab[Functor!contravariant]{contravariant functor}) between categories $\cA \xrightarrow{F} \cB$ is a map $\Ob(\cA) \xrightarrow{F} \Ob(\cB)$ with a family of maps $\Hom_\cA(X,Y) \xrightarrow{F} \Hom_\cB(F(X),F(Y))$ (resp. $\Hom_\cA(X,Y) \xrightarrow{F} \Hom_\cB(F(Y),F(X))$ in the case of contravariant functors), where $X$ and $Y$ are arbitrary objects of $\cA$, such that the following conditions hold:
     \begin{itemize}
         \item $F(\Id_X) = \Id_{F(X)}$ 
         \item For morphisms $X \xrightarrow{f} Y \xrightarrow{g} Z$ in $\cA$, we have $F(gf) = F(g)F(f)$ ( resp. $F(gf) = F(f)F(g)$)
    \end{itemize}
    A functor is called \vocab[Functor!essentially surjective]{essentially surjective}  if every object of $\cB$ is isomorphic to an element of the image of $\Ob(\cA) \xrightarrow{F}  \Ob(\cB)$.
    A functor is called \vocab[Functor!full]{full} (resp. \vocab[Functor!faithful]{faithful}) if it induces surjective (resp. injective) maps between sets of morphisms.
    It is called an \vocab{equivalence of categories} if it is full, faithful and essentially surjective.
\end{definition}
\begin{example}
    \begin{itemize}
        \item There are \vocab[Functor!forgetful]{forgetful functors} from rings to abelian groups or from abelian groups to sets which drop the multiplicative structure of a ring or the group structure of a group.
        \item If $\mathfrak{k}$ is any vector space there is  a contravariant functor from $\mathfrak{k}$-vector spaces to itself sending $V$ to its dual vector space $V\subseteq$ and $V \xrightarrow{f} W$ to the dual linear map $W\st \xrightarrow{f\st} V\st$.
            When restricted to the full subcategory of finite-dimensional vector spaces it becomes a contravariant self-equivalence of that category.
        \item The embedding of a subcategory is a faithful functor. In the case of a full subcategory it is also full.
    \end{itemize}
\end{example}



\subsection{The category of varieties}

\begin{definition}[Algebraic variety]\label{defvariety}
    An \vocab{algebraic variety}  or \vocab{prevariety}  over $\mathfrak{k}$ is a pair $(X, \cO_X)$, where $X$ is a topological space and $\cO_X$ a subsheaf of the sheaf of $\mathfrak{k}$-valued functions on  $X$ such that for every $x \in X$, there are a neighbourhood $U_x$ of $x$ in $X$, an open subset $V_x$ of a closed subset $Y_x$ of $\mathfrak{k}^{n_x}$\footnote{By the result of \ref{affopensubtopbase} it can be assumed that $V_x = Y_x$ without altering the definition.} and a homeomorphism $V_x \xrightarrow{\iota_x} U_x$ such that for every open subset $V \subseteq U_x$ and every function $V\xrightarrow{f} \mathfrak{k}$, we have $f \in \cO_X(V) \iff \iota\st_x(f) \in \cO_{Y_x}(\iota_x\inv(V))$,

        In this, the \vocab{pull-back} $\iota_x\st(f)$ of $f$ is defined by $(\iota_x\st(f))(\xi) \coloneqq f(\iota_x(\xi))$.


        A morphism $(X, \cO_X) \to  (Y, \cO_Y)$ of varieties is a continuous map $X \xrightarrow{\phi} Y$ such that for all open $U \subseteq Y$ and $f \in \cO_Y(U)$, $\phi\st(f) \in \cO_X(\phi\inv(U))$.
        An isomorphism is a morphism such that $\phi$ is bijective and $\phi\inv$ also is a morphism of varieties.
\end{definition}
\begin{example}
    \begin{itemize}
        \item If $(X, \cO_X)$ is a variety and $U \subseteq X$ open, then $(U, \cO_X\defon{U})$ is a variety (called an \vocab{open subvariety}  of $X$), and the embedding $U \to  X$ is a morphism of varieties.
        \item If $X$ is a closed subset of $\mathfrak{k}^n$ or $\bP^n$, then $(X, \cO_X)$ is a variety, where $\cO_X$ is the structure sheaf on $X$ (\ref{structuresheafkn}, reps. \ref{structuresheafpn}).
            A variety is called \vocab[Variety!affine]{affine} (resp. \vocab[Variety!projective]{projective}) if it is isomorphic to a variety of this form, with $X $ closed in $\mathfrak{k}^n$ (resp. $\bP^n$).
            A variety which is isomorphic to and open subvariety of $X$ is called \vocab[Variety!quasi-affine]{quasi-affine} (resp. \vocab[Variety!quasi-projective]{quasi-projective}). 
        \item If $X = V(X^2 - Y^3) \subseteq \mathfrak{k}^2$ then $\mathfrak{k} \xrightarrow{t \mapsto (t^3,t^2)} X$ is a morphism which  is a homeomorphism of topological spaces but not an isomorphism of varieties.
            % TODO

        \item The composition of two morphisms $X \to  Y \to Z$ of varieties is a morphism of varieties.
        \item $X\xrightarrow{\Id_X} X$ is a morphism of varieties.
    \end{itemize}
\end{example}

\subsubsection{The category of affine varieties}
\begin{lemma}\label{localinverse}
    Let $X$ be any $\mathfrak{k}$-variety and $U \subseteq X$ open.
    \begin{enumerate}[i)]
        \item All elements of $\cO_X(U)$ are continuous.
        \item If $U \subseteq X$ is open, $U \xrightarrow{\lambda} \mathfrak{k}$ any function and every $x \in U$ has a neighbourhood $V_x \subseteq U$ such that $\lambda \defon{V_x}  \in  \cO_X(V_x)$, then $\lambda \in \cO_X(U)$.
        \item If $\vartheta \in \cO_X(U)$ and $\vartheta(x) \neq 0$ for all $x \in U$, then $\vartheta \in \cO_X(U)^{\times }$.
    \end{enumerate}
\end{lemma}
\begin{proof}
    \begin{enumerate}[i)]
        \item  The property is local on $U$, hence it is sufficient to show it in the quasi-affine case. This was done in \ref{structuresheafcontinuous}.
        \item For the second part, let $\lambda_x \coloneqq \lambda \defon{V_x} $. 
            We have $\lambda_x\defon{V_x \cap V_y} = \lambda \defon{V_x \cap V_y} =  \lambda_y \defon{V_x \cap V_y} $.
            The $V_x$ cover $U$. By the sheaf axiom for $\cO_X$ there is $\ell \in \cO_X(U)$ with $\ell\defon{V_x} =\lambda_x$. It follows that  $\ell=\lambda$.
        \item By the definition of variety, every $x \in U$ has a quasi-affine neighbourhood $V \subseteq U$. We can assume  $U$ to be quasi-affine and $X = V(I) \subseteq \mathfrak{k}^n$, as the general assertion follows by an application of ii).
            If $x \in U$ there are a neighbourhood $x \in W \subseteq U$ and $a,b \in R = \mathfrak{k}[X_1,\ldots,X_n]$ such that $\vartheta(y) = \frac{a(y)}{b(y)}$ for $y \in W$, with $b(y) \neq 0$.
            Then $a(x) \neq 0$ as $\vartheta(x) \neq 0$. Replacing $W$ by $W \sm V(a)$, we may assume that $a$ has no zeroes on $W$.
            Then $\lambda(y) = \frac{b(y)}{a(y)}$ for $y \in W$ has a non-vanishing denominator and $\lambda \in \cO_X(U)$.
            We have $\lambda \cdot \vartheta = 1$, thus $\vartheta \in  \cO_X(U)^{\times}$.
    \end{enumerate}

    
\end{proof}
\begin{proposition}[About affine varieties]
    \label{propaffvar}
    \begin{itemize}
        \item Let $X,Y$ be varieties over $\mathfrak{k}$. Then the map
            \begin{align}
                \phi: \Hom_{\Var_\mathfrak{k}}(X,Y) &\longrightarrow \Hom_{\Alg_\mathfrak{k}}(\cO_Y(Y), \cO_X(X)) \\
                (X \xrightarrow{f} Y) &\longmapsto (\cO_Y(Y) \xrightarrow{f\st}  \cO_X(X))
            \end{align}
            is injective when $Y$ is quasi-affine and bijective when $Y$ is affine.
        \item The contravariant functor
            \begin{align}
                F: \Var_\mathfrak{k} &\longrightarrow \Alg_\mathfrak{k} \\
                X &\longmapsto \cO_X(X)\\
                (X\xrightarrow{f} Y) &\longmapsto (\cO_X(X) \xrightarrow{f\st} \cO_Y(Y))
            \end{align}
            restricts to an equivalence of categories between the category of affine varieties over $\mathfrak{k}$ and the full subcategory $\cA$ of $\Alg_\mathfrak{k}$,
            having the $\mathfrak{k}$-algebras $A$ of finite type with $\nil A = \{0\} $ as objects.
    \end{itemize}
\end{proposition}

\begin{remark}
    It is clear that $\nil(\cO_X(X)) = \{0\}$ for arbitrary varieties. For general varieties it is however not true that $\cO_X(X)$ is a $\mathfrak{k}$-algebra of finite type.
    There are counterexamples even for quasi-affine $X$. %TODO

    If, however, $X$ is affine, we may assume w.l.o.g. that $X = V(I)$ where $I = \sqrt{I} \subseteq R$ is an ideal with $R = \mathfrak{k}[X_1,\ldots,X_n]$.
    Then $\cO_X(X) \cong R / I$ (see \ref{structuresheafri}) is a $\mathfrak{k}$-algebra of finite type.
\end{remark}

\begin{proof}




    It suffices to investigate $\phi$ when $Y$ is an open subset of $V(I) \subseteq \mathfrak{k}^n$, where $I = \sqrt{I}  \subseteq R$ is an ideal and $Y = V(I)$ when  $Y$ is affine.
    Let $(f_1,\ldots,f_n)$ be the components of $X \xrightarrow{f} Y \subseteq \mathfrak{k}^n$. Let $Y \xrightarrow{\xi_i}  \mathfrak{k}$ be the $i$-th coordinate.
    By definition $f_i = f\st(\xi_i) $. Thus $f$ is uniquely determined by $\cO_Y(Y) \xrightarrow{f\st} \cO_X(X)$.
    Conversely, let $Y = V(I)$ and $\cO_Y(Y) \xrightarrow{\phi} \cO_X(X)$ be a morphism of $\mathfrak{k}$-algebras. Define $f_i \coloneqq \phi(\xi_i)$ and consider $X \xrightarrow{f = (f_1,\ldots,f_n)} Y\subseteq \mathfrak{k}^n$.
    \begin{claim}
        $f$ has image contained in $Y$.
    \end{claim}
    \begin{subproof}
        For $x \in X, \lambda \in I$ we have $\lambda(f(x)) = (\phi(\lambda \mod I))(x) = 0$ as $\phi$ is a morphism of $\mathfrak{k}$-algebras.
        Thus $f(x) \in V(I) = Y$.
    \end{subproof}
    \begin{claim}
        $f$ is a morphism in $\Var_\mathfrak{k}$
    \end{claim}
    \begin{subproof}
        For open $\Omega \subseteq Y, U = f\inv(\Omega) = \{x \in X | \A \lambda \in J ~ (\phi(\lambda))(x) \neq 0\}$ is open in $X$, where $Y \sm \Omega = V(J)$.
        If $\lambda \in \cO_Y(\Omega)$ and $x \in U$, then $f(x)$ has a neighbourhood $V$ such that there are $a,b \in R$ with $\lambda(v) = \frac{a(v)}{b(v)}$ and $b(v) \neq 0$ for all $v \in V$.
        Let $W \coloneqq f\inv(V)$. Then $\alpha \coloneqq \phi(a)\defon{W} \in \cO_X(W)$,  $\beta \coloneqq \phi(b)\defon{W} \in \cO_X(W)$.
        By the second part of \ref{localinverse} $\beta \in \cO_X(W)^{\times}$ and $f\st(\lambda)\defon{W}  = \frac{\alpha}{\beta} \in \cO_X(W)$.
        The first part of \ref{localinverse} shows that  $f\st(\lambda) \in  \cO_X(U)$.
    \end{subproof}
    By definition of $f$, we have $f\st = \phi$. This finished the proof of the first point.



    \begin{claim}
        The functor in the second part maps affine varieties to objects of $\cA$ and is essentially surjective.
    \end{claim}
    \begin{subproof}
        It follows from the remark that the functor maps affine varieties to objects of $\cA$.

        If $A \in \Ob(\cA)$ then $ A /\mathfrak{k}$ is of finite type, thus $A \cong R / I$ for some $n$.
        Since $\nil(A) = \{0\}$ we have $I = \sqrt{I}$, as for $x \in \sqrt{I}$, $x \mod I \in  \nil(R / I) \cong \nil(A) = \{0\}$.
        Thus $A \cong\cO_X(X)$ where $X = V(I)$.
    \end{subproof}
    Fullness and faithfulness of the functor follow from the first point.
\end{proof}

\begin{remark}
    Note that giving a contravariant functor $\cC \to \cD$ is equivalent to giving a functor $\cC \to \cD\op$. We have thus shown that the category of affine varieties is equivalent to $\cA\op$, where $\cA \subsetneq \Alg_\mathfrak{k}$ is the full subcategory of $\mathfrak{k}$-algebras $A$ of finite type with $\nil(A) = \{0\}$.
\end{remark}
\subsubsection{Affine open subsets are a topology base}

\begin{definition}
    A set $\cB$ of open subsets of a topological space $X$ is called a \vocab{topology base} for $X$ if every open subset of $X$ can be written as a (possibly empty) union of elements of $\cB$.
\end{definition} 
\begin{fact}
If $X$ is a set, then $\cB \subseteq \cP(X)$ is a base for some topology on $X$ iff $X = \bigcup_{U \in \cB} U$ and for arbitrary $U, V \in \cB, U \cap V$ is a union of elements of $\cB$.
\end{fact}
\begin{definition}
    Let $X$ be a variety.
    An \vocab{affine open subset} of $X$ is a subset which is an affine variety. 
    
\end{definition}
\begin{proposition}\label{oxulocaf}
    Let $X$ be an affine variety over $\mathfrak{k}$, $\lambda \in \cO_X(X)$ and $U = X \sm V(\lambda)$.
    Then  $U$ is an affine variety and the morphism $\phi: \cO_X(X)_\lambda \to \cO_X(U)$ defined by the restriction $\cO_X(X) \xrightarrow{\cdot |_U } \cO_X(U)$ and the universal property of the localization is an isomorphism.
\end{proposition}
\begin{proof}
    Let $X$ be an affine variety over $\mathfrak{k}, \lambda \in  \cO_X(X)$ and $U = X \sm V(\lambda)$. The fact that $\lambda\defon{U}  \in \cO_x(U)^{\times}$ follows from \ref{localinverse}.
    Thus the universal property of the localization $\cO_X(X)_\lambda$ can be applied to $\cO_X(X) \xrightarrow{\cdot |_U} \cO_X(U)$.
    \begin{figure}[H]
        \centering
        \begin{tikzcd}
            \cO_X(X) \arrow{d}{\cdot |_U}\arrow{r}{x \mapsto \frac{x}{1}} & \cO_X(X)_\lambda \arrow[dotted, bend left]{dl}{\existsone \phi} \\
            \cO_X(U) &
        \end{tikzcd}
        \hspace{50pt}
        \begin{tikzcd}
            &Y \arrow[bend right, swap]{ld}{\pi_0} \arrow[bend right, swap]{d}{\pi}&\cO_Y(Y) \cong A_\lambda \arrow{d}{\mathfrak{s}}& \\
            X \arrow[hookrightarrow]{r}{}& U \arrow[swap]{u}{\sigma} & \cO_X(U)
        \end{tikzcd}
    \end{figure}
    For the rest of the proof, we may assume $X = V(I) \subseteq \mathfrak{k}^n$ where $I = \sqrt{I} \subseteq R \coloneqq\mathfrak{k}[X_1,\ldots,X_n]$ is an ideal.
    Then $A \coloneqq \cO_X(X) \cong R / I$ and there is $\ell \in R$ such that $\ell\defon{X} = \lambda$.
    Let $Y = V(J) \subseteq \mathfrak{k}^{n+1}$ where $J \subseteq \mathfrak{k}[Z,X_1,\ldots,X_n]$ is generated by the elements of $I$ and $1 - Z\ell(X_1,\ldots,X_n)$.

    Then $\cO_Y(Y) \cong \mathfrak{k}[Z,X_1,\ldots,X_n] / J \cong A[Z] / (1 -\lambda Z) \cong A_\lambda$.
    By the proposition about affine varieties (\ref{propaffvar}), the morphism $\mathfrak{s}: \cO_Y(Y) \cong A_\lambda \to \cO_X(U)$ corresponds to a morphism $U \xrightarrow{\sigma} Y$.
    We have $\mathfrak{s}(Z \mod J) = \lambda\inv$ and $\mathfrak{s}(X_i \mod J) = X_i \mod I$.
    Thus $\sigma(x) = (\lambda(x)\inv, x)$ for $x \in U$.
    Moreover, the projection $Y \xrightarrow{\pi_0} X$ dropping the $Z$-coordinate has image contained in $U$, as for $(z,x) \in Y$ the equation
    \[
        1 = z\lambda(x)
    \] 
    implies $\lambda(x) \neq 0$. It thus defines a morphism $Y \xrightarrow{\pi} U$ and by the description of $\sigma$ it follows that $\sigma \pi = \Id_U$.
    Similarly it follows that $\sigma \pi =  \Id_Y$. Thus, $\sigma$ and $\pi$ are inverse to each other.   
\end{proof}
\begin{corollary}\label{affopensubtopbase}
    The affine open subsets of a variety $X$ are a topology base on $X$.
\end{corollary}
\begin{proof}
    Let $X = V(I) \subseteq \mathfrak{k}^n$ with $I = \sqrt{I}$. If $U \subseteq X$ is open then $X \sm U = V(J)$ with $J \supseteq I$ and $U = \bigcup_{f \in J} (X \sm V(f))$.
    Thus $U$ is a union of affine open subsets. The same then holds for arbitrary quasi-affine varieties.
    
    Let $X$ be any variety, $U \subseteq X$ open and $x \in U$.
    By the definition of variety, $x$ has a neighbourhood $V_x$ which is quasi-affine, and replacing $V_x$ by $U \cap V_x$ which is also quasi-affine we may assume  $V_x \subseteq U$.
    $V_x$ is a union of its affine open subsets. Because $U$ is the union of the $V_x$, $U$ as well is a union of affine open subsets.
\end{proof}


% Lecture 14A TODO?

% Lecture 15

% CRTPROG

\subsection{Stalks of sheaves}

\begin{definition}[Stalk]
    Let $\cG$ be a presheaf of sets on the topological space $X$, and let  $x \in X$.
    The \vocab{stalk} (\vocab[Stalk]{Halm}) of $\cG$ at $x$ is the set of equivalence classes of pairs $(U, \gamma)$, where $U$ is an open neighbourhood of $x$ and $\gamma \in \cG(U)$
    and the equivalence relation $\sim $ is defined as follows:
    $( U , \gamma) \sim (V, \delta)$ iff  there exists an open neighbourhood $W \subseteq U \cap V$ of $x$ such that $\gamma \defon{W}  = \delta \defon{W}$. 


    If $\cG$ is a presheaf of groups, one can define a groups structure on $\cG_x$ by
    \[
        ((U, \gamma) / \sim ) \cdot \left( (V,\delta) / \sim  \right) = (U \cap V, \gamma \defon{U \cap V}  \cdot \delta\defon{U \cap V}) / \sim 
    \] 

    If $\cG$ is a presheaf of rings, one can similarly define a ring structure on $\cG_x$.
    

    If $U$ is an open neighbourhood of $x \in X$, then we have a map (resp. homomorphism)
    \begin{align}
        \cdot_x : \cG(U) &\longrightarrow \cG_x \\
        \gamma &\longmapsto \gamma_x \coloneqq (U, \gamma) / \sim 
    \end{align}

\end{definition}
\begin{fact}
    Let $\gamma,\delta \in  \cG(U)$. If $\cG$ is a sheaf\footnote{or, more generally, a separated presheaf} and if for all $x \in U$, we have $\gamma_x = \delta_x$, then $\gamma = \delta$.

    In the case of a sheaf, the image of the injective map $\cG(U) \xrightarrow{\gamma \mapsto (\gamma_x)_{x \in U}} \prod_{x \in U} \cG_x$
    is the set of all $(g_x)_{x \in U} \in  \prod_{x \in U} \cG_x  $ satisfying the following \vocab{coherence condition}:
    For every $x \in U$, there are an open neighbourhood $W_x \subseteq U$ of $x$ and $g^{(x)} \in \cG(W_x)$ with $g_y^{(x)} = g_y$ for all $y \in  W_x$.
\end{fact}
\begin{proof}
    Because of $\gamma_x = \delta_x$, there is $x \in W_x \subseteq U$ open such that $\gamma\defon{W_x}  = \delta\defon{W_x}$. As the $W_x$ cover $U$, $\gamma = \delta$ by the sheaf axiom.
\end{proof}
\begin{definition}
    Let $\cG$ be a sheaf of functions.
    Then $\gamma_x$ is called the \vocab{germ}  of the function $\gamma$ at $x$.
    The \vocab[Germ!value at $x$]{value at $x$ } of $g = (U, \gamma) / \sim \in \cG_x$ defined as $g(x) \coloneqq \gamma(x)$, which is independent of the choice of the representative $\gamma$. 
\end{definition}
\begin{remark}
       If $\cG$ is a sheaf of $C^{\infty}$-functions (resp. holomorphic functions), then $\cG_x$ is called the ring of germs of $C^\infty$-functions (resp. of holomorphic functions) at $x$.

\end{remark}
\subsubsection{The local ring of an affine variety}
\begin{definition}
    If $X$ is a variety, the stalk $\cO_{X,x}$ of the structure sheaf at $x$ is called the \vocab{local ring}  of $X$ at $x$.
    This is indeed a local ring, with maximal ideal $\mathfrak{m}_x = \{f \in \cO_{X,x} | f(x) = 0\}$.
\end{definition}
\begin{proof}
    By \ref{localring} it suffices to show that $\mathfrak{m}_x$ is a proper ideal, which is trivial, and that the elements of $\cO_{X,x} \sm \mathfrak{m}_x$ are units in $\cO_{X,x}$.
    Let $g = (U, \gamma)/\sim \in \cO_{X,x}$ and $g(x) \neq 0$.
    $\gamma$ is  Zariski continuous (first point of \ref{localinverse}). Thus $V(\gamma)$ is closed. By replacing $U$ by $U \sm V(\gamma)$ we may assume that $\gamma$ vanishes nowhere on $U$.
    By the third point of \ref{localinverse} we have $\gamma \in \cO_X(U)^{\times}$.
    $(\gamma\inv)_x$ is an inverse to $g$.
\end{proof}

\begin{proposition}\label{proplocalring}
    Let $X = \Va(I) \subseteq \mathfrak{k}^n$ be equipped with its usual structure sheaf, where $I = \sqrt{I} \subseteq R = \mathfrak{k}[X_1,\ldots,X_n]$ . Let $x \in X$ and $A = \cO_X(X) \cong R / I$.
    $\{P \in  R | P(x) = 0\} \text{\reflectbox{$\coloneqq$}} \fn_x \subseteq R$ is maximal, $I \subseteq \fn_x$ and  $\mathfrak{m}_x \coloneqq \fn_x / I$ is the maximal ideal of elements of $A$ vanishing at $x$.
    If $\lambda \in  A \sm \mathfrak{m}_x$, we have $\lambda_x \in  \cO_{X,x}^{\times}$, where $\lambda_x$ denotes the image under $A \cong \cO_X(X) \to  \cO_{X,x}$.
    By the universal property of the localization, there exists a unique ring homomorphism $A_{\mathfrak{m}_x} \xrightarrow{\iota} \cO_{X,x}$ 
    such that 
    \begin{figure}[H]
        \centering
        \begin{tikzcd}
            A \arrow{r}{} \arrow{d}{\lambda \mapsto \lambda_x} & A_{\mathfrak{m}_x} \arrow[dotted, bend left]{ld}{\existsone \iota} \\
            \cO_{X,x}
        \end{tikzcd}
    \end{figure}
    commutes.
   
    The morphism $A_{\mathfrak{m}_x}\xrightarrow{\iota} \cO_{X,x}$ is an isomorphism.

\end{proposition}
\begin{proof}
    To show surjectivity, let $\ell = (U, \lambda) / \sim  \in  \cO_{X,x}$, where $U$ is an open neighbourhood of $x$ in $X$. 
    We have $X \sm U = V(J)$ where $J \subseteq A$ is an ideal. As $x \in U$ there is $f \in J$ with $f(x) \neq 0$. Replacing $U $ by $X \sm V(f)$ we may assume $U = X \sm V(f)$.
    By \ref{oxulocaf}, $\cO_X(U) \cong A_f$, and $\lambda = f^{-n}\vartheta$ for some $n \in \N$ and $\vartheta \in A$.
    Then $\ell = \iota(f^{-n} \vartheta)$ where the last fraction is taken in $A_{\mathfrak{m}_x}$.


    Let $\lambda = \frac{\vartheta}{g} \in  A_{\mathfrak{m}_x}$ with $\iota(\lambda) = 0$.
    It is easy to see that $\iota(\lambda) = (X \sm V(g), \frac{\vartheta}{g}) / \sim $.
    Thus there is an open neighbourhood $U$ of $x$ in $X \sm V(g)$ such that $\vartheta$ vanishes on $U$.
    Similar as before there is $h \in A$ with $h(x) \neq 0$ and $W = X \sm V(h) \subseteq U$.
    By the isomorphism $\cO_X(W) \cong A_h$, there is $n \in \N$ with $h^{n}\vartheta = 0$ in $A$. Since $h \not\in \mathfrak{m}_x$, $h$ is a unit and the image of $\vartheta$ in $A_{\mathfrak{m}_x}$ vanishes, implying $\lambda = 0$.
\end{proof}
\subsubsection{Intersection multiplicities and Bezout's theorem}
\begin{definition}
    Let $R = \mathfrak{k}[X_0,X_1,X_2]$  equipped with its usual grading and let $x \in \bP^{2}$.
Let $G \in R_g, H \in R_h$ be homogeneous polynomials with $x \in V(G) \cap V(h)$.
Let $\ell\in R_1$ such that $\ell(x) \neq 0$. Then $x \in U = \bP^2 \sm V(\ell)$ and the rational functions $\gamma = \ell^{-g}G, \eta = \ell^{-h}H$ are elements of $\cO_{\bP^2}(U)$.
Let $I_x(G,H) \subseteq \cO_{\bP^2,x}$ denote the ideal generated by $\gamma_x$ and $\eta_x$.


\noindent The dimension $\dim_{\mathfrak{k}}(\cO_{X,x} / I_x(G,H)) \text{\reflectbox{$\coloneqq$}} i_x(G,H)$ is called the \vocab{intersection multiplicity} of $G$ and $H$ at $x$. 
\end{definition}
\begin{remark}
    If $\tilde \ell \in R_1$ also satisfies $\tilde \ell(x) \neq 0$, then the image of $\tilde \ell / \ell$ under $\cO_{\bP^2}(U) \to \cO_{\bP^2,x}$ is a unit, showing that the image of $\tilde \gamma = \tilde \ell^{-g}  G$ in $\cO_{\bP^2,x}$ is multiplicatively equivalent to  $\gamma_x$, and similarly for $\eta_x$.
    Thus $I_x(G,H)$ does not depend on the choice of $\ell \in R_1$ with $\ell(x) \neq 0$.
\end{remark}
\begin{theorem}[Bezout's theorem]
    In the above situation, assume that $V(H)$ and $V(G)$ intersect properly in the sense that $V(G) \cap V(H) \subseteq \bP^2$ has no irreducible component of dimension $\ge 1$.
    Then 
    \[
        \sum_{x \in V(G) \cap V(H)} i_x(G,H) = gh
    \] 
    Thus, $V(G) \cap V(H)$ has $gh$ elements counted by multiplicity.
\end{theorem}
\printvocabindex
\end{document}
\if\false

% TODO REMARK ABOUT ZORNS LEMMA (LECTURE 1)

% TODO REMARK ABOUT FIN PRESENTED MODULES (LECTURE 2)


% TODO: LECTURE 9 LEMMA




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%            ÜBERSICHT              %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% List of forms of HNS


\begin{itemize}
    \item[HNS2 $\implies$ HNS1b] Let $I \subseteq \mathfrak{l}[X_1,\ldots,X_n]$. $I \subseteq \mathfrak{m}$ maximal. $R / \mathfrak{m}$ is isomorphic to a field extension of $\mathfrak{l}$. Finite by HNS2.
    \item[NNT $\implies$ HNS2] Apply NNT to $L / K$ $\leadsto$ alg. independent $a_i$ such that $L$ is finite over the image of $K[X_1,\ldots,X_n] \xrightarrow{\ev_a} L$ ($\ev_a : P \to P(a_1,\ldots,a_n)$).
        $\ev_a(K[X_1,\ldots,X_n])$ is a field by fact about integrality and fields \ref{fintaf}. Hence $n = 0$ and  $L / K$ is finite.
    \item[UNCHNS2] $K$ uncountable, $L / K$ fin. type. Then $\dim_K L$ is countable. Suppose $l \in L$ is not integral. Then $K(l) \cong K(T)$ and $\dim_K L \ge \dim_K K(T) \ge  \aleph_1$.
        Thus $L / K$ algebraic $\implies$ integral $\implies$ finite.
        \item[HNS3] ($V(I) \subseteq V(f) \iff f \in \sqrt{I} $). Suppose $V(I) \subseteq V(f)$. $R' \coloneqq \mathfrak{k}[X_1,\ldots,X_n, T], J \subseteq R'$ the ideal generated by $I$ and $g(X_1,\ldots,X_n,T) \coloneqq 1 - Tf(X_1,\ldots,X_n)$.
\end{itemize}


% Proofs
Def of integrality (<=>)


Fact  about integrality and field:
 % TODO


Technical lemma for Noether normalization: For $S \subseteq \N^n$ finite, there exists $k \in \N^n$ such that $k_1 = 1$ and $s_1 \neq s_2 \in S \implies \langle k, s_1 \rangle \neq  \langle k, s_2 \rangle$:
For $s_1 \neq s_2$, % TODO

Noether normalization: 
$a_i \in A$ minimal  such that $A$ is integral over the subalgebra genereted by the $a_i$.
Suppose $\exists P \in K[X_1,\ldots,X_n] \sm \{ 0\} ~ P(a_1,\ldots,a_n) = 0$. $P = \sum_{\alpha \in \N^n} p_\alpha X^\alpha, S \coloneqq \{ \alpha \in  \N^n | p_\alpha \neq 0\}$.
Choose $k$ as in the lemma.
$b_i \coloneqq a_{i+1} - a_1^{k_{i+1}}, 1 \le i <n$. Claim: $A$ is integral ober subalgebra $B$ generated by the $b_i$ ($\lightning$ minimality)
$Q(T) \coloneqq P(T, b_1 + T^{k_2}, \ldots, b_{n-1} + T^{k_n})$. $Q(a_1) = P(\vec a) = 0$.
For suitable $\beta_{\alpha, l} in B$:
\[
    T^{\alpha_1} \prod_{i=1}^{n-1} (b_i + T^{k_{i+1}})^{\alpha_{i+1}} = T^{w_k(\alpha)} + \sum_{l=0}^{w_k(\alpha) - 1}  \beta_{\alpha,l} T^l 
\]
Thus $Q(T) = p_\alpha T^{w_k(\alpha)} + \ldots$ where $\alpha \in S$ such that $w_k(\alpha)$ is maximal. Thus, $Q$ is normed.


% TODO Artin-Tate



% 
A first result of dimension theory:
$A \mathfrak{l}$-algebra of finite type, $\fp, \fq \in \Spec A, \fp \subsetneq \fq$. Then $\trdeg(\mathfrak{k}(\fp) /\mathfrak{l}) > \trdeg(\mathfrak{k}(\fq) / \mathfrak{l})$:
\Wlog  $\fp = \{0\}$ and $A$ a domain ($A' \coloneqq A / \fp$).
For $\fq \in \mSpec A$, $\mathfrak{k}(\fq) = A / \fq$ finite type, hence finite (HNS)  $\implies \trdeg(\mathfrak{k}(\fq) / \mathfrak{l}) = 0$.
$\trdeg(Q(A) / \mathfrak{l}) = 0 \implies A$ integral over $\mathfrak{k}$ $\implies$ $A$ a field $\implies \fp = \fq \lightning$.

If $\fq \not\in \mSpec A$, let $a_1,\ldots,a_n \in A$ alg. independent such that the $\overline{a_i}$ are a transcendence base for $\mathfrak{k}(\fq) / \mathfrak{k}$
Let $R$ be the ring generated by $\mathfrak{l}$ and the $a_i$. Localize with respect to $S \coloneqq R \sm \{0\}$.
%TODO
% TODO: LERNEN


% Dim k^n
$\dim(\mathfrak{k}^n)$
$ \ge  n$ build chian
$\le n$ a first result in dim  T ($\fp \subsetneq \fq \implies \trdeg(\mathfrak{k}(\fq) / \mathfrak{l}) < \trdeg(\mathfrak{k}(\fp) / \mathfrak{l})$. Thus $\codim(X,Y) \le \trdeg(\fK(Y) / \mathfrak{l}) - \trdeg(\fK(X) / \mathfrak{l})$.

TODO
% List of proofs of HNS


% Going up


% TODO proof of dim Y = trdeg(K(Y) / k)
$\dim Y \ge \trdeg(\mathfrak{k}(Y) / \mathfrak{k})$: Noether normalization. Subalgebra $\cong \mathfrak{k}[X_1,\ldots,X_d]$. Lift chain of prime ideals using going up.

% TODO prime avoidance


Action of $\Aut(L/K)$ on prime ideals of a normal ring extension. $A$ normal domain, $L / Q(A)$ normal field extension, $B$ int closure of $A$ in $L$, $\fp \in \Spec A$.
Then $\Aut(L / K)$ transitively acts on $\{\fq \in \Spec B | \fq \cap A = \fp\}$ :

\begin{itemize}
    \item $\fq,  \fr \in \Spec B$ lying over $\fp$.
    \item only need to show $\fq \subseteq \sigma(\fr)$ for some  $\sigma \in G$ (Krull going-up, no inclusions)
    \item Suppose not. Then  $x \in \fq \sm \bigcup_{\sigma \in G}  \sigma(\fr)$ (prime aviodance)
    \item $y = \prod_{\sigma \in G} \sigma(x) \in \fq \sm \fr$ ($\fr$ prime ideal)
    \item $\exists k \in \N$ s.t. $y^k \in K$ ($y \in L^G$)
    \item $y^k \in K \cap B = A $ ($A$ normal). Thus $y^k \in (A \cap \fq) \sm (A \cap \fr) = \fp \sm \fp$.
    \item  $L / K$ infinite: Apply Zorn to pairs $(M, \sigma)$ where $K \subseteq M \subseteq L$ and $\sigma \in \Aut(M /K)$ s.t. $\sigma(\fr \cap M) = \fq \cap M$.
\end{itemize}


Going down Krull %TODO

The ht p and trdeg
==================
% TODO % TODO % TODO %

% Definitions
Zariski-Topology, Spec, $\mathfrak{k}^n$
Residue field $\mathfrak{k}(\fp) \coloneqq Q(A / \fp), \fK(V(\fp)) \coloneqq \mathfrak{k}(\fp)$. TODO?
% Counterexamples
 no going-up
% list of definitions of codim, dim, trdeg, ht
Original (Noether normalization)
Artin-Tate
Uncountable fields
\begin{landscape}
\subsection{Übersicht}
{\rowcolors{2}{gray!10}{white}
    \begin{longtable}{lll}
  \end{longtable}
}

\end{landscape}


\end{document}
