\documentclass{article}
\input{packages}
\input{def}

\lecture{Multicategories}

\begin{document}
\maketitle

\begin{definition}[(Biased) Multicategory]
A tuple $\langle O, M, \cocomp, \prf{c}, \prf{a}, \id, \prf{i} \rangle$ whose components have the following types:
\begin{description}
\item[Objects $O$:] $\TYPE{1}$
\item[Morphisms $M$:] $\List O \times O \to \Type$
\begin{center}
\begin{tabular}{c@{\hspace{1in}}c}
\begin{tikzpicture}
\path \marrow{m}{\mo{m}};
\draw[->] (m.in13) +(-4mm,0) node[left] {$\ob{C}_1$} -- +(0,0);
\draw[->] (m.in23) +(-4mm,0) node[left] {$\ob{C}_2$} -- +(0,0);
\draw[->] (m.in33) +(-4mm,0) node[left] {$\ob{C}_3$} -- +(0,0);
\draw[->] (m.out) -- +(4mm,0) node[right] {$\ob{C}$};
\end{tikzpicture}
&
\begin{tikzpicture}
\path \marrow{m}{\mo{m}};
\draw[->] (m.in13) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m.in13) +(-4mm,0mm) node[left] {$\vec{\ob{C}}_1$} -- +(0,0mm);
\draw[->] (m.in13) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m.in23) +(-4mm,0mm) node[left] {$\ob{C}_2$} -- +(0,0mm);
\draw[->] (m.in33) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m.in33) +(-4mm,0mm) node[left] {$\vec{\ob{C}}_3$} -- +(0,0mm);
\draw[->] (m.in33) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m.out) -- +(4mm,0) node[right] {$\ob{C}$};
\end{tikzpicture}
\\
A morphism $\mo{m}$ from $[\ob{C}_1, \ob{C}_2, \ob{C}_3]$ to $\ob{C}$
&
A morphism $\mo{m}$ from $\vec{\ob{C}}_1 \append [\ob{C}_2] \append \vec{\ob{C}}_3$ to $\ob{C}$
\end{tabular}
\end{center}
\item[Composition $\cocomp$:] $\forall \ob{C}_2, \ob{C} : O, \vec{\ob{C}}_1, \vec{\ob{C}_2}, \vec{\ob{C}}_3 : \List O.\; M(\vec{\ob{C}}_2, \ob{C}_2) \times M(\vec{\ob{C}}_1 \append [\ob{C}_2] \append \vec{\ob{C}}_3, \ob{C}) \to M(\vec{\ob{C}}_1 \append \vec{\ob{C}}_2 \append \vec{\ob{C}}_3, \ob{C})$
\begin{center}
\begin{tabular}{c}
\begin{tikzpicture}
\path (-1,0) \marrow{m1}{};
\path (1,0) \marrow{m2}{};
\draw[->] (m1.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m1.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.in13) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in13) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in13) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.out) -- (m2.in23);
\draw[->] (m2.in33) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in33) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in33) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.out) -- +(4mm,0mm);
\end{tikzpicture}
\\
The depiction of the composition of two morphisms
\end{tabular}
\end{center}
\item[Commutativity $\prf{c}$:] The following two depictions are always equal:
\begin{center}
\begin{tikzpicture}
\begin{scope}[xshift=-4cm]
\path (1.5,0) \marrow{m}{\mo{m}};
\path ($(-1.5,0) + (m.in13) - (m.in23)$) \marrow{m1}{\mo{m}_1};
\path ($(0,0) + (m.in33) - (m.in23)$) \marrow{m2}{\mo{m}_2};
\draw[->] (m1.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m1.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.out) -- (m.in25);
\draw[->] (m2.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.out) -- (m.in45);
\draw[->] (m.in15) +(-4mm,-2.5mm) -- +(0,-.5mm);
\draw[->] (m.in15) +(-4mm,-2mm) -- +(0,0mm);
\draw[->] (m.in15) +(-4mm,-1.5mm) -- +(0,.5mm);
\draw[->] (m.in35) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m.in35) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m.in35) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m.in55) +(-4mm,1.5mm) -- +(0,-.5mm);
\draw[->] (m.in55) +(-4mm,2mm) -- +(0,0mm);
\draw[->] (m.in55) +(-4mm,2.5mm) -- +(0,.5mm);
\draw[->] (m.out) -- +(4mm,0);
\end{scope}
\node at (0,0) {$=$};
\begin{scope}[xshift=4cm]
\path (1.5,0) \marrow{m}{\mo{m}};
\path ($(0,0) + (m.in13) - (m.in23)$) \marrow{m1}{\mo{m}_1};
\path ($(-1.5,0) + (m.in33) - (m.in23)$) \marrow{m2}{\mo{m}_2};
\draw[->] (m1.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m1.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.out) -- (m.in25);
\draw[->] (m2.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.out) -- (m.in45);
\draw[->] (m.in15) +(-4mm,-2.5mm) -- +(0,-.5mm);
\draw[->] (m.in15) +(-4mm,-2mm) -- +(0,0mm);
\draw[->] (m.in15) +(-4mm,-1.5mm) -- +(0,.5mm);
\draw[->] (m.in35) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m.in35) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m.in35) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m.in55) +(-4mm,1.5mm) -- +(0,-.5mm);
\draw[->] (m.in55) +(-4mm,2mm) -- +(0,0mm);
\draw[->] (m.in55) +(-4mm,2.5mm) -- +(0,.5mm);
\draw[->] (m.out) -- +(4mm,0);
\end{scope}
\end{tikzpicture}
\end{center}
In other words, the two ways to compose the morphisms in the following diagram together are equal:
\begin{center}
\begin{tikzpicture}
\path (1,0) \marrow{m}{};
\path (-1,-.75) \marrow{m1}{};
\path (-1,.75) \marrow{m2}{};
\draw[->] (m1.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m1.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.out) -- (m.in25);
\draw[->] (m2.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.out) -- (m.in45);
\draw[->] (m.in15) +(-4mm,-2.5mm) -- +(0,-.5mm);
\draw[->] (m.in15) +(-4mm,-2mm) -- +(0,0mm);
\draw[->] (m.in15) +(-4mm,-1.5mm) -- +(0,.5mm);
\draw[->] (m.in35) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m.in35) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m.in35) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m.in55) +(-4mm,1.5mm) -- +(0,-.5mm);
\draw[->] (m.in55) +(-4mm,2mm) -- +(0,0mm);
\draw[->] (m.in55) +(-4mm,2.5mm) -- +(0,.5mm);
\draw[->] (m.out) -- +(4mm,0);
\end{tikzpicture}
\end{center}
\item[Associativity $\prf{a}$:] The two ways to compose the morphisms in the following diagram are equal:
\begin{center}
\begin{tikzpicture}
\path (-1.5,0) \marrow{m1}{};
\path (0,0) \marrow{m2}{};
\path (1.5,0) \marrow{m3}{};
\draw[->] (m1.in11) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m1.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in11) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.in13) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in13) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in13) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.out) -- (m2.in23);
\draw[->] (m2.in33) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in33) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in33) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m3.in13) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m3.in13) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m3.in13) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.out) -- (m3.in23);
\draw[->] (m3.in33) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m3.in33) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m3.in33) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m3.out) -- +(4mm,0mm);
\end{tikzpicture}
\end{center}
\item[Identities $\id$:] $\forall \ob{C} : O.\; M([\ob{C}], \ob{C})$
\item[Identity $\prf{i}$:] The following equalities always hold:
\begin{center}
\begin{tikzpicture}
\begin{scope}[xshift=-4cm]
\path (-1,0) \marrow{m1}{\id};
\path (1,0) \marrow{m2}{\mo{m}};
\draw[->] (m1.in11) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in13) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in13) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in13) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.out) -- (m2.in23);
\draw[->] (m2.in33) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m2.in33) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m2.in33) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m2.out) -- +(4mm,0mm);
\end{scope}
\node at (-1.5cm,0) {$=$};
\path (0,0) \marrow{m}{\mo{m}};
\draw[->] (m.in13) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m.in13) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m.in13) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m.in23) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m.in33) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m.in33) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m.in33) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m.out) -- +(4mm,0mm);
\node at (1.5cm,0) {$=$};
\begin{scope}[xshift=4cm]
\path (-1,0) \marrow{m1}{\mo{m}};
\path (1,0) \marrow{m2}{\id};
\draw[->] (m1.in13) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m1.in13) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in13) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.in23) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in33) +(-4mm,-.5mm) -- +(0,-.5mm);
\draw[->] (m1.in33) +(-4mm,0mm) -- +(0,0mm);
\draw[->] (m1.in33) +(-4mm,.5mm) -- +(0,.5mm);
\draw[->] (m1.out) -- (m2.in23);
\draw[->] (m2.out) -- +(4mm,0mm);
\end{scope}
\end{tikzpicture}
\end{center}
\end{description}
\end{definition}

\begin{definition}[Functor of Multicategories]
A mapping of objects and morphisms such that domain, codomain, composition, and identity are preserved.
\end{definition}

\begin{definition}[$\cat{MCAT}$]
The category whose objects are multicategories and whose morphisms are functors between those multicategories, with composition and identity being the obvious.
\end{definition}

\begin{exercise}
Show that there is a functor from~$\cat{CAT}$ to~$\cat{MCAT}$ and another from~$\cat{MCAT}$ to~$\cat{CAT}$ such that their composition is the identity on~$\cat{CAT}$.
\end{exercise}

\clearpage

\begin{example}
\begin{description}
\item[$\cat{Set}$:] Objects are types and morphisms are functions with multiple inputs and one output.
\item[$\cat{Prost}$:] Objects are preordered sets and morphisms from $[\langle S_1, R_1 \rangle, \dots, \langle S_n, R_n \rangle]$ to $\langle S, R \rangle$ are functions $f : S_1 \times \dots \times S_n \to S$ such that $\forall n : \N, (s_i : S_i)_{i : \mathbb{n}}, (s_i : S_i)_{i : \mathbb{n}}.\; (\forall i : \mathbb{n}.\; s_i \mathrel{R_i} s_i') \implies f(s_1, \dots, s_n) \mathrel{R} f(s_1', \dots, s_n')$
\item[$\cat{Cat}$ and $\cat{CAT}$:] Objects are (small) categories and morphisms are multiple-input functors~$F$, where preservation of composition and identity means that $F(\mo{m}_1, \dots, \mo{m}_n) \cocomp F(\mo{m}_1', \dots, \mo{m}_n') = F(\mo{m}_1 \cocomp \mo{m}_1', \dots, \mo{m}_n \cocomp \mo{m}_n')$ and $\id = F(\id_1, \dots, \id_n)$.
\item[$\alg{M}$ where $\alg{M}$ is a monoid:] Objects are elements of~$M$ and there exists a unique morphism from~$\vec{m}$ to~$m$ if and only if $\Pi \vec{m} = m$.
\end{description}
\end{example}

\begin{exercise}
Show that there are two functors of multicategories, $\mathit{Obj}$ and $\mathit{Mor}$, from $\cat{Cat}$ to $\cat{Set}$, with the first mapping a small category to its set of objects and the second mapping a small category to its set of morphisms.
\end{exercise}

\begin{exercise}
Show that one can define a monoidal structure on the objects of a monoidal category if for every list of objects there exists a unique morphism with that list as its domain.
\end{exercise}

\begin{example}
For the following examples we use a common pattern. Each object will have associated with it a left ``anchor'' and right ``anchor''.
The morphisms will exist from a list of objects to an object only if:
\begin{itemize}
\item for each pair of adjacent input objects, the right anchor of the first is equal to the left anchor of the second
\item the left anchor of the first input equals the left anchor of the output and the right anchor of the last input equals the right anchor of the output \emph{or} there is no input and the left and right anchors of the output are equal
\end{itemize}
We present the first such example in more formal detail to help clarify this.
\begin{description}
\item[$\cat{Path}(A : \TYPE{1})$:] An object is a pair of $A$s and there exists a unique morphism from $[\langle a_1, a_1' \rangle, \dots, \langle a_n, a_n' \rangle]$ to $\langle a_0', a_{n+1} \rangle$ if and only if $\forall i : \mathbb{n}\cup\{0\}.\; a_i' = a_{i+1}$.
\item[$\cat{SplitGraph}$:] An object is a split graph~$S \xfrom{s} E \xto{t} T$ where $S$ is the type of (source) nodes, $T$ is the type of (target) nodes, $E$ is the type of edges, and the functions $s$ and $t$ specifying the source and target of each edge. A morphism from $S_1 \xfrom{s_1} E_1 \xto{t_1} (T_1=S_2) \xfrom{s_2} E_2 \xto{t_2} (T_2=\dots=S_n) \xfrom{s_n} E_n \xto{t_n} T_n$ to $S_1 \xfrom{s} E \xto{t} T_n$ is a function mapping each chain of edges $s_1 \xmto{e_1} (t_1=s_2) \xmto{e_2} (t_2=\dots=s_n) \xmto{e_n} t_n$ to an edge $e : E$ with $s(e) = s_1$ and $t(e) = t_n$.
\item[$\cat{BinRel}$:] An object is a binary relation~$R : S \times T \to \Prop$. A morphism from $[R_0 : S_0 \times S_1 \to \Prop, \dots, R_n : S_n \times S_{n+1} \to \Prop]$ to $R : S_0 \to S_{n+1}$ both exists and is unique if and only if the following holds: $$\forall s_0 : S_0, s_{n+1} : S_{n+1}.\; \exists s_1 : S_1, \dots, s_n : S_n.\; R_0(s_0, s_1) \wedge \dots \wedge R_n(s_n, s_{n+1}) \implies R(s_0, s_{n+1})$$
\end{description}
\end{example}

\begin{exercise}
Show that there are functors of multicategories from~$\cat{SplitGraph}$ and from~$\cat{BinRel}$ to~$\cat{Path}(\Type)$.
\end{exercise}

\begin{exercise}
Show that there is a functor of multicategories from~$\cat{BinRel}$ to~$\cat{SplitGraph}$ and from~$\cat{SplitGraph}$ to~$\cat{BinRel}$ such that their composition equals the identity on~$\cat{BinRel}$.
\end{exercise}

\begin{exercise}
Show that there is a functor of categories from~$\cat{Cat}$ to~$\cat{SplitGraph}$ (restricted to unary morphisms) that does not extend to a functor of multicategories from~$\cat{Cat}$ to~$\cat{SplitGraph}$.
\end{exercise}

\end{document}