%TESTS OF MACROS FOR CATEGORY THEORY AND SEMANTICS
%J. C. Reynolds - March 1988

%This file (catmactest.tex) is an input file for LATEX that inputs the macros
%in catmac.tex and tests them.  These macros are described by comments in
%catmac.tex.

\documentstyle[12pt]{article}
\oddsidemargin=0in
\evensidemargin=0in
\textwidth=6.5in
\begin{document}

\thispagestyle{empty}

\input catmac

\newcount\xxcna\newcount\xxcnb
\newcount\xxcnc\newcount\xxcnd\newcount\xxcne
\newbox\xxbxA

\def\xxprintargs#1{\xxcna=1\relax\xxcnb=#1\relax\xxprintargsa}

\def\xxprintargsa{\ifnum\xxcnb=0\relax
\else \{p_{\the\xxcna}\}
\advance\xxcna by 1\relax\advance\xxcnb by -1\relax
\xxprintargsa\fi}

\def\xxcall#1#2{\def\xxcallc{#2}
\xxcna=1\relax\xxcnb=#1\relax\xxcalla
\expandafter\xxcallc\xxcallb}

\def\xxcalla{\ifnum\xxcnb=0\relax
\edef\xxcallb{}
\else\advance\xxcnb by -1\relax
\xxcalla
\edef\xxcallb{\xxcallb{p_{\the\xxcna}}}
\advance\xxcna by 1\relax
\fi}

\def\try#1#2{%
% #1 = number of parameters
% #2 = macro to be tried
$${\rm\string #2} \xxprintargs{#1}\; : \; {\trystyle \xxcall{#1}{#2}}$$}

\def\fulltry#1#2{%
% #1 = number of parameters
% #2 = macro to be tried
$${\rm\string #2} \xxprintargs{#1}\; : \; 
{\displaystyle \xxcall{#1}{#2}}\quad
{\textstyle \xxcall{#1}{#2}}\quad
{\scriptstyle \xxcall{#1}{#2}}\quad
{\scriptscriptstyle \xxcall{#1}{#2}}$$}

\def\delimitertry#1#2{%
% #1 = name to be printed
% #2 = expression to be tried
$$#1
{\textstyle #2}\quad
{\textstyle\bigsize{#2}}\quad
{\textstyle\Bigsize{#2}}\quad
{\textstyle\biggsize{#2}}\quad
{\textstyle\Biggsize{#2}}\quad
{\scriptstyle #2}\quad
{\scriptstyle\scriptbigsize{#2}}\quad
{\scriptscriptstyle #2}\quad
{\scriptscriptstyle\scriptscriptbigsize{#2}}$$}

\def\splitdelimitertry#1#2{%
% #1 = name to be printed
% #2 = expression to be tried
$$#1
{\textstyle #2}\quad
{\textstyle\bigsize{#2}}\quad
{\textstyle\Bigsize{#2}}\quad
{\textstyle\biggsize{#2}}\quad
{\textstyle\Biggsize{#2}}\quad$$ $$
{\scriptstyle #2}\quad
{\scriptstyle\scriptbigsize{#2}}\quad
{\scriptscriptstyle #2}\quad
{\scriptscriptstyle\scriptscriptbigsize{#2}}$$}

\def\itertry#1#2#3#4#5{%
% #1 = minimum numeric parameter to macro
% #2 = number of cases
% #3 = minimum number of arguments
% #4 = step in number of arguments
% #5 = macro to be tried
\xxcnd=#1\relax\xxcnc=#2\relax\xxcne=#3\relax
\xxitertrya{#4}{#5}}

\def\xxitertrya#1#2{%
\ifnum\xxcnc=0\relax%
$$\ldots \hbox{etc.}$$%
\else\try{\the\xxcne}{#2{\the\xxcnd}}%
\advance\xxcnd by 1\relax\advance\xxcnc by -1\relax\advance\xxcne by #1\relax%
\xxitertrya{#1}{#2}\fi}

\def\iterfulltry#1#2#3#4#5{%
% #1 = minimum numeric parameter to macro
% #2 = number of cases
% #3 = minimum number of arguments
% #4 = step in number of arguments
% #5 = macro to be tried
\xxcnd=#1\relax\xxcnc=#2\relax\xxcne=#3\relax
\xxiterfulltrya{#4}{#5}}

\def\xxiterfulltrya#1#2{%
\ifnum\xxcnc=0\relax%
$$\ldots \hbox{etc.}$$%
\else\fulltry{\the\xxcne}{#2{\the\xxcnd}}%
\advance\xxcnd by 1\relax\advance\xxcnc by -1\relax\advance\xxcne by #1\relax%
\xxiterfulltrya{#1}{#2}\fi}

%\measure prints its argument in mathmode and trystyle,
%along with rules showing its width, height, and depth,
%plus a listing of these dimensions to the left of the argument.

\def\measure#1{{\setbox\xxbxA=\hbox{{$\trystyle #1$}}
${\scriptstyle\the\wd\xxbxA \atop
{\scriptstyle\the\ht\xxbxA \atop \scriptstyle\the\dp\xxbxA}}
\;
\vbox{\hrule width10pt
\kern-0.4pt\kern\ht\xxbxA
\hrule width10pt
\kern-0.4pt\kern\dp\xxbxA
\hrule width10pt
\kern-0.2pt\kern-\dp\xxbxA}
\vbox{
\hbox{\vrule height10pt
\kern-0.4pt\kern\wd\xxbxA
\vrule height10pt}\nointerlineskip
\hbox{\kern0.2pt
\copy\xxbxA}}
$}}

%\measureall prints its argument four times in a line,
%by applying \measure in displaystyle, textstyle, scriptstyle, and
%scriptscriptstyle.
%USES \measure

\def\measureall#1{\measure{\displaystyle #1}
\measure{\textstyle #1}
\measure{\scriptstyle #1}
\measure{\scriptscriptstyle #1}}

\def\trystyle{\displaystyle}

\begin{centering}
{\large\bf TESTS OF MACROS FOR CATEGORY THEORY} \\[14 pt]
\today \\[21 pt]
\end{centering}

Each case shows a call of a macro (or occasionally a combination of macros)
followed by one or more displays of the result.
When four displays are given, they are for display style, text style,
script style, and scriptscript style, respectively.


\section{Miscellaneous Special Symbols and Other Macros}

\try0\displayaxis
\try0\textaxis
\try0\scriptaxis
\try0\scriptscriptaxis
\try0\eqper
\try0\eqcom
\fulltry1\reflect
\fulltry1\inverse
\fulltry1\dual
\fulltry2\identgen
\fulltry1\ident

$\backslash$startproof This is an example \ldots{} $\backslash$endproof
$\; :$

\startproof This is an example of a short proof. \endproof
\startproof This is a longer proof that forces
``End of Proof'' to the next line. \endproof

\section{Unary Operators}

\fulltry0\domainop
\fulltry0\rangeop
\fulltry0\sizeop
\fulltry0\objectsop
\fulltry0\morphsop
\fulltry0\apop
\fulltry0\abop

\section{Binary Operators}

\fulltry0\restrictop
\fulltry0\corestrictop
\fulltry0\sccompop
\fulltry0\godmult

\section{Relations}

\fulltry0\eqdef
\fulltry0\noteq
\fulltry0\finsubset
\fulltry0\oldin
\fulltry0\oldnotin
\fulltry0\in
\fulltry0\notin
\fulltry0\uniquein
\fulltry0\arrow
\fulltry1\arrowsub
$$\backslash{\rm arrowsub}\{long_1\}\; : \;
\displaystyle\arrowsub{long_1}\quad
\textstyle\arrowsub{long_1}\quad
\scriptstyle\arrowsub{long_1}\quad
\scriptscriptstyle\arrowsub{long_1}$$
\fulltry1\arrowsuper
$$\backslash{\rm arrowsuper}\{long_1\}\; : \;
\displaystyle\arrowsuper{long_1}\quad
\textstyle\arrowsuper{long_1}\quad
\scriptstyle\arrowsuper{long_1}\quad
\scriptscriptstyle\arrowsuper{long_1}$$
\fulltry2\arrowsubsuper
$$\backslash{\rm arrowsubsuper}\{long_1\}\{long_2\}\; : \;
\displaystyle\arrowsubsuper{long_1}{long_2}\quad
\textstyle\arrowsubsuper{long_1}{long_2}\quad
\scriptstyle\arrowsubsuper{long_1}{long_2}\quad
\scriptscriptstyle\arrowsubsuper{long_1}{long_2}$$
\fulltry0\Arrow
\fulltry1\Arrowsub
$$\backslash{\rm Arrowsub}\{long_1\}\; : \;
\displaystyle\Arrowsub{long_1}\quad
\textstyle\Arrowsub{long_1}\quad
\scriptstyle\Arrowsub{long_1}\quad
\scriptscriptstyle\Arrowsub{long_1}$$
\fulltry1\Arrowsuper
$$\backslash{\rm Arrowsuper}\{long_1\}\; : \;
\displaystyle\Arrowsuper{long_1}\quad
\textstyle\Arrowsuper{long_1}\quad
\scriptstyle\Arrowsuper{long_1}\quad
\scriptscriptstyle\Arrowsuper{long_1}$$
\fulltry2\Arrowsubsuper
$$\backslash{\rm Arrowsubsuper}\{long_1\}\{long_2\}\; : \;
\displaystyle\Arrowsubsuper{long_1}{long_2}\quad
\textstyle\Arrowsubsuper{long_1}{long_2}\quad
\scriptstyle\Arrowsubsuper{long_1}{long_2}\quad
\scriptscriptstyle\Arrowsubsuper{long_1}{long_2}$$

\section{Delimiters}

In each of the following examples, the indicated expression is printed in:
\begin{enumerate}
\item textstyle, without enlargement
(e.g. as a parameter to $\backslash$normsize)
\item textstyle, big size (e.g. as a parameter to $\backslash$bigsize)
\item textstyle, Big size (e.g. as a parameter to $\backslash$Bigsize)
\item textstyle, bigg size (e.g. as a parameter to $\backslash$biggsize)
\item textstyle, Bigg size (e.g. as a parameter to $\backslash$Biggsize)
\item scriptstyle, without enlargement
(e.g. as a parameter to $\backslash$normsize)
\item scriptstyle, scriptbig size
(e.g. as a parameter to $\backslash$scriptbigsize)
\item scriptscriptstyle, without enlargement
(e.g. as a parameter to $\backslash$normsize)
\item scriptscriptstyle, scriptscriptbig size
(e.g. as a parameter to $\backslash$scriptscriptbigsize)
\end{enumerate}

\delimitertry{\backslash{\rm varlpar}\; : \;}{\varlpar}
\delimitertry{\backslash{\rm varrpar}\; : \;}{\varrpar}
\delimitertry{\backslash{\rm varlbrack}\; : \;}{\varlbrack}
\delimitertry{\backslash{\rm varrbrack}\; : \;}{\varrbrack}
\delimitertry{\backslash{\rm varlbrace}\; : \;}{\varlbrace}
\delimitertry{\backslash{\rm varrbrace}\; : \;}{\varrbrace}
\delimitertry{\backslash{\rm varlangle}\; : \;}{\varlangle}
\delimitertry{\backslash{\rm varrangle}\; : \;}{\varrangle}
\delimitertry{\backslash{\rm varlvert}\; : \;}{\varlvert}
\delimitertry{\backslash{\rm varrvert}\; : \;}{\varrvert}
\delimitertry{\backslash{\rm varmid}\; : \;}{\varmid}
\delimitertry{\backslash{\rm varlsembr}\; : \;}{\varlsembr}
\delimitertry{\backslash{\rm varrsembr}\; : \;}{\varrsembr}
\delimitertry{\backslash{\rm varbdlangle}\; : \;}{\varbdlangle}
\delimitertry{\backslash{\rm varbdrangle}\; : \;}{\varbdrangle}

\delimitertry{\backslash{\rm paren}\{p_1\}\; : \;}{\paren{p_1}}
$$\backslash{\rm paren}\{\backslash{\rm paren}\{p_1\}\}\; : \;$$
\delimitertry{}{\paren{\paren{p_1}}}
\delimitertry{\backslash{\rm carrier}\{p_1\}\; : \;}{\carrier{p_1}}
\delimitertry{\backslash{\rm carrier}\{\backslash{\rm carrier}\{p_1\}\}\; : \;}
{\carrier{\carrier{p_1}}}
\delimitertry{\backslash{\rm sembr}\{p_1\}\; : \;}{\sembr{p_1}}
$$\backslash{\rm sembr}\{\backslash{\rm sembr}\{p_1\}\}\; : \;$$
\delimitertry{}{\sembr{\sembr{p_1}}}
$$\backslash{\rm setdef}\{p_1\}\{p_2\}\; : \;$$
\splitdelimitertry{}{\setdef{p_1}{p_2}}
$$\backslash{\rm setdef}
\{\backslash{\rm paren}\{p_1\}\}\{\backslash{\rm paren}\{p_1\}\}\; : \;$$
\splitdelimitertry{}{\setdef{\paren{p_1}}{\paren{p_2}}}

\section{Macros with a Variable Number of Parameters}

\itertry{0}{4}{4}{1}\simplist
\fulltry0\emptyset
\itertry{0}{4}{0}{1}\setlist
\fulltry0\emptysqlist
\itertry{0}{4}{0}{1}\sqlist
\fulltry0\emptyanglelist
\itertry{0}{4}{0}{1}\anglelist
\fulltry0\emptybdanglelist
\itertry{0}{4}{0}{1}\bdanglelist

\itertry{0}{3}{5}{2}\pairlist
\try8\pairlistdots
\itertry{0}{4}{0}{2}\sqpairlist
\try4\sqpairlistdots
\itertry{0}{4}{0}{2}\anglepairlist
\try4\anglepairlistdots
\itertry{0}{4}{0}{2}\bdanglepairlist
\try4\bdanglepairlistdots

\itertry{0}{3}{5}{2}\pairext
\try9\pairextdots
\itertry{0}{4}{1}{2}\sqpairext
\try5\sqpairextdots
\itertry{0}{4}{1}{2}\anglepairext
\try5\anglepairextdots
\itertry{0}{4}{1}{2}\bdanglepairext
\try5\bdanglepairextdots

\itertry{1}{3}{2}{1}\infix
\itertry{1}{3}{1}{1}\compo
\itertry{1}{3}{2}{1}\compogen
\itertry{1}{3}{1}{1}\fcompo
\itertry{1}{3}{2}{1}\fcompogen
\itertry{1}{3}{1}{1}\godcompo

\section{Lambda Notation}

\fulltry2\lambin
\fulltry0\emptylambin
\itertry{0}{4}{0}{2}\multlambin
\try4\multlambindots
\fulltry2\lambsub
\fulltry1\Lambop
\fulltry1\Deltop

\section{Large Operators}

Under the influence of $\backslash$expandlargeops (the default):
\fulltry0\Union
\fulltry0\Intersect
\fulltry0\prod
\fulltry0\sum
\fulltry0\Lm
\fulltry0\Col
\fulltry0\Lub
\fulltry0\Glb

\compresslargeops
Under the influence of $\backslash$compresslargeops:
\fulltry0\Union
\fulltry0\Intersect
\fulltry0\prod
\fulltry0\sum
\fulltry0\Lm
\fulltry0\Col
\fulltry0\Lub
\fulltry0\Glb

$$\backslash{\rm multscript}\{\backslash{\rm displaystyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm displaystyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\multscript{\displaystyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\displaystyle\scriptstyle$$
$$\backslash{\rm multscript}\{\backslash{\rm textstyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm textstyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\multscript{\textstyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\textstyle\scriptstyle$$
$$\backslash{\rm multscript}\{\backslash{\rm scriptstyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptstyle}\}\{\backslash{\rm scriptscriptstyle}\}\; : \;
\multscript{\scriptstyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\scriptstyle\scriptscriptstyle$$
$$\backslash{\rm multscript}\{\backslash{\rm scriptscriptstyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptscriptstyle}\}\{\backslash
{\rm scriptscriptstyle}\}\; : \;
\multscript{\scriptscriptstyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\scriptscriptstyle\scriptscriptstyle$$

$$\backslash{\rm multscript}\{\backslash{\rm displaystyle}\;O\}
\{long_1\}\{long_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm displaystyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\multscript{\displaystyle O}{long_1}{long_2}{S_1}{S_2}{0pt}{0pt}
\displaystyle\scriptstyle$$
$$\backslash{\rm multscript}\{\backslash{\rm textstyle}\;O\}
\{long_1\}\{long_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm textstyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\multscript{\textstyle O}{long_1}{long_2}{S_1}{S_2}{0pt}{0pt}
\textstyle\scriptstyle$$
$$\backslash{\rm multscript}\{\backslash{\rm scriptstyle}\;O\}
\{long_1\}\{long_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptstyle}\}\{\backslash{\rm scriptscriptstyle}\}\; : \;
\multscript{\scriptstyle O}{long_1}{long_2}{S_1}{S_2}{0pt}{0pt}
\scriptstyle\scriptscriptstyle$$
$$\backslash{\rm multscript}\{\backslash{\rm scriptscriptstyle}\;O\}
\{long_1\}\{long_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptscriptstyle}\}\{\backslash
{\rm scriptscriptstyle}\}\; : \;
\multscript{\scriptscriptstyle O}{long_1}{long_2}{S_1}{S_2}{0pt}{0pt}
\scriptscriptstyle\scriptscriptstyle$$

$$\backslash{\rm compscript}\{\backslash{\rm displaystyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm displaystyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\compscript{\displaystyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\displaystyle\scriptstyle$$
$$\backslash{\rm compscript}\{\backslash{\rm textstyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm textstyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\compscript{\textstyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\textstyle\scriptstyle$$
$$\backslash{\rm compscript}\{\backslash{\rm scriptstyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptstyle}\}\{\backslash{\rm scriptscriptstyle}\}\; : \;
\compscript{\scriptstyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\scriptstyle\scriptscriptstyle$$
$$\backslash{\rm compscript}\{\backslash{\rm scriptscriptstyle}\;O\}
\{l_1\}\{l_2\}\{S_1\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptscriptstyle}\}\{\backslash
{\rm scriptscriptstyle}\}\; : \;
\compscript{\scriptscriptstyle O}{l_1}{l_2}{S_1}{S_2}{0pt}{0pt}
\scriptscriptstyle\scriptscriptstyle$$

$$\backslash{\rm compscript}\{\backslash{\rm displaystyle}\;O\}
\{l_1\}\{\}\{\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm displaystyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\compscript{\displaystyle O}{l_1}{}{}{S_2}{0pt}{0pt}
\displaystyle\scriptstyle$$
$$\backslash{\rm compscript}\{\backslash{\rm textstyle}\;O\}
\{l_1\}\{\}\{\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm textstyle}\}\{\backslash{\rm scriptstyle}\}\; : \;
\compscript{\textstyle O}{l_1}{}{}{S_2}{0pt}{0pt}
\textstyle\scriptstyle$$
$$\backslash{\rm compscript}\{\backslash{\rm scriptstyle}\;O\}
\{l_1\}\{\}\{\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptstyle}\}\{\backslash{\rm scriptscriptstyle}\}\; : \;
\compscript{\scriptstyle O}{l_1}{}{}{S_2}{0pt}{0pt}
\scriptstyle\scriptscriptstyle$$
$$\backslash{\rm compscript}\{\backslash{\rm scriptscriptstyle}\;O\}
\{l_1\}\{\}\{\}\{S_2\}$$ $$\{{\rm 0pt}\}\{{\rm 0pt}\}
\{\backslash{\rm scriptscriptstyle}\}\{\backslash
{\rm scriptscriptstyle}\}\; : \;
\compscript{\scriptscriptstyle O}{l_1}{}{}{S_2}{0pt}{0pt}
\scriptscriptstyle\scriptscriptstyle$$

\expandlargeops
Under the influence of $\backslash$expandlargeops:
\fulltry4\prodms
\fulltry4\summs
\fulltry4\Lmms
\fulltry4\Colms
\fulltry4\Lubms
\fulltry4\Glbms

\compresslargeops
Under the influence of $\backslash$compresslargeops:
\fulltry4\prodms
\fulltry4\summs
\fulltry4\Lmms
\fulltry4\Colms
\fulltry4\Lubms
\fulltry4\Glbms

\section{Circled Operators}

\expandlargeops
Under the influence of $\backslash$expandlargeops
and$\backslash$largecircleops (the defaults):
\fulltry4\cirprodms
\fulltry4\cirsumms
\fulltry4\cirLmms
\fulltry4\cirColms

\compresslargeops
Under the influence of $\backslash$compresslargeops
and$\backslash$largecircleops:
\fulltry4\cirprodms
\fulltry4\cirsumms
\fulltry4\cirLmms
\fulltry4\cirColms

\smallcircleops
\expandlargeops
Under the influence of $\backslash$expandlargeops
and$\backslash$smallcircleops:
\fulltry4\cirprodms
\fulltry4\cirsumms
\fulltry4\cirLmms
\fulltry4\cirColms

\compresslargeops
Under the influence of $\backslash$compresslargeops
and$\backslash$smallcircleops:
\fulltry4\cirprodms
\fulltry4\cirsumms
\fulltry4\cirLmms
\fulltry4\cirColms

\end{document}




