\documentclass[12pt]{amsart}
\usepackage{amsmath,amsthm,amsfonts,latexsym,amssymb}
\pagestyle{headings}
\setlength{\textwidth}{36true pc}
\setlength{\headheight}{8true pt} % needed for 12pt documents
\setlength{\oddsidemargin}{15 truept}
\setlength{\evensidemargin}{15 truept}
\setlength{\textheight}{572true pt}
\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lm}[thm]{Lemma}
\newtheorem{prp}[thm]{Proposition}
\newtheorem{clm}[thm]{Claim}
%
\theoremstyle{definition}
\newtheorem{df}[thm]{Definition}
\newtheorem{exmp}[thm]{Example}
\newtheorem{prb}[thm]{Problem}
%
\theoremstyle{remark}
\newtheorem{rem}[thm]{Remark}
%
\numberwithin{equation}{section}
%
\newcommand{\thref}[1]{Theorem~\ref{#1}}
\newcommand{\secref}[1]{\S\ref{#1}}
\newcommand{\lmref}[1]{Lemma~\ref{#1}}
%
\DeclareMathOperator{\satf}{\models}
\DeclareMathOperator{\miff}{\Longleftrightarrow} 
                                           % math `if and only if'
\DeclareMathOperator{\mimplies}{\Longrightarrow} 
                                           % math `implies'
\DeclareMathOperator{\mimplied}{\Longleftarrow}  
                                           % math `implied by'
\newcommand{\set}[2]{\{#1\,:\,\text{#2}\}} % { x : ... }
\DeclareMathOperator{\id}{\textsl{id}}     % The identity map
\DeclareMathOperator{\miffdef}{\stackrel{def}{\miff}}
                                           % defining iff
\DeclareMathOperator{\eqdef}{\stackrel{def}{=}}
                                           % defining equation

\DeclareMathOperator{\neareq}{\stackrel{\ae}{=}}
\DeclareMathOperator{\aeqv}{\stackrel{ae}{\equiv}}
\DeclareMathOperator{\aeq}{\stackrel{ae}{=}}
%
\DeclareMathOperator{\BZ}{\mathbb{Z}} % integers
\DeclareMathOperator{\BQ}{\mathbb{Q}} % rationals
\DeclareMathOperator{\BR}{\mathbb{R}} % reals
\DeclareMathOperator{\BC}{\mathbb{C}} % complex numbers
\DeclareMathOperator{\BE}{\mathbb{E}} % 
\DeclareMathOperator{\BF}{\mathbb{F}} % 
\DeclareMathOperator{\BH}{\mathbb{H}} % 
\DeclareMathOperator{\BK}{\mathbb{K}} % 
\DeclareMathOperator{\BL}{\mathbb{L}} % 
\DeclareMathOperator{\BO}{\mathbb{O}} % 
\DeclareMathOperator{\re}{Re}         % real part
\DeclareMathOperator{\im}{Im}         % imaginary part
\DeclareMathOperator{\Ker}{Ker}
%
\DeclareMathOperator{\meet}{\wedge}
\DeclareMathOperator{\join}{\vee}
\DeclareMathOperator{\union}{\cup}
\DeclareMathOperator{\inter}{\cap}  % intersection
\DeclareMathOperator{\iso}{\cong}   % isomorphic
\DeclareMathOperator{\piso}{\simeq} % polynomially isomorphic
\newcommand{\Star}{^ *}
\DeclareMathOperator{\compose}{{\scriptstyle \circ}} % f o g
%
\newcommand{\wec}[1]{{\mathbf{#1}}}  % notation for vectors in algebras
%\newcommand{\wec}[1]{{\bar{#1}}} % which one do you prefer?
\newcommand{\wrel}[1]{\;#1\;}     % a\wrel{\alpha}b = a \alpha b
%              % this provides a flexible way to change the spacing
%
\newcommand{\m}[1]{{\mathbf{\uppercase{#1}}}}
\newcommand{\vr}[1]{{\mathcal{\uppercase {#1}}}}
%
\DeclareMathOperator{\Var}{\mathbf{V}}
\DeclareMathOperator{\Ho}{\mathbf{H}}
\DeclareMathOperator{\Su}{\mathbf{S}}
\DeclareMathOperator{\Pd}{\mathbf{P}}
\DeclareMathOperator{\Iso}{\mathbf{I}}
\DeclareMathOperator{\Ps}{\mathbf{P}_s}
\newcommand{\fin}[1]{{\mathbf{#1}}_{\text{\upshape fin}}}
%
\DeclareMathOperator{\Pol}{Pol}
\DeclareMathOperator{\Clo}{Clo}
\DeclareMathOperator{\Con}{Con}
\DeclareMathOperator{\Conb}{\mathbf{Con}} % Con(A) as a lattice
\DeclareMathOperator{\cg}{Cg}
\DeclareMathOperator{\sg}{Sg}
\newcommand{\Cg}[1]{{\cg}^{\m{#1}}}
\newcommand{\Sg}[1]{{\sg}^{\m{#1}}}
%
\newcommand{\M}[3]{\text{\upshape M}_{\m{#1}} (#2, #3)}
\newcommand{\minl}[1]{\text{\upshape Min}_{\m{#1}}}
%
\DeclareMathOperator{\typ}{typ}
\DeclareMathOperator{\ann}{ann}
\DeclareMathOperator{\Sep}{Sep}
\DeclareMathOperator{\ssb}{ssb}
\DeclareMathOperator{\sst}{sst}
%
\DeclareMathOperator{\utyp}{\mathbf{1}}% unary      
\DeclareMathOperator{\atyp}{\mathbf{2}}% affine     
\DeclareMathOperator{\btyp}{\mathbf{3}}% boolean    
\DeclareMathOperator{\ltyp}{\mathbf{4}}% lattice    
\DeclareMathOperator{\styp}{\mathbf{5}}% semilattice
\DeclareMathOperator{\ityp}{\mathbf{i}}
\DeclareMathOperator{\jtyp}{\mathbf{j}}
%
\DeclareMathOperator{\solv}{\stackrel{s}{\sim}}
\DeclareMathOperator{\ssolv}{\stackrel{ss}{\sim}}
%
\newcommand{\bd}{\begin{description}}
\newcommand{\ed}{\end{description}}
%
\newcommand{\lb}{\langle} % <...>
\newcommand{\rb}{\rangle}
\newcommand{\lv}{{[\![}}  % [[...]]
\newcommand{\rv}{{]\!]}}
%
\newcommand{\ul}{\underline}
\newcommand{\ol}{\overline}
%
\newcommand{\vep}{\varepsilon}
\newcommand{\di}{\diamond}
%


\begin{document}

\noindent
{\large \bf Additional notes \#6.}

\bigskip

\noindent
{\bf Categories, Functors, and Natural Transformations.}

\bigskip

The intuitive model of a category is a collection of
mathematical structures (called {\it objects}) equipped
with structure preserving mappings (called {\it morphisms}).
The formal definition closely resembles our definition
of ``algebra''; in fact, a (small) category is a
2-sorted partial algebra.

\begin{df} A {\it category} is a structure
\[\lb O, M; \circ, {\rm id}, {\rm dom}, {\rm cod}\rb\]
where
\begin{enumerate}
\item[(1)] $O$ is a class whose members are called {\it objects},
\item[(2)] $M$ is a class whose members are called {\it morphisms},
\item[(3)] $\circ: M\times M\rightarrow M$ is a binary partial
operation called {\it composition}, 
\item[(4)] ${\rm id}: O\rightarrow M$ is a unary function
assigning to each object $A\in O$ a morphism 
${\rm id}_A$ called {\it the
identity of $A$}, 
\item[(5)] ${\rm dom}, {\rm cod}: M\rightarrow O$ are unary
functions assigning to each morphism $f$ objects called
the {\it domain} and {\it codomain} of $f$ respectively.
\end{enumerate}
The laws defining categories are:
\begin{enumerate}
\item[(1)] $f\circ g$ exists if and only if 
${\rm dom}(f) = {\rm cod}(g)$. 
\item[(2)] Composition is associative when it is defined.
\item[(3)] ${\rm dom}(f\circ g) = {\rm dom}(g)$, 
${\rm cod}(f\circ g) = {\rm cod}(f)$.
\item[(4)] If $A = {\rm dom}(f)$ and $B = {\rm cod}(f)$, then 
$f\circ {\rm id}_A = f$ and ${\rm id}_B\circ f = f$.
\item[(5)] ${\rm dom}({\rm id}_A) = {\rm cod}({\rm id}_A) = A$.
\end{enumerate}
A category is {\it small} if $M$ is a set.
This forces $O$ to be a set, too.
\end{df}

\medskip

\noindent
{\bf Notation.} We let ${\rm Hom}_{\vr C}(A,B)$ denote
the class of $f\in M$ for which ${\rm dom}(f) = A$
and ${\rm cod}(f) = B$.

\medskip

\noindent
{\bf Examples.}
\begin{enumerate}
\item[(1)] If $\vr V$ is a variety of algebras, then 
$\vr V$ may be thought of as a category whose objects
are the algebras in $\vr V$ and whose morphisms are
the homomorphisms between members of $\vr V$.
\item[(2)] If $\lb P; \leq \rb$ is a partially 
ordered set, then the elements of $P$ may
be thought of as the objects of a category
whose morphisms are the arrows $a\rightarrow b$
where $a\leq b$ in $P$.
\end{enumerate}

Since the definition of a category is so close to that of
an algebra, it is natural to try to compare categories
with ``homomorphisms''. These are called ``covariant
functors''.

\begin{df}
A {\it covariant functor} $F:{\vr C}\rightarrow {\vr D}$
is a ``structure preserving mapping'' from $\vr C$ to $\vr D$.
Precisely, $F$ is a pair of mappings, both called $F$,
between object classes 
($F(O_{\vr C})\subseteq O_{\vr D}$) 
and morphism classes ($F(M_{\vr C})\subseteq M_{\vr D}$) where 
\begin{enumerate}
\item[(1)] $F(f\circ g) = F(f)\circ F(g)$,
\item[(2)] $F({\rm id}_A) = {\rm id}_{F(A)}$, 
\item[(3)] $F({\rm dom}(f)) = {\rm dom}(F(f))$, and
\item[(4)] $F({\rm cod}(f)) = {\rm cod}(F(f))$.
\end{enumerate}

A {\it contravariant functor} $F:{\vr C}\rightarrow {\vr D}$
is a ``composition reversing mapping'' from 
$\vr C$ to $\vr D$. That is, $F(O_{\vr C})\subseteq O_{\vr D}$,
$F(M_{\vr C})\subseteq M_{\vr D}$, and
\begin{enumerate}
\item[(1)] $F(f\circ g) = F(g)\circ F(f)$,
\item[(2)] $F({\rm id}_A) = {\rm id}_{F(A)}$, 
\item[(3)] $F({\rm dom}(f)) = {\rm cod}(F(f))$, and
\item[(4)] $F({\rm cod}(f)) = {\rm dom}(F(f))$.
\end{enumerate}
\end{df}

\noindent
{\bf Examples.}
\begin{enumerate}
\item[(1)] Let $\vr C$ be any category, and let 
$A\in O_{\vr C}$ be any object in $\vr C$.
The {\it covariant hom functor represented by $A$}
is the covariant 
functor $F:{\vr C}\rightarrow {\sf Sets}$ 
whose behavior on objects is 
$F(X) = {\rm Hom}_{\vr C}(A,X)$ and whose 
behavior on morphisms is 
$F(f)$ = left composition with $f$.
\item[(2)] The {\it contravariant hom functor represented by $A$}
is the contravariant 
functor $F:{\vr C}\rightarrow {\sf Sets}$ 
whose behavior on objects is 
$F(X) = {\rm Hom}_{\vr C}(X,A)$ and whose 
behavior on morphisms is 
$F(f)$ = right composition with $f$.
\item[(3)] If we consider posets $P$ and $Q$ to be
categories (as earlier), then a function from $P$
to $Q$ is a covariant functor
if it is order preserving and is a contravariant 
functor if it is order reversing.
\end{enumerate}

\medskip

\noindent
{\bf Exercise.} Check that these are functors.

\medskip

We compare functors $F, G: {\vr C}\rightarrow {\vr D}$
with ``natural transformations'':

\begin{df}
If $F, G: {\vr C}\rightarrow {\vr D}$ are two covariant
functors, then a {\it natural transformation}
$\eta:F\rightarrow G$ is a 
mapping $\eta:O_{\vr C}\rightarrow M_{\vr D}: A\mapsto \eta_A$
such that for any $f:A\rightarrow B$ in $\vr C$ we have
$G(f)\circ \eta_A = \eta_B\circ F(f)$. 
\[
\begin{array}{c}
\hphantom{f} A\\
f \downarrow \\
\hphantom{f} B
\end{array}
\begin{array}{rcl}
\hphantom{F(f)FFF} F(A) & \stackrel{\eta_A}{\rightarrow} & G(A)\hphantom{G(f)GGG}\\
F(f) \downarrow \hphantom{F} & & \hphantom{G}\downarrow G(f)\\
\hphantom{F(f)FFF} F(B) & \stackrel{\eta_B}{\rightarrow} & G(B)\hphantom{G(f)GGG}\\
\end{array}
\]
\end{df}

\medskip

\noindent
{\bf Exercise.} Let ${\BF}$ be a field and let
$\vr V$ be the variety of ${\BF}$ vector spaces.
It follows from the earlier exercise that 
$F(X) = {\rm Hom}_{\vr V}(X,{\BF}) = X^*$
is the object part of 
a contravariant functor from $\vr V$ to 
$\vr V$, so $G(X) = X^{**}$
is the object part of a covariant functor
from $\vr V$ to 
$\vr V$.
Prove that the evaluation map 
$E:X\rightarrow X^{**}$ is a natural
transformation from the identity functor
on $\vr V$ and the functor $G$.


\medskip



\end{document}

