\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz-cd}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{url}
\setlength{\parindent}{0pt}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{defn}[thm]{Definition}
\theoremstyle{definition}
\newtheorem{rem}[thm]{Remark}
\theoremstyle{definition}
\newtheorem{ex}[thm]{Example}
\newcommand{\catname}[1]{\textup{\textbf{#1}}}
\newcommand{\infcatname}[2]{\mathcal{#1}\textup{#2}}
\newcommand{\Set}{\catname{Set}}
\newcommand{\Sh}{\catname{Sh}}
\newcommand{\PSh}{\catname{PSh}}
\newcommand{\Kan}{\catname{Kan}}
\newcommand{\Top}{\catname{Top}}
\newcommand{\Grp}{\catname{Grp}}
\newcommand{\Ring}{\catname{Ring}}
\newcommand{\Cat}{\catname{Cat}}
\newcommand{\sSet}{\catname{sSet}}
\newcommand{\sCat}{\catname{sCat}}
\newcommand{\infcat}{\infcatname{C}{at}_{\infty}}
\newcommand{\biginfcat}{\widehat{\infcatname{C}{at}}_{\infty}}
\newcommand{\infgrpd}{\infcatname{G}{rpd}_{\infty}}
\newcommand{\biginfgrpd}{\widehat{\infcatname{G}{rpd}}_{\infty}}
\newcommand{\lpres}{\infcatname{P}{r}^{\textup{L}}}
\newcommand{\rpres}{\infcatname{P}{r}^{\textup{R}}}
\newcommand{\Res}{\infcatname{R}{es}}
\newcommand{\Gpd}{\infcatname{G}{pd}}
\newcommand{\Pos}[1]{\catname{Pos}_{#1}}
\newcommand{\Map}{\textup{Map}}
\newcommand{\Fun}{\textup{Fun}}
\newcommand{\Sub}{\textup{Sub}}
\newcommand{\Mono}{\textup{Mono}}
\newcommand{\Ind}{\textup{Ind}}
\newcommand{\Ps}{\mathcal{P}}
\newcommand{\id}{\textup{id}}
\newcommand{\colim}{\operatornamewithlimits{colim}}
\newcommand{\N}{\textup{N}}
\newcommand{\yon}{\textup{\textbf{y}}}
\newcommand{\mem}[1]{\textcolor{red}{#1}}
\newcommand{\Ab}{\catname{Ab}}
\newcommand{\Met}{\catname{Met}}
\newcommand{\Haus}{\catname{Haus}}
\newcommand{\CHaus}{\catname{CHaus}}
\newcommand{\Mon}{\catname{Mon}}
\newcommand{\CRng}{\catname{CRng}}
\newcommand{\Rel}{\catname{Rel}}
\newcommand{\CABA}{\catname{CABA}}
\newcommand{\Nat}{\textup{Nat}}
\newcommand{\At}{{\mathcal{A} \textit{t}}\ }
\newcommand{\Hom}{\textup{Hom}}
\newcommand{\im}{\textup{im}}
\title{Exercise sessions for the Algebra III course, fall semester 2021-22}
\author{Giulio Lo Monaco}
\date{}

\begin{document}
\section*{Week 1}
\begin{itemize}
\item[\textbf{Main examples}] The first and most natural examples of large categories typically contain sets with additional structures as objects and morphisms that are compatible with the given structures as morphisms. So for instance we have $\Set$, $\Grp$, $\Ab$, $\Met$, $\Ring$, $\Top$ etc...

\item[\textbf{Examples}] Not all categories have this look though. As a mild counterexample, we look at two large categories that have sets as objects but whose morphisms are not functions between them, although somewhat related.\\

$\catname{Rel}$ is thus constituted: the objects are sets; the morphisms are defined by $\catname{Rel}(A,B) = \mathcal{P}(A \times B)$, so they are precisely binary relations from $A$ to $B$. The identity on $A$ is simply $\Delta_A \subseteq A \times A$ and composition is defined as follows: for $R \subseteq A \times B$ and $S \subseteq B \times C$, we have

\begin{center}
$S \circ R = \{ (a,c) \in A \times C | \exists b \in B$ such that $(a,b) \in R$ and $(b,c) \in S \}$.
\end{center}

It's a simple check that this is in fact a category.\\

$\catname{Part}$ is thus constituted: the objects are again sets; a morphism from $A$ to $B$ is a pair $(A_0, f)$ where $A_0 \subseteq A$ and $f: A_0 \to B$ (think of a partially defined function $A \to B$. The identity on $A$ is $(A, \id_A)$ and the composition is

\begin{center}
$(B_0, g) \circ (A_0, f) = (f^{-1}(B_0), g \circ f_{|f^{-1}(B_0)})$.
\end{center}

\item[\textbf{Exercise}] Show that  $i: \mathbb{N} \hookrightarrow \mathbb{Z}$ is monic and epic in $\Mon$ but it is not an isomorphism.

\item[\textbf{Solution}] It is obviously monic, and obviously not surjective so not an isomorphism. In order to prove that it is epic, consider two monoid homomorphisms $f,g: \mathbb{Z} \to M$ such that $fi = gi$. Since the $i(n) = n$ for $n \geq 0$, in order to show that $f=g$ it only remains to prove that $f(-n) = g(-n)$. For this, compute

\begin{center}
$f(-n) = -f(n) = -fi(n) = -gi(n) = -g(n) = g(-n)$
\end{center}

where we use the condition on $f$ and $g$ and the fact that they are homomorphisms.

\item[\textbf{Exercise}] What is initial in $\catname{Rel}$? What is terminal?

\item[\textbf{Solution}] The initial object is $\emptyset$. Indeed, for any set $B$ we have $\emptyset \times B = \emptyset$ so it has a unique subset, that is, $\emptyset$ itself. For the same reason, $\emptyset$ is also terminal.

\item[\textbf{Definition}] A zero object is an object that is both initial and terminal. A category is called pointed if it has a zero object.

\item[\textbf{Exercise}] Is $\Set$ pointed? What about $\Top$, $\Cat$, $\Grp$, $\Ring$.

\item[\textbf{Solution}] $\Set$ is not pointed, becase it has an initial $\emptyset$ and a terminal $\ast$ and they are not isomorphic. Similarly for $\Top$ and $\Cat$, where the initial and terminal objects have the same underlying sets. $\Grp$ is pointed, because $\textbf{0}$ is both initial and terminal. In $\Ring$, $\textbf{0}$ is terminal but not initial: there is a homomorphism $\textbf{0} \to R$ if and only if $R = \textbf{0}$. On the other hand, $\mathbb{Z}$ is initial, because 0 must be sent to 0, 1 to 1, and the rest is determined by the homomorphism property.

\item[\textbf{Definition}] A pointed set is a pair $(X,x)$ where $x \in X$. The category $\Set_{\ast}$ of pointed sets has pointed sets as objects, and a morphism $(X,x) \to (Y,y)$ is a function $f: X \to Y$ such that $f(x) = y$.\\
Similarly, we define the category $\Top_{\ast}$ of pointed spaces and $\Cat_{\ast}$ of pointed small categories (not pointed as categories, but rather having a selected object that must be preserved by functors).

\item[\textbf{Definition}] Given a category $\mathcal{C}$ and an object $C$ therein, the category $C \downarrow \mathcal{C}$ has as objects pairs $(A,f)$ where $A \in \mathcal{C}$ and $f: C \to A$. A morphism from $(A,f)$ to $(B,g)$ is a morphism $h: A \to B$ such that $hf=g$. Dually we define the category $\mathcal{C} \downarrow C$ with objects being of the form $A \to C$.

\item[\textbf{Remark}] Oftentimes, when we have a terminal object $\ast$ in a non-pointed category $\mathcal{C}$, we can define the category of pointed objects as the category $\ast \downarrow \mathcal{C}$. This is the case, for instance, of $\Set$, $\Top$, $\Cat$ etc...\\
A function between sets $\ast \to X$ precisely selects an element of $X$, and a function that preserves this selection of points is precisely one that makes the diagram

\begin{center}
\begin{tikzcd}
& \ast \ar[dl] \ar[dr]\\
X \ar[rr] && Y
\end{tikzcd}
\end{center}

commutative.

\item Can we define something like pointed objects also in pointed categories? This depends on the specific properties of the categories.

\item[\textbf{Example}] We know that for a group $G$ there is an isomorphism $\Grp(\mathbb{Z},G) \cong G$, so the datum of a morphism $\mathbb{Z} \to G$ is precisely an arbitrary choice of an element $g \in G$, and a homomorphism preserving these choices is precisely a homomorphism $G \to H$ that makes the diagram

\begin{center}
\begin{tikzcd}
& \mathbb{Z} \ar[dl] \ar[dr]\\
G \ar[rr] && H
\end{tikzcd}
\end{center}

commutative. In other words, the category $\mathbb{Z} \downarrow \Grp$ is something like the category of pointed groups.\\
Similarly, we have an isomorphism $\Ring(\mathbb{Z}[x], R) \cong R$, because $\mathbb{Z}$ is initial and $x$ can be sent anywhere, thus determining a full homomorphism $\mathbb{Z}[x] \to R$. So the category $\mathbb{Z}[x] \downarrow \Ring$ is something like the category of pointed rings.

\item[\textbf{Products and coproducts}] Let us examine products and coproducts in $\Grp$. For two groups $G$ and $H$, the product is $G \times H$ with the pointwise group structure and the natural projections $p_1: G \times H \to G$ and $p_2: G \times H \to H$. Given another group $A$ with homomorphisms $f: A \to G$ and $f': A \to H$, define $(f,f'): A \to G \times H$ as $a \mapsto (f(a), f'(a))$. This is clearly a homomorphism, and clearly $p_1 \circ (f,f') = f$ and $p_2 \circ (f,f') = f'$. Moreover, it is unique, in that if we have another morphism $q: A \to G \times H$ such that $p_1 q = f$ and $p_2 q = f'$, then compute the element $q(a)$ for $a \in A$. It must be of the form $(g,h) \in G \times H$. Now we have

\begin{center}
$g = p_1 (g,h) = p_1 q(a) = f(a)$
\end{center}

and similarly $h = f'(a)$.\\

The coproduct is the so called free product $G \ast H$. Its elements are equivalence classes of words $(s_1, \ldots, s_n)$ where for each $i=1, \ldots, n$ we have either $s_i \in G$ or $s_i \in H$. The equivalence relation is that generated by

\begin{center}
$(\ldots, s_i, s_{i+1}, \ldots) \sim (\ldots, s_i s_{i+1}, \ldots)$
\end{center}

whenever $s_i$ and $s_{i+1}$ belong to the same group. The product operation is given by concatenation. The inclusions $i_1: G \to G \ast H$ and $i_2: H \to G \ast H$ are given by $i_1(g) = [g]$ and $i_2(h) = [h]$.\\
Now, given two homomorphisms $f: G \to A$ and $f': H \to A$, we define $\{ f, f' \}: G \ast H \to A$ as $[s_1, \ldots, s_n] \mapsto f_1 (s_1) \cdots f_n (s_n)$ where $f_i = f$ if $s_i \in G$ and $f_i = f'$ if $s_i \in H$. This is well-defined by the very definition of the equivalence relation and the fact that $f$ and $f'$ are homomorphisms. It is also clearly a homomorphism, and we have $\{ f, f' \} \circ i_1 = f$ and $\{ f, f' \} \circ i_2 = f'$. Moreover, this is unique, because given another $q: G \ast H \to A$ such that $q i_1 = f$ and $q i_2 = f'$, this condition says that $q([g]) = f(g)$ and $q([h]) = f'(h)$, so the homomorphism property implies

\begin{center}
$q([s_i, \ldots, s_n]) = q([s_1] \cdots [s_n]) = q([s_1]) \cdots q([s_n]) = f_1(s_1) \cdots f_n(s_n)$.
\end{center}
\end{itemize}

\section*{Week 2}
\begin{itemize}
\item[\textbf{Review}] In predicate logic, a language is defined to be a set of symbols for variables, a set of symbols for relations, a set of symbols for functions, and the fixed set $\{ \approx, \wedge, \neg, \forall \}$.\\
Starting with these, one can expand the dictionary with shortcuts, such as $p \vee q : = \neg(\neg p \wedge \neg q)$, or $p \rightarrow q := \neg p \vee q$, or yet $\exists x p(x) := \neg \forall x \neg p(x)$.\\

On the other hand, in equational logic we only have symbols for variables, for functions and the set $\{ \approx, \wedge, \forall \}$. The absence of $\neg$ in particular implies that we don't have $\vee$, $\rightarrow$, $\exists$ among others.

\item[\textbf{Example}] Some objects can be axiomatizable in a certain context using the full power of predicate logic but also admit an equivalent axiomatization in equational logic.\\
A lattice can be defined to be a poset with all finite joins and meets. In this case, the axioms saying that the relation is an order relation use the $\rightarrow$ connector, moreover the definition of joins and meets in a poset also requires the use of $\rightarrow$, because it says that for every element that is bigger than something, \emph{then} it is also bigger than the join, etc...\\

A lattice can also be formulated as having two binary operations $\vee$ and $\wedge$ subject to the axioms:

\begin{itemize}
\item[Commutativity] $\forall x \forall y x \vee y \approx y \vee x$;
\item[Associativity] $\forall x \forall y \forall z (x \vee y) \vee z \approx x \vee (y \vee z)$;
\item[Idempotency] $\forall x x \vee x \approx x$;
\item[Absorption] $\forall x \forall y x \approx x \vee (x \wedge y)$
\end{itemize}

and their duals obtained inverting the symbols $\vee$ and $\wedge$.\\

It is clear that a lattice in the former definition gives rise to one in the latter. For the opposite direction, observe that you can define the binary relation $\leq$ as $x \leq y := x \approx x \wedge y$ and then verify that this is a poset having $\vee$ and $\wedge$ as joins and meets respectively.

\item[\textbf{Exercise}] For an algebra $A$ and a subset $X \subseteq A$, define $\langle X \rangle$ to be the smallest subalgebra of $A$ that contains $X$ or, alternatively, the intersection of all the subalgebras of $A$ that contain $X$. How can this be written explicitly?

\item[\textbf{Solution}] Define the operator

\begin{center}
$EX := X \cup \{ f(x_1, \ldots, x_n) | x_1, \ldots, x_n \in X$, $f$ is an $n$-ary operation of $A \}$.
\end{center}

Then we have $\langle X \rangle = \bigcup_{n \in \mathbb{N}} E^n X$. Indeed, if $X \subseteq A_0$ and $A_0$ is a subalgebra of $A$, then $EX \subseteq A_0$ because it is closed under all operations, and by iterating this we obtain $\langle X \rangle \subseteq A_0$. Moreover, $\langle X \rangle$ is a subalgebra of $A$ because if $x_1, \ldots, x_n \in \langle X \rangle$, then there is an $n$ such that they are in $E^n X$. If $f$ is an $n$-ary function symbol, then by definition we have $f(x_1, \ldots, x_n) \in E^{n+1} X \subseteq \langle X \rangle$.

\item[\textbf{Normal subgroups}] In groups, there is a bijective correspondence between congruences and normal subgroups.\\
Given a congruence $\sim$, define $N = [1]$. This a subgroup because if $a \sim 1$ and $b \sim 1$ then $ab \sim 1$ because $\sim$ is compatible with the product. Moreover, if $a \sim 1$ then $a^{-1} \sim 1^{-1} = 1$. Moreover, this subgroup is normal because if $a \in N$ then for $h \in G$ we have $hah^{-1} \sim hh^{-1} = 1$, which follows by $a \sim 1$ and $\sim$ being compatible with the product.\\
Viceversa, let $N$ be a normal subgroup, and define $a \sim b$ if and only if $ab^{-1} \in N$. Now we have

\begin{itemize}
\item[Reflexivity] $aa^{-1} = 1 \in N$ because $N$ is a subgroup;
\item[Symmetricity] $ab^{-1} \in N$ then $ba^{-1} = (ab^{-1})^{-1} \in N$ similarly;
\item[Transitivity] $ab^{-1} \in N$ and $bc^{-1} \in N$ then $ac^{-1} = ab^{-1}bc^{-1} \in N$ similarly;
\item[Compatibility] $ac^{-1} \in N$ and $bd^{-1} \in N$ then by normality $abd^{-1}a^{-1} \in N$ so $abd^{-1}a^{-1}ac^{-1} \in N$ but this is $abd^{-1}c^{-1} = (ab)(cd)^{-1}$.
\end{itemize}

\item[\textbf{Ideals}] In rings, we have a similar correspondence between congruences and ideals. Given a congruence $\sim$ we can define $I = [0]$. It is closed under sums by compatibility, and moreover if $a \in I$, that is, $a \sim 0$, for any $b \in R$ we have $ab \sim 0b = 0$, so $ab \in I$ and $I$ is an ideal.\\
Conversely, given an ideal $I$, we define $a \sim b$ if and only if $a-b \in I$. As above, this is an equivalence relation. We need to prove that it is compatible with both sum and product.

\begin{itemize}
\item[Sum] If $a-c \in I$ and $b-d \in I$ then $a+b-c-d \in I$;
\item[Product] Multiplying $a-c$ on the right and knowing that $I$ is an ideal, we obtain $ab - cb \in I$, similarly we obtain $cb - cd \in I$. Adding these two elements, we have $ab - cb + cb - cd = ab - cd \in I$.
\end{itemize}

\item[\textbf{Kernels}] For groups, rings and a number of other commonly studied algebraic structure, whenever we have a homomorphism $f: A \to B$, the kernel $\textup{ker} f \subseteq A$ corresponds to a congruence. Following the above and calling this congruence also $\textup{ker} f$, we have

\begin{center}
$a \sim b \Leftrightarrow ab^{-1} \in \textup{ker} f \Leftrightarrow f(ab^{-1}) = 1 \Leftrightarrow f(a)f(b)^{-1} = 1 \Leftrightarrow f(a) = f(b)$.
\end{center}

This allows to generalize the concept of kernel to any type of algebras.

\item[\textbf{Definition}] $\textup{ker} f = \{ (a,b) \in A^2 | f(a) = f(b) \}$.

\item[\textbf{Theorem}] Just as in the known cases of groups and rings, we have for general algebras the isomorphism theorem: given a homomorphism $f: A \to B$, this induces a congruence on $A$, therefore a quotient $\pi: A \to A/\textup{ker} f$ so that $f$ factors uniquely as

\begin{center}
\begin{tikzcd}
A \ar[dr, "\pi"] \ar[rr, "f"] && B\\
& A/\textup{ker} f \ar[ur, dotted, "t"].
\end{tikzcd}
\end{center}

Of course, $t$ is defined as $[a] \mapsto f(a)$.

\item[\textbf{Definition}] An element of a lattice $x \in X$ is called compact if for every subset $A \subseteq X$ such that $x \leq \bigvee A$ there is a finite subset $A_0 \subseteq A$ such that $x \leq \bigvee A_0$.

\item[\textbf{Definition}] A lattice is called compactly generated if every element is a supremum of compact elements.

\item[\textbf{Definition}] A lattice is called algebraic if it is complete and compactly generated.

\item[\textbf{Lattices of algebras}] Given an algebra $A$, we can take the set of its subalgebras $S \hookrightarrow A$. These are ordered by $S \leq S'$ if and only if $S$ can be embedded into $S'$ as subalgebras of $A$. We have formed a poset $\textup{Sub} A$.\\
Similarly, we can take the set of all congruences on $A$ (or quotients $A \twoheadrightarrow A/\sim$ and order it by $\sim \leq \sim'$ if and only if $a \sim b$ implies $a \sim' b$, in other words when there is a factorization

\begin{center}
\begin{tikzcd}
A \ar[dr] \ar[rr] && A/\sim'\\
& A/\sim \ar[ur].
\end{tikzcd}
\end{center}

This also forms a poset, that we are going to call $\textup{Con} A$.

\item[\textbf{Theorem}] Given an algebra $A$, then both posets $\textup{Sub} A$ and $\textup{Con} A$ are algebraic lattices. Moreover, given an algebraic lattice $L$ there is a set of operations $\Omega$ and an $\Omega$-algebra $A$ such that $L \cong \textup{Sub} A$.
\end{itemize}

\section*{Week 3}
We want to prove the part about subalgebras in the last stated theorem.

\begin{itemize}
\item[\textbf{Definition}] A closure operator on a set $A$ is a function $C: \mathcal{P}(A) \to \mathcal{P}(A)$ such that

\begin{itemize}
\item[C1] $\forall X \subseteq A$, $X \subseteq C(X)$;
\item[C2] $\forall X \subseteq A$, $C^2(X) = C(X)$;
\item[C3] $\forall X,Y \subseteq A$, if $X \subseteq Y$ then $C(X) \subseteq C(Y)$.
\end{itemize}

\item[\textbf{Definition}] Given a closure operator $C$, a closed subset is a subset $X$ such that $C(X) = X$. We define $L_C$ to be the poset of closed subsets under inclusion.

\item[\textbf{Proposition}] $L_C$ is a complete lattice.

\item[\textbf{Proof}] It suffice to observe that, for a family $C(X_i)_{i \in I}$ of closed subsets, we can define

\begin{center}
$\bigvee_{i \in I} C(X_i) = C(\bigcup_{i \in I} X_i)$ and
$\bigwedge_{i \in I} C(X_i) = \bigcap_{i \in I} C(X_i)$
\end{center}

and observe that they are both closed subsets and play the roles of join and meet respectively.

\item[\textbf{Proposition}] Given $L$ a complete lattice, then there is a closure operator $C$ such that $L \cong L_C$.

\item[\textbf{Proof}] For $X \subseteq L$, define

\begin{center}
$C(X):= \{ a \in L | a \leq \bigvee X \}$.
\end{center}

This is a closure operator, and its closed subsets are precisely those containing their join. So we have a bijection $L \leftrightarrow L_C$ given by $b \mapsto \{ a \in L | a \leq b \}$ to the right, and by $X \mapsto \bigvee X$ to the left.

\item[\textbf{Definition}] A closure operator $C$ is algebraic if

\begin{itemize}
\item[C4] $\forall X \subseteq A$, $C(X) = \bigcup \{ C(Y)$, $Y \subseteq X$ finite $\}$.
\end{itemize}

\item[\textbf{Proposition}] Given an algebraic closure operator, then $L_C$ is an algebraic lattice.

\item[\textbf{Proof}] We only need to show that $L_C$ is compactly generated. Given C4, this follows by proving that compact elements are precisely those of the form $C(X)$ for a finite set $X$, so we are reduced to proving that.\\
Suppose $X = \{ a_1, \ldots, a_k \}$, and suppose that

\begin{center}
$C(X) \subseteq \bigvee_{i \in I} C(A_i) = C(\bigcup_{i \in I} A_i)$.
\end{center}

For $a_j \in X$, by C1 and C4 there is a finite $X_j \subseteq \bigcup_{i \in I} A_i$ such that $a_j \in C(X_j)$. By finiteness, $X_j \subseteq A_{j1} \cup \cdots \cup A_{jn_j}$, so that $a_j \in C(A_{j1} \cup \cdots \cup A_{jn_j})$.\\
Therefore, we have $X \subseteq \bigcup_{1 \leq j \leq k} C(\bigcup_{1 \leq i \leq n_j} A_{ji}) \subseteq C(\bigcup_{\substack{1 \leq j \leq k \\ 1 \leq i \leq n_j}} A_{ji}$. Applying $C$ and using C3 and C2, we obtain $C(X) \subseteq C(\bigcup A_{ji})$ so $C(X)$ factors through a finite join and it is compact.\\
Conversely, assume that $C(X)$ is compact. By C4, we have $C(X) \subseteq \bigcup \{ C(Y_i)$, $Y_i \subseteq X$ finite $\}$. Using compactness, there is a finite set of indices $I_0$ such that $C(X) \subseteq \bigcup_{i \in I_0} C(Y_i) \subseteq C(\bigcup_{i \in I_0} Y_i)$. Moreover, $\bigcup_{i \in I_0} \subseteq X$, therefore applying C3 we obtain $C(\bigcup_{i \in I_0} \subseteq C(X)$. In conclusion, we just proved that $C(X) = C(\bigcup Y_i)$ and the union on the right-hand side is a finite union of finite sets, so it is finite and we are finished.

\item[\textbf{Proposition}] If $L$ is an algebraic lattice, then $L \cong L_C$ for some algebraic closure operator $C$.

\item[\textbf{Proof}] Define $A$ to be the set of all compact elements of $L$, and for every $X \subseteq A$

\begin{center}
$C(X) := \{ a \in A | a \leq \bigvee X \}$.
\end{center}

This is a closure operator. Let us show that it is algebraic. If $a \in C(X)$, then $a \leq \bigvee X$, and since $a$ is compact we must have $a \leq \bigvee Y$ for some finite $Y \subseteq X$. By definition, this means that $a \in C(Y)$, which proves C4.\\
An isomorphism $L \cong L_C$ is given by $a \mapsto \{ b \leq a \}$ to the right, and $X \mapsto \bigvee X$ to the left. They are mutually inverse, using that $L$ is compactly generated.

\item[\textbf{Proposition}] Given an algebra $A$, then $\textup{Sub} A$ is an algebraic lattice.

\item[\textbf{Proof}] The operator $\langle - \rangle$ on subsets of $A$ is clearly a closure operator. Since $L_{\langle - \rangle} = \textup{Sub} A$, we only need to show that $\langle - \rangle$ is algebraic. If $E$ is the operator that closes only once under all the operations of $A$, then we have, for every $X \subseteq A$,

\begin{center}
$\langle X \rangle = \bigcup_{n \in \mathbb{N}} E^n X$.
\end{center}

If $a \in \langle X \rangle$, then for some $n$ we have $a \in E^nX$. This means that it is of the form $a = f(a_1, \ldots, a_k)$ for some $k$-ary operation $f$, and $a_1, \ldots, a_k \in E^{n-1} X$. The point is that the $a_i$'s are in finite amount, and we can reproduce the reasoning for each one of them, obtaining a finite set of elements of $E^{n-2} X$. Iterating this procedure until we reach $E^0 X = X$, we have obtained a finite set $Y \subseteq X$, such that $a \in E^n Y$, so $a \in \langle Y \rangle$. This proves C4.

\item[\textbf{Proposition}] If $L$ is an algebraic lattice, then $L \cong \textup{Sub} A$ for some algebra $A$.

\item[\textbf{Proof}] We know that $L \cong L_C$ for some algebraic closure operator $C$ on a set $A$. We will define an algebra structure on $A$ in such a way that $\textup{Sub} A \cong L_C$.\\
For each finite $B \subseteq A$ and each $b \in C(B)$, calling $n: = |B|$ we define an $n$-ary operation

\begin{center}
$f_{B,b}(a_1, \ldots, a_n)
\begin{cases}
b \quad \text{if } B = \{ a_1, \ldots, a_n \} \\
a_1 \quad \text{otherwise.}
\end{cases}$
\end{center}

Analyzing all possible values of such an $f_{B,b}$, this implies that, for a subset $A \subseteq A$ and elements $a_1, \ldots, a_n \in X$ then

\begin{center}
$f_{B,b}(a_1, \ldots, a_n) \in C(\{a_1, \ldots, a_n \}) \subseteq C(X)$.
\end{center}

By definition of $EX$, this means precisely that $EX \subseteq C(X)$. By iterating this, we see that for each $n \in \mathbb{N}$ we have $E^n X \subseteq C(X)$ so that $\langle X \rangle \subseteq C(X)$.\\
On the other hand, for a finite $B \subseteq X$ given by $B = \{ a_1, \ldots, a_n$ we have $C(B) = \{ f_{B,b}(a_1, \ldots, a_n | b \in C(B) \} \subseteq EB \subseteq \langle B \rangle \subseteq \langle X \rangle$. Using C4, this implies $C(X) \subseteq \langle X \rangle$.\\
In conclusion, we have proven that $\langle - \rangle = C$, so $L_C = L_{\langle - \rangle}$, but the closed subsets under $\langle - \rangle$ are precisely subalgebras of $A$, so this is precisely $\textup{Sub} A$.

\item[\textbf{HSP theorem}] Given a class of objects that are structures for some signature, then this is precisely the class of all algebras for some equational theory if and only if it is closed under subalgebras, homomorphic images and arbitrary products.

\item[\textbf{Remark}] The first part of the statement means that when we look at such a class of objects, we must already know that they are sets with certain operations defined on them. The question is whether these operations satisfy the axioms of some equational theory.

\item[\textbf{Exercise}] Are lattices algebras for an equational theory? What about complete lattices? Integral domains? Fields? Vector spaces?

\item[\textbf{Solution}] Using the HSP theorem, we see that lattices are algebras for an equational theory. Complete lattices are not, in that they are not closed under subalgebras, think for example of $\mathbb{N} \subset \mathbb{N} \cup \{ \infty \}$. This reflects the fact that we need implication symbols in order to define infinite joins and meets, but the theorem tells us much more: it says that there is no way of axiomatizing complete lattice that happens to be equational. Integral domains also are not, because they're not closed under products. Indeed, if $R$ and $S$ are integral domains, take $(0,1), (1,0) \in R \times S$, so $(0,1)(1,0)=(0,0)$. Therefore, fields are likewise not algebras for an equational theory. Vector spaces on a fixed base field are, which reflects the fact that, although it is impossible to equationally define multiplicative inversion for fields, we can circumvent this issue in defining vector spaces by defining a unary operation for each element of the field, and then subjecting those to equational axioms.

%\item[\textbf{Example}] A somewhat surprising example is $\CHaus$, the category of compact Hausdorff spaces. It turns out that it is possible to define these objects as algebraic structures, and they are in addition algebras for an equational theory, although this theory possibly contains a proper class of axioms.
\end{itemize}

\section*{Week 4}
Our next purpose will be to create a connection between the language of universal algebra and category theory. We will first explore the relation between two ubiquitous category-theoretic concepts, adjunctions and monads.

\begin{itemize}
\item[\textbf{Definition}] An adjunction between two categories is a pair of functors $L: \mathcal{C} \leftrightarrows \mathcal{D}: R$ such that, for every pair of objects $C \in \mathcal{C}$ and $D \in \mathcal{D}$ we have bijections

\begin{center}
$\mathcal{D}(LC,D) \cong \mathcal{C}(C,RD)$
\end{center}

that are natural in the sense that, for two morphisms $f: C' \to C$ and $g: D \to D'$ in the respective categories, the square

\begin{center}
\begin{tikzcd}
\mathcal{D}(LC,D) \ar{d}[swap]{\mathcal{D}(Lf,g)} \ar[r, "\cong"] & \mathcal{C}(C,RD) \ar{d}{\mathcal{C}(f,Rg)}\\
\mathcal{D}(LC',D') \ar[r, "\cong"] & \mathcal{C}(C',RD')
\end{tikzcd}
\end{center}

is commutative. We also denote adjunctions by $L \dashv R$.

\item[\textbf{Definition}] In the situation above, consider the bijection $\mathcal{D}(LC,LC) \cong \mathcal{C}(C,RLC)$. There is a unique morphism $\eta_C:C \to RLC$ corresponding to $\id_{LC}$ via this bijection. By the naturality conditions on an adjunction, all the morphisms $\eta_C$ aggregate into a natural transformation $\id_{\mathcal{C}} \to RL$, which is called the unit of the adjunction.\\
Analogously we obtain morphisms $\varepsilon: LRD \to D$ which aggregate into a natural transformation $\varepsilon: LR \to \id_{\mathcal{D}}$, known as the counit of the adjunction.

\item[\textbf{Example}] The functors $F: \Set \leftrightarrows \Grp:U$ are one of the archetypical examples of adjunction. Indeed, by the universal property of adjunctions says that whenever we have a set $X$ and a group $G$ with a function $f: X \to UG$, then there is a unique group homomorphism $k: FX \to G$ such that the triangle

\begin{center}
\begin{tikzcd}
X \ar[rr, "f"] \ar[rd] && UG\\
& UFX \ar[ur, "Uk", swap]
\end{tikzcd}
\end{center}

commutes.\\
For a set $X$, the unit $X \to UFX$ is the natural inclusion of elements of $X$ as words of length 1 in the free group. For a set $G$, the counit $FUG \to G$ takes a finite word of elements of $G$ and takes it to the product of all of them.

\item[\textbf{Definition}] A monad on a category $\mathcal{C}$ is a functor $T: \mathcal{C} \to \mathcal{C}$, with two natural transformations $\mu: T^2 \to T$ and $\eta: \id \to T$, called the multiplication and unit of the monad respectively, such that the diagrams

\begin{center}
\begin{tikzcd}
T^3 \ar[r, "T \mu"] \ar[d, "\mu_T", swap] & T^2 \ar[d, "\mu"]\\
T^2 \ar[r, "\mu", swap] & T
\end{tikzcd}
\hspace{50pt}
\begin{tikzcd}
T \ar[r, "T \eta"] \ar[dr, "\id_T", swap] & T^2 \ar[d, "\mu"] & T \ar[l, "\eta_T", swap] \ar[dl, "\id_T"]\\
& T
\end{tikzcd}
\end{center}

are commutative. The first is known as the associativity condition and the second as the unitality conditions.

\item[\textbf{Definition}] Given a monad $(T,\mu,\eta)$, a $T$-algebra is an object $C \in \mathcal{C}$ with a morphism $h: TC \to C$ satisfying the condition that the diagrams

\begin{center}
\begin{tikzcd}
T^2 C \ar[r, "Th"] \ar[d, "\mu_C", swap] & TC \ar[d, "h"]\\
TC \ar[r, "h", swap] & C
\end{tikzcd}
\hspace{50pt}
\begin{tikzcd}
C \ar[r, "\eta_C"] \ar[dr, "\id_C", swap] & TC \ar[d, "h"]\\
& C
\end{tikzcd}
\end{center}

are commutative. This says that the “algebraic” structure that we put on $C$ is compatible with the requirements dictated by the monad $T$.\\
A $T$-homomorphism between $T$-algebras $(C,h)$ and $(D,k)$ is a morphism $f: C \to D$ such that the square

\begin{center}
\begin{tikzcd}
TC \ar[d, "h", swap] \ar[r, "Tf"] & TD \ar[d, "k"]\\
C \ar[r, "f", swap] & D
\end{tikzcd}
\end{center}

is commutative. In other words, it is compatible with the “algebraic” structures of $C$ and $D$.

\item[\textbf{Example}] Given a monad $T$, there is a category $\textup{Alg}(T)$ whose objects are $T$-algebras and whose morphisms are $T$-homomorphisms. Clearly, there is a functor $U^T: \textup{Alg}(T) \to \mathcal{C}$ which simply forgets the additional structure. Moreover, there is a functor $F^T: \mathcal{C} \to \textup{Alg}(T)$ which takes an object $C$ to the “free $T$-algebra on $C$”, that is, the pair $(TC, \mu_C)$. This is a $T$-algebra by definition of monad. It is called free because, similarly to other definitions of freeness, it satisfies no conditions other than those declared by the monad itself.\\
There is an adjunction $F^T \dashv U^T$ (this is left as an exercise).

\item[\textbf{Example}] Given an adjunction $L: \mathcal{C} \leftrightarrows \mathcal{D}:R$, we can construct a monad on $\mathcal{C}$ as follows: set $T:= RL$. As a multiplication $\mu: T^2 \to T$, we take $R \varepsilon_L: RLRL \to RL$, and as a unit $\eta: \id \to T$ we simply take the unit of the adjunction $\eta: \id \to RL$. The conditions of a monad are satisfied by the naturality of an adjunction. We also say that $T$ is the monad induced by the adjunction $L \dashv R$.

\item[\textbf{Definition}] A fork is a diagram \begin{tikzcd} a \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & b \ar[r, "e"] & c \end{tikzcd} in a category. It is a coequalizer if it is a colimit diagram, i.e. $ef_0 = ef_1$ and for every other map $t: b \to d$ such that $tf_0 = tf_1$, then there exists a unique $q: c \to d$ such that $qe = t$. Intuitively, the morphism $e: b \to c$ is the minimal thing that equalizes $f_0$ and $f_1$ by postcomposition.

\item[\textbf{Definition}] An absolute coequalizer is a fork whose image along any functor is a coequalizer. In particular, it is obviously a coequalizer itself after pulling it through the identity functor.

\item[\textbf{Definition}] A split fork is a fork as above such that there exist maps \begin{tikzcd} a & b \ar[l, "t", swap] & c \ar[l, "s", swap] \end{tikzcd} satisfying $ef_0 = ef_1$, $es = \id_c$, $f_0 t = \id_b$ and $f_1 t = se$.

\item[\textbf{Example}] Every split fork is in particular an absolute coequalizer (left as an exercise). Therefore, we will in the following also say split coequalizer for split fork.

\item[\textbf{Example}] If $T$ is a monad and $(x,h)$ is a $T$-algebra, then the diagram \begin{tikzcd} T^2 x \ar[r, shift left, "\mu_x"] \ar[r, shift right, "Th", swap] & Tx \ar[r, "h"] & x \end{tikzcd} is a split fork. Indeed, if we consider the arrows \begin{tikzcd} T^2 x & Tx \ar[l, "\mu_{Tx}", swap] & x \ar[l, "\eta_x", swap] \end{tikzcd}, we have $h \circ \mu_x = h \circ Th$ and $h \circ \eta_x = \id_x$ by definition of $T$-algebra, $\mu_x \circ \eta_{Tx} = \id_{Tx}$ by definition of monad, and $Th \circ \eta_{Tx} = \eta_x \circ h$ by naturality of $\eta$. As a consequence, for every $T$-algebra there is a split coequalizer diagram as above.

\item We only need one last ingredient before embarking into our journey which will eventually relate adjunctions and monads in a precise way. This relation will then be applied to constructions from universal algebra.

\item[\textbf{Definition}] A functor $F: \mathcal{C} \to \mathcal{D}$ creates coequalizers if, whenever we have a diagram $a \rightrightarrows b$ in $\mathcal{C}$ such that $Fa \rightrightarrows Fb$ admits a coequalizer $e: Fb \to d$, then there exists a unique $k: b \to c$ such that $Fk = e$ and, moreover, the diagram $a \rightrightarrows b \rightarrow c$ is itself a coequalizer.

\item[\textbf{Lemma}] Assume we are given a solid diagram

\begin{center}
\begin{tikzcd}
\mathcal{D}' \ar[rr, dotted, "K"] \ar[dr, shift left, "R'"] && \mathcal{D} \ar[dl, shift left, "R"]\\
& \mathcal{C} \ar[ul, shift left, "L'"] \ar[ur, shift left, "L"]
\end{tikzcd}
\end{center}

where the arrows form two adjunctions inducing the same monad $T$. Moreover, assume that $R$ creates coequalizers for all pairs $f_0,f_1$ such that $Rf_0,Rf_1$ have a split coequalizer.\\
Then, there exists a unique comparison functor $K: \mathcal{D}' \to \mathcal{D}$ such that $KL' = L$ and $RK = R'$.

\item[\textbf{Proof}] If $K$ exists, observe that we have $LRK = KL'R'$ and $K \varepsilon' = \varepsilon_K$. We need to prove that $K$ is unique, and in the follwing we will freely use the equalities just mentioned. For an object $d' \in \mathcal{D}'$, consider the fork

\begin{center}
\begin{tikzcd}
L'R'L'R'd' \ar[r, shift left, "\varepsilon'_{L'R'd'}"] \ar[r, shift right, "L'R'\varepsilon'_{d'}", swap] & L'R'd' \ar[r, "\varepsilon'_{d'}"] & d'.
\end{tikzcd}
\end{center}

Applying $K$ to shis fork, we obtain

\begin{center}
\begin{tikzcd}
LRLR'd' \ar[r, shift left, "\varepsilon_{LR'd'}"] \ar[r, shift right, "LR'\varepsilon'_{d'}", swap] & LR'd' \ar[r, "K\varepsilon'_{d'}"] & Kd'.
\end{tikzcd}
\end{center}

Applying $R$ to this second fork, we obtain

\begin{center}
\begin{tikzcd}
RLRLR'd' \ar[r, shift left, "R\varepsilon_{LR'd'}"] \ar[r, shift right, "RLR'\varepsilon'_{d'}", swap] & RLR'd' \ar[r, "R'\varepsilon'_{d'}"] & R'd'
\end{tikzcd}
\end{center}

which is a particular case of the split fork in the example above, applied to the free $T$-algebra on $R'd'$. Since $R$ creates split coequalizers, then there is a unique $k: LR'd' \to d$ such that $Rk = R'\varepsilon_{d'}$. But we already know by the above discussion that $K\varepsilon'_{d'}: LR'd' \to Kd'$ has this property, so it must be $K\varepsilon'_{d'} = k$. In particular, we have $Kd = k$, so that $K$ is uniquely determined on objects. Moreover, we know that $k$ is a coequalizer (again by the assumption on the creation of coequalizers). For a morphism $f: d' \to d''$, we have an induced diagram

\begin{center}
\begin{tikzcd}
LRLR'd' \ar[r, shift left, "\varepsilon_{LR'd'}"] \ar[r, shift right, "LR'\varepsilon'_{d'}", swap] \ar[d, "LRLR'f", swap] & LR'd' \ar[r, "K\varepsilon'_{d'}"] \ar[d, "LR'f"] & Kd' \ar[d, "Kf"]\\
LRLR'd' \ar[r, shift left, "\varepsilon_{LR'd''}"] \ar[r, shift right, "LR'\varepsilon'_{d''}", swap] & LR'd'' \ar[r, "K\varepsilon'_{d''}", swap] & Kd''
\end{tikzcd}
\end{center}

where the horizontal arrows constitutes forks as the second above. Since as we have shown they are coequalizers, there is a unique factorization $q: Kd' \to Kd''$ which makes the right square commute, but we know that $Kf$ already does the job, so $Kf = q$. Therefore $K$ is also uniquely determined on morphisms, and we are done.\\
Now we need to show that such a $K$ exists. We already know that, if it does, it must have the form above, so let us define it as a coequalizer in the first line of the diagram

\begin{center}
\begin{tikzcd}
LR'L'R'd' \ar[r, shift left] \ar[r, shift right] \ar[d, "LR'L'R'f"] & LR'd' \ar[r] \ar[d, "LR'f"] & Kd' \ar[d, dotted]\\
LR'L'R'd'' \ar[r, shift left] \ar[r, shift right] & LR'd'' \ar[r] & Kd''.
\end{tikzcd}
\end{center}

If we have a morphism $f: d' \to d''$, this induces the diagram above which, by universal property of the coequalizer $Kd'$, induces a unique morphism $Kd' \to Kd''$ which makes the right square commute. This will be the value of $Kf$, so we have defined a functor $K: \mathcal{D}' \to \mathcal{D}$.\\
Now there is a fork of the form

\begin{center}
$RLR'L'R'd' \rightrightarrows RLR'd' \rightarrow R'd'$
\end{center}

in $\mathcal{C}$, and we can see that it is a split fork. Since $R$ creates coequalizers for split forks, it must be $RKd' = R'd'$, because we already know that

\begin{center}
$LR'L'R'd' \rightrightarrows LR'd' \rightarrow Kd'$
\end{center}

is a coequalizer. An analogous argument shows that for a morphism $f$ we have $RKf= R'f$, so that we have $RK = R'$. Moreover, if we perform the construction above on an object of the form $L'c$, we are taking the coequalizer of a diagram which is of the form $L(R'L'R'L'c \rightrightarrows R'L'c)$, so we have a coequalizer

\begin{center}
$LR'L'R'L'c \rightrightarrows LR'L'c \rightarrow KL'c$.
\end{center}

Moreover, we have a fork

\begin{center}
$LR'L'R'L'c \rightrightarrows LR'L'c \rightarrow Lc$.
\end{center}

Applying $R$ to both these forks, we obtain the same diagram

\begin{center}
$RLR'L'R'L'c \rightrightarrows RLR'L'c \to R'L'c$
\end{center}

and since $RL = R'L'$ (because they induce the same monad), this is a special case of the split fork in the example above, applied to the free algebra on $c$. Since $R$ creates split coequalizers, the two forks above must be the same, so $KL'c = Lc$. An analogous argument will show that this also holds on morphisms, so $KL' = L$, as we desired.
\end{itemize}

\section*{Week 5}
Last week, we introduced adjunctions and monads, and we showed a way to associate certain adjunctions to monads, and monads to adjunctions. Namely, given a monad $T$ on $\mathcal{C}$, we have an adjunction

\begin{center}
$F^T: \mathcal{C} \leftrightarrows \textup{Alg}(T) :U^T$
\end{center}

and given an adjunction $L \dashv R$, we can generate a monad $(RL, R\varepsilon_L, \eta)$. In general, there are many adjunctions inducing the same monad. In particular, the adjunction $F^T \dashv U^T$ is one of these. We recall the proven Lemma.

\begin{itemize}
\item[\textbf{Lemma 1}] We are given a solid diagram

\begin{center}
\begin{tikzcd}
\mathcal{D}' \ar[rr, dotted, "K"] \ar[dr, shift left, "R'"] && \mathcal{D} \ar[dl, shift left, "R"]\\
& \mathcal{C} \ar[ul, shift left, "L'"] \ar[ur, shift left, "L"]
\end{tikzcd}
\end{center}

where the diagonal arrows constitute two adjunctions inducing the same monad. Assume that $R$ creates coequalizers for all pairs $f_0,f_1$ such that $Rf_0,Rf_1$ have a split coequalizers. Then there exists a unique comparison functor $K: \mathcal{D}' \to \mathcal{D}$ such that $KL' = L$ and $RK = R'$.

\item[\textbf{Lemma 2}] Given a monad $T$, then the forgetful functor $U^T: \textup{Alg}(T) \to \mathcal{C}$ creates coequalizers for all pairs $f_0,f_1$ such that $U^Tf_0,U^Tf_1$ have an absolute coequalizer.

\item[\textbf{Proof}] Take a pair \begin{tikzcd} (x,h) \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & (y,k) \end{tikzcd} of $T$-homomorphisms, and assume that there is an absolute coequalizer \begin{tikzcd} x \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & y \ar[r, "e"] & z \end{tikzcd} in $\mathcal{C}$. We need to show that there is a unique algebra structure on $z$ such that $e$ is a $T$-homomorphism. Moreover, we need to show that the resulting diagram is also a coequalizer in $\textup{Alg}(T)$. Let us look at the solid diagram

\begin{center}
\begin{tikzcd}
Tx \ar[r, shift left, "Tf_0"] \ar[r, shift right, "Tf_1", swap] \ar[d, "h"] & Ty, \ar[r, "Te"] \ar[d, "k"] & Tz \ar[d, dotted, "m"]\\
x \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & y \ar[r, "e"] & z. 
\end{tikzcd}
\end{center}

Since our coequalizer is absolute, the first line of horizontal arrows is a coequalizer diagram. Therefore, there is a unique $m: Tz \to z$ such that the right square commutes. In particular, if $m$ is a $T$-algebra structure the same square automatically proves that $e$ is a $T$-homomorphism. To see that $m$ is a $T$-algebra structure, we need to show that the outer square in the diagram

\begin{center}
\begin{tikzcd}
T^2z \ar[rrr, "Tm"] \ar[ddd, "\mu_z", swap] &&& Tz \ar[ddd, "m"]\\
& T^2y \ar[r, "Tk"] \ar[d, "\mu_y"] \ar[ul, "T^2e"] & Ty \ar[d, "k"] \ar[ur, "Te", swap]\\
& Ty \ar[r, "k"] \ar[dl, "Te", swap] & y \ar[dr, "e"]\\
Tz \ar[rrr, "m", swap] &&& z
\end{tikzcd}
\end{center}

commutes. We already know that all the other squares are commutative, some by naturality of $\mu$, some by the diagram above, some because $y$ is a $T$-algebra. Therefore, we know that

\begin{center}
$m \circ Tm \circ T^2e = m \circ \mu_z \circ T^2e$.
\end{center}

Since our first coequalizer was absolute, $T^2e$ is a coequalizer, and since both $m \circ Tm$ and $m \circ \mu_z$ are factorizations of $e \circ k \circ Tk (= e \circ k \circ \mu_y)$, the universal property of coequalizers says that they are equal. Similarly, we prove that $m \circ \eta_z = \id_z$, so $(z,m)$ is a $T$-algebra.\\
It remains to show that $x \rightrightarrows y \rightarrow z$ is also a coequalizer of $T$-algebras, so consider a diagram in $\textup{Alg}(T)$

\begin{center}
\begin{tikzcd}
(x,h) \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & (y,k) \ar[r, "e"] \ar[dr, "g"] & (z,m)\\
&& (w,n)
\end{tikzcd}
\end{center}

where $gf_0 = gf_1$. Since the horizontal arrows constitute a coequalizer in $\mathcal{C}$, there is a unique factorization $q: z \to w$ with $qe = g$. We only need to show that $q$ is a $T$-homomorphism, that is, that the outer square in the diagram

\begin{center}
\begin{tikzcd}
Tz \ar[rr, "Tq"] \ar[ddd, "m", swap] && Tw \ar[ddd, "n"]\\
& Ty \ar[d, "k"] \ar[ul, "Te"] \ar[ur, "Tg", swap]\\
& y \ar[dl, "e", swap] \ar[dr, "g"]\\
z \ar[rr, "q", swap] && w
\end{tikzcd}
\end{center}

commutes. All other squares and triangles there commute, so $n \circ Tq \circ Te = q \circ m \circ Te$. Again since our first coequalizer was absolute, we know that $Te$ is a coequalizer, so reasoning as above we conclude that $m \circ Tq = q \circ m$, which is what we wanted.

\item[\textbf{Comparison theorem}] We are given a diagram

\begin{center}
\begin{tikzcd}
\mathcal{D} \ar[dr, shift left, "R"] \ar[rr, dotted, "K"] && \textup{Alg}(T) \ar[dl, shift left, "U^T"]\\
& \mathcal{C} \ar[ul, shift left, "L"] \ar[ur, shift left, "F^T"]
\end{tikzcd}
\end{center}

where the adjunction $L \dashv$ induces the monad $T$, there is a unique comparison functor $K: \mathcal{D} \to \textup{Alg}(T)$ such that $KL = F^T$ and $U^T K = R$.

\item[\textbf{Proof}] Since all split coequalizers are in particular absolute, Lemma 2 says that the adjunction on the right satisfies the hypotheses of Lemma 1. Therefore, we may use the latter and obtain the comparison functor.

\item[\textbf{Beck's monadicity theorem}] Given a diagram

\begin{center}
\begin{tikzcd}
\mathcal{D} \ar[dr, shift left, "R"] \ar[rr, dotted, "K"] && \textup{Alg}(T) \ar[dl, shift left, "U^T"]\\
& \mathcal{C} \ar[ul, shift left, "L"] \ar[ur, shift left, "F^T"]
\end{tikzcd}
\end{center}

where the adjunction $L \dashv R$ induces the monad $T$ and $K$ is a the comparison functor, the following conditions are equivalent:

\begin{enumerate}
\item there is a comparison functor $K$ which is an isomorphism of categories;
\item $R$ creates coequalizers for all pairs $f_0,f_1$ such that $Rf_0,Rf_1$ have an absolute coequalizer;
\item $R$ creates coequalizers for all pairs $f_0,f_1$ such that $Rf_0,Rf_1$ have a split coequalizer.
\end{enumerate}

\item[\textbf{Proof}] If there is a comparison isomorphism $K$, we may reduce to the case where the adjunction $L \dashv R$ is precisely $F^T \dashv U^T$, so the implication $1 \Rightarrow 2$ is precisely Lemma 2. The implication $2 \Rightarrow 3$ is obvious since all split coequalizers are absolute.\\
For the implication $3 \Rightarrow 1$, observe that by Lemma 1 we obtain both our $K: \mathcal{D} \to \textup{Alg}(T)$ and a comparison functor $M: \textup{Alg}(T) \to \mathcal{D}$. Moreover, it is clear that the composite $MK: \mathcal{D} \to \mathcal{D}$ is a comparison functor as well. Since $\id_{\mathcal{D}}$ is another comparison functor, by its uniqueness we know that $MK$ is the identity. Analogously, $KM$ is the identity on $\textup{Alg}(T)$, so $K$ has an inverse and is therefore an isomorphism, which proves 1.

\item[\textbf{Corollary}] A variety of algebras is monadic over $\Set$.

\item[\textbf{Proof}] Given a variety of algebras $\mathcal{V}$ with signature $\Omega$, there is a forgetful functor $U: \mathcal{V} \to \Set$ by definition, and in the course we have seen that free algebras exist, so $U$ has a left adjoint $F: \Set \to \mathcal{V}$. By Beck's theorem, we only need to show that $U$ creates coequalizers for pairs $f_0,f_1$ such that $Uf_0,Uf_1$ have an absolute coequalizer. Let us take a pair of homomorphisms \begin{tikzcd} (A,(\alpha_i)_{i \in \Omega}) \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & (B, (\beta_i)_{i \in \Omega}) \end{tikzcd} such that there is an absolute coequalizer

\begin{center}
\begin{tikzcd}
A \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & B \ar[r, "e"] & C
\end{tikzcd}
\end{center}

in $\Set$. Given $i \in \Omega$ of arity $n_i$, let us consider the solid diagram

\begin{center}
\begin{tikzcd}
A^{n_i} \ar[r, shift left, "f_0^{n_i}"] \ar[r, shift right, "f_1^{n_i}", swap] \ar[d, "\alpha_i"] & B^{n_i} \ar[r, "e^{n_i}"] \ar[d, "\beta_i"] & C^{n_i} \ar[d, dotted, "\gamma_i"]\\
A \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & B \ar[r, "e"] & C
\end{tikzcd}
\end{center}

Since our coequalizer was absolute, the first line is a coequalizer, therefore there is a unique $\gamma_i: C^{n_i} \to C$ such that the right square commutes. This is an $n_i$-ary operation on $C$ which is compatible with the corresponding operation on $B$. Doing this for every $i \in \Omega$, we have endowed $C$ with a unique structure of $\Omega$-algebra such that $e$ is an $\Omega$-homomorphism. We need to prove that the resulting fork is a coequalizer of $\Omega$-algebras, so consider a diagram of $\Omega$-algebras

\begin{center}
\begin{tikzcd}
(A, (\alpha_i)_{i \in \Omega}) \ar[r, shift left, "f_0"] \ar[r, shift right, "f_1", swap] & (B, (\beta_i)_{i \in \Omega}) \ar[r, "e"] \ar[dr, "g", swap] & (C, (\gamma_i)_{i \in \Omega})\\
&& (D, (\delta_i)_{i \in \Omega})
\end{tikzcd}
\end{center}

where $gf_0 = gf_1$. Since we have a coequalizer of sets, we get $q: C \to D$ such that $qe = g$. We need to show that $q$ is a $\Omega$-homomorphism. For this, take $i \in \Omega$ and consider the diagram

\begin{center}
\begin{tikzcd}
C^{n_i} \ar[rr, "q^{n_i}"] \ar[ddd, "\gamma_i", swap] && D^{n_i} \ar[ddd, "\delta_i"]\\
& B^{n_i} \ar[ul, "e^{n_i}"] \ar[ur, "g^{n_i}", swap] \ar[d, "\beta_i"]\\
& B \ar[dl, "e"] \ar[dr, "g", swap]\\
C \ar[rr, "q"] && D.
\end{tikzcd}
\end{center}

We know that everything commutes except perhaps for the outer square, so $\delta_i \circ q^{n_i} \circ e^{n_i} = q \circ \gamma_i \circ e^{n_i}$ and, since $e^{n_i}$ is a coequalizer, as in Lemma 2 we conclude that $\delta_i \circ q^{n_i} = q \circ \gamma_i$. Since this can be done with every $i \in \Omega$, it means that $q$ is an $\Omega$-homomorphism.
\end{itemize}

\section*{Week 6}
We would like to establish a converse of the last corollary. In other words, we would like to have a way of detecting varieties of algebras that only makes use of purely categorical means. We remind the previous result, whose proof is based on the powerful Beck's monadicity theorem.

\begin{itemize}
\item[\textbf{Theorem}] Given a variety of algebras $\mathcal{V}$, this is isomorphic to a category of the form $\textup{Alg}(T)$, for some monad $T$ on $\Set$.

\item[\textbf{Remark}] In order to have a full converse to the above theorem, we need to make some allowances on our definition of variety of algebras. Namely, we will allow the signature $\Omega$ to be a proper class rather than just a set, and we will allow our operations to be infinitary, that is, of the form $A^{\lambda} \to A$, for $\lambda$ a not necessarily finite cardinal.

\item[\textbf{Lemma}] Given a monomorphism $m: X \to Y$, and two morphisms $x: TX \to X, y: TY \to Y$ such that $m \circ x = y \circ Tm$, if $(Y,y)$ is a $T$-algebra then $(X,x)$ is also a $T$-algebra.

\item[\textbf{Proof}] Consider the diagram

\begin{center}
\begin{tikzcd}
T^2X \ar[rrr, "\mu_X"] \ar[ddd, "Tx", swap] \ar[dr, "T^2m", swap] &&& TX \ar[ddd, "x"] \ar[dl, "Tm"]\\
& T^2Y \ar[r, "\mu_X"] \ar[d, "Ty"] & TY \ar[d, "y"]\\
& TY \ar[r, "y"] & Y\\
TX \ar[rrr, "x", swap] \ar[ur, "Tm"] &&& X \ar[ul, "m"].
\end{tikzcd}
\end{center}

We already know that every square except maybe for the outer one commutes, so $m \circ x \circ \mu_X = m \circ x \circ Tx$. Since $m$ is a monomorphism, this implies $x \circ \mu_X = x \circ Tx$, which is the associativity condition. Similarly we prove the commutativity of the unitality triangles.

\item[\textbf{Theorem}] Given a canonical adjunction $F: \Set \leftrightarrows \textup{Alg}(T): U$, then $\textup{Alg}(T)$ is a variety of algebras.

\item[\textbf{Proof}] Remember that a cardinal $\lambda$ can be regarded as a set (namely, the set of all cardinals $< \lambda$, so the monad $T$ can be applied to cardinals. We define a signature by

\begin{center}
$\Omega: = \{ (\lambda, i) | \lambda$ is a cardinal and $i \in T\lambda \}$
\end{center}

and we set the arity of $(\lambda,i)$ to be $\lambda$. Given a $T$-algebra $(X,x)$ and a symbol $(\lambda,i)$, we define an operation $\omega_{(\lambda,i)}^x: X^{\lambda} \to X$ as follows: remembering that an element $g \in X^{\lambda}$ can be regarded as a function $\lambda \to X$, our definition is $g \mapsto x \circ Tg (i)$. Doing this for every element of $\Omega$ gives an $\Omega$-algebra $E(X,x) = (X, (\omega_{(\lambda,i)}^x)_{(\lambda,i) \in \Omega})$.\\
Our first claim is that a morphism $f: X \to Y$ between two $T$-algebras is a $T$-homomorphism if and only if it is an $\Omega$-homomorphism. So assume that it is a $T$-homomorphism, then for every element $X^{\lambda}$ we have

\begin{center}
$f \circ \omega_{(\lambda,i)}^x (g) = f \circ x \circ Tg (i) = y \circ Tf \circ Tg (i) = y \circ T(fg)(i) = \omega_{(\lambda,i)}^y (fg) = \omega_{(\lambda,i)}^y \circ f^{\lambda} (g)$
\end{center}

which means that $f \circ \omega_{(\lambda,i)}^x = \omega_{(\lambda,i)}^y \circ f^{\lambda}$, and this for every $(\lambda,i)$, so $f$ is an $\Omega$-algebra.\\
Conversely, if $f$ is an $\Omega$-algebra, define $\lambda = |X|$ and choose an isomorphism $g: \lambda \to X$. Now, for every element $i \in T\lambda$, compute

\begin{center}
$f \circ x \circ Tg (i) = f \circ \omega_{(\lambda,i)}^x (g) = \omega_{(\lambda,i)}^y \circ f^{\lambda} (g) = \omega_{(\lambda,i)}^y (f \circ g) = y \circ T(fg)(i) = y \circ Tf \circ Tg (i)$
\end{center}

which means $f \circ x \circ Tg = y \circ Tf \circ Tg$. Since $g$ is an isomorphism, then so is $Tg$, so we obtain $f \circ x = y \circ Tf$, and $f$ is a $T$-algebra.\\
What we have just proven is that the image $E(\textup{Alg}(T))$ is isomorphic to a full subcategory of $\textup{Alg}(\Omega)$. By Birkhoff's HPS theorem, we now only need to verify that it is closed under products, subalgebras and surjections.\\
An $\Omega$-algebra structure on a product is defined componentwise, and it corresponds to the componentwise $\Omega$-algebra structure defined by $E$, so we have closure under products.\\
Now take a subalgebra embedding $m: (X, (\omega_{(\lambda,i)})) \hookrightarrow E(Y,y)$. Choose an isomorphism $g: \lambda \to X$ and define a function $f_{(\lambda,g)}: T\lambda \to X$ to be $i \mapsto \omega_{(\lambda,i)}(g)$. We compute, for $i \in T\lambda$,

\begin{center}
$m \circ f_{(\lambda,g)} (i) = m \circ \omega_{(\lambda,i)}(g) = \omega_{(\lambda,i)}^y \circ m^{\lambda} (g) = \omega_{(\lambda,i)}^y (mg) = y \circ Tm \circ Tg (i)$,
\end{center}

so that $m \circ f_{(\lambda,g)} = y \circ Tm \circ Tg$. Consider the solid square

\begin{center}
\begin{tikzcd}
T\lambda \ar[d, "f_{(\lambda,g)}", swap] \ar[r, "Tg"] & TX \ar[d, "y \circ Tm"] \ar[dl, dotted, "x"]\\
X \ar[r, hook, "m", swap] & Y.
\end{tikzcd}
\end{center}

Since $Tg$ is an isomorphism, there exists a diagonal arrow $x: TX \to X$ making the two triangles commute. By the previous lemma, we know that $(X,x)$ is a $T$-algebra. Moreover, $E(X,x)$ and $(X, (\omega_{(\lambda,i)}))$ are both obtained from $E(Y,y)$ by restricting all the operations therein, so they must coincide, and $(X,(\omega_{(\lambda,i)}))$ is in the image of $E$.\\
Finally, let us consider a surjection $q: E(X,x) \twoheadrightarrow (Y,(\omega_{(\lambda,i)}))$. By a direct check, we know that this is the coequalizer of the fork $P \rightrightarrows E(X,x)$, where $P= \{ (x_0,x_1) \in X \times X | q(x_0) = q(x_1) \} \subseteq X \times X$, and the two arrows are the projections on the two components. By the previous discussion, we know that $P$ is in the image of $E$, so there is a $T$-algebra $(Z,z)$ such that $E(Z,z) = P$. Applying $U^T$ to this coequalizer, we obtain a diagram

\begin{center}
$P \rightrightarrows X \twoheadrightarrow Y$
\end{center}

in $\Set$. Now by choosing a section of $q$, we obtain a map $Y \to X$. Moreover, we can consider the diagonal $X \to P$. These two make the fork under observation into a split fork, a since $U^T$ creates coequalizers for these, there is a unique $T$-algebra structure $y$ on $Y$ for which $q$ is a $T$-homomorphism. Now, $E(Y,y)$ and $(Y,(\omega_{(\lambda,i)}))$ are obtained from $E(X,x)$ via the same quotient, so they must coincide, and $(Y,(\omega_{(\lambda,i)}))$ is in the image of $E$. This concludes the proof.

\item[\textbf{Definition}] A cardinal $\lambda$ is regular if, whenever $(\mu_i)_{i \in I}$ is a family of cardinals such that $|I| < \lambda$ and $\forall i \in I, \mu_i < \lambda$, then $\sum_{i \in I} \mu_i < \lambda$.

\item[\textbf{Example}] $\omega$ is regular. Indeed, a finite sum of finite cardinals is finite.\\
Any infinite successor cardinal, i.e. of the form $\mu^+$ is regular. Indeed, being $< \mu^+$ is equivalent to being $\leq \mu$. Therefore, if we have a family $(\mu_i)_{i \in I}$ with $|I| \leq \mu$ and $\mu_i \leq \mu$, then $\sum_{i \in I} \mu_i \leq \sum_{i \in I} \mu = \mu \cdot \mu = \mu$.

\item[\textbf{Definition}] Given a regular cardinal $\lambda$, a poset is called $\lambda$ directed if every $\lambda$-small subposet has an upper bound.

\item[\textbf{Example}] The typical example of this is, given a set $S$, the poset $\mathcal{P}^{\lambda}(S) = \{ X \subseteq S$ such that $|X| < \lambda \}$. It is a poset by inclusion, and $\lambda$-directed because, by regularity of $\lambda$, a $\lambda$-small union of elements of $\mathcal{P}^{\lambda}(S)$ is an element of $\mathcal{P}^{\lambda}(S)$.

\item[\textbf{Definition}] A functor $T: \Set \to \Set$ is called $\lambda$-accessible if it preserves colimits indexed by $\lambda$-directed posets.\\
To illustrate this, for every set we have $S = \bigcup \mathcal{P}^{\lambda}(S)$. The condition for $T$ of being $\lambda$-accessible means that this union also holds after applying $T$, that is, $TS$ can be recovered as the union of the images of all sets $TX$, for $X \in \mathcal{P}^{\lambda}(S)$.

\item[\textbf{Theorem}] Given a canonical adjunction $F: \Set \leftrightarrows \textup{Alg}(T):U$, where $T$ is $\lambda$-accessible, then $\textup{Alg}(T)$ is a variety of algebras for a small signature of operations whose arities are $< \lambda$.

\item[\textbf{Proof}] We can retrace the proof of the previous theorem, defining the signature

\begin{center}
$\Omega = \{ (\mu,i) | \mu < \lambda$ and $i \in T\mu \}$.
\end{center}

The fact that we had arbitrarily large cardinals in our signature was only used in two places in the previous proof, the rest can be replayed as it is. Namely, we need to tweak our proof that an $\Omega$-homomorphism is a $T$-homomorphism, and that the image of $E$ is closed under subobjects.\\
For the first, the set $X$ can be written as $X = \bigcup \{ Y_j \subseteq X$ with $|Y_j| < \lambda \}$. Let us call $g_j$ the inclusion $Y_j \hookrightarrow X$. For every such subset $Y_j$ of cardinality $\mu < \lambda$, and every $i \in T\mu$, we compute, as in the original proof,

\begin{center}
$f \circ x \circ Tg_j = y \circ Tf \circ Tg_j$.
\end{center}

Since $TX$ is the union of all the images of $Tg_j$, these are jointly surjective, which lets us cancel them on the right, so we obtain $f \circ x = y \circ Tf$ anyway.\\
In the discussion of subobjects, we similarly obtain commutative squares of the form

\begin{center}
\begin{tikzcd}
T\mu \ar[d, "f_{(\mu,g_j)}", swap] \ar[r, "Tg_j"] & TX \ar[dl, dotted, "x"] \ar[d, "y \circ Tm"]\\
X \ar[r, hook, "m", swap] & Y.
\end{tikzcd}
\end{center}

Now the arrows $Tg_j$ present $TX$ as a colimit of the diagram $(TY_j)$, so that there exists a unique factorization $x: TX \to X$. Now, again by universal property of colimits, we have $y \circ Tm = m \circ x$, then we proceed as in the original proof.

\item[\textbf{Corollary}] A category of the form $\textup{Alg}(T)$, where $T$ is a finitely accessible monad, is a variety of algebras for a small signature of finitary operations.

\item[\textbf{Proof}] Just take $\lambda = \omega$ in the previous theorem.

\item[\textbf{Example}] Let us show in with purely categorical methods that monoids can be obtained by a set of finitary operations as an equational theory. By the previous corollary, all we have to do is verify that the free monoids monad is finitely accessible.\\
For a set $X$, the set $TX$ contains finite sequences of elements of $X$. Given such a word $(a_1,\ldots, a_n)$, we obviously have

\begin{center}
$(a_1,\ldots, a_n) \in T(\{a_1, \ldots, a_n \})$
\end{center}

which is a finite subset of $X$. Since this is true for every word, we may conclude that $TX = \bigcup \{ TY | Y \subseteq X$ finite $\}$.

\item[\textbf{Example}] The functor $(-)^{\mathbb{N}}$ can be given the structure of a monad with unit $X \to X^{\mathbb{N}}$ taking constant sequences, and multiplication $X^{\mathbb{N} \times \mathbb{N}} \to X^{\mathbb{N}}$ sending a double sequences $(x_{ij})_{i,j \in \mathbb{N}}$ to $(x_{ii})_{i \in \mathbb{N}}$. This is $\aleph_1$-accessible but not $\aleph_0$-accessible.\\
Indeed, given a set $X$, this can be written as $\bigcup \{ Y \subseteq X | Y$ is at most countable$\}$. A sequence $(x_i) \in X^{\mathbb{N}}$ is in particular contained in $\{ x_i \}^{\mathbb{N}}$, which is a countable subset of $X$, and thus we recover all sequences, therefore $(-)^{\mathbb{N}}$ is $\aleph_1$-accessible.\\
To see that it is not $\aleph_0$-accessible, take a set $X$ with $|X| \geq |\mathbb{N}|$. Therefore, there exist a sequence $(x_i)$ in $X^{\mathbb{N}}$ such that $x_i \neq x_j$ for $i \neq j$. Now, this sequence cannot be contained in any $Y^{\mathbb{N}}$ with $Y$ finite. We conclude that $X^{\mathbb{N}}$ is not equal to the union of all sets $Y^{\mathbb{N}}$ for $Y \subset X$ finite, so that $(-)^{\mathbb{N}}$ is not $\aleph_0$-accessible.
\end{itemize}

\section*{Week 7}
\begin{itemize}
\item[\textbf{Exercise}] Decide whether $\mathbb{R}$ is finitely generated as a $\mathbb{Q}$-module.

\item[\textbf{Solution}] No, it is not. Indeed, a map $\mathbb{Q}^n \to \mathbb{R}$ can never be surjective, because the domain is countable but the codomain is not.

\item[\textbf{Exercise}] Decide whether $\mathbb{Q}$ is finitely generated as a $\mathbb{Z}$-module.

\item[\textbf{Solution}] It is not. Indeed, we can prove that there is no surjective homomorphism $\mathbb{Z}^n \to \mathbb{Q}$. Consider a homomorphism as indicated. The domain contains $n$ elements of the form $e_i=(0,\ldots,1,\ldots,0)$ having all components 0 except for the $i$-th, which is 1. The image of $e_i$ is of the form $\frac{p_i}{q_i}$. Notice that the denominators of linear combinations of these elements are finite products of $q_i$'s, and the function is completely determined by the values of $e_i$ by taking linear combinations. Now, if $r$ is a prime number $> \textup{max}\{ q_i \}$, by this discussion we know that $\frac{1}{r}$ cannot be in the image. Therefore, our function is not surjective.

\item[\textbf{Proposition}] If $M$ is a torsion $\mathbb{Z}$-module, then $\mathbb{Q} \otimes_{\mathbb{Z}} M = 0$.

\item[\textbf{Proof}] We prove that every element of the tensor product is 0. It suffices to show it for elementary tensors, that is, elements of the form $\frac{p}{q} \otimes m$. Since $M$ is a torsion module, there is an integer $n$ such that $nm = 0$, so we have

\begin{center}
$\frac{p}{q} \otimes m = \frac{np}{nq} \otimes m = \frac{p}{nq} \otimes nm = \frac{p}{nq} \otimes 0 = 0$.
\end{center}

\item[\textbf{Observation}] If $M$ is a $\mathbb{Z}$-module, then an explicit computation shows that $\mathbb{Q} \otimes_{\mathbb{Z}} M$ is the module of fractions obtained by inverting all scalars. The previous proposition says that the torsion component of $M$, if it has one, doesn't contribute to the process.

\item[\textbf{Remark}] The same exact proof shows that, if $R$ is an integral domain and $\mathbb{F}$ its field of fractions, then tensoring with $\mathbb{F}$ over $R$ is equivalent to inverting formally all scalars. Moreover, torsion components are annihilated in the process. Here, an element $m \in M$ is torsion if there is $r \in R$ such that $rm = 0$.

\item[\textbf{Exercise}] Show that a sequence \begin{tikzcd} 0 \ar[r] & A \ar[r, "u"] & B \ar[r, "v"] & C \end{tikzcd} of $R$-modules is exact if and only if for any other module $N$ the sequence

\begin{center}
\begin{tikzcd}
0 \ar[r] & \Hom_R(N,A) \ar[r, "u_{\ast}"] & \Hom_R(N,B) \ar[r, "v_{\ast}"] & \Hom_R(N,C)
\end{tikzcd}
\end{center}

is exact.

\item[\textbf{Solution}] If the first sequence is exact, take two maps $f,g: N \to A$ such that $u_{\ast}(f) = u_{\ast}(g)$, i.e. $uf = ug$. Since $u$ is injective, it is a monomorphism, therefore $f=g$, and $u_{\ast}$ is injective. Now take $f: N \to B$ in $\ker(v_{\ast})$, that is, $vf=0$. Then $\im(f) \subseteq \ker(v) = \im(u) \cong A$ because $u$ is injective. So we can compose with an inverse map $\im(u) \to A$ and obtain a map $g: N \to A$ such that $f=ug$. This means that $f \in \im(u_{\ast})$. Lastly, if $f \in \im(u_{\ast})$, then it is of the form $f = ug$. Since we know that $vu = 0$, then $vf = vug = 0$, and $f \in \ker(v_{\ast})$.\\
Conversely, if the shown induced sequence is exact, for every $N$, the we just choose $N = R$ to reobtain the first sequence.

\item[\textbf{Remark}] As assigned in the exercise sheet, we also know that $A \to B \to C \to 0$ is exact if and only if for each other $R$-module $N$ the sequence

\begin{center}
$0 \to \Hom_R(C,N) \to \Hom_R(B,N) \to \Hom_R(A,N)$
\end{center}

is exact.

\item[\textbf{Observation}] For every three $R$-modules $A,B$ and $C$, we have an isomorphism of modules

\begin{center}
$\Hom_R(A \otimes_R B,C) \cong \Hom_R(A,\Hom_R(B,C))$
\end{center}

which is natural in all three variables. Therefore, for every module $M$ there is an adjunction $- \otimes_R M \dashv \Hom_R(M,-)$.

\item[\textbf{Exercise}] Show that a sequence $A \to B \to C \to 0$ is exact if and only if for every module $M$ the induced sequence

\begin{center}
$M \otimes_R A \to M \otimes_R B \to M \otimes_R C \to 0$
\end{center}

is exact.

\item[\textbf{Solution}] By the previous exercises, the first sequence is exact if and only if for each $N$ the sequence

\begin{center}
$0 \to \Hom_R(C,N) \to \Hom_R(B,N) \to \Hom(A,N)$
\end{center}

is exact, if and only if for each $N$ and $M$ the sequence

\begin{center}
$0 \to \Hom_R(M,\Hom_R(C,N)) \to \Hom_R(M,\Hom_R(B,N)) \to \Hom_R(M,\Hom_R(A,N))$
\end{center}

is exact, if and only for each $N$ and $M$ if the sequence

\begin{center}
$0 \to \Hom_R(M \otimes_R C,N) \to \Hom_R(M \otimes_R B,N) \to \Hom_R(M \otimes_R A,N)$
\end{center}

is exact, if and only if for each $M$ the sequence

\begin{center}
$M \otimes_R A \to M \otimes_R B \to M \otimes_R C \to 0$
\end{center}

is exact.
\end{itemize}

\section*{Week 8}
\begin{itemize}
\item[\textbf{Definition}] A pullback in a category is the limiting cone of a diagram of shape \begin{tikzcd} & \bullet \ar[d]\\ \bullet \ar[r] & \bullet \end{tikzcd}. More explicitly, it is a commutative square

\begin{center}
\begin{tikzcd}
C' \ar[r, "f'"] \ar[d, "g'"] & D' \ar[d, "g"]\\
C \ar[r, "f"] & D
\end{tikzcd}
\end{center}

such that, whenever there is an object $K$ with morphisms as in the solid diagram

\begin{center}
\begin{tikzcd}
K \ar[rrd, bend left, "p"] \ar[ddr, bend right, "q"] \ar[dr, dotted, "t"]\\
& C' \ar[r, "f'"] \ar[d, "g'"] & D' \ar[d, "g"]\\
& C \ar[r, "f"] & D
\end{tikzcd}
\end{center}

with $gp = fq$, then there exists a unique factorization $t: K \to C$ such that $f't = p$ and $g't = q$.\\
The dual notion is that of pushout. It is therefore an (inner) commutative square as in the diagram

\begin{center}
\begin{tikzcd}
C \ar[d, "g"] \ar[r, "f"] & D \ar[d, "g'"] \ar[ddr, bend left, "p"]\\
C' \ar[r, "f'"] \ar[drr, bend right, "q"] & D' \ar[dr, dotted, "t"]\\
&& K
\end{tikzcd}
\end{center}

such that whenever there is a commutative outer square, then there is a unique factorization $t: D' \to K$.

\item[\textbf{Lemma}] In a pullback square as above, if $f$ is monic, then so is $f'$. Dually, in a pushout square as above, if $f$ is epic, then so is $f'$.

\item[\textbf{Proof}] Consider a diagram

\begin{center}
\begin{tikzcd}
K \ar[r, shift left, "p"] \ar[r, shift right, "q", swap] \ar[dr, bend right, shift left] \ar[dr, bend right, shift right] \ar[rr, bend left] & C' \ar[d, "g'"] \ar[r, "f'"] & D' \ar[d, "g"]\\
& C \ar[r, "f"] & D
\end{tikzcd}
\end{center}

with $f'p = f'q$, this being the upper bent arrow. The two lower bent arrows are $g'p$ and $g'q$ respectively. Now we have

\begin{center}
$fg'p = gf'p = gf'q = fg'q$
\end{center}

and since $f$ is monic by assumption, this implies that $g'p = g'q$, so that the two lower bent arrows are in fact the same. This means that we are looking at a commutative outer square having $K$ as an upper left vertex, and by universal property of pullbacks there is a unique factorization $K \to C'$. But now both $p$ and $q$ are such factorizations, therefore it must be $p = q$.

\item[\textbf{Proposition}] A sequence of $R$-modules $0 \to A \to B \to C$ is exact if and only if the square

\begin{center}
\begin{tikzcd}
A \ar[r, "u"] \ar[d] & B \ar[d, "v"]\\
0 \ar[r] & C
\end{tikzcd}
\end{center}

is a pullback.\\
A sequence $A \to B \to C \to 0$ is exact if and only if the square above is a pushout.

\item[\textbf{Proof}] We will prove the former statement, the latter being simply the dual. However, it will be included in the exercise sheet.\\
Assume that the sequence is exact, and consider a solid diagram

\begin{center}
\begin{tikzcd}
M \ar[drr, bend left, "p"] \ar[ddr, bend right] \ar[dr, dotted, "k"]\\
& A \ar[r, "u"] \ar[d] & B \ar[d, "v"]\\
& 0 \ar[r] & C.
\end{tikzcd}
\end{center}

The commutativity of the outer square just means that $vp=0$, so $\im(p) \subseteq \ker(v) = \im(u) \cong A$, where we are using both that the sequence is exact at $B$ and at $A$. Therefore, just use this to define the factorization $k: M \to A$, which is moreover unique because it is given by composition with the inverse isomorphism $\im(u) \to A$.\\
Conversely, if the square above is a pullback, then we know by the previous lemma that $u: A \to B$ is monic, because $0 \to C$ of course is. Moreover, $vu=0$ implies that $\im(u) \subseteq \ker(v)$. It remains to show that $\ker(v) \subseteq \im(u)$. To this end, consider a solid diagram

\begin{center}
\begin{tikzcd}
\ker(v) \ar[drr, bend left, "i"] \ar[ddr, bend right] \ar[dr, dotted, "k"]\\
& A \ar[r, "u"] \ar[d] & B \ar[d, "v"]\\
& 0 \ar[r] & C.
\end{tikzcd}
\end{center}

Since obviously we have $vi = 0$, the outer square is commutative, therefore there is a unique factorization $k: \ker(v) \to A$. Since $i$ is monic, then so must be $k$. In other words, $\ker(v)$ may be regarded as a submodule of $A$, which is isomorphic to $\im(u)$. This concludes the proof.

\item[\textbf{Remark}] A sequence \begin{tikzcd} M_0 \ar[r, "f_1"] & M_1 \ar[r, "f_2"] & \cdots & \ar[r, "f_n"] & M_n \end{tikzcd} is exact if and only if all the induced sequences of the form

\begin{center}
$0 \to N_i \to M_i \to N_{i+1} \to 0$
\end{center}

are exact, where $N_i = \im(f_i)$.\\
Notice that the arrow $N_i \to M_i$ is an injection and $M_i \to N_{i+1}$ is a surjection by definition. If the long sequence is exact, then $N_i = \ker(f_{i+1})$, which means that the short sequence above is exact. Conversely, if all those short sequences are exact, then $N_i = \ker(M_i \to N_{i+1}) = \ker(f_{i+1})$, but since by definition $N_i = \im(f_i)$ we are done.

\item[\textbf{Definition}] A functor $F: \textup{R-Mod} \to \textup{R-Mod}$ is exact if it preserves long exact sequences.

\item[\textbf{Proposition}] A functor $F$ is exact if and only if it preserves short exact sequences.

\item[\textbf{Proof}] It $F$ preserves long exact sequences, then it also preserves short ones, because they are a particular case.\\
Suppose that $F$ preserves short exact sequences. Given a long exact sequence as above, let us split it into short exact sequences. At each node $M_i$, we have the following diagram

\begin{center}
\begin{tikzcd}
M_{i-1} \ar[dr, "f_i"] \ar[d, two heads] && M_{i+1}\\
N_i \ar[r, hook] & M_i \ar[ur, "f_{i+1}"] \ar[r, two heads] & N_{i+1} \ar[u, hook]
\end{tikzcd}
\end{center}

where the lower horizontal arrows constitute a short exact sequence. Let us plug the whole diagram through $F$, observing that, since it preserves SES's, in particular it preserves both monomorphisms and epimorphisms. The resulting diagram therefore will be

\begin{center}
\begin{tikzcd}
FM_{i-1} \ar[d, two heads] \ar[dr, "Ff_i"] && FM_{i+1}\\
FN_i \ar[r, hook, "j", swap] & FM_i \ar[ur, "Ff_{i+1}"] \ar[r, two heads, "\pi", swap] & FN_{i+1} \ar[u, hook]
\end{tikzcd}
\end{center}

and the lower horizontal row remains a short exact sequence. Now compute

\begin{center}
$\im(Ff_i) = \im(j) = \ker(\pi)$
\end{center}

the first equality by surjectivity of $FM_{i-1} \twoheadrightarrow FM_i$, the second by exactness of the horizontal row. Now, since $FN_{i+1} \hookrightarrow FM_{i+1}$, an element of $FM_i$ is sent to 0 by $Ff_{i+1}$ if and only if it is sent to zero by $\pi$, so $\ker(\pi) = \ker(Ff_{i+1})$, and we conclude.

\item[\textbf{Lemma}] A left adjoint preserves colimits, a right adjoint preserves limits.

\item[\textbf{Proof}] Given a colimit diagram $(A_i \to A)$, consider the induced diagram $(LA_i \to A)$ and another cocone $(LA_i \to K)$. By adjunction, this cone corresponds to one of the form $(A_i \to RK)$, therefore by universal property this yields a unique factorization $A \to RK$, which again by adjunction corresponds to a unique factorization $LA \to K$. Similarly in the dual case.

\item[\textbf{Proposition}] If a functor $\textup{R-Mod} \to \textup{R-Mod}$ preserves finite limits, then it is left exact. If it preserves finite colimits, then it is right exact.

\item[\textbf{Proof}] This follows from the characterization of left exact sequences given above in terms of pullbacks of pushouts, and by the observation that final and initial objects are limits and colimits respectively of the empty diagram, and in $\textup{R-Mod}$ they are always zero objects.

\item[\textbf{Corollary}] A left adjoint is right exact, a right adjoint is left exact.

\item Now we want to be able to give alternative definitions of flatness, some of which may be more usefule in some contexts, and some in other contexts. We need a preliminary lemma.

\item[\textbf{Lemma}] Given $x_i \in M$ and $y_i \in N$ such that $\sum x_i \otimes y_i = 0 \in M \otimes N$, then there exist finitely generated $M_0 \subseteq M$ and $N_0 \subseteq N$ such that $\sum x_i \otimes y_i = 0 \in M_0 \otimes N_0$.

\item[\textbf{Remark}] The fact that this is not true for \emph{all} finitely generated submodules reflects the fact that not all modules are flat, so tensoring does not always preserve injectivity. However, even when our modules are not flat, the lemma says that there are \emph{some} finitely generated submodules for which injectivity is preserved.

\item[\textbf{Proof}] Remember that a tensor product can be constructed as a quotient module $F(M \times N)/Q$, where the numerator is the free module on the underlying set of $M \times N$, and $Q$ is generated by all expressions of the form

\begin{center}
$(x+x',y) - (x,y) - (x',y)$\\
$(x,y+y') - (x,y) - (x,y')$\\
$(ax,y) - a(x,y)$\\
$(x,ay) - a(x,y)$.
\end{center}

Now since $\sum x_i \otimes y_i = 0$, this means that the formal expression $\sum (x_i,y_i) \in Q$. By definition of $Q$, this means that it can also be expressed as a finite formal sul $\sum g_j$, where every $g_j$ is an expression of the form above. Now take as $M_0$ the submodule generated by all the $x_i$'s and all the elements appearing as first coordinates of the $g_j$'s. Define $N_0$ similarly.\\
It is clear then that $\sum (x_i,y_i) \in Q_0$, this being the corresponding module over which we quotient in order to obtain $M_0 \otimes N_0$. In other words, our tensor is $0$ in $M_0 \otimes N_0$.

\item[\textbf{Remark}] If $\sum x_i \otimes y_i = 0 \in M_0 \in N_0$, a fortiori this implies that it is 0 in $M_0 \otimes N$. This means that the result is true even if we replace only one of the two modules with a finitely generated one.

\item[\textbf{Theorem}] Given a module $M$, the following conditions are equivalent:

\begin{enumerate}
\item the functor $M \otimes -$ preserves long exact sequences;
\item the functor $M \otimes -$ preserves short exact sequences;
\item given an injection $A \hookrightarrow B$, then $M \otimes A \to M \otimes B$ is an injection;
\item given an injection $A \hookrightarrow B$ between finitely generated modules, then $M \otimes A \to M \otimes B$ is an injection.
\end{enumerate}

\item[\textbf{Proof}] The equivalence $1 \Leftrightarrow 2$ has been discussed. The equivalence $2 \Leftrightarrow 3$ follows since all functors $M \otimes -$ are right exact, so the only thing left to preserve short exact sequences is the first map remaining an injection after tensoring. Moreover, $3 \Rightarrow 4$ is obvious.\\
It remains to show $4 \Rightarrow 3$. Given an injection $f: A \hookrightarrow B$, and an element $\sum m_i \otimes a_i$ in the kernel of $M \otimes f$, we want to see that this is 0. Since it is in the kernel, we have $\sum m_i \otimes f(x_i) = 0 \in M \otimes B$. Now take $A_0 \subseteq A$ to be generated by all $a_i$. By the previous lemma (and remark) we can choose a finitely generated $B_0 \subseteq B$ that moreover contains $f(A_0)$ (by enlarging it if necessary) in which $\sum m_i \otimes f(a_i) = 0 \in M \otimes B_0$. By our hypothesis, this implies $\sum m_i \otimes a_i = 0 \in M \otimes A_0$. A fortiori, this means $\sum m_i \otimes a_i = 0 \in M \otimes A$.
\end{itemize}

\section*{Week 9}
\begin{itemize}
\item This week's topic is a very brief introduction to homological algebra, which incidentally also includes some interesting constructions which is possible to perform with projective and injective modules.

\item[\textbf{Definition}] A chain complex is a $\mathbb{Z}$-indexed sequence of modules and morphisms of the form

\begin{center}
\begin{tikzcd}
\ldots \ar[r, "d_2"] & C_1 \ar[r, "d_1"] & C_0 \ar[r, "d_0"] & C_{-1} \ar[r, "d_{-1}"] & \ldots
\end{tikzcd}
\end{center}

with the property that for every $i$ we have $d_{i-1} \circ d_i = 0$. The maps $d_i$'s are called boundary operators.\\
We denote moreover $B_i(C) := \im(d_{i+1})$ and $Z_i(C) := \ker(d_i)$. Elements of $C_i$ are called $i$-chains, elements of $B_i(C)$ are $i$-boundaries and elements of $Z_i(C)$ are $i$-cycles.

\item[\textbf{Definition}] A cochain complex is the dual of a chain complex, i.e. the maps are going upward. Conventionally, all the indexes are usually put in superscript instead of subscript. The $d^i$'s are known as differentials, elements of $C^i$ are $i$-cochains, elements of $B^i(C_{\bullet})$ are $i$-coboundaries and elements of $Z^i(C_{\bullet})$ are $i$-cocycles.

\item[\textbf{Remark}] Sometimes, boundary operators of a chain complex (but not differentials of a cochain complex) are denoted witih $\partial$ instead of $d$. These differences in terminology are due to the fact that in the motivating applications one or the other form is preferred in different context, e.g. chain complexes are often used in algebraic topology, cochain complexes in differential geometry, so the terms are borrowed from the respective branches of mathematics. On a purely categorical perspective, the two notions are nothing more than dual to one another.

\item[\textbf{Remark}] Often, when it is clear from the context, indices will be suppressed, for the sake of notational simplicity.

\item[\textbf{Definition}] A chain map is a homomorphism in the category of chain complexes, i.e. a sequence of maps $f_i: C_i \to C'_i$ such that $d f_{i+1} = f_i d$.

\item[\textbf{Definition}] The condition $d \circ d = 0$ can be rewritten as $B_i(C) \subseteq Z_i(C)$. Therefore, given a chain complex $C_i$, we can define the $i$-th homology module as $H_i(C):=Z_i/B_i$.\\
Dually, for a cochain complex we can define the $i$-th cohomology module as $H^i(C) := Z^i/B^i$.

\item[\textbf{Remark}] The operations $H_{\bullet}$ are functorial, i.e. they are functors from the category of chain complexes to that of modules. Moreover, they are additive, in the sense that $H_i(f+g) = H_i(f) + H_i(g)$ (this will be on the exercise sheet).

\item[\textbf{Definition}] Given two chain maps $f,g: C_{\bullet} \to C'_{\bullet}$, a chain homotopy from $f$ to $g$ is a sequence of maps $s_i: C_i \to C'_{i+1}$ such that $f_i - g_i = ds_i + s_{i-1}d$.

\begin{center}
\begin{tikzcd}[column sep = huge, row sep = huge]
\ldots \ar[r, "d"] & C_{i+1} \ar[r, "d"] \ar[d, shift right, "f_{i+1}", swap] \ar[d, shift left, "g_{i+1}"] & C_i \ar[r, "d"] \ar[d, shift right, "f_i", swap] \ar[d, shift left, "g_i"] \ar[dl, "s_i", near end] & C_{i-1} \ar[r, "d"] \ar[d, shift right, "f_{i-1}", swap] \ar[d, shift left, "g_{i-1}"] \ar[dl, "s_{i-1}", near end] & \ldots\\
\ldots \ar[r, "d", swap] & C'_{i+1} \ar[r, "d", swap] & C'_i \ar[r, "d", swap] & C'_{i-1} \ar[r, "d", swap] & \ldots
\end{tikzcd}
\end{center}

\item[\textbf{Lemma}] If two chain maps $f$ and $g$ are chain homotopic, then they induce the same maps on all homology modules.

\item[\textbf{Proof}] By definition of chain homotopy, there are maps $s$ in every degree such that $f-g = ds + sd$. Now, by definition of homology, all chains of the form $d(c)$ are collapsed to 0 in the quotient, so for every $i$, by the definitions and additivity of the homology functors, we have

\begin{center}
$H_i(f) - H_i(g) = H_i(f-g) = H_i(ds + sd) = H_i(ds) = H_i(sd) = 0$
\end{center}

which implies $H_i(f) = H_i(g)$.

\item Next, we are going to use these notions in combinations with projectivity and injectivity.

\item[\textbf{Definition}] A left resolution $C_{\bullet}$ of a module $M$ is an exact sequence of the form

\begin{center}
$\ldots \rightarrow C_2 \rightarrow C_1 \rightarrow C_0 \rightarrow M \rightarrow 0$.
\end{center}

A right resolution is the dual notion.

\item[\textbf{Definition}] A projective resolution of a module $M$ is a left resolution $P_{\bullet}$ where each module $P_i$ is projective.\\
An injective resolution is a right resolution $I_{\bullet}$ where each module $I_i$ is injective.

\item[\textbf{Remark}] Every module admits both a projective and an injective resolution (this also will be in the exercise sheet).

\item[\textbf{Remark}] Note that a left resolution of $M$ can be regarded as a chain complex, having $C_i$ in non-negative degree, $M$ in degree -1 and 0 in all other degrees. The condition $d \circ d = 0$ is verified, because the stronger condition of exactness is true.\\
Dually, we can regard a right resolution as a chain complex which is 0 in all degrees $< -1$.

\item[\textbf{Lemma}] Given a map $f': M \to N$ and two projective resolutions as in the diagram

\begin{center}
\begin{tikzcd}
\ldots P_2 \ar[r, "d"] & P_1 \ar[r, "d"] & P_0 \ar[r, "\varepsilon"] & M \ar[r] \ar[d, "f'"] & 0\\
\ldots Q_2 \ar[r, "d"] & Q_1 \ar[r, "d"] & Q_0 \ar[r, "\eta"] & N \ar[r] & 0
\end{tikzcd}
\end{center}

then we can lift $f'$ to a chain map $f$. Moreover, this chain map is unique up to chain homotopy.

\item[\textbf{Proof}] We already have the chain map constructed in all degrees $\leq -1$, this being $f'$ in degree -1 and 0 in all other negative degrees. So we can proceed by induction, assuming that we have defined our chain map up to $f_n$, with $n \geq -1$. In this case, we have $f_{n-1}d = d f_n$. Taking an $n$-cycle $p$, i.e. $d(p)=0$, then we have $d f_n(p) = f_{n-1} d(p)=0$, which means that $f_n$ is also an $n$-cycle. In other words, $f_n$ restricts to a map $Z_n(P) \to Z_n(Q)$. Let us represent this in the solid diagram

\begin{center}
\begin{tikzcd}
P_{n+1} \ar[r, two heads, "d"] \ar[d, dotted, "f_{n+1}"] & Z_n(P) \ar[r] \ar[d, "f_n"] & 0\\
Q_{n+1} \ar[r, two heads, "d"] & Z_n(Q) \ar[r] & 0
\end{tikzcd}
\end{center}

where the two $d$'s are surjective by exactness of the rows. By projectivity of $P_{n+1}$, there is a map $f_{n+1}$ making the square commute, so the induction step is complete. It only remains to prove that the obtained chain map $f$ is unique up to homotopy.\\
Suppose we have two chain maps $f, g: P \to Q$, both lifting $f'$. We want to produce a chain homotopy between them. Define $h:= f-g$. For all degrees $\leq -2$, there is nothing to prove. Moreover, $h_{-1} = 0$, so we can just define $s_{-1} = 0: M \to Q_0$ and the chain homotopy condition will be trivially satisfied. For all non-negative degrees, we proceed again by induction, so first assume $n = 0$. We have $\eta h_0 = \eta f - \eta g = f' \varepsilon - f' \varepsilon = 0$. This means that $h_0$ lands in $Z_0(Q)$. Now consider the diagram

\begin{center}
\begin{tikzcd}
P_0 \ar[r, "h_0"] \ar[dr, dotted, "s_0", swap] & Z_0(Q)\\
& Q_1 \ar[u, two heads, "d", swap].
\end{tikzcd}
\end{center}

Again $d$ is surjective by exactness, so projectivity of $P_0$ ensures the existence of $s_0$ such that $ds_0 = h_0$. Since $s_{-1} = 0$, this is already the required condition.\\
Now assume we have defined our $s_i$'s up to some $n \geq 0$. We have $h_n = ds_n + s_{n-1}d$. Consider the map $h_{n+1} - s_n d : P_{n+1} \to Q_{n+1}$, and use this to compute

\begin{center}
$d(h_{n+1} - s_n d) = dh_{n+1} - (h_n - s_{n-1} d)d = dh_{n+1} - h_n d = 0$
\end{center}

the last equality following from the fact that $h$ is a chain map. So $h_{n+1} - s_n d$ lands in $Z_{n+1}(Q)$. Similarly as above, in the solid diagram

\begin{center}
\begin{tikzcd}[column sep = huge]
P_{n+1} \ar[r, "h_{n+1} - s_n d"] \ar[dr, dotted, "s_{n+1}", swap] & Z_{n+1}(Q)\\
& Q_{n+1} \ar[u, two heads, "d", swap]
\end{tikzcd}
\end{center}

there exists a lift $s_{n+1}$, so that $d s_{n+1} = h_{n+1} - s_n d$, which is the chain homotopy condition, so our induction step is complete.

\item[\textbf{Definition}] Given a right exact functor $F$ on some category of modules, we can define the left derived functors of $F$ by choosing a projective resolution $P$ for each modules $M$, and then the $n$-th left derived functor will be computed on $M$ as $L_nF(M) = H_n(F(P))$.

\item[\textbf{Proposition}] The left derived functors are well-defined. Moreover, they are indeed functors.

\item[\textbf{Proof}] Choosing two different projective resolutions $P$ and $Q$ for $M$, the lemma above says that they are connected by a map $f$. Since this map is unique up to chain homotopy, it becomes strictly unique after passing to homology. Analogously, we have a map $g$ in the other direction which is unique after passing to homology. Again by uniqueness, it must be $H_n(f) \circ H_n(g) = H_n(\id) = \id$ and $H_n(g) \circ H_n(f) = H_n(\id) = \id$, so that $H_n(P) \cong H_n(Q)$.\\
By the same reasoning, this assignment is functorial.

\item[\textbf{Remark}] Dually, all maps can be completed to cochain maps between injective resolution in a way that is unique after taking cohomology. Given a left exact functor $F$, we can defined the $n$-th right derived functor of $F$ by choosing such an injective resolution $I$ for a module $M$, and then defining $R_nF(M) = H^n(F(I))$.

\item[\textbf{Definition}] Remember that the tensoring functors are right exact. The higher Tor modules are defined as follows:

\begin{center}
$\textup{Tor}^n(A,B) = L_n(A \otimes -)(B)$.
\end{center}

Similarly, remember that the hom-functors are left exact, then define the higher Ext modules as:

\begin{center}
$\textup{Ext}^n(A,B) = R_n(\Hom(A,-))(B)$.
\end{center}

\item We also have the two following results, allowing to compute Tor and Ext modules in symmetric ways. They are non-trivial and require some more advanced tools from homological algebra to be proven.

\item[\textbf{Theorem}] $\textup{Ext}^n(A,B) \cong R_n(\Hom(A,-))(B) \cong R_n(\Hom(-,B))(A)$.\\
$\textup{Tor}^n(A,B) \cong L_n(A \otimes -)(B) \cong L_n(- \otimes B)(A)$.

\item[\textbf{Proposition}] If $R$ is a PID (see exercise sheet), then for all $R$-modules $A$ and $B$ and $n \geq 2$ we have $\textup{Ext}^n(A,B) = 0$.

\item[\textbf{Proof}] We can choose an injective resolution of $B$ of the form

\begin{center}
$0 \to M \hookrightarrow I_0 \twoheadrightarrow I_1 \to 0 \to \ldots$
\end{center}

where $I_0$ is an injective hull (see the course for its existence) and $I_1$ is the quotient $I_0/M$, which is itself injective (see the exercise sheet). After applying the functor $\Hom(A,-)$, we obtain a cochain complex which is 0 in degree $\geq 2$, so its cohomology is 0.
\end{itemize}

\section*{Week 10}
\begin{itemize}
\item[\textbf{Construction}] Suppose we are given a short exact sequence \begin{tikzcd} 0 \ar[r] & A_{\bullet} \ar[r, "u"] & B_{\bullet} \ar[r, "v"] & C_{\bullet} \ar[r] & 0 \end{tikzcd}. For each $n \in \mathbb{Z}$, we construct a homomorphism $\partial: H_n(C) \to H_{n-1}(A)$ as follows:\\

let us keep in mind a specific section of our short exact sequence of chain complexes, that it, the diagram

\begin{center}
\begin{tikzcd}
0 \ar[r] & A_{n+1} \ar[r, "u"] \ar[d, "d"] & B_{n+1} \ar[r, "v"] \ar[d, "d"] & C_{n+1} \ar[r] \ar[d, "d"] & 0\\
0 \ar[r] & A_n \ar[r, "u"] \ar[d, "d"] & B_n \ar[r, "v"] \ar[d, "d"] & C_n \ar[r] \ar[d, "d"] & 0\\
0 \ar[r] & A_{n-1} \ar[r, "u"] \ar[d, "d"] & B_{n+1} \ar[r, "v"] \ar[d, "d"] & C_{n-1} \ar[r] \ar[d, "d"] & 0\\
0 \ar[r] & A_{n-2} \ar[r, "u"] & B_{n-2} \ar[r, "v"] & C_{n-2} \ar[r] & 0.
\end{tikzcd}
\end{center}

An element of $H_n(C)$ is a homology class of the form $[c]$, for some cycle $c \in Z_n(C)$. By surjectivity of $v$, there is $b \in B_n$ such that $v(b) = c$. Now observe that $vd(b) = dv(b) = d(c) = 0$ because $c$ is a cycle, so we know that $d(b) = \ker(v) = \im(u)$, and by injectivity of $u$ there is a unique $a \in A_{n-1}$ such that $u(a) = d(b)$. Now we want to show that this $a$ is a cycle. For this we compute $ud(a) = du(a) = dd(b) = 0$, and since $u$ is injective we have $d(a) = 0$, so $a \in Z_{n-1}(A)$. Now we choose $\partial([c])$ to be the homology class $[a] \in H_{n-1}(A)$.

\item[\textbf{Proposition}] The construction above is well-defined and it is a module homomorphism.

\item[\textbf{Proof}] We need to show that our construction is independent of the representative $c$ of the homology class $[c]$, and also of the preimage $b \in B_n$. We will kill both birds with one stone. So let us assume that we have another $b' \in B_n$ such that $v(b') \in [c]$. By definition of homology, this means that $v(b') = c + d(c'')$ for some $c'' \in C_{n+1}$. Now choose $b'' \in B_{n+1}$ such that $v(b'') = c''$, and compute

\begin{center}
$v(b') = v(b) + dv(b'') = v(b) + vd(b'') = v(b + d(b''))$
\end{center}

which means that $b' - b - d(b'') \in \ker(v) = \im(u)$, and by injectivity of $u$ there is a unique $a'' \in A_n$ such that $b' - b - d(b'') = u(a'')$. Now, we chose above $a$ to be the preimage of $d(b)$, and analogously we choose $a' \in A_{n-1}$ to be the preimage of $(b')$, which is similarly a cycle. Finally, we compute

\begin{center}
$u(a') = d(b') = d(b) + dd(b'') + du(a'') = u(a) + ud(a'') = u(a + d(a''))$
\end{center}

which by injectivity of $u$ implies $a' = a + d(a'')$. This means that $[a'] = [a]$, so our construction is well-defined. With a similar argument we can show that it is a homomorphism.

\item[\textbf{Snake lemma}] Given a short exact sequences of chain complexes \begin{tikzcd} 0 \ar[r] & A_{\bullet} \ar[r, "u"] & B_{\bullet} \ar[r, "v"] & C_{\bullet} \ar[r] & 0 \end{tikzcd}, there exists a long exact sequence of the form

\begin{center}
\begin{tikzcd}
\ldots \ar[r] & H_n(A) \ar[r, "u_{\ast}"] & H_n(B) \ar[r, "v_{\ast}"] & H_n(C) \ar[r, "\partial"] & H_{n-1}(A) \ar[r] & \ldots
\end{tikzcd}
\end{center}

\item[\textbf{Proof}] First, observe that a cycle $a \in Z_n(A)$ yields a cycle $u(a) = Z_n(B)$, because $du(a) = ud(a) = u(0) = 0$, so $u$ restricts to a map $u: Z_n(A) \to Z_n(B)$. Moreover, a boundary $d(a) \in B_n(A)$ yields likewise a boundary, in that $ud(a) = du(a)$, so this induces a well-defined map $u_{\ast}: H_n(A) \to H_n(B)$. Analogously, we have a map $v_{\ast}: H_n(B) \to H_n(C)$. We will leave it up to the reader to show that the chain is exact at $H_n(B)$, and prove explicitly exactness at $H_n(A)$ and $H_n(C)$.\\
Let us show that $\ker(u_{\ast}) \subseteq \im(\partial)$. If $[a] \in H_n(A)$ is in $\ker(u_{\ast})$, it means that $[u(a)] = 0$, that is, $u(a) = d(b)$ for some $b \in B_{n+1}$. Now, observe that $dv(b) = vd(b) = vu(a) = 0$, so $v(b)$ is a cycle. By construction of $\partial$, we have $\partial([v(b)]) = [a]$.\\
Now let us show that $\im(\partial) = \ker(u_{\ast})$. If $[a] \in \im(\partial)$, there exists a cycle $c \in Z_{n+1}(C)$ such that, chosen $b$ with $v(b) = c$, we have $[u^{-1}d(b)] = [a]$. This means that $u^{-1}d(b) = a + d(a')$ for some $a' \in A_{n+1}$. Now we have

\begin{center}
$u(a) = d(b) - ud(a') = d(b-u(a'))$
\end{center}

so it the boundary of $b-u(a')$, which is 0 after passing to homology. We have proven that $[a] \in \ker(u_{\ast})$. The proof of exactness at $H_n(A)$ is complete.\\
Let us prove first that $\im(v_{\ast}) \subseteq \ker(\partial)$. For a homology class of the form $v_{\ast}([b]) \in H_n(C)$, reproduce the construction of $\partial$ to obtain

\begin{center}
$\partial v_{\ast}([b]) = \partial([v(b)]) = [u^{-1}dv^{-1}v(b)] = u^{-1}d(b)] = [u^{-1}(0)] = [0]$
\end{center}

where we slightly abuse notation in that $v^{-1}$ is not uniquely determined, but we have seen above that it doesn't matter what element of the preimage we choose. On the other hand, $u^{-1}$ is not an abuse of notation, because $u$ is injective. Moreover, we are using $d(b) = 0$ because homology classes are defined starting with cycles.\\
Now we prove $\ker(\partial) = \im(v_{\ast})$. Assume that $[c] \in \ker(\partial)$. If $v(b) = c$, this means that $[u^{-1}d(b)] = 0$, so that $u^{-1}d(b) = d(a')$ for some $a' \in A_n$. Let us consider the element $b - u(a') \in B_n$, we have

\begin{center}
$d(b - u(a')) = d(b) - ud(a') = 0$
\end{center}

so $b - u(a')$ is a cycle, hence it defines a homology class. We conclude by seeing that

\begin{center}
$v_{\ast}([b-u(a')]) = [v(b) - vu(a')] = [v(b)] = [c]$
\end{center}

because $vu = 0$. So $[c]$ is in the image of $v_{\ast}$, and our proof is complete.

\item[\textbf{Corollary}] For a short exact sequence of modules $0 \to A \to B \to C \to 0$ and a right exact functor $F$, there is a long exact sequence

\begin{center}
$\ldots \to L_2F(C) \to L_1F(A) \to L_1F(b) \to L_1F(C) \to F(A) \to F(B) \to F(C) \to 0$.
\end{center}

(Remember, from the exercise sheet, that $L_0F \cong F$.)

\item[\textbf{Corollary}] For a short exact sequence as above and a module $M$, there are long exact sequences

\begin{center}
$\ldots \to \textup{Tor}^1(M,A) \to \textup{Tor}^1(M,B) \to \textup{Tor}^1(M,C) \to M \otimes A \to M \otimes B \to M \otimes C \to 0$\\
\vspace{15pt}
$\ldots \to \textup{Tor}^1(A,M) \to \textup{Tor}^1(B,M) \to \textup{Tor}^1(C,M) \to A \otimes M \to B \otimes M \to C \otimes M \to 0$.
\end{center}

\item[\textbf{Remark}] Dually, there is are cohomology long exact sequences going upward in dimension, with homomorphisms $\partial: H^n(C) \to H^{n+1}(A)$. In particular, given a short exact sequence of modules and a left exact functor, there is a long exact sequence of the form

\begin{center}
$0 \to F(A) \to F(B) \to F(C) \to R_1F(A) \to R_1F(B) \to R_1F(C) \to R_2F(A) \to \ldots$.
\end{center}

Specializing even more, we get long exact sequences of the form

\begin{center}
$0 \to \Hom(M,A) \to \Hom(M,B) \to \Hom(M,C) \to \textup{Ext}^1(M,A) \to \textup{Ext}^1(M,B) \to \textup{Ext}^1(M,C) \to \ldots$\\
\vspace{15pt}
$0 \to \Hom(C,M) \to \Hom(B,M) \to \Hom(A,M) \to \textup{Ext}^1(C,M) \to \textup{Ext}^1(B,M) \to \textup{Ext}^1(A,M) \to \ldots$.
\end{center}
\end{itemize}

\section*{Week 11}
\begin{itemize}
\item[\textbf{Question}] Why are Ext modules called Ext? The name $\textup{Ext}$ originated from extension groups, that we will illustrate in a moment. It was then shown that these groups could equivalently be constructed by the means of projective or injective resolutions of abelian groups, and such methods are quite naturally generalized to the context of modules, where the higher constructions are possibly non-trivial, giving thus rise, by analogy, to the nomenclature $\textup{Ext}^n$ for the higher steps of the same constructions. We are then reduced to the question of what extension groups are and how they are related to $\textup{Ext}^1$.

\item[\textbf{Definition}] Given two abelian groups $A$ and $B$, an extension of $A$ through $B$ is a short exact sequence of the form

\begin{center}
$0 \to B \to M \to A \to 0$.
\end{center}

Two such sequences are called equivalent if there is a map $M \to N$ such that the diagram

\begin{center}
\begin{tikzcd}
&& M \ar[dr] \ar[dd]\\
0 \ar[r] & B \ar[ur] \ar[dr] && A \ar[r] & 0\\
&& N \ar[ur]
\end{tikzcd}
\end{center}

is commutative. It can be checked that whenever this is the case the map $M \to N$ is necessarily an isomorphism. The extension group $\textup{Ext}(A,B)$ has equivalence classes of extensions of $A$ through $B$ as elements. The group structure is depicted below.

\item[\textbf{Baer sum}] Given two extensions as above, with $f: B \to M$ and $g: B \to N$ respectively as first arrow, their Baer sum is defined to be the equivalence class of the short exact sequence

\begin{center}
$0 \to B \to E \to A \to 0$
\end{center}

where $E$ is the quotient of $M \oplus N$ on the subgroup generated by all elements of the form $(f(b),0) - (0,-g(b))$ for all elements $b \in B$.\\
The unit for this monoid structure is given by the splitting sequence, that is, the sequence

\begin{center}
$0 \to B \to A \oplus B \to A \to 0$
\end{center}

and the inverse of a sequence given by the two maps $u: B \to M$ and $v: M \to A$ is the sequence given by $-u$ and $v$.

\item[\textbf{Theorem}] The above construction gives a group structure on $\textup{Ext}(A,B)$. Moreover, there is an natural isomorphism $\textup{Ext}(A,B) \cong \textup{Ext}^1(A,B)$.

\item[\textbf{Idea of proof}] We construct a map $\textup{Ext}(A,B) \to \textup{Ext}^1(A,B)$ and omit the rest of the proof. Choose an extension of $A$ through $B$, and choose a projective resolution of $A$, as in the diagram

\begin{center}
\begin{tikzcd}
0 \ar[r] & P_1 \ar[d, dotted] \ar[r] & P_0 \ar[d, dotted] \ar[r] & A \arrow[equal]{d} \ar[r] & 0\\
0 \ar[r] & B \ar[r] & M \ar[r] & A \ar[r] & 0.
\end{tikzcd}
\end{center}

By projectivity of $P_0$, there is an arrow $P_0 \to M$ that makes the right square commute, then since the lower row is exact, its universal property yields the arrow $P_1 \to M$ that makes the left square commute as well. Now observe that $\textup{Ext}^1(A,B)$ is the quotient of $\Hom(P_1,B)$ on the subgroup of all maps that factor through $P_1 \to P_0$. Our starting short exact sequence will be associated to the equivalence class of the obtained map $P_1 \to B$.

\item[\textbf{Question}] Why are Tor modules called Tor? The answer to this also restricts to the case of $\textup{Tor}^1$ on abelian groups. The reason is that, in that case, Tor groups are always torsion groups. We need a couple of preliminaries to prove that.

\item[\textbf{Proposition}] Let $F$ be a right exact functor, and $U$ an exact functor. Then there is a natural isomorphism $UL_nF \cong L_nUF$, where $L_n$ denotes as usual the $n$-th left derived functor.

\item[\textbf{Proof}] Exercise sheet.

\item[\textbf{Proposition}] Let $I$ be a directed diagram, then the functor $\colim: R-\catname{Mod}^I \to R-\catname{Mod}$ is exact.

\item[\textbf{Sketch of proof}] We know that $\colim$ is left adjoint to the diagonal functor $\delta: R-\catname{Mod} \to R-\catname{Mod}^I$ sending an object $M$ to the constant functor on $M$. Therefore, as we have already seen in a past session, it is right exact. It only remains to show that it preserves monomorphisms. This can be done explicitly, keeping in mind that monomorphisms are precisely injections, and colimits of directed diagrams behave like unions of all the involved modules.

\item[\textbf{Corollary}] Given a left adjoint (hence right exact) functor $F$ and a directed diagram of modules $(A_i)_{i \in I}$, we have a natural isomorphism $L_nF(\colim A_i) \cong \colim L_nF(A_i)$.

\item[\textbf{Proof}] Let us compute

\begin{center}
$L_nF(\colim A_i) \cong L_n \colim F(A_i) \cong \colim L_nF(A_i)$
\end{center}

where the first isomorphism is given by the fact that $L$ is a left adjoint and therefore it preserves all colimits, and the second isomorphism is a combination of the two previous propositions.

\item[\textbf{Remark}] A dual result is obtained if we choose a left exact functor $F$ and its right derived functors.

\item[\textbf{Corollary}] For a directed diagram of modules $(A_i)_{i \in I}$ and a module $B$, we have natural isomorphisms $\textup{Tor}^n(\colim A_i, B) \cong \colim \textup{Tor}^n(A_i,B)$.

\item[\textbf{Theorem}] For $A$ and $B$ abelian groups, $\textup{Tor}^1(A,B)$ is a torsion group.

\item[\textbf{Proof}] $A$ can be expressed as the union of all its finitely generated subgroups $A_i$. In particular, this union is the colimit of a directed diagram. Now we compute

\begin{center}
$\textup{Tor}^1(A,B) \cong \textup{Tor}^1(\colim A_i,B) \cong \colim \textup{Tor}^1(A_i,B)$
\end{center}

by the corollary above. Now torsion groups are stable under colimits, therefore we are reduced to the case where $A$ is finitely generated. In other words, it must be of the form

\begin{center}
$A \cong \mathbb{Z}^m \oplus \mathbb{Z}/n_1 \oplus \ldots \oplus \mathbb{Z}/n_r$
\end{center}

for appropriate natural numbers $m, n_1, \ldots, n_r$. Next, we compute

\begin{center}
$\textup{Tor}^1(A,B) \cong \textup{Tor}^1(\mathbb{Z}^m,B) \oplus \textup{Tor}^1(\mathbb{Z}/n_1,B) \oplus \ldots \oplus \textup{Tor}^1(\mathbb{Z}/n_r,B)$
\end{center}

since all functors $\textup{Tor}^n$ preserve finite sums (see exercise sheet). Now, we know that the first term is $0$ because $\mathbb{Z}^m$ is projective, and all other terms are $B/n_iB$, hence torsion. This concludes the proof.

\item[\textbf{Exercise}] Let us compute the group $\textup{Ext}^1(\mathbb{Q},\mathbb{Z}/n)$.

\item[\textbf{Solution}] Let us choose an injective resolution of $\mathbb{Z}/n$ as follows:

\begin{center}
\begin{tikzcd}
0 \ar[r] & \mathbb{Z}/n \ar[r, "\frac{1}{n}"] & \mathbb{Q}/\mathbb{Z} \ar[r, "n"] & \mathbb{Q}/\mathbb{Z} \ar[r] & 0
\end{tikzcd}
\end{center}

where the first map is the injection that sends $1 \in \mathbb{Z}/n$ to $\frac{1}{n} \in \mathbb{Q}/\mathbb{Z}$. The second map is then the quotient of this injection. We can picture it as the rational circle wrapping around itself $n$ times. Now apply the functor $\Hom(\mathbb{Q},-)$ and consider the degree 1 of the resulting chain complex. This is $\Hom(\mathbb{Q},\mathbb{Q}/\mathbb{Z})$. Now $\mathbb{Q}$ has no torsion elements, and $\mathbb{Q}/\mathbb{Z}$ has only torsion elements. Since a homomorphic image of a torsion element is itself torsion, we conclude that $\Hom(\mathbb{Q},\mathbb{Q}/\mathbb{Z}) \cong 0$. Since $\textup{Ext}^1(\mathbb{Q},\mathbb{Z}/n)$ is a quotient of that, this must also be 0.
\end{itemize}
\end{document}