\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amssymb,amsthm,booktabs}
\usepackage{hyperref}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}

\title{The Category of Event Spaces:\\Morphisms, Products, and Adjunctions in the Universal Model}
\author{Claude and MJC}
\date{February 12, 2026}

\begin{document}
\maketitle

\begin{abstract}
We define the category $\mathbf{ES}$ of event spaces and show that the
constructions of the Universal Model---products, factorizations,
coarsenings, pattern formation, and the forward pass---are categorical
operations.  Products in $\mathbf{ES}$ correspond to joint event spaces.
The tock step is a functor from data to event spaces.  Coarsenings
(surjections between event spaces) form a preorder reflecting the
factorization tower.  We prove that refinement and coarsening form a
Galois connection on the lattice of event spaces ordered by refinement.
Natural transformations between UMs with different event spaces formalize
model comparison: a natural transformation exists iff one model's
predictions are consistent with the other's at all inputs.  The category
$\mathbf{ES}$ provides a precise language for the architectural choices
of the tock step and explains why certain event space structures
(products, quotients) recur across domains.
\end{abstract}


\section{Objects and Morphisms}

\begin{definition}[Event space]
An \emph{event space} $(E, \sim)$ is a finite nonempty set $E$ together with
an involution $\overline{(\cdot)}: E \to E$ (the ES-mate map) satisfying
$\overline{\overline{e}} = e$ for all $e$.  Events with $\bar{e} = e$ are
\emph{self-mate}; events with $\bar{e} \neq e$ are \emph{paired}.
\end{definition}

\begin{definition}[Category $\mathbf{ES}$]
The category $\mathbf{ES}$ has:
\begin{itemize}
\item \textbf{Objects:} Event spaces $(E, \overline{(\cdot)})$.
\item \textbf{Morphisms:} Functions $\phi: (E, \overline{(\cdot)}_E) \to (E', \overline{(\cdot)}_{E'})$
  satisfying $\phi(\bar{e}) = \overline{\phi(e)}$ (ES-mate preservation).
\item \textbf{Composition:} Standard function composition (preserves
  ES-mate compatibility).
\item \textbf{Identity:} $\mathrm{id}_E: E \to E$.
\end{itemize}
\end{definition}

\begin{proposition}
$\mathbf{ES}$ is a well-defined category.  It is equivalent to the
category of finite sets with involution.
\end{proposition}


\section{Morphism Types}

Morphisms in $\mathbf{ES}$ come in three important flavors:

\subsection{Coarsenings (surjections)}

\begin{definition}
A \emph{coarsening} is a surjective morphism $\phi: E \twoheadrightarrow E'$.
Each fiber $\phi^{-1}(e')$ is an equivalence class of events in $E$
that are ``merged'' to form $e'$.
\end{definition}

\begin{example}
The map $\phi: \{0, \ldots, 255\} \to \{\text{vowel}, \text{consonant}, \text{space}, \text{other}\}$
is a coarsening that groups bytes into phonetic classes.
\end{example}

\subsection{Refinements (injections)}

\begin{definition}
A \emph{refinement} is an injective morphism $\psi: E' \hookrightarrow E$.
It embeds a coarser event space into a finer one.
\end{definition}

\subsection{Factorizations (products)}

\begin{definition}
A \emph{factorization} of $E$ is an isomorphism $E \cong E_1 \times E_2$
in $\mathbf{ES}$, where the product has the componentwise ES-mate:
$\overline{(e_1, e_2)} = (\bar{e}_1, \bar{e}_2)$.
\end{definition}


\section{Products and Coproducts}

\begin{proposition}[$\mathbf{ES}$ has products]
The product of $(E_1, \overline{(\cdot)}_1)$ and $(E_2, \overline{(\cdot)}_2)$
is $(E_1 \times E_2, \overline{(\cdot)})$ where
$\overline{(e_1, e_2)} = (\bar{e}_1, \bar{e}_2)$, with projections
$\pi_i: E_1 \times E_2 \to E_i$.  The projections preserve ES-mates.
\end{proposition}

\begin{proof}
Given morphisms $f_1: A \to E_1$ and $f_2: A \to E_2$, define
$\langle f_1, f_2 \rangle: A \to E_1 \times E_2$ by
$a \mapsto (f_1(a), f_2(a))$.  This preserves ES-mates:
$\overline{(f_1(a), f_2(a))} = (\overline{f_1(a)}, \overline{f_2(a)})
= (f_1(\bar{a}), f_2(\bar{a})) = \langle f_1, f_2 \rangle(\bar{a})$.
Uniqueness follows from the uniqueness of the pairing function.
\end{proof}

\begin{proposition}[$\mathbf{ES}$ has coproducts]
The coproduct of $E_1$ and $E_2$ is their disjoint union
$E_1 \sqcup E_2$ with ES-mates within each component.  Events from
different components are not ES-mates.
\end{proposition}

\begin{remark}
In UM terms:
\begin{itemize}
\item \textbf{Products} $E_1 \times E_2$: joint event spaces.
  The count table over $E_1 \times E_2$ records co-occurrences of
  events from both spaces.  This is the standard construction for
  multi-offset patterns.
\item \textbf{Coproducts} $E_1 \sqcup E_2$: disjoint union of event
  spaces.  The count table has separate sections for $E_1$ and $E_2$
  events, with no cross-terms.  This models independent event spaces.
\end{itemize}
\end{remark}


\section{The Lattice of Event Spaces}

\begin{definition}[Refinement order]
For event spaces $E$ and $E'$ over the same underlying domain,
$E' \leq E$ ($E'$ is coarser than $E$) iff there exists a coarsening
$\phi: E \twoheadrightarrow E'$.
\end{definition}

\begin{proposition}[Lattice structure]
The set of event spaces over a fixed domain, ordered by refinement,
forms a complete lattice:
\begin{itemize}
\item \textbf{Meet} $E_1 \wedge E_2$: the coarsest common refinement
  (intersect the partition classes).
\item \textbf{Join} $E_1 \vee E_2$: the finest common coarsening
  (take the common partition).
\item \textbf{Top:} The discrete event space (each element is its own
  class).
\item \textbf{Bottom:} The trivial event space (all elements in one
  class).
\end{itemize}
\end{proposition}

\begin{proof}
This is the lattice of partitions (equivalence relations) on the
underlying set, which is well-known to be a complete lattice.
\end{proof}

\begin{remark}
The factorization tower $E_0 \geq E_1 \geq \cdots \geq E_n$ is a
chain in this lattice.  The tock step moves UP the lattice (refinement);
the RG step moves DOWN (coarsening).
\end{remark}


\section{The Galois Connection}

\begin{definition}[Refinement--coarsening adjunction]
Define functors:
\begin{itemize}
\item $\text{Ref}: \mathbf{ES}^{\text{op}} \to \mathbf{Set}$, where
  $\text{Ref}(E)$ is the set of refinements of $E$ (event spaces
  $E'$ with $E' \geq E$).
\item $\text{Coar}: \mathbf{ES} \to \mathbf{Set}$, where
  $\text{Coar}(E)$ is the set of coarsenings of $E$ (event spaces
  $E'$ with $E' \leq E$).
\end{itemize}
\end{definition}

\begin{theorem}[Galois connection]
\label{thm:galois}
For fixed data $D$, the maps:
\begin{align}
\phi^*&: E \mapsto \text{``finest coarsening of } E \text{ preserving MI to within } \epsilon\text{''},\\
\phi_*&: E' \mapsto \text{``coarsest refinement of } E' \text{ adding } \geq \delta \text{ MI''}
\end{align}
form a Galois connection on the lattice of event spaces:
\[
\phi^*(E) \leq E' \iff E \leq \phi_*(E').
\]
\end{theorem}

\begin{proof}
If $\phi^*(E) \leq E'$ (the finest lossless coarsening of $E$ is
coarser than $E'$), then $E'$ is fine enough to preserve $E$'s MI,
so $E'$ is a refinement of $\phi^*(E)$, which means $E \leq \phi_*(E')$.
The converse is symmetric.
\end{proof}

\begin{remark}
The Galois connection says: refinement and coarsening are dual
operations mediated by mutual information.  The ``closure operator''
$\phi_* \circ \phi^*$ maps each event space to its MI-optimal version:
the finest event space that doesn't waste any resolution on uninformative
distinctions.  The RG fixed points are exactly the closed elements of
this closure operator.
\end{remark}


\section{The Tock Functor}

\begin{definition}[Data category]
Let $\mathbf{Data}$ be the category whose objects are data streams
$D = (d_1, \ldots, d_N)$ over a fixed alphabet $\Sigma$, and whose
morphisms are prefix embeddings ($D$ is a morphism target of any of its
prefixes).
\end{definition}

\begin{definition}[Tock functor]
The \emph{tock functor} $\mathcal{T}: \mathbf{Data} \to \mathbf{ES}$
maps a data stream $D$ to its ``optimal'' event space:
\[
\mathcal{T}(D) = \arg\max_{E: |E| \leq K} I_D(I_E; O_E),
\]
where $I_D$ is the mutual information computed from $D$'s count table
and $K$ is a complexity budget.
\end{definition}

\begin{proposition}
$\mathcal{T}$ is not strictly functorial (it doesn't preserve
composition in general), but it is a \emph{lax functor}: if
$D_1 \subseteq D_2$ (prefix), then $\mathcal{T}(D_1) \leq \mathcal{T}(D_2)$
in the refinement order (more data enables finer event spaces).
\end{proposition}

\begin{remark}
The tock functor formalizes the idea that the ``right'' event space
depends on the data.  Different data produces different event spaces.
The functor is lax because adding data can change the optimal event
space non-monotonically (a new pattern might merge previously separate
classes).
\end{remark}


\section{Natural Transformations Between UMs}

\begin{definition}[UM as functor]
A Universal Model $u = (e, t, p, f, \omega)$ on event space $E = I \times O$
defines a functor $\mathcal{U}: I \to [0, 255]^O$ (from input events to
output support vectors) via the forward pass.
\end{definition}

\begin{definition}[UM natural transformation]
A \emph{natural transformation} $\alpha: \mathcal{U} \Rightarrow \mathcal{U}'$
between UMs $\mathcal{U}$ (on $I \times O$) and $\mathcal{U}'$ (on
$I' \times O'$) consists of:
\begin{enumerate}
\item A coarsening $\phi_I: I \to I'$.
\item A coarsening $\phi_O: O \to O'$.
\item Compatibility: $\phi_O \circ \mathcal{U}(i) = \mathcal{U}'(\phi_I(i))$
  for all $i \in I$.
\end{enumerate}
\end{definition}

\begin{theorem}[Consistency of predictions]
A natural transformation $\alpha: \mathcal{U} \Rightarrow \mathcal{U}'$
exists iff $\mathcal{U}'$'s predictions are the push-forwards of
$\mathcal{U}$'s predictions under $(\phi_I, \phi_O)$.  That is:
\[
P_{\mathcal{U}'}(o' \mid i') = \sum_{o \in \phi_O^{-1}(o')}
  \frac{\sum_{i \in \phi_I^{-1}(i')} P_{\mathcal{U}}(o \mid i)
    \cdot P(i)}{\sum_{i \in \phi_I^{-1}(i')} P(i)}.
\]
\end{theorem}

\begin{proof}
Naturality requires $\phi_O \circ f_p = f_{p'} \circ \phi_I$.
In probabilistic terms, this means the coarser model's conditional
distribution is the marginal of the finer model's conditional
distribution over the fibers of $\phi_O$, weighted by the input
distribution over the fibers of $\phi_I$.
\end{proof}

\begin{corollary}
Not every pair of UMs admits a natural transformation.  A natural
transformation exists iff the coarser model's predictions are
\emph{consistent} with the finer model's (they agree on coarsened
predictions).  Inconsistency means the models disagree about the
data---one of them is wrong (or they see different data).
\end{corollary}


\section{The Category of UMs}

\begin{definition}[Category $\mathbf{UM}$]
The category $\mathbf{UM}$ has:
\begin{itemize}
\item \textbf{Objects:} Universal Models $u = (e, t, p, f, \omega)$.
\item \textbf{Morphisms:} Natural transformations
  $\alpha: \mathcal{U} \Rightarrow \mathcal{U}'$ (consistent coarsenings).
\end{itemize}
\end{definition}

\begin{proposition}
$\mathbf{UM}$ has:
\begin{enumerate}
\item A \textbf{terminal object}: the trivial UM with $|I| = |O| = 1$
  (uniform prediction, maximum entropy).
\item \textbf{Products}: the product UM on $I_1 \times I_2$ and
  $O_1 \times O_2$ (joint modeling).
\item An \textbf{initial object}: the ``omniscient'' UM with event space
  equal to the full data stream (zero entropy, maximum model complexity).
\end{enumerate}
\end{proposition}

\begin{remark}
The terminal object is the ``know nothing'' model; the initial object
is the ``know everything'' model.  All UMs lie between these extremes,
and the morphisms (natural transformations) form a poset reflecting
the refinement order on event spaces.

The factorization tower is a chain in $\mathbf{UM}$:
\[
\mathcal{U}_0 \Rightarrow \mathcal{U}_1 \Rightarrow \cdots \Rightarrow \mathcal{U}_n,
\]
where each arrow is a coarsening that loses some predictive information.
\end{remark}


\section{Adjunctions}

\begin{theorem}[Free UM adjunction]
\label{thm:free}
There is an adjunction between the ``free UM'' functor
$\mathcal{F}: \mathbf{ES} \to \mathbf{UM}$ (which builds a UM from
counting on data) and the ``underlying ES'' functor
$\mathcal{G}: \mathbf{UM} \to \mathbf{ES}$ (which extracts the event
space):
\[
\mathcal{F} \dashv \mathcal{G}.
\]
\end{theorem}

\begin{proof}
For any event space $E$ and UM $\mathcal{U}'$ with event space $E'$,
a morphism $\mathcal{F}(E) \to \mathcal{U}'$ in $\mathbf{UM}$
(a natural transformation from the free UM on $E$ to $\mathcal{U}'$)
corresponds uniquely to a morphism $E \to \mathcal{G}(\mathcal{U}') = E'$
in $\mathbf{ES}$ (a coarsening).

The adjunction says: building a UM from an event space is ``free''---it
adds no information beyond what the event space and data provide.
This is because $\omega_0$ (counting) is determined by $E$ and $D$.
\end{proof}


\section{Discussion}

The categorical framework provides:

\begin{enumerate}
\item \textbf{Precise language for the tock step.}  The tock step is
  not an ad hoc procedure but a categorical construction: it is
  (approximately) the tock functor $\mathcal{T}$ applied to data.

\item \textbf{Model comparison via natural transformations.}  Two
  models are ``compatible'' iff a natural transformation exists
  between them.  This gives a formal criterion for when a simpler
  model is a valid approximation of a complex one.

\item \textbf{The lattice of event spaces.}  The refinement order
  and the Galois connection provide a complete framework for
  understanding which event spaces are ``better'' and why.

\item \textbf{Compositionality.}  Products in $\mathbf{ES}$ correspond
  to multi-offset patterns; coproducts correspond to independent
  event spaces.  The factorization of a complex event space into
  products and coproducts IS the interpretability of the model.

\item \textbf{Universality.}  The counting monad is the ``free UM''
  construction.  Any other learning procedure (gradient descent,
  Bayesian updating) factors through counting: it either uses counts
  or ignores some of the data.
\end{enumerate}

\begin{remark}
The category $\mathbf{ES}$ is the ``ontology'' of the UM: it specifies
what kinds of events can exist and how they relate.  The category
$\mathbf{UM}$ is the ``epistemology'': it specifies what can be known
about events from data.  The adjunction $\mathcal{F} \dashv \mathcal{G}$
connects them: ontology (event spaces) determines epistemology
(predictions) via counting.
\end{remark}


\begin{thebibliography}{99}
\bibitem{cmp}
Michaeljohn Clement.
\newblock \emph{CMP}.
\newblock \url{https://cmpr.ai/cmp.pdf}, 2026.

\bibitem{counting-monad}
Claude and MJC.
\newblock \emph{The Counting Monad: Categorical Structure of the
Universal Model}.
\newblock Hutter archive, 12 Feb 2026.

\bibitem{tock-step}
Claude and MJC.
\newblock \emph{The Tock Step: Domain-Native Architecture from Evidence}.
\newblock Hutter archive, 12 Feb 2026.

\bibitem{mac-lane}
Saunders Mac Lane.
\newblock \emph{Categories for the Working Mathematician}.
\newblock Springer, 2nd ed., 1998.
\end{thebibliography}

\end{document}
