%! TEX root = CT.tex
% vim: tw=50
% 29/11/2024 09AM

\glsnoundefn{allg}{allegory}{allegories}%
P. Freyd developed a theory of \emph{allegories}
which have the structure of \glspl{cat} of
\glspl{rel} and axiomatised those allegories
$\mathcal{A}$ for which the sub\gls{cat}
$\mathcal{A}_{la}$ is \gls{reg}.

\glsnoundefn{erel}{equivalence
relation}{equivalence relations}%
\glsadjdefn{reflr}{reflexive}{relation}%
\glsadjdefn{symmr}{symmetric}{relation}%
\glsadjdefn{transr}{transitive}{relation}%
\glsadjdefn{eff}{effective}{\gls{erel}}%
\glsadjdefn{effregc}{effective regular}{\gls{cat}}%
In a \gls{reg} \gls{cat} $\mathcal{C}$, we say a
\gls{rel} $R : A \torel A$ is \emph{reflexive} if
$\indicator{A} \le R$, \emph{symmetric} if $R^\ucirc =
R$, and \emph{transitive} if $R \circ R \le R$.
$R$ is an \emph{equivalence relation} if it has
all three properties.
For any $A \stackrel{f}{\to} B$ in $\mathcal{C}$,
the kernel-pair $R \stackrel{(a, b)}{\to} A \times
A$ of $f$ is an \gls{erel}. We say an \gls{erel}
$R$ is \emph{effective} if it occurs as a
kernel-pair, and $\mathcal{C}$ is \emph{effective
regular} if all \glspl{erel} are effective.

$\tfAbGp$ is \gls{regc} but not \gls{effregc}: $\{(m, n)
\in \Zbb \times \Zbb \st m \equiv n \pmod 2\}$ is
a non-\gls{eff} \gls{erel} on $\Zbb$.

Note that an \gls{erel} is idempotent in
$\Reln(\mathcal{C})$, and if $\mathcal{A}$ is an
\gls{allg} and $\mathcal{E}$ is a class of
\gls{symmr} idempotents in $\mathcal{A}$ then
$\mathcal{A}[\check{\mathcal{E}}]$ (as defined in
Exercise 1.18) is an \gls{allg}; and if
$\mathcal{A}$ is $\Reln(\mathcal{C})$ for a
\gls{reg} \gls{cat} $\mathcal{C}$, then:

\begin{fcprop}[]
  \label{prop:7.8}
  % Proposition 7.8
  Assuming:
  - $\mathcal{C}$ a \gls{reg} \gls{cat}
  - $\mathcal{E}$ is the class of \glspl{erel} in
  $\mathcal{C}$
  Then:
  $\mathcal{C}_{\text{eff}} =
  (\Reln(\mathcal{C})[\check{\mathcal{E}}])_{la}$
  is \gls{effregc}, and the embedding
  $\Reln(\mathcal{C}) \to
  \Reln(\mathcal{C})[\check{\mathcal{E}}]$
  restricts to a \gls{full} and \gls{faith}
  \gls{reg} \gls{func} $\mathcal{C} \to
  \mathcal{C}_{\text{eff}}$ which is universal
  among \gls{reg} \glspl{func} $\mathcal{C} \to
  \mathcal{D}$ where $\mathcal{D}$ is
  \gls{effregc}.
\end{fcprop}

Note that if $\mathcal{C}$ is \gls{effregc}, its
\glspl{erel} are split idempotents in
$\Reln(\mathcal{C})$: if $A \stackrel{R}{\torel}
A$ is the kernel-pair of $A \stackrel{f}{\covers}
B$ then it splits as $f^\bull f_\bull$ (as we saw
for $\mathcal{C} = \Set$ in Exercise 1.19).

\begin{fcdefn}[Topos]
  \glsnoundefn{topos}{topos}{toposes}%
  \label{defn:7.9}
  % Definition 7.9
  A \emph{topos} is a \gls{regc} \gls{cat}
  $\mathcal{E}$ for which the embedding
  $\mathcal{E} \to \Reln(\mathcal{E})$ sending $f$
  to $f_\bull$ has a \gls{radj}. We write the
  effect of the \gls{radj} on objects by $A
  \mapsto PA$, and the \gls{unit} $A \to PA$ as
  $\{\}_A$, and the \gls{counit} $PA \torel A$ as
  $\exists_A \monic PA \times A$.
\end{fcdefn}

In $\Set$, $PA$ is the power-set of $A$, the unit
is the mapping $a \mapsto \{a\}$ of
\cref{eg:1.7}(c), and $\exists_A = \{(A', a) \mid
a \in A'\} \subseteq PA \times A$.

Note that (isomorphism classes of) \glspl{subobj}
of $A$ are in bijection with morphisms
$\identity{} \to PA$. C. J. Mikkelses showed that
any \gls{topos} has finite \glspl{colim}; we'll
give Bob Par\'e's proof, which is much simpler.

\begin{fcprop}[]
  \label{prop:7.10}
  % Proposition 7.10
  Assuming:
  - $\mathcal{E}$ a \gls{topos}
  Then:
  there exists a \gls{monadic} \gls{func}
  $\mathcal{E}^\op \to \mathcal{E}$. In
  particular, $\mathcal{E}^\op$ has finite
  \glspl{colim} and if $\mathcal{E}$ has
  \glspl{lim} of shape $J$ then it also has
  \glspl{colim} of shape $J^\op$.
\end{fcprop}

\begin{proof}
  We make the assignment $A \mapsto PA$ into a
  \gls{func} $P : \mathcal{E} \to \mathcal{E}$ and
  a \gls{func} $P^* : \mathcal{E}^\op \to
  \mathcal{E}$: given $f : A \to B$, $Pf : PA \to
  PB$ corresponds to the \gls{image} of $\exists_A
  \monic PA \times A \stackrel{\identity{} \times
  f}{\to} PA \times B$, and $P^* f$ corresponds to
  the \gls{pullb} of
  \begin{picmath}
    \begin{tikzcd}
      & \exists_B \ar[d, tail] \\
      PB \times A \ar[r, "\identity{} \times f"]
      & PB \times B
    \end{tikzcd}
  \end{picmath}
  Given $C \stackrel{g}{\to} PA$ corresponding to
  $R \monic C \times A$, $(Pf)g$ corresponds to
  the \gls{image} of $R \monic C \times A
  \stackrel{\identity{} \times f}{\to} C \times
  B$ and similarly given $S \monic D \times B$,
  composing with $P^* f$ corresponds to pulling
  back along $D \times A \stackrel{\identity{}
  \times f}{\to} D \times B$.

  Given a \gls{pullb} square
  \begin{picmath}
    \begin{tikzcd}
      D \ar[r, "h"] \ar[d, "k"]
      & A \ar[d, "f"] \\
      B \ar[r, "g"]
      & C
    \end{tikzcd}
  \end{picmath}
  in $\mathcal{E}$,
  \begin{picmath}
    \begin{tikzcd}
      PD \ar[d, "Pk"]
      & PA \ar[l, "P^* h"] \ar[d, "Pf"] \\
      PB
      & PC \ar[l, "P^* g"]
    \end{tikzcd}
  \end{picmath}
  commutes, since both ways correspond to the
  \gls{image} of the left vertical composite in
  \begin{picmath}
    \begin{tikzcd}
      E \ar[r] \ar[d, tail]
      & \exists_A \ar[d, tail] \\
      PA \times D \ar[r] \ar[d]
      & PA \times A \ar[d] \\
      PA \times B \ar[r]
      & PA \times C
    \end{tikzcd}
  \end{picmath}
  where both squares are \glspl{pullb}.

  Now, as in \cref{eg:5.14}(d), we have that if $E
  \stackrel{e}{\to} A \twofuncs fg B$ is a
  co\gls{pprefl} in $\mathcal{E}$, then
  \begin{picmath}
    \begin{tikzcd}
      PB \ar[r, shift left=3pt, "P^* f"]
      \ar[r, shift right=3pt, "P^* g", swap]
      & PA \ar[r, "P^* e"]
      \ar[l, bend left=45, "Pg"]
      & PE \ar[l, bend left=30, "Pe"]
    \end{tikzcd}
  \end{picmath}
  is a \gls{splitcoeq} \gls{coequaler} in
  $\mathcal{E}$. Also, $P^*$ is self-adjoint on
  the right, and it \gls{reflects} isomorphisms by
  Exercise 7.17(v). The second assertion follows
  from \cref{prop:5.8}(i).
\end{proof}
