-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkit.tex
1587 lines (1356 loc) · 124 KB
/
kit.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass{amsart}
\newif\ifcref\creftrue
%\usepackage{overrightarrow}
\makeatletter
\newcommand\reldoublebar{\mathrel{\smash=}}
\newcommand{\Rightarrowfill@@}[1]{%
\m@th \setboxz@h {$#1\reldoublebar $}\ht \z@ \z@
$#1\copy \z@
\mkern -6mu\cleaders \hbox {$#1\mkern -2mu\box \z@ \mkern -2mu$}\hfill
\mkern -6mu
\mathord \Rightarrow $}
\newcommand{\Overrightarrow}{\mathpalette{\overarrow@\Rightarrowfill@@}}
\makeatother
\input{decls}
\usepackage{ifmtarg,tikz,mathpartir}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\tikzstyle{darrow}=[-implies, double equal sign distance]
\tikzstyle{barrow}=[-implies, double equal sign distance,postaction={decorate},decoration={markings,mark=at position .5 with {\node[fill,circle,inner sep=1.5pt] {};}}]
\tikzset{lab/.style={auto,font=\scriptsize}} % arrow labels
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.geometric,shapes.arrows}
\newenvironment{tikzc}[1][]{\begin{center}\begin{tikzpicture}[#1]}{\end{tikzpicture}\end{center}}
\tikzset{>=stealth}
\tikzset{ed/.style={auto,inner sep=0pt,font=\scriptsize}} %edges
\tikzset{arr/.style={draw,isosceles triangle,inner sep=2pt}} %arrows
\makeatletter
\def\rightbulletarrowfill@{%
\slashedarrowfill@\relbar\relbar{\raisebox{1.25pt}{$\scriptscriptstyle\bullet$}}\rightarrow}
\newcommand\xbulletrightarrow[2][]{%
\ext@arrow 0055{\rightbulletarrowfill@}{#1}{#2}}
\mdef\bto{\xbulletrightarrow{\quad}}
\let\xbto\xbulletrightarrow
\def\rightcircarrowfill@{%
\slashedarrowfill@\relbar\relbar{\raisebox{1.25pt}{$\scriptscriptstyle\circ$}}\rightarrow}
\newcommand\xcircrightarrow[2][]{%
\ext@arrow 0055{\rightcircarrowfill@}{#1}{#2}}
\mdef\oto{\xcircrightarrow{\quad}}
\let\xoto\xcircrightarrow
\makeatother
\let\tc\cdot
\newcommand{\bc}{\mathbin{\raisebox{1pt}{\scriptsize$\bullet$}}}
\let\oc\circ
\newcommand{\C}{\cC}
\newcommand{\D}{\cD}
\renewcommand{\Chat}{\ensuremath{\widehat{\C}}\xspace}
\newcommand{\Chats}{\ensuremath{\Chat_{\Sigma}}\xspace}
\newcommand{\thhat}{\ensuremath{\widehat{\theta}}\xspace}
\newcommand{\thchk}{\ensuremath{\widecheck{\theta}}\xspace}
\newcommand{\E}{\cE}
\newcommand{\F}{\cF}
\newcommand{\G}{\cG}
\newcommand{\V}{\cV}
\newcommand{\W}{\cW}
\newcommand{\K}{\bbK}
\newcommand{\Hkl}[2]{\mathbb{H}\text{-}\mathsf{Kl}(#1,#2)}
\newcommand{\Hcokl}[2]{\mathbb{H}\text{-}\mathsf{coKl}(#1,#2)}
\newcommand{\Hbikl}[2]{\mathbb{H}\text{-}\mathsf{biKl}(#1,#2)}
% Horizontal units
\newcommand{\hunit}[1]{\Id_{#1}}
% Monads
\newcommand{\Tmult}{\nu}
\newcommand{\Tunit}{\iota}
\newcommand{\Smult}{\mu}
\newcommand{\Sunit}{\eta}
% Pseudonaturality
\newcommand{\alnat}{\bar\alpha}
% Distributive law
\newcommand{\dl}{\delta}
\newcommand{\dlnat}{\bar\delta}
\newcommand{\Tdlmult}{\bar\Tmult}%{\hat\delta}
\newcommand{\Sdlmult}{\bar\Smult}%{\check\delta}
\newcommand{\Tdlunit}{\bar\Tunit}%{\bar\delta}
\newcommand{\Sdlunit}{\bar\Sunit}%{\tilde\delta}
\newcommand{\one}{\done}
\newcommand{\bone}{\mathbf{1}}
\autodefs{\cMod\dCat\bCat\dSpan\cSpan\dMod\bSet\bGraph\dMod\cMod\fSpan\cDbl\cLx\fDbl}
\let\Mod\dMod
\let\mod\cMod
\def\modk{\mod_\K}
\def\mor#1{\hom_{#1}}
\def\lxdbl{\ensuremath{\mathcal{L}\mathit{x}\mathcal{D}\mathit{bl}}\xspace}
\def\cart{\chi}
\def\opcart{\chi}
\def\emptyvec#1{()_{#1}}
\def\unit#1{\hom_{#1}}
\def\bigcomp{\textstyle\bigodot\!}
\newcommand{\blank}{\mathord{\hspace{1pt}\text{--}\hspace{1pt}}}
\newcommand{\uniq}{\mathord{!}}
\renewcommand{\o}{^{\circ}}
\newcommand{\p}{^{+}}
\newcommand{\m}{^{-}}
\newcommand{\e}[1][]{^{\varepsilon_{#1}}}
\newcommand{\epbar}{^{\varepsilon^*}}
\renewcommand{\ph}[1][]{^{\varphi_{#1}}}
\newcommand{\phe}[2]{^{\varphi_{#1}\varepsilon_{#2}}}
% \let\vec\overrightarrow
% \let\Vec\Overrightarrow
%\renewcommand{\Vec}[1]{\overset{\Rightarrow}{#1}}
\def\types{\;\vdash\;} % turnstile
\let\mto\vdash % As a hom operator on modules
\def\mhom#1#2{\left( #1 \vphantom{\big|}\mto #2 \right)}
\def\mhomc#1#2#3{\left( #1 \mid #2 \vphantom{\big|}\mto #3 \right)}
\def\cb{\;\mid\;} % context break
\newcommand\combine{,}
\newcommand\combineU{\sqcup}
\def\flip#1{#1^*} % reverse the variances of all variables
\newcommand{\unif}[4]{#1\doteq #2\,\mathsf{ via }\,#3\cb #4}
\newcommand{\coend}{\begingroup\textstyle\int\endgroup}
\newcommand{\tend}{\begingroup\textstyle\int\endgroup}
\newcommand{\subst}[3]{{#1}[#2 \mapsfrom #3]}
\newcommand{\ev}{\mathsf{ev}}
\renewcommand{\id}{\mathsf{id}}
\newcommand{\Id}{\mathsf{Id}}
\newcommand{\repr}[1]{{#1}_\bullet}
\newcommand{\corepr}[1]{{#1}^\bullet}
\title{Multivariable formal category theory}
\author{Patrick Schultz and Michael Shulman}
\begin{document}
\maketitle
\setcounter{tocdepth}{1}
\tableofcontents
\section{Introduction}
\label{sec:intro}
We propose a categorical structure designed for doing ``multivariable formal category theory'', including particularly contravariant functors and extraordinary natural transformations, and hence the abstract study of monoidal objects, enriched objects, multivariable adjunctions, closed objects, rigid objects, and so on.
This is analogous to how proarrow equipments~\cite{wood:proarrows-i} and Yoneda structures~\cite{street-walters:yoneda} provide abstract contexts for doing one-variable formal category theory.
By analogy with the word ``equipment'', we call our structure a \textbf{kit}.
There does already exist one structure in which one can do multivariable formal category theory.
As observed by Day and Street~\cite{ds:monbi-hopfagbd}, the opposite of a category is its dual in the monoidal bicategory of profunctors, making the latter ``compact closed'' (also called ``rigid'' or ``autonomous''); and inside a compact closed bicategory one can define structures of multivariable category theory.
Of course, the bicategory of profunctors does not quite know which profunctors are representable by functors (the left adjoint profunctors are ``representable up to Cauchy completion''), but this can be remedied by enhancing it to a ``compact closed proarrow equipment''.
The differences between a kit and a compact closed equipment, and hence the reasons for defining the former, are:
\begin{enumerate}
\item Compact closed equipments have not actually been defined yet either, and it's not necessarily \emph{a priori} obvious how much coherence should be required between the ``functor arrows'' and the compact closed structure.
(As observed in~\cite{shulman:contravariance}, even for just the one-variable ``opposite category'' operation there are nontrivial coherence questions.)
The definition of a kit is ``more obviously complete''.
Below, we will actually also define compact closed equipments and prove that any such gives rise to a kit, justifying that definition.
\item A kit is ``fully virtual'' in the sense of~\cite{cs:multicats}; that is, all of its structure is multicategorical.
This means that rather than including \emph{operations} such as profunctor composition, monoidal product, and dualization, a kit includes a basic notion of ``morphism out of such things'', in the same way that a multicategory has no actual monoidal product but includes a basic notion of ``multivariable morphism'' that ``would be a morphism out of a monoidal product if it existed''.
This allows these operations, when they exist, to be characterized by universal properties, eliminating the question of what coherence axioms have to be imposed upon them as structure.
It also allows us to describe examples where such operations do \emph{not} exist.
For instance, categories enriched over any monoidal category \bV form a kit, whether or not \bV has any limits or colimits; indeed \bV could be only a multicategory itself.
\item Because of virtuality, it is much simpler to define sub-kits and quotient kits.
In particular, this allows us to construct ``homotopy kits'' by first restricting to a subclass of well-behaved objects, then quotienting by a homotopy relation.
This gives one approach to formal higher category theory using only 2-categorical machinery.
%% The quasicategorical case is probably easiest to do by going via a compact ordinary equipment, adding opposites to the Riehl-Verity construction. But this approach probably works for 2Cat-Gray, and might for higher ones using the lax monoidal structures.
\item A kit eliminates the ``two-sided bias'' of a bicategory or an equipment.
Two-sidedness is appropriate and necessary for one-variable category theory, since in examples such as categories enriched in a non-symmetric monoidal category (or in a bicategory) the only ``modules'' that can be defined are covariant in exactly one variable and contravariant in exactly one other variable.
But for multivariable category theory, where a module can naturally be covariant in many variables and contravariant in many other variables, it feels artificial to divide these variables into a ``domain'' and a ``codomain'', forcing us to pass back and forth across dualization equivalences when we want to compare a profunctor $A \hto B\times C$ with a profunctor $C\op\times A \hto B$, while intuitively (and in most examples) there is really only one notion involved, namely a functor $B\op \times C\op \times A \to \bSet$.
% TODO: Is this true?
% (Lest the reader worry about generality, categories enriched in a non-symmetric monoidal category do still form a kit; it just happens to be a kit all of whose modules depend on one covariant variable and one contravariant one.
% More generally, any equipment can be regarded directly as a kit in this way.)
\item Finally, a kit furnishes a more natural semantics for the ``directed type theory'' of~\cite{lnss:dirtt}, because its classes of objects and morphisms correspond directly to the judgments of the latter.
In particular, a kit admits a very familiar set-like ``internal-language'' in which to reason about its objects, analogous to the ``abstract index notation'' of tensor calculus.
We will introduce this language informally here; for details see~\cite{lnss:dirtt}.
\end{enumerate}
\part{Multivariable formal category theory}
\label{part:mfct}
In this part we will describe the structure of a kit informally, and consider a number of examples of how to use that structure to formulate category-theoretic arguments abstractly.
The formal definition of a kit is rather technically involved and occupies \cref{part:def}; but this part is intended to demonstrate that for nearly all practical applications it is not necessary to know the details of the formal definition, only to have faith that it exists and behaves as one would expect.
\section{The structure of a kit}
\label{sec:structure}
A kit is composed of four sorts of things, which we discuss in turn.
\subsection{Cats}
There is a class of objects, which we call \textbf{cats}, since they play the role of categories.
\subsection{Functors}
We generally call the morphisms between cats \textbf{functors}.
This is in line with the fact that the morphisms between many different kinds of generalized categories --- enriched categories, indexed categories, bicategories, $\infty$-categories, etc. --- are frequently called just ``functors'' without qualification.
The functors in a kit are functors of many variables, some covariant and some contravariant.
More precisely, the domain of a functor is a finite list of cats, some of which are annotated with the formal symbol $(-)\o$ to indicate contravariance.
(This does not yet represent an operation of ``oppositization'' on cats; it is just a formal marker for contravariance.
Similarly, we do not in general assume a ``tensor product'' of cats; as we will see later, these operations can be characterized by universal properties in terms of the multivariable functors.)
The codomain of a functor, by contrast, is a single cat; thus we might have for instance $f:(A,B\o,C) \to D$.
If the list contains only one cat, we generally omit the parentheses, writing $f:A\to B$.
Functors can be composed in a ``multicategorical'' way that keeps track of variance.
For instance, if in addition to $f:(A,B\o,C) \to D$ we have $g:X \to A$ and $h:(Y\o,Z)\to B$ and $k:()\to C$ (yes, lists can have length zero), then there is a composite $f\circ (g,h,k) : (X,Y,Z\o)\to D$.
Finally, like in a symmetric multicategory, we have symmetric group actions on the domains of functors, so that from $f:(A,B\o,C) \to D$ we can obtain a functor $(B\o,C,A)\to D$ and so on.
In particular, we have a category of cats and unary functors, which we denote $\K_1$.
Later on we will enhance this to a 2-category.
\subsection{Modules}
Now we have a second class of objects, which we call \textbf{modules}; these represent presheaves, profunctors, and more general ``functors into the base of enrichment''.
Each module is indexed by a finite list of cats with variance (the same sort of list that appears as the domain of a functor).
We write $\modk(A,B\o,C)$ for the category (see below) of modules indexed by a list $(A,B\o,C)$.
Modules can be restricted along functors; thus if $M\in \modk(A,B\o,C)$, and $g,h,k$ are as above, we have $(g,h,k)^*M \in \modk(X,Y,Z\o)$.
We will also write $(g,h,k)^*M$ as $M(g,h,k)$.
This restriction is strictly functorial with respect to functor composition (one could consider generalizations of a kit where it is only weakly functorial, but in most examples it is strict, and in other cases it can be modified to become so).
The symmetric groups also act on modules; thus if $M\in \modk(A,B\o,C)$ we have a module $\sigma^*M\in \modk(B\o,C,A)$ and so on.
As with restriction, we assume for simplicity that this action is strict.
Formally, the symmetric group action is combined with the restriction along functors, by representing the collection of modules as a functor defined on a category whose objects are lists of cats with variance and whose morphisms are lists of functors together with a permutation of their combined input.
\subsection{Module morphisms}
Finally we have module morphisms; this is where all the subtlety and difficulty lies.
The simplest sort of morphism between modules is an ``ordinary'' one between modules indexed by the same list of cats.
These form the morphisms of the categories such as $\modk(A,B\o,C)$, and restriction along functors is of course functorial on these categories.
The next simplest sort of module morphism is a ``multivariable'' one that represents a potential ``tensor product of modules'' multicategorically, similarly to how the multivariable functors represent a potential tensor product of categories.
Since our intended models include categories enriched over a non-cartesian base, the individual categories such as $\modk(A,B\o,C)$ are not necessarily monoidal (that is, we can't necessarily take a pointwise tensor product of presheaves), but we can expect ``external'' products such as $\modk(A) \times \modk(B) \to \modk(A,B)$.
Thus, representing these multicategorically we have multivariable module morphisms such as $(M_1,M_2,\dots,M_n) \to N$, where $M_i\in \modk(\Psi_i)$ and $N\in\modk(\Psi_1,\Psi_2,\cdots,\Psi_n)$, where $(\Psi_1,\Psi_2,\cdots,\Psi_n)$ indicates the concatenated list of cats with variance.
As with functors, the symmetric groups act on the domains of such morphisms.
However, in order to really do multivariable category theory, we also need ``extra\-ordinary'' natural transformations as in~\cite{ek:gen-funct-calc}.
For instance, given $M\in\modk(A,A\o,B)$ and $N\in \modk(C,C\o,B)$ we want to speak about a transformation $\alpha:M\to N$ that is ordinary natural in $B$ and extraordinary natural in $A$ and $C$ on either side.
In plain set-based category theory this means we have components $\alpha_{a,b,c}:M(a,a,b) \to N(c,c,b)$ such that the following naturality squares commute for all $f:a_1\to a_2$, $g:b_1\to b_2$, $h:c_1\to c_2$, and $a,b,c$:
\begin{mathpar}
\xymatrix{ M(a,a,b_1) \ar[d]_{M(1,1,g)} \ar[r]^{\alpha} &
N(c,c,b_1) \ar[d]^{N(1,1,g)}\\
M(a,a,b_2) \ar[r]_{\alpha} & N(c,c,b_2)}\and
\xymatrix{ M(a_1,a_2,b) \ar[d]_{M(1,f,1)} \ar[r]^{M(f,1,1)} &
M(a_2,a_2,b) \ar[d]^{\alpha}\\
M(a_1,a_1,b) \ar[r]_{\alpha} & N(c,c,b)}\and
\xymatrix{ M(a,a,b) \ar[d]_{\alpha} \ar[r]^{\alpha} &
N(c_2,c_2,b) \ar[d]^{N(1,h,1)}\\
N(c_1,c_1,b) \ar[r]_{N(h,1,1)} & N(c_2,c_1,b)}
\end{mathpar}
Thus, a kit includes a set of ``extraordinary'' module morphisms from $M$ to $N$ whenever $M\in \modk(\Psi_1, \Psi_1\o, \Psi_2)$ and $N\in\modk(\Psi_3, \Psi_3\o, \Psi_2)$.
Here the $\Psi_i$ are lists of cats with variance, and $\Psi\o$ denotes reversal of all the variances in $\Psi$.
Of course, in general the cats we want to match up extraordinarily may not appear in exactly this order (e.g.\ we could have $M\in \modk(A,B,A\o)$ and $N\in \modk(B,C\o,C)$), but we can first act on the modules by a permutation.
The extraordinary morphisms, like the ordinary ones that form the arrows of the categories $\modk(\Psi)$, can be restricted along functors, in a functorial way.
Specifically, given $M\in \modk(\Psi_1, \Psi_1\o,\Psi_2)$ and $N\in\modk(\Psi_3, \Psi_3\o,\Psi_2)$ as above, determining a type of extraordinary module morphism from $M$ to $N$, then such module morphisms can be restricted along any lists of functors $f_i:\Psi_i' \to \Psi_i$ (for $i=1,2,3$).
Here $f_i$ consists of a functor with codomain $A$ for each cat $A$ in $\Psi_i$, and $\Psi_i'$ is the concatenated list of the domains of these functors, with the variance of each $A$ in $\Psi_i$ applied to the domain of the corresponding functor.
Thus for instance if $g:(A,B\o) \to C$ and $h:D\to E$, we would have $(g,h):(A,B\o,D\o) \to (C,E\o)$.
Note that just as the domain and codomain of an ordinary module morphism have to be restricted along the same functor (since restriction defines functors $\modk(\Psi) \to \modk(\Psi')$), the two occurrences of a cat in the domain or codomain in an extraordinary morphism also have to be restricted along the same functor.
Finally, we can have multivariable extraordinary morphisms as well, where the domain is a list of modules rather than a single one.
In this case we almost always want to permute the lists of cats appearing in the domain rather than simply concatenating them, so technically we have to incorporate a notion of permutation action on a list; in a moment we will introduce a more convenient notation for this.
The real complication comes when defining how extraordinary morphisms can be \emph{composed}.
The rules for how to compose extraordinary natural transformations were given in~\cite{ek:gen-funct-calc}, but it seems to be quite involved to use these rules to define an abstract structure in a categorically respectable way.
In \cref{sec:composing} we will describe the rules informally; but first we digress to introduce a better notation for extraordinary morphisms.
\section{Abstract variable notation}
\label{sec:tt}
It turns out to be quite convenient to use a different notation for modules and their morphisms.
Rather than writing
\[ M \in \modk(A,B\o,C) \]
we allow ourselves to think of $M$ as a functor that takes ``values'' on ``variables'' belonging to $A,B,C$, and write
\[ \ctx{a:A,b:B\o,c:C} \types M(a,b,c) \in\modk. \]
Note that the cats in a kit are still just abstract objects; we are not asserting that they have ``elements'' in any sense.
These ``variables'' are purely schematic.
This is very much like the ``abstract index notation'' of tensor calculus that allows us to write $T^{a b}_{c}$ for an element of a tensor space $V \otimes V\otimes V^*$ without needing to actually pick a basis of $V$ to make $a,b,c$ into actual numerical indices of components.
One reason this ``abstract variable notation'' is useful is when restricting modules along functors.
In the previous example with $M$ as above and
\begin{mathpar}
g:X \to A \and h:(Y\o,Z)\to B \and k:()\to C
\end{mathpar}
instead of $(g,h,k)^*M$ or $M(g,h,k)$ we can write
\[ \ctx{x:X,y:Y,z:Z\o}\types M(g(x),h(y,z),k)\in\modk \]
This indicates much more clearly how the functors $g,h,k$ match up with the dependence of $M$ on $A,B\o,C$ and how the resulting dependence on $X,Y,Z\o$ feeds into $g,h,k$.
The strict functoriality of restriction with respect to functor composition means that this notation behaves as we expect on such composites; for instance, if we have
\begin{mathpar}
\ctx{c:C}\types M(c)\in\modk \and g:B\to C \and f:A\to B
\end{mathpar}
then the three restrictions $g^*M$, $f^*g^*M$, and $(g\circ f)^*M$ are represented in this notation as
\begin{mathpar}
\ctx{b:B}\types M(g(b)) \in\modk\\
\ctx{a:A}\types M(g(f(a))) \in\modk\and
\ctx{a:A}\types M((g\circ f)(a)) \in\modk
\end{mathpar}
where the second and third are, as we expect, equal.
\begin{rmk}\label{rmk:turnstile}
To avoid confusion between functors and abstract variables, we emphasize that the symbol $\types$ always indicates the use of abstract variables, and in its absence we always revert back to the notation $M(g,h,k)$.
\end{rmk}
The second place that abstract variable notation is useful is when describing module morphisms, and especially extraordinary ones.
We said above that extraordinary module morphisms go from $M$ to $N$ whenever $M\in \modk(\Psi_1, \Psi_1\o, \Psi_2)$ and $N\in\modk (\Psi_3, \Psi_3\o, \Psi_2)$.
We also mentioned that we generally have to apply a permutation in order to put the lists of cats in exactly this form, such as if $M\in \modk(A,B,A\o)$ and $N\in \modk(B,C,C\o)$.
In practice, instead of actually acting on $M$ and $N$ by symmetric groups, it is easier to just indicate how the cats should be matched up.
We can do this with abstract variables as follows:
\[ \ctx{a:A,b:B,c:C} \cb M(a,b,a) \types N(b,c,c) \]
Note that every variable appears exactly twice to the right of the vertical bar, once covariantly and once contravariantly (where occurrences to the left of the turnstile $\vdash$ are counted with opposite variance).
This notation is especially valuable when the same cat appears multiple times.
For instance, if $M\in\modk(A,A\o,A)$ and $N\in\modk(A)$, then there are two kinds of extraordinary morphisms from $M$ to $N$, which are represented in this notation as
\begin{mathpar}
\ctx{x:A,y:A} \cb M(x,x,y)\types N(y)\\
\ctx{x:A,y:A} \cb M(x,y,y)\types N(x)
\end{mathpar}
It is also especially useful when talking about multivariable extraordinary morphisms.
For instance, we could have
\[ \ctx{a:A,b:B,c:C,d:D} \cb M_1(a,b), M_2(b,c) \types N(a,d,c,d) \]
but here there is no way to act on $M_1$ and $M_2$ by symmetric groups separately to put the $B,B\o$ in front.
Formally, this means that when describing multivariable extraordinary morphisms we have to incorporate a permutation in the definition; but with abstract variable notation we don't need to think about that.
Finally, if the cats that the variables correspond to are obvious from context, we can omit their declarations, obtaining a more concise notation $M(a,b,a) \mto N(b,c,c)$ for a set of extraordinary module morphisms.
Thus, if we want to give a name to a particular such morphism we can write
\[ \phi \in \mhom{M(a,b,a)}{N(b,c,c)} \]
As noted in \cref{rmk:turnstile}, the symbol $\types$ is still present here to indicate the use of abstract variables, even though the correspondence of variables to cats is not explicitly ``declared''.
It is worth emphasizing one difference between the use of abstract variables for restriction and for extraordinary morphisms.
In the case of restriction, we write $\ctx{a:A,b:B}\types M(f(a),g(b))$ to denote the \emph{actual module} $(f,g)^*M$ obtained by restricting $M$ along $f$ and $g$.
However, in the case of extraordinary morphisms, it is probably better not to think of the notation $\ctx{a:A} \types M(a,a)$ as actually denoting any module distinct from $M$;\footnote{In the formal definition to be presented in \cref{part:def}, it is possible to think of $\ctx{a:A} \types M(a,a)$ as an object of ``$S\E$'', but this is arguably just a technical device.} in particular it is not obtained by restriction of $M$ along any sort of ``diagonal'' (which need not exist in an arbitrary kit).
We will also combine these notations, writing for instance $M(f(a),g(a),h(b))\mto N(k(b))$; in this case it is better to think of the restrictions as happening first (obtaining modules such as $\ctx{a_1:A,a_2:A,b:B}\types M(f(a_1),g(a_2),h(b))$), followed by the pairing of variables to determine a type of extraordinary morphism.
So far we have described our ``abstract variable notation'' somewhat informally.
When doing formal category theory, this informal understanding is generally sufficient.
However, the notation can in fact be made much more precise, by defining a type theory to serve as the ``internal language'' of a kit; see~\cite{lnss:dirtt}.
\section{Composing extraordinary morphisms}
\label{sec:composing}
The simplest sort of composition for extraordinary morphisms is composition with ordinary ones on either side.
For instance, a morphism $\phi\in \mhom{M(a,b,a)}{N(b,c,c)}$ can be composed with an ordinary map $\psi:N\to N'$ in $\modk(B,C,C\o)$ to obtain a morphism $\psi\phi\in \mhom{M(a,b,a)}{N'(b,c,c)}$
In examples it is easy to see how to do this: just compose the components
\[ M(a,b,a) \xto{\phi_{a,b,c}} N(b,c,c) \xto{\psi_{b,c,c}} N'(b,c,c) \]
and check that the naturality relations (both ordinary and extraordinary) are preserved.
(Note that the components $\psi_{b,c_1,c_2}$ with $c_1\neq c_2$ do not appear in the definition, but they do appear in the proof of extraordinary naturality.)
Formally, we can say that each set of extraordinary morphisms admits an action on both sides by the categories $\modk(\Psi)$ (that is, it is a profunctor).
More interesting sorts of composition involve two extraordinary transformations, as explained in~\cite{ek:gen-funct-calc}.
The most basic composite of this sort involves two morphisms
\begin{mathpar}
\phi\in \mhom{M(x)}{N(x,y,y)} \and \psi\in\mhom{N(z,z,w)}{P(w)}.
\end{mathpar}
with $x,y,z,w$ all associated to the same cat $A$.
In examples, we can compose these by composing their components
\[ M(x) \xto{\phi_{x,x}} N(x,x,x) \xto{\psi_{x,x}} P(x) \]
and check that the result is an ordinary natural transformation $M\to P$.
Note that the identification of all three variables in $N$ is mandated in order to be able to write both $\phi$ and $\psi$, since $\phi$ requires the second and third variables to be the same while $\psi$ requires the first and second to be the same.
This then determines how the naturality of the composite matches up the variables of $M$ and $P$ (in this case, of course, they have only one variable each, but in general they might have many and this matching might be ambiguous).
This process of identifying variables can be represented by drawing a graph:
\begin{center}
\begin{tikzpicture}[xscale=2,yscale=.8]
\node (A1) at (0,0) {$A$};
\node (A2a) at (1,1) {$A$};
\node (A2b) at (1,0) {$A$};
\node (A2c) at (1,-1) {$A$};
\node (A3) at (2,0) {$A$};
\draw (A1) to[out=0,in=180] node[auto,swap] {$x$} (A2c);
\draw (A2a) to[out=0,in=180] node[auto] {$w$} (A3);
\draw (A2a) to[out=180,in=180] node[auto,swap] {$y$} (A2b);
\draw (A2b) to[out=0,in=0] node[auto] {$z$} (A2c);
\end{tikzpicture}
\end{center}
or by solving a system of equations that ``unifies'' each arguments of the codomain $N(x,y,y)$ of $\phi$ with the corresponding argument of the domain $N(z,z,w)$ of $\psi$:
\begin{mathpar}
x=z \and y=z \and y=w
\end{mathpar}
There are cases where this doesn't work; that is, pairs of extraordinary morphisms from $M$ to $N$ and from $N$ to $P$ that are ``non-composable'' despite having the same module $N$ in the middle.
For example, we might instead have
\begin{mathpar}
\phi\in \mhom{M(x)}{N(x,y,y)} \and \xi\in\mhom{N(w,z,z)}{P(w)}.
\end{mathpar}
The problem here is that when ``composing components'' there is no way to decide what $y$ and $z$ should be: we can write down the composite
\[ M(x) \xto{\phi_{x,y,y}} N(x,y,y) \xto{\xi_{x,y,y}} P(x) \]
for any value of $y$, and there is no canonical choice (note that $x$ and $w$ might belong to an entirely different cat, so choosing $y=x$ is not an option).
Graphically, this problem is visible as the presence of a ``loop'':
\begin{center}
\begin{tikzpicture}[xscale=2,yscale=.8]
\node (A1) at (0,0) {$A$};
\node (A2a) at (1,1) {$B$};
\node (A2b) at (1,0) {$B$};
\node (A2c) at (1,-1) {$A$};
\node (A3) at (2,0) {$A$};
\draw (A1) to[out=0,in=180] node[auto,swap] {$x$} (A2c);
\draw (A2c) to[out=0,in=180] node[auto,swap] {$w$} (A3);
\draw (A2a) to[out=180,in=180] node[auto,swap] {$y$} (A2b);
\draw (A2a) to[out=0,in=0] node[auto] {$z$} (A2b);
\end{tikzpicture}
\end{center}
A more careful explanation of this condition, and a proof that it is the most general answer (for the classical case of enriched categories), can be found in~\cite{ek:gen-funct-calc}.
The technical work in the precise definition of a kit is to make precise \emph{all} the allowable composites of extraordinary morphisms, how they interact with restriction along functors, and in what sense these composites must be ``associative''.
However, in practical applications this generality is rarely needed, as most extraordinary morphisms only involve a few variables, and intuition from ordinary category theory is generally sufficient to give the right answer.
We intend to demonstrate this with some examples of doing ``formal category theory'' in a kit; but first we need to discuss some universal properties of cats and modules.
\section{Universal constructions}
\label{sec:univ}
Universal constructions in a kit are more complicated than those in an ordinary category, due to the interaction of the different kinds of morphisms.
Specifically, universal properties of cats generally have to be extended to say something about modules and module morphisms, while universal properties of modules have to include the extraordinary module morphisms somehow and also be stable under restriction along functors.
\subsection{Tensor products of cats and opposites}
\label{sec:tens-opp}
We begin with the simplest universal properties for cats: those that directly internalize the operations represented ``virtually'' by the multicategorical nature of functors.
For instance, a tensor product of cats $A,B$ should be a cat $A\otimes B$ with a functor $\chi:(A,B)\to A\otimes B$ through which any functor $(A,B)\to C$ factors uniquely.
However, this plain universal property, though it suffices to determine $A\otimes B$ uniquely up to isomorphism, is insufficient in several ways.
Firstly, as in the case of ordinary multicategories, it needs to apply to more general functors containing $(A,B)$ as only part of their domain.
Secondly, it needs to apply even in the contravariant case: functors $(A\o,B\o)\to C$ should factor through $(A\otimes B)\o$.
Thirdly, it needs to apply to modules as well: we should have $\modk(A\otimes B)\cong \modk(A,B)$, and similarly when other cats are also present.
And finally, it also needs to apply to module morphisms of all sorts, even extraordinary ones.
In order to state all of these universal properties precisely, we need some more notation.
\begin{itemize}
\item We will write $A\e$ to indicate either $A$ or $A\o$, and in this case we write $A\epbar$ for the other one ($A\o$ or $A$, respectively).
\item We will use the letter $\Gamma$ for a finite list of modules with abstract variables, such as $M(a,b),N(b,c,d),P(e)$ or $M_1(f(x),g(y,z)),M_2(h(y,x))$.
Similarly, we will use the letter $\Omega$ for a single module with abstract variables; thus a general extraordinary module morphism can be written $\phi\in\mhom{\Gamma}{\Omega}$.
\item We will write $\subst\Gamma x \theta$ for the result of substituting the expression $\theta$ for all occurrences of the abstract variable $x$ in $\Gamma$, and similarly, for $\Omega$.
Thus, for instance, if $\Omega = M(a,b)$, then $\subst\Omega a{f(x,y)} = M(f(x,y),b)$.
Note that this might perform zero, one, or two substitutions, depending on how many times the variable occurs.
\end{itemize}
\begin{defn}\label{defn:tens-cat}
A \textbf{tensor product} of cats $A,B$ is a cat $A\otimes B$ with a functor $\chi:(A,B) \to A\otimes B$ such that
\begin{enumerate}
\item Precomposition with $\chi$ induces bijections of functor sets
\[ \K((\Psi,(A\otimes B)\e),C) \toiso \K((\Psi,A\e,B\e),C)\]
for any list $\Psi$ of cats with variance;\label{item:tenscat-1}
\item Restriction along $\chi$ induces an isomorphism of categories
\[ \modk(\Psi,(A\otimes B)\e) \toiso \modk(\Psi,A\e,B\e) \]
for any $\Psi$; and finally
\item Restriction along $\chi$ induces bijections of sets of extraordinary morphisms
\[ \mhomc{\Psi,z:(A\otimes B)\e}{\Gamma}{\Omega}\toiso \mhomc{\Psi,x:A\e,y:B\e}{\subst\Gamma z{\chi(x,y)}}{\subst \Omega z {\chi(x,y)}}\]
whenever this makes sense.\label{item:tenscat-3}
\end{enumerate}
\end{defn}
Note that due to the symmetric group actions, it suffices to assert these universal properties when $A\otimes B$ is at the end of a list; corresponding properties then follow when it appears anywhere.
We can similarly define $n$-ary tensor products of cats for all $n$, and using only~\ref{item:tenscat-1} we can show that these are associative and symmetric insofar as they exist.
That is, if $A\otimes B$ and $(A\otimes B)\otimes C$ exist, then the latter is a ternary tensor product; hence if $B\otimes C$ exists then $A\otimes (B\otimes C)$ exists and is isomorphic to $(A\otimes B)\otimes C$.
A 0-ary tensor product is a cat $I$ with a functor $\chi:()\to I$, precomposition with which induces isomorphisms
\begin{align*}
\K((\Psi,I\e),C) &\toiso \K(\Psi,C)\\
\modk(\Psi,I\e) &\toiso \modk(\Psi)\\
\mhomc{\Psi,z:I\e}{\Gamma}{\Omega} &\toiso \mhomc{\Psi}{\subst\Gamma z\chi}{\subst\Omega z \chi}
\end{align*}
In particular, if all tensor products of cats exist, then the category $\K_1$ of cats and unary functors is symmetric monoidal.
Similarly, we can internalize contravariance by defining an operation of ``oppositization''.
We will write this as $(-)\op$ to distinguish it from the formal marker of contravariance $(-)\o$.
\begin{defn}\label{defn:opp-cat}
An \textbf{opposite} of a cat $A$ is a cat $A\op$ with a functor $\chi:(A\o) \to A\op$ precomposition with which induces isomorphisms
\begin{align*}
\K((\Psi,(A\op)\e),C) &\toiso \K((\Psi,A\epbar),C)\\
\modk(\Psi,(A\op)\e) &\toiso \modk(\Psi,A\epbar) \\
\mhomc{\Psi,z:(A\op)\e}{\Gamma}{\Omega} &\toiso \mhomc{\Psi,x:A\epbar}{\subst\Gamma z {\chi(x)}}{\subst\Omega z{\chi(x)}}
\end{align*}
\end{defn}
If all opposites exist, then $(-)\op$ defines an endofunctor of $\K_1$.
By comparing universal properties, we can see that $(A\op)\op\cong A$ and $(A\otimes B)\op \cong A\op \otimes B\op$ and $I\op$, so that $(-)\op$ is a ``symmetric monoidal involution'' in a suitable sense.
\subsection{Tensor products of modules}
\label{sec:tens}
Like the tensor product of cats, the tensor product of modules has a universal property very much like that of tensor products in an ordinary multicategory.
It is simpler in that we don't need to worry about the dependence of modules on cats (the second two properties in \cref{defn:tens-cat,defn:opp-cat}).
However, it is more complicated in that the universal property applies to all sorts of extraordinary morphisms, and that it must be stable under restriction along functors.
To state this precisely, we need a bit more notation.
\begin{itemize}
\item If $M\in\modk(\Psi)$, we will write $M(\theta)$ for $M$ with a list of expressions $\theta$ for its abstract variables.
For instance, if $M\in\modk(A,B\o,C)$ and we have $g:X \to A$ and $h:(Y\o,Z)\to B$ and $k:()\to C$, then with $\theta=(g(x),h(y,z),k)$ we have $M(\theta) = M(g(x),h(y,z),k)$.
We will also use letters like $\gamma$ and $\omega$ for such lists $\theta$.
\end{itemize}
\begin{defn}
A \textbf{tensor product} of modules $M_1\in\modk(\Psi_1)$ and $M_2\in\modk(\Psi_2)$ is a module $M_1\otimes M_2 \in \modk(\Psi_1,\Psi_2)$ along with an (ordinary) morphism $\chi:(M_1,M_2)\to M_1\otimes M_2$ such that precomposition with $\chi$ (or some restriction of it) induces bijections
\[ \mhom{\Gamma,(M_1\otimes M_2)(\theta_1,\theta_2)}{\Omega} \toiso \mhom{\Gamma,M_1(\theta_1),M_2(\theta_2)}{\Omega} \]
\end{defn}
The presence of the $\theta$s means that this universal property includes extraordinary morphisms of all sorts, where paired variables may occur anywhere.
Examples include:
\begin{align*}
\mhom{(M_1 \otimes M_2)(a,b)}{N(a,b)} &\toiso \mhom{M_1(a), M_2(b)}{N(a,b)}\\
\mhom{(M_1 \otimes M_2)(a,a)}{N} &\toiso \mhom{M_1(a), M_2(a)}{N}\\
\mhom{P(a),(M_1 \otimes M_2)(a,b,c)}{N(b,c,d,d)} &\toiso \mhom{P(a),M_1(a,b), M_2(c)}{N(b,c,d,d)}\\
\intertext{
and so on.
Similarly, $\theta$ can also include restrictions, so that we might have}
\mhom{(M_1\otimes M_2)(f(a),g(b))}{N(a,b)} &\toiso \mhom{M_1(f(a)),M_2(g(b))}{N(a,b)}
\end{align*}
In other words, the restricted morphism $(f,g)^*\chi : f^*M, g^*N \to (f,g)^*(M\otimes N)$ has the universal property that would be expected of $\chi: f^*M, g^*N \to f^*M \otimes g^*N$, and thus tensor products are stable under restriction: $ (f,g)^*(M\otimes N) \cong f^*M \otimes g^*N$.
In general this stability is only up to isomorphism, so we technically ought to resist the temptation to write things like $M_1(a,b)\otimes M_2(c)$ instead of $(M_1 \otimes M_2)(a,b,c)$.
However, the former notation is so useful (it reminds us how the dependencies split) that we will often succumb to this temptation.
It should be possible to prove a coherence theorem making tensor products (and all similar universal properties to be introduced below) strictly stable under restriction, and this is moreover how they appear in the type theory of~\cite{lnss:dirtt}.
Remember also that the pairing of variables only indicates the type of extraordinary morphism under consideration; when we write $(M_1 \otimes M_2)(a,a)$ or $M_1(a)\otimes M_2(a)$ we are still talking about the same tensor product module $M_1\otimes M_2$, just different kinds of morphisms out of it.
As usual, we can define $n$-ary tensor products for all $n$, and the usual arguments show that these are associative and symmetric insofar as they exist.
A nullary tensor product is a module $I\in \modk(())$ and a morphism $() \to I$, precomposition with which induces bijections $\mhom{\Gamma,I}{\Omega} \toiso \mhom\Gamma \Omega$.
\subsection{Ends and coends}
\label{sec:ends-coends}
The tensor product of modules has a universal property that extends to extraordinary morphisms, but the universal morphism $(M,N)\to M\otimes N$ itself is an ordinary morphism.
Now we consider universal morphisms that are themselves extraordinary.
Perhaps the simplest of these are ends and coends.
First one more bit of notation:
\begin{itemize}
\item We will write $\xi$ for a $\theta$ that contains no functors or pairings, only a list of distinct abstract variables.
In other words, $M(\xi)$ simply stands for a way to import $M$ into abstract variable notation, which is unique up to the choice of variable names.
Thus if $M\in \modk(A,B\o,C)$ then $M(\xi)$ might mean $M(a,b,c)$ but not $M(g(x),h(y,z),k)$.
Moreover, if different $\xi$s appear in an expression we assume them to be disjoint.
\end{itemize}
For instance, the universal morphism of a tensor product could be written in abstract variable notation as $\chi \in \mhom{M_1(\xi_1), M_2(\xi_2)}{(M_1\otimes M_2)(\xi_1,\xi_2)}$.
We avoided this before by writing it without abstract variables, but that is no longer possible now that we want to consider extraordinary universal morphisms.
\begin{defn}
A \textbf{coend} of a module $M\in \modk(A,A\o,\Psi)$ is a module $\coend^A M\in\modk(\Psi)$ together with a morphism $\chi\in\mhom{M(a,a,\xi)}{\big(\coend^A M\big)(\xi)}$, precomposition with which induces bijections
\[ \mhom{\Gamma,(\coend^A M)(\theta)}{\Omega} \toiso \mhom{\Gamma,M(a,a,\theta)}{\Omega} \]
whenever this makes sense.
\end{defn}
If other variables belonging to $A$ occur elsewhere, then we may indicate which one is being ``coended'' by writing $\coend^{a:A} M(a,a)$.
In this notation the variable $a$ is ``bound'' and no longer indicates any ordinary or extraordinary dependence of the morphism under consideration.
The simplest case of the universal property of a coend is that
\[ \mhom{\coend^A M}{N} \cong \mhom{M(a,a)}{N} \]
for $M\in\modk(A,A\o)$ and $N\in\modk(())$.
In other words, $\coend^A M$ is the module universally equipped with a morphism from $M$ that is extraordinary in $A$.
As with tensor products, the full universal property also applies to multivariable morphisms that may have other variables, both ordinary and extraordinary, and also implies a stability under restriction: $f^*(\coend^A M) \cong \coend^A f^*M$.
This stability is, of course, only true for restriction along functors between \emph{other} cats that $M$ may depend on: a functor $f:B\to A$ does not induce an isomorphism $\coend^{B} (f,f)^* M \cong \coend^A M$.
We do, however, have a morphism $\coend^{B} (f,f)^* M \to \coend^A M$, induced by first restricting the universal morphism $M(a,a) \to \coend^A M$ along $f$ to obtain $M(f(b),f(b)) \to \coend^A M$, then applying the universal property of $\coend^B$.
By comparing universal properties, we can deduce the ``Fubini theorem''
\[ \coend^A \coend^B M \cong \coend^B \coend^A M. \]
Moreover, if $A\otimes B$ exists, then both iterated coends are also isomorphic to $\coend^{A\otimes B} M'$, where $M'$ corresponds to $M$ under the universal property of $A\otimes B$ (applied twice, once covariantly and once contravariantly).
Similarly, we have $\coend^I M'\cong M$ if $I$ is the unit cat and $M'$ corresponds to $M$ under its universal property.
Combining the coend with the (external) tensor product of modules, we obtain the \emph{binding} or \emph{canceling} tensor product of modules:
\[ M\otimes_A N = \coend^A (M\otimes N) \]
where $M\in\modk(\Psi_1,A)$ and $N\in\modk(\Psi_2,A\o)$ (or vice versa).
Comparing universal properties, we see that this is also associative:
\[ (M\otimes_A N) \otimes_B P \cong M\otimes_A (N\otimes_B P) \]
and we can verify the pentagon axiom.
This wants to be the composition operation in a bicategory of cats and modules, where the hom-category from $A$ to $B$ is $\modk(B\o,A)$; but we do not yet have the identity 1-cells for such a bicategory.
Note that it is possible to express directly the universal property of the binding tensor product: it comes with a morphism $M(\xi_1,a), N(a,\xi_2) \mto (M\otimes_A N)(\xi_1,\xi_2)$, inducing bijections
\[ \mhom{\Gamma,(M\otimes_A N) (\theta_1,\theta_2)}{\Omega} \toiso \mhom{\Gamma,M(\theta_1,a),N(a,\theta_2)}{\Omega} \]
This is useful because in some kits the binding tensor product may exist even if the external tensor product and coend do not separately exist.
Finally, ends are dual to coends.
These are our first module with a ``mapping in'' universal property.
\begin{defn}
An \textbf{end} of a module $M\in \modk(A,A\o,\Psi)$ is a module $\tend_A M\in\modk(\Psi)$ together with a morphism $\chi\in\mhom{\big(\tend_A M\big)(\xi)}{M(a,a,\xi)}$, postcomposition with which induces bijections
\[ \mhom{\Gamma}{(\tend_A M)(\theta)} \toiso \mhom{\Gamma}{M(a,a,\theta)} \]
whenever this makes sense.
\end{defn}
\subsection{Function modules}
\label{sec:func-mod}
For ends and coends, the universal morphism is extraordinary in the input (the module being ended or coended); now we move on to universal morphisms that are extraordinary in the output (the object with a universal property).
The first of these are function modules, the ``right adjoints'' to tensor products --- although as we will see, to actually construct adjunctions requires incorporating ends and coends as well.
\begin{defn}
A \textbf{function module} of modules $M_1\in \modk(\Phi_1)$ and $M_2\in \modk(\Phi_2)$ is a module $M_1\multimap M_2 \in \modk(\Phi_1\o,\Phi_2)$ with a morphism
\[\ev \in \mhom{(M_1\multimap M_2)(\xi_1,\xi_2), M_1(\xi_1)}{M_2(\xi_2)},\]
postcomposition with which induces bijections
\begin{equation}
\mhom{\Gamma}{(M_1\multimap M_2)(\theta_1,\theta_2)} \toiso
\mhom{\Gamma,M_1(\theta_1)}{M_2(\theta_2)}\label{eq:func-ump}
\end{equation}
whenever this makes sense.
\end{defn}
As before, $\xi$'s represent disjoint lists of distinct variables; thus $\ev$ (``evaluation'') is a single morphism such as $(M_1\multimap M_2)(a,b), M_1(a) \mto M_2(b)$.
But also as before, the $\theta$'s represent arbitrary expressions, possibly with variable pairings; thus the universal property includes as particular cases:
\begin{align*}
\mhom{N(a,b)}{(M_1\multimap M_2)(a,b))} &\toiso \mhom{N(a,b),M_1(a)}{M_2(b)}\\
\mhom{N}{(M_1\multimap M_2)(a,a))} &\toiso \mhom{N,M_1(a)}{M_2(a)}\\
\mhom{N(a,b)}{(M_1\multimap M_2)(a,c,b,c))} &\toiso \mhom{N(a,b),M_1(a,c)}{M_2(b,c)}\\
\mhom{N(f(x,z),g(y))}{(M_1\multimap M_2)(h(x,y),z))} &\toiso \mhom{N(f(x,z),g(y)),M_1(h(x,y))}{M_2(z)}
\end{align*}
and so on.
Note that the composition map~\eqref{eq:func-ump} is indeed what we get by postcomposing with $\ev$: as described in \cref{sec:composing}, when composing $\mhom{(M_1\multimap M_2)(\xi_1,\xi_2), M_1(\xi_1)}{M_2(\xi_2)}$ with $\mhom{\Gamma}{(M_1\multimap M_2)(\theta_1,\theta_2)}$ (and technically the identity on $M_1(\xi_1)$ as well), $\xi_1$ and $\xi_2$ get identified with $\theta_1$ and $\theta_2$, so that in the result instead of $M_1(\xi_1)$ and $M_2(\xi_2)$ in the domain and codomain we have $M_1(\theta_1)$ and $M_2(\theta_2)$.
Combining the universal properties of function modules with tensor products, we have an isomorphism
\[ \mhom{(M_1\otimes M_2)(\theta_1,\theta_2)}{M_3(\theta_3)} \cong \mhom{M_1(\theta_1)}{(M_2\multimap M_3)(\theta_2,\theta_3)}
\]
that looks like an adjunction, except that one side or the other (or both) must always be extraordinary.
However, if we add in an end or a coend, we can make an isomorphism between two ordinary sets of morphisms, and therefore an actual adjunction.
Examples include
\begin{align*}
\mhom{\coend^{a:A} (M_1\otimes M_2)(a,a)}{M_3} &\cong \mhom{M_1(a)}{(M_2\multimap M_3)(a)}\\
\mhom{(M_1\otimes M_2)(a)}{M_3(a)} &\cong \mhom{M_1}{\tend_{a:A} (M_2\multimap M_3)(a,a)}\\
\end{align*}
which can be interpreted (for fixed $M_2\in \modk(A)$) as adjunctions
\begin{align*}
\modk(A) &\leftrightarrows \modk(())\\
\modk(()) &\leftrightarrows \modk(A)
\end{align*}
respectively.
Adding in a couple of other variables, we find that for $M\in \modk(B\o,A)$ and $N\in\modk(C\o,B)$ and $P\in modk(C\o,A)$ we have
\begin{align*}
\mhom{\coend^{b:B} (N\otimes M)(c,b,b,a)}{P(c,a)} &\cong \mhom{M(b,a)}{\tend_{c:C} (N\multimap P)(c,b,c,a)}
\end{align*}
Since $\coend^B (N\otimes M)$ is the composition in the expected ``bicategory of profunctors'', this shows that if we have function modules and ends then that will be a \emph{closed bicategory}, in the usual sense that its composition functors have right adjoints on both sides.
As in the case of the binding tensor product, it is sometimes useful to directly name the \emph{binding function module}
\[ M\multimap_A N = \tend_A (M\multimap N)\]
whose universal property can be expressed directly as a morphism
\[\ev\in \mhom{(M\multimap_A N)(\theta_1,\theta_2),M(\theta_1,a)}{N(\theta_2,a)}\]
postcomposition with which induces an isomorphism
\[ \mhom{\Gamma}{(M\multimap_A N)(\theta_1,\theta_2)} \toiso
\mhom{\Gamma,M(\theta_1,a)}{N(\theta_2,a)}.
\]
\subsection{Hom-modules and representable modules}
\label{sec:hom}
The most important universal objects in a kit are the ``hom-modules'' $\mor A \in \modk(A\o,A)$.
Their universal property is essentially a ``two-sided double Yoneda lemma''.
\begin{defn}
A \textbf{hom-module} of a cat $A$ is a module $\mor A \in \modk(A\o,A)$ together with a morphism $\id_A \in \mhom{}{\mor A(a,a)}$, precomposition with which induces bijections
\[ \mhom{\Gamma,\mor A(x,y)}{\Omega} \toiso
\mhom{\subst\Gamma y x}{\subst\Omega y x}
\]
\end{defn}
Two instances of this universal property look like the Yoneda lemma and the co-Yoneda lemma:
\begin{align*}
\mhom{\mor A(x,y)}{M(x,y)} &\toiso \mhom{}{M(x,x)}\\
\mhom{M(x),\mor A(x,y)}{N(y)} &\toiso \mhom{M(x)}{N(x)}
\end{align*}
TODO: Derive the one-sided versions.
\subsection{Functor and presheaf cats}
\label{sec:func-pshf}
\section{Examples of formal category theory}
\label{sec:examples}
We will always assume that all kits have hom-modules; this seems to be a prerequisite for doing much of any formal category theory.
However, we will explicitly assume other universal objects when we need them.
\subsection{Limits and colimits}
Consider functors $d:D\to C$ and $l:()\to C$ (i.e.\ $l$ is an ``object'' of $C$), and a module $J\in\modk(D)$.
A \textbf{$J$-weighted cone} over $d$ with vertex $l$ is a (ordinary) module morphism
\[ \pi \in \mhom{J(x)}{\mor{C}(l,d(x))}. \]
Using the universal property of hom-modules, this corresponds to a morphism
\[ \pi' \in \mhom{\mor{C}(y,l),J(x)}{\mor{C}(y,d(x))}. \]
We say that $\pi$ exhibits $l$ as a \textbf{$J$-weighted limit} of $d$ if $\pi'$ gives $\mor C(1,l)$ the universal property of the binding function module $J \multimap_D \mor{C}(1,d)$; in other words, if postcomposition with $\pi'$ induces bijections
\[ \mhom{\Gamma}{\mor{C}(y,l)} \toiso \mhom{\Gamma,J(x)}{\mor{C}(y,d(x))}. \]
Of course, if $J \multimap_D \mor{C}(1,d)$ is known to exist (such as if $\K$ has ends and function modules), then to make $l$ a $J$-weighted limit of $d$ is equivalent to giving an isomorphism $\mor{C}(1,l) \cong J \multimap_D \mor{C}(1,d)$ in $\modk(C\o)$.
(Hmm, in the definition of function modules (and all the other universal properties) I incorporated a substitution to make it restriction-stable. Is that necessary to do here too? In an equipment that corresponds to asserting the universal property with respect to cells having nontrivial vertical-arrow boundaries. But maybe we can avoid that once we have homs and the Yoneda lemma by moving them into the domain?)
While the above definition most closely matches the usual definition of weighted limits, it is not necessary to restrict $d$ and $l$ to have unary and nullary domains, respectively.
The case when $l$ also has unary domain $E$ is also very important.
In this case $\pi$ is ordinary in $E$ and $\pi'$ is extraordinary:
\begin{align*}
\pi &\in \mhom{J(e,x)}{\mor{C}(l(e),d(x))} \\
\pi' &\in \mhom{\mor{C}(y,l(e)),J(e,x)}{\mor{C}(y,d(x))}
\end{align*}
and the limit is again characterized by $\mor{C}(1,l) \cong J \multimap_D \mor{C}(1,d)$, only now this is an isomorphism in $\modk(C\o,E)$.
Since universal properties are stable under restriction, it follows that for any $f:E'\to E$ we have also $\mor{C}(1,l f) \cong J(f,1) \multimap_D \mor{C}(1,d)$, so that $l:E\to C$ is a functor given by taking ``pointwise limits''.
As a special case, we can define (pointwise) Kan extensions.
If $f:D\to C$ and $g:D\to E$ are functors, then the right Kan extension of $f$ along $g$ (if it exists) is the limit of $f$ weighted by $\mor{E}(1,g)$.
\part{The definition of a kit}
\label{part:def}
\section{Generalized polycategories}
\label{sec:genpoly}
Our formal definition of a kit will be a special case of a general notion called a \emph{generalized polycategory}.
Generalized polycategories appear only implicitly in the literature (e.g.~\cite{garner:polycats}), so we will have to define them as well along the way.
However, we defer their general study to a later paper, taking here a reasonably geodesic route to the definition of kit.
Roughly speaking, generalized polycategories are to polycategories as generalized multicategories are to multicategories.
Recall that a \emph{multicategory} is like a category in which a morphism can have a finite list of objects, rather than a single object, as its domain (but still only a single object as codomain).
\emph{Generalized multicategories} are a vast generalization obtained by observing that ``finite lists'' can be regarded as elements of the free-monoid monad, and that a version of the definition of multicategory can be carried out for \emph{any} sufficiently well-behaved monad.
\emph{Polycategories}, on the other hand, are like categories in which a morphism can have finite lists of objects as both its domain and codomain.
However, this brief description is significantly farther from a precise definition than the corresponding brief description of multicategories, because there are many more choices about how to allow such morphisms to be composed.
Polycategories proper~\cite{szabo:polycats,cs:wk-distrib} result from one such choice, but other (perhaps even more natural) choices yield structures such as ``colored props'' and ``colored properads''.\footnote{Thus perhaps the general notion should be called a ``generalized prop'', but ``generalized polycategory'' is more euphonious and intuitive-sounding.}
\emph{Generalized polycategories} are thus defined relative not just to two monads (one describing the domains and one the codomains), but also a ``distributive law'' between them that describes ``how morphisms should be composed''.
Ordinary polycategories were defined in this language by Garner~\cite{garner:polycats}; to obtain a general notion we abstract out the details of his construction (with some changes; see below).
This is promising as an avenue for defining kits, since we can use the distributive law to encode the ``allowable composites'' of extraordinary natural transformations.
There are a number of perspectives on generalized multicategories that one could enhance to a theory of generalized polycategories.
We will use the framework of~\cite{cs:multicats}, except that (aiming at a geodesic route to kits) we simplify it by considering only double categories rather than the ``virtual double categories'' used there.
Specifically, we consider \emph{pseudo double categories}, in which one direction of composition is strict and the other is only associative and unital up to isomorphisms in the strict direction.
The literature is not consistent about whether the strict direction is the ``vertical'' or the ``horizontal'' one.
To be agnostic about this, we will use instead the words \textbf{tight} and \textbf{loose} (from~\cite{ls:limlax}) for the strict and pseudo directions, and we allow ourselves to write them in either orientation, marking the loose morphisms with a dot to disambiguate.
Thus, a cell in a double category can be written either as
\[ \vcenter{\xymatrix{ A \ar[r]|{\bullet} \ar[d] \ar@{}[dr]|{\Downarrow}& B \ar[d] \\ C \ar[r]|{\bullet} & D } }
\qquad\text{or}\qquad
\vcenter{\xymatrix{ A \ar[d]|{\bullet} \ar[r] \ar@{}[dr]|{\Rightarrow}& C \ar[d]|{\bullet} \\ B \ar[r] & D } }
\]
We write tight composition (of arrows or cells) with $\tc$ or juxtaposition in applicative order, and loose composition (of arrows or cells) with $\bc$ in diagrammatic order.\footnote{Applicative order means that the composite of $f:A\to B$ and $g:B\to C$ is $g\tc f$, while diagrammatic order means that the composite of $M:A\bto B$ and $N:B\bto C$ is $M\bc N$.}
Similarly, we write $1$ for tight identities (of objects or loose arrows), and $\hunit{A}$ for loose identities (of objects or tight arrows).
The particular double category we have most in mind is \dCat, where:
\begin{itemize}
\item The objects are categories,
\item The tight arrows are functors,
\item A loose arrow $A\bto B$ is a profunctor, i.e.\ a functor $B\op\times A\to\bSet$, and
\item The 2-cells are natural transformations of the obvious sort.
\end{itemize}
We will also be interested in \emph{slice} double categories of \dCat: for any object $A$ of a double category \dD, in the slice $\dD/A$ the category $(\dD/A)_0$ of objects and tight maps is the slice of $\dD_0$ over $A$, and the category $(\dD/A)_1$ of loose arrows and cells is the slice of $\dD_1$ over $\hunit A$.
Between (pseudo) double categories we will mainly be interested in \emph{strong} or \emph{pseudo double functors}, which are strictly functorial in the tight direction and functorial up to tight isomorphism in the loose direction.
Such functors admit an obvious notion of \emph{tight transformation}, with tight arrow components $\alpha_A:FA\to GA$ for each object $A$, and 2-cell components
\[ \vcenter{\xymatrix{ FA \ar[r]|{\bullet}^{FM} \ar[d]_{\alpha_A} \ar@{}[dr]|{\Downarrow}& FB \ar[d]^{\alpha_B} \\ GA \ar[r]|{\bullet}_{GM} & GB } } \]
for each loose arrow $A\xbto{M} B$.
This yields a strict 2-category of double categories which we denote \cDbl.
By a \textbf{double monad} we mean a monad in this 2-category.
(Many of the definitions make sense even for double monads whose underlying double functors are \emph{lax}, but all the ones we will be interested in are strong.)
Distributive laws can also be defined internal to any 2-category; interpreted in \cDbl this yields a notion of \textbf{tight distributive law}.
However, for generalized polycategories we are interested in \emph{loose distributive laws}, which we now define.
If $F$ and $G$ are double functors between pseudo double categories, a \textbf{loose transformation} $\alpha:F\bto G$ consists of a loose arrow $\alpha_X : F X \bto G X$ for each object $X$ of the domain, forming a pseudonatural transformation between the loose parts of $F$ and $G$, together with for each tight arrow $f:X\to Y$ in the domain, a cell
\[ \xymatrix{ F X \ar[r]|-{\bullet}^-{\alpha_X} \ar[d]_{F f} \ar@{}[dr]|{\alpha_f} & G X \ar[d]^{G f} \\
F Y \ar[r]|-{\bullet}_-{\alpha_Y} & G Y} \]
satisfying some evident axioms; see~\cite{gp:something} wherein this is called a \emph{vertical transformation}.
These are the loose arrows in a double category of functors whose tight arrows are tight transformations, and whose cells are an evident kind of ``square modification''.
In the following definitions, we write composition of double functors (and whiskering of tight and loose transformations by double functors) with $\oc$, to distinguish it from the compositions $\tc$ and $\bc$ in the tight and loose direction respectively.
A further reason for this will become apparent in \cref{sec:linear-double-monads}.
For brevity, we will also omit mention of the associativity and unit constraints for loose composition, and the functoriality constraints for double functors.
\begin{defn}\label{def:hdl}
Let $T$ and $S$ be monads on a double category \K.
A \textbf{loose distributive law} between $(T,\Tmult,\Tunit)$ and $(S,\Smult,\Sunit)$ consists of the following:
\begin{enumerate}
\item A loose transformation $\dl : T\oc S \bto S \oc T$.
\item Square modifications
\begin{mathpar}
\xymatrix{ T \oc T\oc S \ar[r]|{\bullet}^{T\oc \dl} \ar[d]_{\Tmult \oc S}
\ar@{}[drr]|{\Tdlmult} &
T\oc S\oc T \ar[r]|{\bullet}^{\dl\oc T} & S\oc T\oc T \ar[d]^{S \oc \Tmult} \\
T\oc S \ar[rr]|{\bullet}_{\dl}&& S\oc T}\and
\xymatrix{ S \ar[d]_{\Tunit\oc S} \ar[r]|{\bullet}^{\hunit S} \ar@{}[dr]|{\Tdlunit} & S \ar[d]^{S\oc \Tunit} \\
T\oc S \ar[r]|{\bullet}_{\dl} & S \oc T}\and
\xymatrix{ T\oc S\oc S \ar[r]|{\bullet}^{\dl \oc S} \ar[d]_{T \oc \Smult}
\ar@{}[drr]|{\Sdlmult} &
S \oc T\oc S \ar[r]|{\bullet}^{S\oc \dl} & S\oc S\oc T \ar[d]^{\Smult\oc T} \\
T\oc S \ar[rr]|{\bullet}_{\dl}&& S\oc T}\and
% \xymatrix{ & S \ar[dl]_{\Tunit S} \ar[dr]^{S \Tunit} \ar@{}[d]|{\Tdlunit} \\
% T S \ar[rr]|{\bullet}_{\dl} && S T}\and
% \xymatrix{ & T \ar[dl]_{T\Sunit} \ar[dr]^{\Sunit T} \ar@{}[d]|{\Sdlunit} \\
% T S \ar[rr]|{\bullet}_{\dl} && S T}
\xymatrix{ T \ar[d]_{T\oc \Sunit} \ar[r]|{\bullet}^{\hunit T} \ar@{}[dr]|{\Sdlunit} & T \ar[d]^{\Sunit \oc T} \\
T\oc S \ar[r]|{\bullet}_{\dl} & S \oc T}
\end{mathpar}
These are versions of the diagrams that would have to \emph{commute} if $\dl$ were an ordinary tight distributive law.
\item The following equalities of square modifications hold:
\begin{alignat*}{2}
\Tdlunit \tc \hunit{\Sunit} &= \Sdlunit \tc \hunit{\Tunit} &\qquad % PDA1
\Sdlmult \tc ((\Sdlmult\oc S)\bc \Smult_\dl) &= \Sdlmult \tc (\dl_{\Smult} \bc (S\oc \Sdlmult)) \\ % PDA6
\Sdlmult \tc ((\Sdlunit \oc S)\bc \Sunit_\dl) &= 1_\dl &\qquad % PDA2
\Tdlmult \tc (\Tmult_\dl\bc (\Tdlmult\oc T)) &= \Tdlmult \tc ((T\oc \Tdlmult)\bc \dl_{\Tmult}) \\ % PDA7
\Sdlmult \tc (\dl_{\Sunit} \bc (S\oc \Sdlunit)) &= 1_\dl &\qquad % PDA3
\Sdlmult \tc ((\Tdlunit\oc S)\bc S\Tdlunit) &= \Tdlunit \tc \hunit{\Smult} \\ % PDA8
\Tdlmult \tc (\Tunit_\dl \bc (\Tdlunit\oc T)) &= 1_\dl &\qquad % PDA4
\Tdlmult \tc ((T\oc\Sdlunit)\bc (\Sdlunit\oc T)) &= \Sdlunit \tc \hunit{\Tmult} \\ % PDA9
\Tdlmult \tc ((T\oc\Tdlunit) \bc \dl_{\Tunit}) &= 1_\dl &\qquad % PDA5
\Sdlmult \tc ((\Tdlmult \oc S)\bc (S\oc \Tdlmult)) &= \Tdlmult \tc ((T\oc\Sdlmult)\bc (\Sdlmult\oc T)) \tc \dlnat % PDA10
\end{alignat*}
where
\[\dlnat : (\dl\oc T\oc S) \bc (T\oc S\oc \dl) \toiso (T\oc S\oc \dl) \bc (\dl\oc T\oc S)\]
is a pseudonaturality constraint of $\dl$.
In all cases the tight naturality and monad axioms for the transformations $\Tmult,\Tunit,\Smult,\Sunit$ ensures that the boundaries of both sides of the equations agree automatically.
\end{enumerate}
\end{defn}
The data and axioms of a loose distributive law may appear rather formidable when written out unforgivingly as above.
In \cref{fig:hdl-data,fig:hdl-axioms} we sketch them instead using an informal string diagram calculus, in which the monads $T$ and $S$ are written as a red and a blue string respectively and the loose transformation $\dl$ is a ``string crossing''.
\begin{figure}[p]
\centering
\includegraphics{hdl-data.png}
\caption{The data of a loose distributive law}
\label{fig:hdl-data}
\end{figure}
\begin{figure}[p]
\centering
\includegraphics[width=\textwidth]{hdl-axioms.png}
\caption{The axioms of a loose distributive law}
\label{fig:hdl-axioms}
\end{figure}
In~\cite{cs:genmulti} the theory of generalized multicategories relative to a double monad is developed in two steps, by first constructing a ``horizontal Kleisli virtual double category'' and then considering monoids therein.
In a later paper we will do the same for generalized polycategories relative to a loose distributive law, but at present it suffices to define the end result explicitly.
In the following definitions we write application of double functors and transformations to objects by juxtaposition, so that for instance the components of $\dl:T\oc S \bto S \oc T$ are of the form $\dl_A : T S A \bto S T A$.
\begin{defn}
Let $\dl : T\oc S \bto S\oc T$ be a loose distributive law between double monads.
A \textbf{$\dl$-monoid} consists of an object $A$ and a loose arrow $M:TA\bto SA$ together with unit and multiplication cells
\[ \xymatrix{
A \ar[d]_{\Tunit_A} \ar[r]|{\bullet}^{\hunit A} \ar@{}[dr]|{e\Downarrow} & A \ar[d]^{\Sunit_A} \\
T A \ar[r]|{\bullet}_M & S A }\qquad
\xymatrix{ TTA \ar[r]|{\bullet}^{T M} \ar[d]_{\Tmult_A} \ar@{}[drrr]|{m\Downarrow} &
T S A \ar[r]|{\bullet}^{\dl} & S T A \ar[r]|{\bullet}^{S M} & S S A \ar[d]^{\Smult_A}\\
T A \ar[rrr]|{\bullet}_M &&& S A}\]
such that the two following two ways to compose the multiplication with the unit are equal (modulo unit constraints for loose composition) to the identity on $M$:
\[ \xymatrix@C=1.7pc{
TA \ar[r]|{\bullet}^{\hunit{T A}} \ar@{=}[d] \ar@{}[dr]|{\bar T} &
TA \ar[r]|{\bullet}^{\hunit{TA}} \ar@{=}[d]
& TA \ar@{=}[d] \ar[r]|{\bullet}^{M} &
SA \ar@{=}[d] \\
TA \ar[r]|{\bullet}^{T\hunit A} \ar[d]_{T\Tunit_A} \ar@{}[dr]|{Te} &
TA \ar[r]|{\bullet}^{\hunit{TA}} \ar[d]|{T\Sunit_A} \ar@{}[dr]|{\Sdlunit}
& TA \ar[d]|{\Sunit_{TA}} \ar[r]|{\bullet}^{M} \ar@{}[dr]|{\eta_M} &
SA \ar[d]^{\Sunit_{SA}} \\
TTA \ar[r]|{\bullet}_{T M} \ar[d]_{\Tmult_A} \ar@{}[drrr]|{m} &
T S A \ar[r]|{\bullet}_{\dl} & S T A \ar[r]|{\bullet}_{S M} & S S A \ar[d]^{\Smult_A}\\
T A \ar[rrr]|{\bullet}_M &&& S A}
\xymatrix@C=1.7pc{
TA \ar@{=}[d] \ar[r]|{\bullet}^{M} &
SA \ar@{=}[d] \ar[r]|{\bullet}^{\hunit{SA}} &
SA \ar@{=}[d] \ar[r]|{\bullet}^{\hunit{S A}} \ar@{}[dr]|{\bar S} &
SA \ar@{=}[d] \\
TA \ar[d]_{\Tunit_{TA}} \ar[r]|{\bullet}^{M} \ar@{}[dr]|{\Tunit_M} &
SA \ar[d]|{\Tunit_{SA}} \ar[r]|{\bullet}^{\hunit{SA}} \ar@{}[dr]|{\Tdlunit} &
SA \ar[d]|{S\Tunit_A} \ar[r]|{\bullet}^{S\hunit A} \ar@{}[dr]|{Se} &
SA \ar[d]^{S\Sunit_A} \\
TTA \ar[r]|{\bullet}_{T M} \ar[d]_{\Tmult_A} \ar@{}[drrr]|{m} &
T S A \ar[r]|{\bullet}_{\dl} & S T A \ar[r]|{\bullet}^{S M} & S S A \ar[d]^{\Smult_A}\\
T A \ar[rrr]|{\bullet}_M &&& S A}\]
and also the two following ways to compose the multiplication with itself are equal to each other:
\[ \xymatrix@C=1.7pc{ TTTA \ar[r]|{\bullet}^{TTM} \ar[d]_{\Tmult T} \ar@{}[dr]|{\Tmult_M} &
TTSA \ar[r]|{\bullet}^{T\dl} \ar[d]_{\Tmult S} \ar@{}[drr]|{\Tdlmult} &
TSTA \ar[r]|{\bullet}^{\dl T} &
STTA \ar[r]|{\bullet}^{STM} \ar@{}[drrr]|{S m} \ar[d]^{S\Tmult} &
STSA \ar[r]|{\bullet}^{S\dl} &
SSTA \ar[r]|{\bullet}^{SSM} &
SSSA \ar[d]^{S\Smult}\\
TTA \ar[d]^{\Tmult} \ar@{}[drrrrrr]|{m} \ar[r]|{\bullet}_{TM} &
TSA \ar[rr]|{\bullet}_{\dl} &&
STA \ar[rrr]|{\bullet}_{SM} &&& SSA \ar[d]^{\Smult} \\
TA \ar[rrrrrr]|{\bullet} &&&&&& SA}\]
\[ \xymatrix@C=1.7pc{
TTTA \ar[r]|{\bullet}^{TTM} \ar@{=}[d] &
TTSA \ar[r]|{\bullet}^{T\dl} \ar@{=}[d] &
TSTA \ar[r]|{\bullet}^{\dl T} \ar@{=}[d] \ar@{}[drr]|{\dlnat} &
STTA \ar[r]|{\bullet}^{STM} &
STSA \ar[r]|{\bullet}^{S\dl} \ar@{=}[d] &
SSTA \ar[r]|{\bullet}^{SSM} \ar@{=}[d] &
SSSA \ar@{=}[d]\\
TTTA \ar[d]_{T\Tmult} \ar[r]|{\bullet}^{TTM} \ar@{}[drrr]|{T m} &
TTSA \ar[r]|{\bullet}^{T\dl} &
TSTA \ar[r]|{\bullet}^{TSM} &
TSSA \ar[d]^{T\Smult} \ar[r]|{\bullet}^{\dl S} \ar@{}[drr]|{\Sdlmult} &
STSA \ar[r]|{\bullet}^{S\dl} &
SSTA \ar[d]_{\Smult T} \ar[r]|{\bullet}^{SSM} \ar@{}[dr]|{\Smult M} & SSSA \ar[d]^{\Smult S} \\
TTA' \ar[d]^{\Tmult} \ar@{}[drrrrrr]|{m} \ar[rrr]|{\bullet}_{TM} &&&
TSA \ar[rr]|{\bullet}_{\dl} &&
STA \ar[r]|{\bullet}_{SM} & SSA \ar[d]^{\Smult} \\
TA \ar[rrrrrr]|{\bullet} &&&&&& S A}\]
\end{defn}
(In the last axiom, note that we needed to use the loose pseudonaturality of $\dl$ to make the domains match up.)
\begin{defn}
If $(A,M,e_M,m_M)$ and $(B,N,e_N,m_N)$ are $\dl$-monoids, a \textbf{$\dl$-monoid morphism} consists of a tight arrow $f:A\to B$ and a cell
\[ \xymatrix{ T A \ar[r]|{\bullet}^M \ar[d]_{T f} \ar@{}[dr]|{\fbar\Downarrow} & S A \ar[d]^{S f} \\ T B \ar[r]|{\bullet}_{N} & S B } \]
such that $\fbar \tc e_M = e_N$ and $\fbar \tc m_M = m_N \tc (T\fbar \bc \dl_f \bc S\fbar)$.
\end{defn}
\begin{defn}
If $(f,\fbar)$ and $(g,\gbar)$ are $\dl$-monoid morphisms from $(A,M,e_M,m_M)$ to $(B,N,e_N,m_N)$, a \textbf{$\dl$-monoid transformation} $\al:f\Rightarrow g$ consists of a cell
\[ \xymatrix{ A \ar[r]|{\bullet}^{\hunit A} \ar[d]_{\Tunit_B \tc g %= T g \tc \Tunit_A
} \ar@{}[dr]|{\al\Downarrow} & A \ar[d]^{\Sunit_B \tc f %= S f \tc \Sunit_A
} \\ T B \ar[r]|{\bullet}_{N} & S B } \]
such that the following two composites are equal:
\[
\xymatrix@C=1.5pc{
T A \ar[rrr]|{\bullet}^M \ar@{=}[d] \ar@{}[drrr]|{\cong} &&& S A \ar@{=}[d]\\
T A \ar[r]|{\bullet}^{T\hunit A} \ar[d]_{Tg} \ar@{}[ddr]|{T\al} &
T A \ar[d]|{T f} \ar@{}[dr]|{\hunit{T f}} \ar[r]|{\bullet}^{\hunit{TA}} &
T A \ar[d]|{T f} \ar@{}[dr]|{\fbar} \ar[r]|{\bullet}^M &
S A \ar[d]^{S f}\\
T B \ar[d]_{T\Tunit_B } &
T B \ar[d]|{T\Sunit_B} \ar[r]|{\bullet}^{\hunit{T B}} \ar@{}[dr]|{\Sdlunit_B} &
T B \ar[d]|{\Sunit_{TB}} \ar[r]|{\bullet}^{N} \ar@{}[dr]|{\Sunit_N} & S B \ar[d]^{\Sunit_{S B}}\\
T T B \ar[r]|{\bullet}^{T M} \ar[d]_{\Tmult_B} \ar@{}[drrr]|{m_N\Downarrow} &
T S B \ar[r]|{\bullet}^{\dl_B} & S T B \ar[r]|{\bullet}^{S N} & S S B \ar[d]^{\Smult_B}\\
T B \ar[rrr]|{\bullet}_N &&& S B
}
\quad
\xymatrix@C=1.5pc{
T A \ar[rrr]|{\bullet}^M \ar@{=}[d] \ar@{}[drrr]|{\cong} &&& S A \ar@{=}[d]\\
T A \ar[r]|{\bullet}^{M} \ar[d]_{T g} \ar@{}[dr]|{\gbar} &
S A \ar[d]|{S g} \ar@{}[dr]|{\hunit{S g}} \ar[r]|{\bullet}^{\hunit{SA}} &
S A \ar[d]|{S g} \ar@{}[ddr]|{S\al} \ar[r]|{\bullet}^{S\hunit A} &
S A \ar[d]^{S f}\\
T B \ar[d]_{\Tunit_{TB}} \ar[r]|{\bullet}^{N} \ar@{}[dr]|{\Tunit_M} &
S B \ar[d]|{\Tunit_{SB}} \ar[r]|{\bullet}^{\hunit{S B}} \ar@{}[dr]|{\Tdlunit_B} &
S B \ar[d]|{S \Tunit_B} & S B \ar[d]^{S\Sunit_B}\\
T T B \ar[r]|{\bullet}^{T M} \ar[d]_{\Tmult_B} \ar@{}[drrr]|{m_N\Downarrow} &
T S B \ar[r]|{\bullet}^{\dl_B} & S T B \ar[r]|{\bullet}^{S N} & S S B \ar[d]^{\Smult_B}\\
T B \ar[rrr]|{\bullet}_N &&& S B
}
% \xymatrix@C=1.5pc{
% T A \ar[rrr]|{\bullet}^M \ar@{=}[d] \ar@{}[drrr]|{\cong} &&& S A \ar@{=}[d]\\
% T A \ar[r]|{\bullet}^{T\hunit A} \ar[d]_{Tg} \ar@{}[ddr]|{T\al} &
% T A \ar[d]|{T\Sunit_A} \ar@{}[dr]|{\Sdlunit_A} \ar[r]|{\bullet}^{\hunit{TA}} &
% T A \ar[d]|{\Sunit_{TA}} \ar@{}[dr]|{\Sunit_M} \ar[r]|{\bullet}^M &
% S A \ar[d]^{\Sunit_{SA} }\\
% T B \ar[d]_{T\Tunit_B } &
% T S A \ar[d]|{T S f} \ar[r]|{\bullet}^{\dl_A} \ar@{}[dr]|{\dl_f} &
% S T A \ar[d]|{S T f} \ar[r]|{\bullet}^{S M} \ar@{}[dr]|{S\fbar} & S S A \ar[d]^{S S f}\\
% TTB \ar[r]|{\bullet}^{T M} \ar[d]_{\Tmult_B} \ar@{}[drrr]|{m_N\Downarrow} &
% T S B \ar[r]|{\bullet}^{\dl_B} & S T B \ar[r]|{\bullet}^{S N} & S S B \ar[d]^{\Smult_B}\\
% T B \ar[rrr]|{\bullet}_N &&& S B
% }
% \quad
% \xymatrix@C=1.5pc{
% T A \ar[rrr]|{\bullet}^M \ar@{=}[d] \ar@{}[drrr]|{\cong} &&& S A \ar@{=}[d]\\
% T A \ar[r]|{\bullet}^{M} \ar[d]_{\Tunit_{TA}} \ar@{}[dr]|{\Tunit_M} &
% S A \ar[d]|{\Tunit_{SA}} \ar@{}[dr]|{\Tdlunit_A} \ar[r]|{\bullet}^{\hunit{SA}} &
% S A \ar[d]|{S\Tunit_A} \ar@{}[ddr]|{S\al} \ar[r]|{\bullet}^{S\hunit A} &
% S A \ar[d]^{S f}\\
% T T A \ar[d]_{T T g} \ar[r]|{\bullet}^{T M} \ar@{}[dr]|{T\gbar} &
% T S A \ar[d]|{T S g} \ar[r]|{\bullet}^{\dl_A} \ar@{}[dr]|{\dl_g} &
% S T A \ar[d]|{S T g} & S B \ar[d]^{S\Sunit_B}\\
% T T B \ar[r]|{\bullet}^{T M} \ar[d]_{\Tmult_B} \ar@{}[drrr]|{m_N\Downarrow} &
% T S B \ar[r]|{\bullet}^{\dl_B} & S T B \ar[r]|{\bullet}^{S N} & S S B \ar[d]^{\Smult_B}\\
% T B \ar[rrr]|{\bullet}_N &&& S B
% }
\]
%$m_B \tc (T\al \bc \dl_f \bc S\fbar)\tc(\Sdlunit \bc \Sunit_M) = m_B (\gbar \bc \al)$.
\end{defn}
\begin{thm}
$\dl$-monoids, $\dl$-monoid morphisms, and $\dl$-monoid transformations form a 2-category.
\end{thm}
\begin{proof}
Composition of morphisms is easy: simply compose both the tight arrow and cell components.
We define the postwhiskering of a transformation $\al:f\Rightarrow g$ by a morphism $h:N\to P$ to be $\hbar\tc \al$.
The transformation axiom follows by postcomposing that for $\al$ with $\hbar$ and using the morphism axiom $\hbar \tc m_N = m_P \tc (T\hbar \bc \dl_h \bc S\hbar)$, the naturality of $\Tunit,\Sunit$, and the modification/naturality of $\Tdlunit,\Sdlunit$.
For associativity of postwhiskering, we have $\kbar \tc (\hbar \tc \al) = (\kbar \tc \hbar)\tc \al = \overline{k\tc h} \tc\al$, and similarly for identities.
We define the prewhiskering of a transformation $\al:f\Rightarrow g$ by a morphism $h:P\to M$ to be $\al \tc \hunit{h}$.
The transformation axiom follows by precomposing that for \al with $\hbar$ and using the naturality of the constraints for loose composition and for the pseudofunctoriality of $T$ and $S$.
For associativity we have $(\al\tc\hunit{k})\tc\hunit{h} = \al\tc(\hunit{k}\tc\hunit{h}) = \al\tc\hunit{k\tc h}$, and similarly for identities.
The identity transformation on a morphism $f:M\to N$ is the cell $e_N \tc \hunit{f}$.
We define the composite of two transformations $\al:f\Rightarrow g$ and $\be:g\Rightarrow h$ to be the following composite (precomposed with a unit isomorphism):
\[
\xymatrix{
A \ar[d]_h \ar[r]|{\bullet}^{\hunit A} \ar@{}[ddr]|{\beta} &
A \ar[d]_g \ar[r]|{\bullet}^{\hunit A} \ar@{}[dr]|{\hunit g} &
A \ar[d]^g \ar[r]|{\bullet}^{\hunit A} \ar@{}[ddr]|{\alpha} &
A\ar[d]^f \\
B \ar[d]_{\Tunit_b} &
B \ar[d]|{\Sunit_B} \ar@{}[ddr]|{\Tdlunit \tc \hunit{\Sunit} =\atop \Sdlunit \tc \hunit{\Tunit}} \ar[r]|{\bullet}^{\hunit B} &
B \ar[d]|{\Tunit_B} &
B\ar[d]^{\Sunit_B}\\
T B \ar[d]_{\Tunit_{TB}} \ar[r]|{\bullet}^N \ar@{}[dr]|{\Tunit_N} &
S B \ar[d]|{\Tunit_{SB}} &
T B \ar[d]|{\Sunit_{TB}} \ar[r]|{\bullet}^N \ar@{}[dr]|{\Sunit_N} &