\documentclass{article}

\input{preamble-articles}

\title{Notes on the smash product}
\author{Floris van Doorn \and Stefano Piceghello}
\date{\today}
\usepackage{fullpage}
\newcommand{\pmap}{\to}
\newcommand{\lpmap}{\xrightarrow}
\newcommand{\smsh}{\wedge}
\renewcommand{\phi}{\varphi}
\renewcommand{\epsilon}{\varepsilon}
\newcommand{\tr}{\cdot}
\renewcommand{\o}{\ensuremath{\circ}}
\newcommand{\auxl}{\mathsf{auxl}}
\newcommand{\auxr}{\mathsf{auxr}}
\newcommand{\gluel}{\mathsf{gluel}}
\newcommand{\gluer}{\mathsf{gluer}}
\newcommand{\sy}{^{-1}}
\newcommand{\const}{\ensuremath{\mathbf{0}}\xspace}
\newcommand{\alphabar}{\overline{\alpha}}
\newcommand{\rhobar}{\overline{\rho}}
\newcommand{\lambdabar}{\overline{\lambda}}
\newcommand{\gammabar}{\overline{\gamma}}
\newcommand{\zeroh}{\mathsf{z}}
\newcommand{\oneh}{\mathsf{u}}
\newcommand{\two}{\mathsf{b}}
\newcommand{\twist}{\mathsf{tw}}
\newcommand{\mc}{\mathcal}

\begin{document}

\maketitle

\section{Pointed Types}

\begin{defn}
  We work in the $(\infty,1)$-category of pointed types.
  \begin{itemize}
  \item The objects are pointed types $A$, types together with a basepoint $a_0:A$.
\item 1-cells are pointed maps $f:A\to B$ which are maps with a chosen path $f_0:f(a_0)=b_0$. We
  write $A\pmap B$ for pointed maps and $A\pmap B\pmap C$ means $A\pmap (B\pmap C)$.
\item 2-cells are pointed homotopies. A pointed homotopy $h:f\sim g$ is a homotopy with a chosen 2-path
  $h(a_0) \tr g_0 = f_0$.
\item As 3-cells (or higher cells) we take equalities between 2-cells (or higher cells).
\end{itemize}
\end{defn}

\begin{rmk}\label{rmk:pointed-types}
  All types, maps and homotopies in these notes are pointed, unless explicitly mentioned
  otherwise. Whenever we say that a diagram of $n$-cells commutes we mean it in the sense that there
  is an $(n+1)$-cell witnessing it.
\item Pointed homotopies are equivalent to equalities of pointed types: $(f\sim g)\equiv (f=g)$. So
  we could have chosen to define our 2-cells as equalities between 1-cells. We choose not to, since
  the aforementioned equivalence requires function extensionality. In a type theory where function
  extensionality does not compute (like Lean) it is better to define the type of pointed homotopies
  manually so that the underlying homotopy of a 2-cell is definitionally equal to the homotopy we
  started with. In diagrams, we will denote pointed homotopies by equalities, but we always mean
  pointed homotopies.
\item The type $A\to B$ of pointed maps from $A$ to $B$ is itself pointed, with as basepoint the
  constant map $0\equiv0_{A,B}:A\to B$ which has as underlying function $\lam{a:A}b_0$. We have the homotopies:
  \begin{align*}
  \zeroh_g &: 0 \o g \sim 0 & \zeroh'_f &: f \o 0 \sim 0\\
  \oneh_f &: f \o \idfunc \sim f & \oneh'_g &: \idfunc \o g \sim g
  \end{align*}
  satisfying
  \begin{align*}
  \zeroh_{\idfunc} &= \oneh_0 & \zeroh'_{\idfunc} &= \oneh'_0 \\
  \zeroh_0 &= \zeroh'_0 & \oneh_{\idfunc} &= \oneh'_{\idfunc}
  \end{align*}
\item A pointed equivalence is a pointed map $f : A \to B$ whose underlying map is an
  equivalence. In this case, we can find a pointed map $f\sy:B\to A$ with pointed homotopies
  $f\o f\sy\sim0$ and $f\sy\o f\sim0$.
\end{rmk}

\begin{defn}\label{def:b-and-tw}
We define the pointed equivalences:
  \[\two : (\bool \to X) \simeq X\] where $\bool$ is the type of booleans (pointed in $0_\bool$) with underlying map defined with $\two(f) \defeq f(1_\bool)$, and
  \[\twist : (A \to B \to X) \simeq (B \to A \to X)\]
  with underlying map defined with $\twist(f) \defeq \lam{b}\lam{a}f(a)(b)$.
\end{defn}

\begin{lem}\label{lem:composition-pointed}
  Given maps $f:A'\pmap A$ and $g:B\pmap B'$. Then there are maps
  $(f\pmap C):(A\pmap C)\pmap(A'\pmap C)$ and $(C\pmap g):(C\pmap B)\pmap(C\pmap B')$ given by
  precomposition with $f$, resp. postcomposition with $g$. The map $\lam{g}C\pmap g$ preserves the basepoint, giving rise to a map $$(C\pmap ({-})):(B\pmap B')\pmap(C\pmap B)\pmap(C\pmap B').$$
  Also, the following square commutes:
\begin{center}
\begin{tikzcd}
(A\pmap B) \arrow[r,"A\pmap g"]\arrow[d,"f\pmap B"] & (A\pmap B')\arrow[d,"f\pmap B'"] \\
(A'\pmap B) \arrow[r,"A'\pmap g"] & (A'\pmap B')
\end{tikzcd}
\end{center}

\end{lem}

\section{Naturality and a version of the Yoneda lemma}

\begin{defn}\label{def:naturality}
	A (1-coherent) \emph{functor} $F$ between pointed types is a function $F_0:\type^*\to\type^*$ with an action of morphisms $F_1 : (A \to^* B) \to (FA \to^* FB)$ such that $F_1(g \o f)\sim F_1g \o F_1 f$ and $F_1\idfunc[A]\sim\idfunc[F_0A]$. We will write both $F_0$ and $F_1$ as $F$. A functor $F$ is \emph{pointed} if $F\unit$ is contractible. In this case $F0_{A,B}\sim 0_{FA,FB}$.
	Let $F$, $G$ be functors of pointed types. Suppose that we have a transformation $\theta_X : F(X) \to G(X)$ for all pointed types $X$.
	% \begin{center}
	% \begin{tikzcd}
	% 	F(A)
	% 		\arrow[r, "F(f)"]
	% 		\arrow[d, swap, "\theta_A"]
	% 	& F(B)
	% 		\arrow[d, "\theta_B"]
	% 	\\
	% 	G(A)
	% 		\arrow[r, swap, "G(f)"]
	% 	& G(B)
	% \end{tikzcd}
	% \end{center}
	We define the following notions of naturality for $\theta$:
	\begin{itemize}
		\item \textbf{naturality} will refer to a pointed homotopy
		\[p_\theta(f) : G(f) \o \theta_A \sim \theta_B \o F(f)\]
		for every $f : A \to B$ and \textbf{weak naturality} to the underlying (non-pointed) homotopy;
		\item \textbf{pointed naturality} will refer to the same pointed homotopy, with the additional condition that $p_\theta(0) = (p_\theta)_0$, where
		\[(p_\theta)_0 : G(0) \o \theta_A \sim 0 \o \theta_A \sim 0 \sim \theta_B \o 0 \sim \theta_B \o F(0)\]
		is the canonical proof of the pointed homotopy $G(0) \o \theta_A \sim \theta_B \o F(0)$, whereas \textbf{pointed weak naturality} will refer to the corresponding non-pointed condition.
	\end{itemize}
\end{defn}

\begin{rmk}
	The relation between the four notions of naturality is as expected: naturality implies weak naturality, and pointed implies simple. Weak naturality is generally ill-behaved: for example, weak naturality of $\theta$ does not imply weak naturality of $\theta \to X$ or $X \to \theta$, whereas the implication holds for naturality.
\end{rmk}

\begin{rmk}
	The equivalences $\two$ and $\twist$ as defined in \autoref{def:b-and-tw} are natural in all their arguments and pointed natural in the last argument.
\end{rmk}

\begin{lem}[Yoneda]\label{lem:yoneda}
	Let $A$, $B$ be pointed types, and assume, for all pointed types $X$, a pointed equivalence $\phi_X : (B \to X) \simeq (A \to X)$, natural in $X$, i.e. for all $f : X \to X'$ there is a pointed homotopy \[ p_\phi(f) : (A \to f) \o \phi_X \sim \phi_{X'} \o (B \to f) \]
%	 making the following diagram commute for all $f : X \to X'$:
%	\begin{center}
%	\begin{tikzcd}
%		(B \to X)
%			\arrow[r, "\phi_X"]
%			\arrow[d, swap, "f \o -"]
%		& (A \to X)
%			\arrow[d, "f \o -"]
%		\\
%		(B \to X')
%			\arrow[r, swap,"\phi_{X'}"]
%		& (A \to X')
%	\end{tikzcd}
%	\end{center}
	Then there exists a pointed equivalence $\psi_\phi : A \simeq B$.
\end{lem}
\begin{proof}
	We define $\psi_\phi \defeq \phi_B(\idfunc[B]) : A \to B$ and $\psi_\phi\sy \defeq \phi_A\sy(\idfunc[A]):B\to A$. The given naturality square for $f \defeq \psi_\phi\sy$ yields $\psi_\phi\sy \o \phi_B (\idfunc[B]) \judgeq \psi_\phi\sy \o \psi_\phi \sim \phi_A (\psi_\phi\sy \o \idfunc[B]) \judgeq \phi_A (\phi_A\sy (\idfunc[A])) \sim \idfunc[A]$, and similarly for the inverse composition.
\end{proof}

\begin{lem}\label{lem:yoneda-pointed}
	Assume $A$, $B$, $\phi_X$ and $p$ as in \autoref{lem:yoneda}, and assume moreover that $\phi$ is pointed natural. Then there is a pointed homotopy $(\psi_\phi \to X) \sim \phi_X$.
\end{lem}

\begin{proof}
	Let $f : B \to X$. The underlying homotopy is obtained by:
	\begin{align*}
		(\psi_\phi \to X)(f) &\judgeq f \o \psi_\phi\\
		&\sim \phi_X (f \o \idfunc) &&\text{(by $p_\phi(f)(\idfunc)$)}\\
		&\sim \phi_X (f) &&\text{(by $\mapfunc{\phi_X}(\oneh_f)$)}
	\end{align*}
	To show that this is a pointed homotopy, we need to prove that the following diagram commutes:
	\begin{center}
	\begin{tikzcd}[column sep=4em]
		(\psi_\phi \to X)(0)
			\arrow[rr, equals, "p_\phi(0)(\idfunc)\tr\mapfunc{\phi_X}(\oneh_0)"]
			\arrow[dr, equals, swap, "\zeroh_{\psi_\phi}"]
		&&\phi_X(0)
			\arrow[dl, equals, "(\phi_X)_0"]
		\\
		&0
	\end{tikzcd}
	\end{center}
	where the top-left expression is definitionally equal to $0 \o \phi_X(\idfunc)$, the horizontal path comes from the underlying homotopy and $(\phi_X)_0$ is the canonical path from $\phi_X(0)$ to $0$. Since $\phi_X$ is pointed natural, we have that
	$p_{\phi_X}(0)(\idfunc) = (p_{\phi_X})_0(\idfunc)$, which, in this case, is the concatenation:
	\begin{align*}
	0\o \phi_X(\idfunc)
	&= 0 &&\text{(by $\zeroh_{q_X(\idfunc)}$)}\\
	&= \phi_X(0) &&\text{(by $(\phi_X)_0\sy$)}\\
	&= \phi_X(0\o 1) &&\text{(by $(\mapfunc{\phi_X}(\zeroh_{\idfunc}))\sy$)}
	\end{align*}
	The diagram then commutes by cancellation of inverses and using that $\zeroh_{\idfunc} = \oneh_0$.
\end{proof}

\section{Smash Product}\label{sec:smash}

\begin{defn}
  The smash of $A$ and $B$ is the HIT generated by the point constructor $(a,b)$ for $a:A$ and $b:B$
  and two auxilliary points $\auxl,\auxr:A\smsh B$ and path constructors $\gluel_a:(a,b_0)=\auxl$
  and $\gluer_b:(a_0,b)=\auxr$ (for $a:A$ and $b:B$). $A\smsh B$ is pointed with point $(a_0,b_0)$.
\end{defn}
\begin{rmk}
  This definition of $A\smsh B$ is basically the pushout of
  $\bool\leftarrow A+B\to A \times B$.  A more traditional definition of $A\smsh B$ is the pushout
  $\unit\leftarrow A\vee B\to A \times B$; here $\vee$ denotes the wedge product, which can be
  equivalently described as either the pushout $A\leftarrow \unit\to B$ or
  $\unit\leftarrow \bool\to A + B$. These two definitions of $A\smsh B$ are equivalent, because in
  the following diagram the top-left square and the top rectangle are pushout squares, hence the
  top-right square is a pushout square by applying the pushout lemma. Another application of the
  pushout lemma then states that the two definitions of $A\smsh B$ are equivalent.
\begin{center}
\begin{tikzcd}
\bool \arrow[r]\arrow[d] & A+B     \arrow[r]\arrow[d] & \bool \arrow[d] \\
\unit \arrow[r]          & A\vee B \arrow[r]\arrow[d] & \unit \arrow[d] \\
                     & A\times B        \arrow[r] & A\smsh B
\end{tikzcd}
\end{center}

\end{rmk}
\begin{lem}\label{lem:smash-general}
	The smash product is functorial: if $f:A\pmap A'$ and $g:B\pmap B'$ then
    $f\smsh g:A\smsh B\pmap A'\smsh B'$. We write $A\smsh g$ or $f\smsh B$ if one of the
    functions is the identity function. Moreover, if $p:f\sim f'$ and $q:g\sim g'$ then $p\smsh q:f\smsh g\sim f'\smsh g'$; this operation preserves reflexivities, symmetries and transitivies. We will write $p \smsh g$ or $f \smsh q$ if one of the homotopies is reflexivity.
%	The smash product satisfies the following properties.
%  \begin{itemize}
%  \item The smash product is functorial: if $f:A\pmap A'$ and $g:B\pmap B'$ then
%    $f\smsh g:A\smsh B\pmap A'\smsh B'$. We write $A\smsh g$ or $f\smsh B$ if one of the
%    functions is the identity function.
%  \item The smash product preserves composition, which gives rise to the interchange law:
%    \[i:(f' \o f)\smsh (g' \o g) \sim f' \smsh g' \o f \smsh g\]
%  \item If $p:f\sim f'$ and $q:g\sim g'$ then $p\smsh q:f\smsh g\sim f'\smsh g'$. This operation
%    preserves reflexivities, symmetries and transitivies.
%  \item There are homotopies $f\smsh0\sim0$ and $0\smsh g\sim 0$ such that the following diagrams
%    commute for given homotopies $p : f\sim f'$ and $q : g\sim g'$.
%    \begin{center}
%\begin{tikzcd}
%f\smsh 0 \arrow[rr, equals,"p\smsh1"]\arrow[dr,equals] & &
%f'\smsh 0\arrow[dl,equals] \\
%& 0 &
%\end{tikzcd}
%\qquad
%\begin{tikzcd}
%0\smsh g\arrow[rr, equals,"1\smsh q"]\arrow[dr,equals] & &
%0\smsh g'\arrow[dl,equals] \\
%& 0 &
%\end{tikzcd}
%\end{center}
%\end{itemize}
\end{lem}

\begin{lem}\label{lem:interchange}
	The smash product preserves composition, which gives rise to the interchange law:
    \[i:(f_2 \o f_1)\smsh (g_2 \o g_1) \sim f_2 \smsh g_2 \o f_1 \smsh g_1\]
    for maps $A_1\lpmap{f_1}A_2\lpmap{f_2}A_3$ and $B_1\lpmap{g_1}B_2\lpmap{g_2}B_3$.
\end{lem}
\begin{proof}
	Let us denote the basepoints of $A_i$ and $B_i$ with $a_i$ and $b_i$ respectively. We first apply induction on the paths that all the maps in the statement respect the basepoint. We verify the underlying homotopy of $i$ by induction on terms $x$ of the domain $A_1 \smsh B_1$ of the two maps; this can be defined on point constructors $(a,b)$, $\auxl$ and $\auxr$ to be the identity path. If $x$ varies over $\gluel_a$, we need to fill the following square:
	\begin{equation}\label{eq:i-gluel}
	\begin{tikzcd}
		(f_2(f_1(a)), b_3)
			\arrow[r,equals,"1"]
			\arrow[d,swap,equals,"\mapfunc{(f_2 \o f_1)\smsh (g_2 \o g_1)}(\gluel_a)"]
		& (f_2(f_1(a)), b_3)
			\arrow[d,equals,"\mapfunc{f_2 \smsh g_2 \o f_1 \smsh g_1}(\gluel_a)"]
		\\
		\auxl
			\arrow[r,swap,equals,"1"]
		&\auxl
	\end{tikzcd}
	\end{equation}
	This reduces to proving that
	\[\mapfunc{(f_2(f_1(a)),-)}(g_2\o g_1)_0 \tr \gluel_{f_2(f_1(a))} = \mapfunc{(f_2(f_1(a)),-)}(\mapfunc{g_2}{(g_1)}_0 \tr {(g_2)}_0) \tr \gluel_{f_2(f_1(a))}\]
	Since we assumed that ${(g_1)}_0$ and ${(g_2)}_0$ are the identity path, the claim is easily verified. The case for $x$ varying over $\gluer_b$ is entirely analogous, giving the square:
	\begin{equation}\label{eq:i-gluer}
	\begin{tikzcd}
		(a_3, g_2(g_1(b))
			\arrow[r,equals,"1"]
			\arrow[d,swap,equals,"\mapfunc{(f_2 \o f_1)\smsh (g_2 \o g_1)}(\gluer_b)"]
		& (a_3, g_2(g_1(b))
			\arrow[d,equals,"\mapfunc{f_2 \smsh g_2 \o f_1 \smsh g_1}(\gluer_b)"]
		\\
		\auxr
			\arrow[r,swap,equals,"1"]
		&\auxr
	\end{tikzcd}
	\end{equation}
	The resulting homotopy is pointed, as $i(a_1,b_1) \judgeq 1$ and the proofs that the two maps respect the basepoint are assumed to be the identity path.
\end{proof}

\begin{lem}\label{lem:smash-zero}
	There are homotopies
	\begin{align*}
	t_g : 0\smsh g\sim 0 && t'_f : f\smsh0\sim0
	\end{align*}
	such that the following diagrams
    commute for given homotopies $p : g\sim g'$ and $q : f\sim f'$.
    \begin{equation}\label{eq:t-triangles}
	\begin{tikzcd}
	0\smsh g
		\arrow[rr, equals,"1\smsh p"]
		\arrow[dr,equals,swap,"t_g"]
	&& 0\smsh g'\arrow[dl,equals,"t_{g'}"]
	&f\smsh 0
		\arrow[rr, equals,"q\smsh 1"]
		\arrow[dr,equals,swap, "t'_f"]
	&& f'\smsh 0\arrow[dl,equals,"t'_{f'}"]
	\\
	& 0
	&&& 0
	\end{tikzcd}
%	\qquad\qquad
%	\begin{tikzcd}
%	f\smsh 0
%		\arrow[rr, equals,"q\smsh 1"]
%		\arrow[dr,equals,swap, "t'_f"]
%	&& f'\smsh 0\arrow[dl,equals,"t'_{f'}"]
%	\\
%	& 0
%	\end{tikzcd}
	\end{equation}
\end{lem}
\begin{proof}
	We will define the homotopy $t_g : 0 \smsh g$, with $0 : A_1 \to A_2$ and $g : B_1 \to B_2$ (with the notational convention for the basepoints as in \autoref{lem:interchange}); the definition for $t'_f$ is analogous. First, we apply induction on the path that $g$ respects the basepoint. The underlying homotopy of $t_g$ is given by induction on terms $x : A_1 \smsh B_1$. On point constructors, we define:
	\begin{align*}
	t_g (a,b) &\defeq \gluer_{g(b)} \tr \gluer_{b_2}\sy && : (a_2, g(b)) = (a_2, b_2)\\
	t_g (\auxl) &\defeq \gluel_{a_2}\sy && : \auxl = (a_2, b_2)\\
	t_g (\auxr) &\defeq \gluer_{b_2}\sy && : \auxr = (a_2, b_2)
	\end{align*}
	If $x$ varies over $\gluel_a$, after some reductions, we need to fill the following square:
	\begin{equation}\label{eq:t-gluel}
	\begin{tikzcd}[column sep=7em]
		(a_2, g(b_1))
			\arrow[r,equals,"\gluer_{b_2} \tr \gluer_{b_2}\sy"]
			\arrow[d,swap,equals, "\gluel_{a_2}"]
		& (a_2, b_2)
			\arrow[d,equals,"1"]
		\\
		\auxl
			\arrow[r,swap,equals, "\gluel_{a_2}\sy"]
		& (a_2, b_2)
	\end{tikzcd}
	\end{equation}
	Similarly, if $x$ varies over $\gluer_b$, we need to fill the following square:
	\begin{equation}\label{eq:t-gluer}
	\begin{tikzcd}[column sep=7em]
		(a_2, g(b))
			\arrow[r,equals,"\gluer_{g(b)} \tr \gluer_{b_2}\sy"]
			\arrow[d,swap,equals, "\gluer_{g(b)}"]
		& (a_2, b_2)
			\arrow[d,equals,"1"]
		\\
		\auxr
			\arrow[r,swap,equals, "\gluer_{b_2}\sy"]
		& (a_2, b_2)
	\end{tikzcd}
	\end{equation}
	The squares in (\ref{eq:t-gluel}) and (\ref{eq:t-gluer}) can both be filled by simple path algebra. The resulting homotopy is pointed, as $t_g(a_1,b_1)$ is equal to the identity path and the proof that $g$ respects the basepoint is also assumed to be the identity path. Finally, for $p : g \sim g'$, the diagram on the left in (\ref{eq:t-triangles}) commutes by induction on $p$.
\end{proof}

\begin{lem}\label{lem:smash-coh}
 	Suppose that we have maps $A_1\lpmap{f_1}A_2\lpmap{f_2}A_3$ and $B_1\lpmap{g_1}B_2\lpmap{g_2}B_3$
 	and suppose that either $f_1$ or $f_2$ is constant. Then there are two homotopies
  $(f_2 \o f_1)\smsh (g_2 \o g_1)\sim 0$, one which uses the interchange law and one which does not. These two homotopies are equal. Specifically, the following two diagrams commute:
	\begin{center}
	\begin{tikzcd}
		(f_2 \o 0)\smsh (g_2 \o g_1)
			\arrow[r, equals, "i"]
			\arrow[dd, swap, equals, "\zeroh' \smsh (g_2 \o g_1)"]
		&(f_2 \smsh g_2)\o (0 \smsh g_1)
			\arrow[d, equals, "(f_2 \smsh g_2) \o t_{g_1}"]
		\\
		& (f_2 \smsh g_2)\o 0
			\arrow[d,equals, "\zeroh'"]
		\\
		0\smsh (g_2 \o g_1)
			\arrow[r,equals, swap, "t_{g_2 \o g_1}"]
		& 0
	\end{tikzcd}
	\qquad
	\begin{tikzcd}
		(0 \o f_1)\smsh (g_2 \o g_1)
			\arrow[r, equals, "i"]
			\arrow[dd, swap, equals, "\zeroh \smsh (g_2 \o g_1)"]
		& (0 \smsh g_2)\o (f_1 \smsh g_1)
			\arrow[d,equals, "t_{g_2} \o (f_1 \smsh g_1)"]
		\\
		& 0\o (f_1 \smsh g_1)
			\arrow[d,equals, "\zeroh"]
		\\
		0\smsh (g_2 \o g_1)
			\arrow[r,swap, equals, "t_{g_2 \o g_1}"]
		& 0
	\end{tikzcd}
	\end{center}

\end{lem}
\begin{proof}
%  We will only do the case where $f_1\jdeq 0$, i.e. fill the diagram on the left. The other case is similar (and slightly easier).

	\textbf{Case $f_1\judgeq 0$ (diagram on the left)}. First apply induction on the paths that $f_2$, $g_1$ and $g_2$
  respect the basepoint. In this case $f_2\o0$ is definitionally equal to $0$, and the canonical
  proof that $f_2\o 0\sim0$ is (definitionally) equal to reflexivity. This means that the homotopy
  $(f_2 \o 0)\smsh (g_2 \o g_1)\sim0\smsh (g_2 \o g_1)$ is also equal to reflexivity, and also the
  path that $f_2 \smsh g_2$ respects the basepoint is reflexivity, hence the homotopy
  $(f_2 \smsh g_2)\o 0\sim0$ is also reflexivity. This means we need to fill the following square:
	\begin{center}
	\begin{tikzcd}
		(f_2 \o 0)\smsh (g_2 \o g_1)
			\arrow[r, equals,"i"]
			\arrow[d, swap, equals,"1"]
		& (f_2 \smsh g_2)\o (0 \smsh g_1)
			\arrow[d,equals,"(f_2\smsh g_2)\o t_{g_1}"]
		\\
		0 \smsh (g_2 \o g_1)
			\arrow[r, swap, equals,"t_{g_1 \o g_2}"]
		& 0
	\end{tikzcd}
	\end{center}
  For the underlying homotopy, take $x : A_1\smsh B_1$ and apply induction on $x$. Suppose
  $x\equiv(a,b)$ for $a:A_1$ and $b:B_1$. With the notational convention for basepoints as in \autoref{lem:interchange}, we have to fill the square (we use that the paths that the maps respect the basepoints are reflexivity):
  \begin{equation}\label{eq:pent-left-ab}
    \begin{tikzcd}[column sep=5em]
	(a_3,g_2(g_1(b)))
      	\arrow[r, equals,"1"]
      	\arrow[d,swap,equals,"1"]
		%\arrow[d,equals,"\gluer_{g_2(g_1(b))}\tr\gluer_{g_2(g_1(b_1))}\sy"]
	& (a_3,g_2(g_1(b)))
		\arrow[d,equals,"\mapfunc{f_2\smsh g_2}(\gluer_{g_1(b)}\tr\gluer_{b_2}\sy)"]
	\\
	(a_3,g_2(g_1(b)))
		\arrow[r,swap,equals,"\gluer_{g_2(g_1(b))}\tr\gluer_{b_3}\sy"]
	& (a_3,b_3)
    \end{tikzcd}
    \end{equation}
   Now $\mapfunc{h\smsh k}(\gluer_z)=\gluer_{k(z)}$, so by general groupoid laws we see that the path on the bottom is equal to the path on the right, which means we can fill the square. For the other point constructors, the squares to fill are similar: if $x \judgeq \auxl$, we have:
      \begin{equation}\label{eq:pent-left-auxl}
    \begin{tikzcd}[column sep=5em]
      \auxl \arrow[r, equals,"1"]
      \arrow[d,swap,equals,"1"] &
      \auxl \arrow[d,equals,"\mapfunc{f_2\smsh g_2}(\gluel_{a_2}\sy)"] \\
      \auxl \arrow[r,swap, equals,"\gluel_{a_3}\sy"] &
      (a_3,b_3)
    \end{tikzcd}
 \end{equation}
	which we can fill, as the path on the bottom is definitionally equal to $\gluel_{a_3}\sy$ (as we applied path induction on the path that $f_2$ respects the basepoint) and the path on the right  also reduces to $\gluel_{a_3}\sy$ using that $\mapfunc{h\smsh k}(\gluel_z)=\gluel_{h(z)}$. Similarly, we can fill the square for $x \judgeq \auxr$, which is:
  \begin{equation}\label{eq:pent-left-auxr}
    \begin{tikzcd}[column sep=5em]
      \auxr \arrow[r, equals,"1"]
      \arrow[d,swap,equals,"1"] &
      \auxr \arrow[d,equals,"\mapfunc{f_2\smsh g_2}(\gluer_{b_2}\sy)"] \\
      \auxr \arrow[r,swap, equals,"\gluer_{b_3}\sy"] &
      (a_3,b_3)
    \end{tikzcd}
  \end{equation}
	If $x$ varies over $\gluel_a$, after some reductions, we need to fill the following cube, where the front and the back are the squares in (\ref{eq:pent-left-ab}) for $(a,b_1)$ and (\ref{eq:pent-left-auxl}) respectively; the left square is degenerate; the other three sides are the squares in the definition of $i$ and $t$ to show that they respect $\gluel_a$ (given in (\ref{eq:i-gluel}) and (\ref{eq:t-gluel}) respectively), where we also apply $f_2 \smsh g_2$ to the square on the right. We suppress in the diagram the arguments of $\gluer$ in $\gluer\tr\gluer\sy$ (which match, so the concatenation results equal to the identity path).
	\begin{equation}\label{eq:pent-left-gluel}
	\begin{tikzcd}[column sep=5em]
	& \auxl
		\arrow[rr, equals, "1"]
		\arrow[dd, swap, equals, near end, "1"]
	&& \auxl
		\arrow[dd, equals, "\mapfunc{f_2\smsh g_2} (\gluel_{a_2}\sy)"]
	\\
	(a_3,b_3)
		\arrow[ur, equals, "\gluel_{a_3}"]
		\arrow[dd, swap, equals, "1"]
		\arrow[rr, equals, crossing over, near end, "1"]
	&& (a_3,b_3)
		\arrow[ur, equals, near start, "\mapfunc{f_2\smsh g_2}(\gluel_{a_2})"]
		%\arrow[dd, equals, near start, "\mapfunc{f_2\smsh g_2}(\gluer\tr\gluer\sy)"]
	\\
	& \auxl
		\arrow[rr, swap, equals, near start, "\gluel_{a_3}\sy"]
	&& (a_3,b_3)
	\\
	(a_3,b_3)
		\arrow[ur, equals, "\gluel_{a_3}"]
		\arrow[rr, swap, equals, "\gluer\tr\gluer\sy"]
	&& (a_3,b_3)
		\arrow[ur, swap, equals, "1"] %1
		\arrow[from=uu, equals, crossing over, very near start, "\mapfunc{f_2 \smsh g_2}(\gluer\tr\gluer\sy)"]
	\end{tikzcd}
	\end{equation}
	Similarly, if $x$ varies over $\gluer_b$, we need to fill the cube below: the front and the back are the squares in (\ref{eq:pent-left-ab}) for $(a_1,b)$ and (\ref{eq:pent-left-auxr}) respectively; the left square is again degenerate; the other three sides come from the fact that $i$ and $t$ respect $\gluer_b$ (given in (\ref{eq:i-gluer}) and (\ref{eq:t-gluer}) respectively). Again, we omit the arguments of $\gluer$ in $\gluer\tr\gluer\sy$ (in this case, not a priori judgementally equal).
	\begin{equation}\label{eq:pent-left-gluer}
	\begin{tikzcd}[column sep=4em]
	& \auxr
		\arrow[rr, equals,"1"]
		\arrow[dd, swap, equals, near end,"1"]
	&& \auxr
		\arrow[dd,equals,"\mapfunc{f_2\smsh g_2}(\gluer_{b_2}\sy)"]
	\\
	(a_3,g_2(g_1(b)))
		\arrow[rr, equals, near end, crossing over, "1"]
		\arrow[dd, swap, equals, "1"]
		\arrow[ur, equals, "\gluer_{g_2(g_1(b))}"]
	&& (a_3,g_2(g_1(b)))
		\arrow[ur, equals, near start, "\mapfunc{f_2\smsh g_2}(\gluer_{g_1(b)})"]
	\\
	& \auxr
		\arrow[rr, swap, equals, near start, "\gluer_{b_3}\sy"]
	&& (a_3,b_3)
	\\
	(a_3,g_2(g_1(b)))
		\arrow[rr, swap, equals,"\gluer\tr\gluer\sy"]
		\arrow[ur, equals, near end, "\gluer_{g_2(g_1(b))}"]
	&& (a_3,b_3)
		\arrow[from=uu, equals, crossing over, very near start, "\mapfunc{f_2\smsh g_2}(\gluer\tr\gluer\sy)"]
		\arrow[ur, swap, equals, "1"]
	\end{tikzcd}
	\end{equation}
  %After canceling applications of  $\mapfunc{h\smsh k}(\gluer_z)=\gluer_{k(z)}$ on various sides of the squares (TODO).
  In order to fill the cubes in (\ref{eq:pent-left-gluel}) and (\ref{eq:pent-left-gluer}), we generalize the paths and fill the cubes by path induction. The cube in (\ref{eq:pent-left-gluel}) can be generalized to a cube:
  \begin{center}
  	\begin{tikzcd}[column sep=3em]
	& h(y)
		\arrow[rr, equals,"1"]
		\arrow[dd, swap, equals, near end,"1"]
	&& h(y)
		\arrow[dd,equals,"\mapfunc{h}(p_l\sy)"]
	\\
	h(x)
		\arrow[rr, equals, near end, crossing over, "1"]
		\arrow[dd, swap, equals, "1"]
		\arrow[ur, equals, "q_l"]
	&& h(x)
		\arrow[ur, equals, near start, "\mapfunc{h}(p_l)"]
	\\
	& h(y)
		\arrow[rr, swap, equals, near start, "q_l\sy"]
	&& h(x)
	\\
	h(x)
		\arrow[rr, swap, equals,"q_r\tr q_r\sy"]
		\arrow[ur, equals, "q_l"]
	&& h(x)
		\arrow[from=uu, equals, crossing over, near start, "\mapfunc{h}(p_r\tr p_r\sy)"]
		\arrow[ur, swap, equals, "1"]
	\end{tikzcd}
	\end{center}
	for $X$ and $X'$ pointed types; a map $h : X \to X'$; terms $x$, $y$ $z : X$; paths $p_l : x = y$, $p_r : x = z$, $q_l : h(x) = h(y)$, $q_r : h(x) = h(z)$; and 2-paths $s_l : \mapfunc{h}(p_l) = q_l$ (for the back and the top) and $s_r : \mapfunc{h}(p_r) = q_r$ (for the right side). This cube is filled by path induction on $s_l$, $s_r$, $p_l$ and $p_r$. The cube in (\ref{eq:pent-left-gluer}) can be generalized to a similar cube:
	 \begin{center}
  	\begin{tikzcd}[column sep=3em]
	& h(y)
		\arrow[rr, equals,"1"]
		\arrow[dd, swap, equals, near end,"1"]
	&& h(y)
		\arrow[dd,equals,"\mapfunc{h}(p_b)"]
	\\
	h(x)
		\arrow[rr, equals, near end, crossing over, "1"]
		\arrow[dd, swap, equals, "1"]
		\arrow[ur, equals, "q_l"]
	&& h(x)
		\arrow[ur, equals, near start, "\mapfunc{h}(p_l)"]
	\\
	& h(y)
		\arrow[rr, swap, equals, near start, "q_b"]
	&& h(z)
	\\
	h(x)
		\arrow[rr, swap, equals,"q_l\tr q_b"]
		\arrow[ur, equals, "q_l"]
	&& h(z)
		\arrow[from=uu, equals, crossing over, near start, "\mapfunc{h}(p_l\tr p_b)"]
		\arrow[ur, swap, equals, "1"]
	\end{tikzcd}
	\end{center}
	for paths $p_l : x = y$, $p_b : y = z$, $q_l : h(x) = h(y)$, $q_b : h(y) = h(z)$ and for 2-paths $s_l : \mapfunc{h}(p_l) = q_l$ (for the top) and $s_b : \mapfunc{h}(p_b) = q_b$ (for the back).

	\textbf{Case $f_2\judgeq 0$ (diagram on the right)}.	(TODO)

  To show that this homotopy is pointed, (TODO)

\end{proof}

\begin{thm}\label{thm:smash-functor-right}
Given pointed types $A$, $B$ and $C$, the functorial action of the smash product induces a map
$$({-})\smsh C:(A\pmap B)\pmap(A\smsh C\pmap B\smsh C)$$
which is natural in $A$, pointed natural in $B$ and dinatural in $C$.
\end{thm}
The naturality and dinaturality means that the following squares commute for $f : A' \to A$ $g:B\to B'$ and $h:C\to C'$.
\begin{center}
\begin{tikzcd}[column sep=5em]
(A\pmap B) \arrow[r,"({-})\smsh C"]\arrow[d,"f\pmap B"] &
(A\smsh C\pmap B\smsh C)\arrow[d,"f\smsh C\pmap B\smsh C"] \\
(A'\pmap B) \arrow[r,"({-})\smsh C"] &
(A'\smsh C\pmap B\smsh C)
\end{tikzcd}
\qquad
\begin{tikzcd}[column sep=5em]
(A\pmap B) \arrow[r,"({-})\smsh C"]\arrow[d,"A\pmap g"] &
(A\smsh C\pmap B\smsh C)\arrow[d,"A\smsh C\pmap g\smsh C"] \\
(A\pmap B') \arrow[r,"({-})\smsh C"] &
(A\smsh C\pmap B'\smsh C)
\end{tikzcd}
\begin{tikzcd}[column sep=5em]
(A\pmap B) \arrow[r,"({-})\smsh C"]\arrow[d,"({-})\smsh C'"] &
(A\smsh C\pmap B\smsh C)\arrow[d,"A\smsh C\pmap B\smsh h"] \\
(A\smsh C'\pmap B\smsh C') \arrow[r,"A\smsh h\pmap B\smsh C'"] &
(A\smsh C\pmap B\smsh C')
\end{tikzcd}
\end{center}
\begin{proof}
First note that $\lam{f}f\smsh C$ preserves the basepoint so that the map is indeed pointed.

Let $k:A\pmap B$. Then as homotopy the naturality in $A$ becomes
$(k\o f)\smsh C=k\smsh C\o f\smsh C$. To prove an equality between pointed maps, we need to give
a pointed homotopy, which is given by interchange. To show that this homotopy is pointed, we need to
fill the following square (after reducing out the applications of function extensinality), which follows from \autoref{lem:smash-coh}.
\begin{center}
\begin{tikzcd}
(0 \o f)\smsh C \arrow[r, equals]\arrow[dd,equals] &
(0 \smsh C)\o (f \smsh C)\arrow[d,equals] \\
& 0 \o (f \smsh C)\arrow[d,equals] \\
0\smsh C \arrow[r,equals] &
0
\end{tikzcd}
\end{center}
The naturality in $B$ is almost the same: for the underlying homotopy we need to show
$i:(g \o k)\smsh C = g\smsh C \o k\smsh C$. For the pointedness we need to fill the following
square, which follows from the left pentagon in \autoref{lem:smash-coh}.
\begin{center}
\begin{tikzcd}
(g \o 0)\smsh C \arrow[r, equals]\arrow[dd,equals] &
(g \smsh C)\o (0 \smsh C)\arrow[d,equals] \\
& (g\smsh C) \o 0\arrow[d,equals] \\
0\smsh C \arrow[r,equals] &
0
\end{tikzcd}
\end{center}
To show that this naturality is pointed, we need to show that if $g=0$ then this homotopy is the same as the concatenation $q_0$ of the following pointed homotopies:
$$({-})\smsh C \circ (A \to 0)\sim ({-})\smsh C \circ 0 \sim 0 \sim 0 \circ ({-})\smsh C\sim 0\smsh B \circ ({-})\smsh C.$$
To show that the underlying homotopies are the same, we need to show that $i(0,f,\idfunc[C],\idfunc[C])$ is equal to the following concatenation of pointed homotopies
$$q_0(f):(0\circ f)\smsh C\sim 0\smsh C \sim 0 \sim 0 \circ f\smsh C\sim 0\smsh B \circ f\smsh C,$$
which is the right pentagon in \autoref{lem:smash-coh}.
To show that these pointed homotopies respect the basepoint in the same way, we need to show that (TODO)
``$R\mathrel\square(0\smsh C \circ t)\cdot q_0=L$ where $L$ and $R$ are the left and right pentagons applied to $0$ and $\square$ is whiskering.''

The dinaturality in $C$ is a bit harder. For the underlying homotopy we need to show
$B\smsh h\o k\smsh C=k\smsh C'\o A\smsh h$. This follows by applying interchange twice:
$$B\smsh h\o k\smsh C\sim(\idfunc[B]\o k)\smsh(h\o\idfunc[C])\sim(k\o\idfunc[A])\smsh(\idfunc[C']\o h)\sim k\smsh C'\o A\smsh h.$$
To show that this homotopy is pointed, we need to fill the following square:
\begin{center}
  \begin{tikzcd}
    B\smsh h\o 0\smsh C \arrow[r, equals]\arrow[d,equals] &
    (\idfunc[B]\o 0)\smsh(h\o\idfunc[C]) \arrow[r, equals]\arrow[d,equals] &
    (0\o\idfunc[A])\smsh(\idfunc[C']\o h)\arrow[r, equals]\arrow[d,equals] &
    0\smsh C'\o A\smsh h\arrow[d,equals] \\
    B\smsh h\o 0 \arrow[d,equals] &
    0\smsh(h\o\idfunc[C]) \arrow[r, equals]\arrow[d,equals] &
    0\smsh(\idfunc[C']\o h) \arrow[d,equals] &
    0\o A\smsh h\arrow[d,equals] \\
    B\smsh h\o 0 \arrow[r, equals] &
    0 \arrow[r, equals] &
    0 \arrow[r, equals] &
    0
  \end{tikzcd}
\end{center}
The left and the right squares are filled by \autoref{lem:smash-coh}. The squares in the middle
are filled by (corollaries of) \autoref{lem:smash-general}.
\end{proof}

\section{Adjunction}

\begin{lem}\label{lem:unit-counit}
  There is a unit $\eta_{A,B}\equiv\eta:A\pmap B\pmap A\smsh B$ natural in $A$ and counit
  $\epsilon_{B,C}\equiv\epsilon : (B\pmap C)\smsh B \pmap C$ dinatural in $B$ and pointed natural in $C$.
  These maps satisfy the unit-counit laws:
  $$(A\to\epsilon_{A,B})\o \eta_{A\to B,A}\sim \idfunc[A\to B]\qquad
  \epsilon_{B,A\smsh B}\o \eta_{A,B}\smsh B\sim\idfunc[A\smsh B].$$
\end{lem}
Note: $\eta$ is also dinatural in $B$, but we don't need this.
\begin{proof}
  We define $\eta ab=(a,b)$. We define the path that $\eta a$ respects the basepoint as
  $$(\eta a)_0\defeq\gluel_a\tr\gluel_{a_0}\sy:(a,b_0)=(a_0,b_0).$$ Also, $\eta$ itself respects the basepoint. To show this, we need to give $\eta_0:\eta (a_0)\sim 0$. The underlying maps are homotopic, by $$\eta_0b\defeq\gluer_b\cdot\gluer_{b_0}\sy:(a_0,b)=(a_0,b_0).$$ To show that
  this homotopy is pointed, we need to show that the two given proofs of $(a_0,b_0)=(a_0,b_0)$ are
  equal, but they are both equal to reflexivity:
  $$\eta_{00}:\gluel_{a_0}\tr\gluel_{a_0}\sy=1=\gluer_{b_0}\tr\gluer_{b_0}\sy.$$
  This defines the unit. To show that it is natural in $A$, we need to give the following pointed homotopy $p_\eta(f)$ for $f:A\to A'$.
  \begin{center}
	\begin{tikzcd}
	A \arrow[r,"\eta"]\arrow[d,"f"] &
	(B\pmap A \smsh B)\arrow[d,"B\to f\smsh B"] \\
	A' \arrow[r,"\eta"] &
	(B\pmap A'\smsh B)
	\end{tikzcd}
  \end{center}
  We may assume that $f_0$ is reflexivity. For the underlying homotopy we need to define for $a:A$ that $p_\eta(f,a):\eta(fa)\sim f\smsh B \circ \eta a$, which is another pointed homotopy. For $b:B$ we have $\eta(fa,b)\equiv(fa,b)\equiv(f\smsh B)(\eta ab).$
  The homotopy $p_\eta(f,a)$ is pointed, since $$(f\smsh B \circ \eta a)_0=\apfunc{f\smsh B}(\gluel_a\cdot\gluel_{a_0}\sy)=\gluel_{fa}\cdot\gluel_{a_0'}\sy=(\eta(fa))_0.$$
  Now we need to show that $p_\eta(f)$ is pointed, for which we need to fill the following diagram.
  \begin{center}
	\begin{tikzcd}
	\eta(fa_0) \arrow[equals,rr,"{p_\eta(f,a_0)}"]\arrow[dr,equals,"{\eta_0}"] & &
	f\smsh B \circ \eta a_0\arrow[dl,equals,"{f\smsh B\circ\eta_0}"] \\
	& 0_{B,A'\smsh B} &
	\end{tikzcd}
  \end{center}
  These pointed homotopies have equal underlying homotopies, since for $b:B$ we have
  $$p_\eta(f,a_0,b)\cdot\apfunc{f\smsh B}(\eta_0 b)=1\cdot\apfunc{f\smsh B}(\gluer_b\cdot\gluer_{b_0}\sy)=\gluer_{b}\cdot\gluer_{b_0}\sy=\eta_0b.$$
  The homotopies are pointed in the same way (TODO).

  To define the counit, given $x:(B\pmap C)\smsh B$, we construct
  $\epsilon (x):C$ by induction on $x$. If $x\jdeq(f,b)$ we set $\epsilon(f,b)\defeq f(b)$. If $x$
  is either $\auxl$ or $\auxr$ then we set $\epsilon (x)\defeq c_0:C$. If $x$ varies over $\gluel_f$
  then we need to show that $f(b_0)=c_0$, which is true by $f_0$. If $x$ varies over $\gluer_b$ we
  need to show that $0(b)=c_0$ which is true by reflexivity. Now $\epsilon_0\defeq 1:\epsilon(0_{B,C},b_0)=c_0$ shows that $\epsilon$ is pointed.

  Now we need to show that the counit is dinatural in $B$ and pointed natural in $C$. (TODO)

  Finally, we need to show the unit-counit laws. For the underlying homotopy of the first one, let
  $f:A\to B$. We need to show that $p_f:\epsilon\o\eta f\sim f$. We define $p_f(a)=1:\epsilon(f,a)=f(a)$. To show that $p_f$ is a pointed homotopy, we need to show that
  $p_f(a_0)\tr f_0=\mapfunc{\epsilon}(\eta f)_0\tr \epsilon_0$, which reduces to
  $f_0=\mapfunc{\epsilon}(\gluel_f\tr\gluel_0\sy)$, but we can reduce the right hand side: (note:
  $0_0$ denotes the proof that $0(a_0)=b_0$, which is reflexivity)
  $$\mapfunc{\epsilon}(\gluel_f\tr\gluel_0\sy)=\mapfunc{\epsilon}(\gluel_f)\tr(\mapfunc{\epsilon}(\gluel_0))\sy=f_0\tr 0_0\sy=f_0.$$
  Now we need to show that $p$ itself respects the basepoint of $A\to B$, i.e. that the composite
  $\epsilon\o\eta(0)\sim\epsilon\o0\sim0$ is equal to $p_{0_{A,B}}$. The underlying
  homotopies are the same for $a : A$; on the one side we have
  $\mapfunc{\epsilon}(\gluer_{a}\tr\gluer_{a_0}\sy)$ and on the other side we have reflexivity
  (note: this typechecks since $0_{A,B}a\equiv0_{A,B}a_0$). These paths are equal, since
  $$\mapfunc{\epsilon}(\gluer_{a}\tr\gluer_{a_0}\sy)=\mapfunc{\epsilon}(\gluer_{a})\tr(\mapfunc\epsilon(\gluer_{a_0}))\sy=1\cdot1\sy\equiv1.$$
  Both pointed homotopies are pointed in the same way, which requires some path-algebra, and we skip the proof here.

  For the underlying homotopy of the second unit-counit law, we need to show for $x:A\smsh B$ that
  $q(x):\epsilon((\eta\smsh B)x)=x$, which we prove by induction to $x$. If $x\equiv(a,b)$ then we can define $q(a,b)\defeq1_{(a,b)}$. If $x$ is $\auxl$ or $\auxr$ then the left-hand side reduces to $(a_0,b_0)$, so we can define $q(\auxl)\defeq\gluel_{a_0}$ and $q(\auxr)\defeq\gluer_{b_0}$. The following computation shows that $q$ respects $\gluel_a$:
  $$\apfunc{\epsilon\circ\eta\smsh B}(\gluel_a)\cdot\gluel_{a_0}= \apfunc{\epsilon}(\gluel_{\eta a})\cdot\gluel_{a_0}=(\eta a)_0\cdot\gluel_{a_0}=\gluel_a\cdot\gluel_{a_0}\sy\cdot\gluel_{a_0}=\gluel_a.$$
  To show that it respects $\gluer_b$ we compute
  $$\apfunc{\epsilon\circ\eta\smsh B}(\gluer_b)\cdot\gluer_{b_0}=
  \apfunc{\epsilon({-},b)}(\eta_0)\cdot\apfunc{\epsilon}(\gluer_b)\cdot\gluer_{b_0}=
  \apfunc{\lam{f}fb}(\eta_0)\cdot\gluer_{b_0}=
  \eta_0b\cdot\gluer_{b_0}=
  %\gluer_b\cdot\gluer_{b_0}\sy\cdot\gluer_{b_0}=
  \gluer_b.$$
  To show that $q$ is a pointed homotopy, we need to show that $(\epsilon\circ\eta\smsh B)_0=1$, For this we compute $$(\epsilon\circ\eta\smsh B)_0=\apfunc{\epsilon({-},b_0)}(\eta_0)=\eta_0b_0=\gluer_{b_0}\cdot\gluer_{b_0}\sy=1.$$
\end{proof}

\begin{defn}
The function $e\jdeq e_{A,B,C}:(A\pmap B\pmap C)\pmap(A\smsh B\pmap C)$ is defined as the composite
$$(A\pmap B\pmap C)\lpmap{({-})\smsh B}(A\smsh B\pmap (B\pmap C)\smsh B)\lpmap{A\smsh B \pmap\epsilon}(A\smsh B\pmap C).$$
\end{defn}

\begin{lem}
  The function $e$ is invertible, hence gives a pointed equivalence $$(A\pmap B\pmap C)\simeq(A\smsh B\pmap C).$$
\end{lem}
\begin{proof}
  Define
  $$\inv{e}_{A,B,C}:(A\smsh B\pmap C)\lpmap{B\pmap({-})}((B\pmap A\smsh B)\pmap (B\pmap
  C))\lpmap{\eta\pmap(B\pmap C)}(A\pmap B\pmap C).$$ It is easy to show that $e$ and $\inv{e}$ are
  inverses as unpointed maps from the unit-counit laws (\autoref{lem:unit-counit}) and naturality of $\eta$ and $\epsilon$.
%   For $f : A\pmap B\pmap C$ we have
%   \begin{align*}
%     \inv{e}(e(f))&\equiv(\eta\pmap(B\pmap C))\o (B\pmap((A\smsh B\pmap\epsilon)\of\smsh B))\\
%                  &= (\eta\pmap(B\pmap C))\o (B\pmap(A\smsh B\pmap\epsilon))\o(B\pmapf\smsh B)\\
% %                 &= (\eta\pmap(B\pmap C))\o (B\pmap(A\smsh B\pmap\epsilon))\o(B\pmapf\smsh B)\\
%   \end{align*}
\end{proof}
\begin{lem}\label{lem:e-natural}
	The function $e$ is natural in $A$, $B$ and pointed natural in $C$.
\end{lem}
\begin{proof}
	\textbf{Naturality of $e$ in $A$}. Suppose that $f:A'\pmap A$. Then the following diagram commutes. The left square commutes by naturality of $({-})\smsh B$ in the first argument and the right square commutes because composition on the left commutes with composition on the right.
	\begin{center}
	\begin{tikzcd}
		(A\pmap B\pmap C) \arrow[r,"({-})\smsh B"]\arrow[d,"f\pmap B\pmap C"] &
		(A\smsh B\pmap (B\pmap C)\smsh B) \arrow[r,"A\smsh B\pmap\epsilon"]\arrow[d,"f\smsh B\pmap\cdots"]  &
		(A\smsh B\pmap C)\arrow[d,"f\smsh B\pmap C"] \\
		(A'\pmap B\pmap C) \arrow[r,"({-})\smsh B"] &
		(A'\smsh B\pmap (B\pmap C)\smsh B) \arrow[r,"A\smsh B\pmap\epsilon"] &
		(A'\smsh B\pmap C)
	\end{tikzcd}
	\end{center}

	\textbf{Naturality of $e$ in $C$}. Suppose that $f:C\pmap C'$. Then in the following diagram the left square commutes by naturality of $({-})\smsh B$ in the second argument (applied to $B\pmap f$) and the right square commutes by applying the functor $A\smsh B \pmap({-})$ to the naturality of $\epsilon$ in the second argument.
	\begin{center}
	\begin{tikzcd}
		(A\pmap B\pmap C) \arrow[r]\arrow[d] &
		(A\smsh B\pmap (B\pmap C)\smsh B) \arrow[r]\arrow[d] &
		(A\smsh B\pmap C)\arrow[d] \\
		(A\pmap B\pmap C') \arrow[r] &
		(A\smsh B\pmap (B\pmap C')\smsh B) \arrow[r] &
		(A\smsh B\pmap C')
	\end{tikzcd}
	\end{center}
Pointed naturality: TODO.

	\textbf{Naturality of $e$ in $B$}. Suppose that $f:B'\pmap B$. Here the diagram is a bit more
complicated, since $({-})\smsh B$ is dinatural (instead of natural) in $B$. Then we get the
following diagram. The front square commutes by naturality of $({-})\smsh B$ in the second argument
	(applied to $f\pmap C$). The top square commutes by naturality of $({-})\smsh B$ in the third
argument, the back square commutes because composition on the left commutes with composition on the
	right, and finally the right square commutes by applying the functor $A\smsh B' \pmap({-})$ to the
	naturality of $\epsilon$ in the first argument.
	\begin{center}
	\begin{tikzcd}[row sep=scriptsize, column sep=-4em]
		& (A\smsh B\pmap (B\pmap C)\smsh B) \arrow[rr] \arrow[dd] & & (A\smsh B'\pmap (B\pmap C)\smsh B)\arrow[dd] \\
		(A\pmap B\pmap C) \arrow[ur] \arrow[rr, crossing over] \arrow[dd] & & (A\smsh B'\pmap (B\pmap C)\smsh B') \arrow[ur] \\
		& (A\smsh B\pmap C)\arrow[rr] &  & (A\smsh B'\pmap C) \\
		(A\pmap B'\pmap C) \arrow[rr] & & (A\smsh B'\pmap (B'\pmap C)\smsh B') \arrow[ur] \arrow[from=uu, crossing over]
	\end{tikzcd}
	\end{center}

\end{proof}
\begin{rmk}
  Instead of showing that $e$ is natural, we could instead show that $e^{-1}$ is natural. In
  that case we need to show that the map $A\to({-}):(B\to C)\to(A\to B)\to(A\to C)$ is natural in
  $A$, $B$ and $C$. This might actually be easier, since we don't need to work with any higher
  inductive type to prove that.
\end{rmk}

\section{Symmetric monoid product}
We aim to prove that the smash product is a (1-coherent) symmetric monoidal product [REF: Brunerie] for pointed types, i.e., that
\[(\type^*,\, \bool,\, \smsh,\, \alpha,\, \lambda,\, \rho,\, \gamma)\]
is a symmetric monoidal category, with the type of booleans $\bool$ (pointed in $0_\bool$) as unit, and for suitable instances of $\alpha$, $\lambda$, $\rho$ and $\gamma$ witnessing associativity, left- and right unitality and the braiding for $\smsh$ and satisfying appropriate coherence relations (associativity pentagon; unitors triangle; braiding-unitors triangle; associativity-braiding hexagon; double braiding).

Using \autoref{lem:yoneda} (Yoneda) we can prove associativity, left- and right unitality and braiding equivalences for the smash product, in the following way.

\begin{defn}\label{def:equiv-precursors}
	The following pointed equivalences are defined for $A$, $B$, $C$ and $X$ pointed types:
	\begin{itemize}
		\item $\alphabar_X : (A \smsh (B \smsh C) \to X) \simeq ((A \smsh B) \smsh C \to X)$ as the composition of the equivalences:
			\begin{align*}
			    A \smsh (B \smsh C)\to X&\simeq A \to B\smsh C\to X && (e\sy)\\
			    &\simeq A \to B\to C\to X && (A \to e\sy)\\
			    &\simeq A \smsh B\to C\to X && (e)\\
		    	&\simeq (A \smsh B)\smsh C\to X. && (e)
			\end{align*}
		\item $\lambdabar_X : (B \to X) \simeq (\bool \smsh B \to X)$ as the composition of the equivalences:
			\begin{align*}
				B \to X &\simeq \bool \to B \to X && (\two\sy)\\
				&\simeq \bool \smsh B \to X && (e)
			\end{align*}
		\item $\rhobar_X : (A \to X) \simeq (A \smsh \bool \to X)$ as the composition of the equivalences:
			\begin{align*}
				A \to X &\simeq A \to \bool \to X && (A \to \two\sy)\\
				&\simeq A \smsh \bool \to X && (e)
			\end{align*}
		\item $\gammabar_X : (B \smsh A \to X) \simeq (A \smsh B \to X)$ as the composition of the equivalences:
			\begin{align*}
				B \smsh A \to X &\simeq B \to A \to X && (e\sy)\\
				&\simeq A \to B \to X && (\twist)\\
				&\simeq A \smsh B \to X && (e)
			\end{align*}
	\end{itemize}
\end{defn}

\begin{rmk}\label{rmk:alrg-pointed-natural}
	The equivalences in \autoref{def:equiv-precursors} are natural in all their arguments and pointed natural in $X$, by (pointed) naturality of $e$ (\autoref{lem:e-natural} and \autoref{lem:e-pointed-natural}), $c$ and $t$. In particular, we will use:
	\begin{align*}
	f \o \alphabar(g) &\sim \alphabar(f \o g) & f \o \lambdabar(g) &\sim \lambdabar(f \o g)\\
	f \o \rhobar(g) &\sim \rhobar(f \o g) & f \o \gammabar(g) &\sim \gammabar(f \o g)
	\end{align*}
\end{rmk}

\begin{defn}\label{def:smash-alrg}
	We define the following equivalences, natural in all their arguments, with inverses provided as in \autoref{lem:yoneda}:
	\begin{itemize}
		\item $\alpha\defeq\alphabar_{A \smsh (B \smsh C)}(\idfunc) : (A \smsh B) \smsh C \simeq A \smsh (B \smsh C)$ (associativity of the smash product), with inverse $\alpha\sy\defeq\alphabar\sy_{(A \smsh B) \smsh C}(\idfunc)$;
		\item $\lambda \defeq \lambdabar_B(\idfunc) : \bool \smsh B \simeq B$ and $\rho \defeq \rhobar_A(\idfunc) : A \smsh \bool \simeq A$ (left- and right unitors for the smash product), with inverses $\lambda\sy\defeq \lambdabar_{\bool\smsh B}\sy(\idfunc)$ and $\rho\sy\defeq \rhobar_{A\smsh \bool}\sy(\idfunc)$, respectively;
		\item $\gamma \defeq \gammabar_{B\smsh A} (\idfunc) : A \smsh B \simeq B \smsh A$ (braiding for the smash product), with inverse $\gamma\sy \defeq \gammabar_{A \smsh B}\sy (\idfunc)$.
	\end{itemize}
	$\alpha$, $\lambda$, $\rho$ and $\gamma$ are natural in all their arguments, as $\alphabar$, $\lambdabar$, $\rhobar$ and $\gammabar$ are.
\end{defn}

\begin{lem}\label{lem:bar-homotopy}
	There are pointed homotopies
	\begin{align*}
	\alphabar_X &\sim \alpha \to X
		& \lambdabar_X &\sim \lambda \to X
	\\
	\rhobar_X &\sim \rho \to X
		& \gammabar_X &\sim \gamma \to X
	\end{align*}
\end{lem}

\begin{proof}
	This follows directly from \autoref{lem:yoneda-pointed} and \autoref{rmk:alrg-pointed-natural}.
\end{proof}

\begin{thm}[Associativity pentagon]\label{thm:smash-associativity-pentagon}
	For $A$, $B$, $C$ and $D$ pointed types, there is a pointed homotopy
	\[\alpha \o \alpha \sim (A \smsh \alpha) \o \alpha \o (\alpha \smsh D)\]
	corresponding to the commutativity of the following diagram:
	\begin{center}
	\begin{tikzcd}
		&((A \smsh B) \smsh (C \smsh D))
			\arrow[dr, "\alpha"]
		\\
		(((A \smsh B) \smsh C) \smsh D)
			\arrow[ru, "\alpha"]
			\arrow[d, swap, "\alpha \smsh D"]
		&& (A \smsh (B \smsh (C \smsh D)))
		\\
		((A \smsh (B \smsh C)) \smsh D)
			\arrow[rr, swap, "\alpha"]
		&& (A \smsh ((B \smsh C) \smsh D))
			\arrow[u, swap, "A \smsh \alpha"]
	\end{tikzcd}
%	\begin{tikzcd}
%		(((A \smsh B) \smsh C) \smsh D)
%			\arrow[rr, "\alpha"]
%			\arrow[d, swap, "\alpha \smsh D"]
%		&& ((A \smsh B) \smsh (C \smsh D))
%			\arrow[d, "\alpha"]
%		\\
%		((A \smsh (B \smsh C)) \smsh D)
%			\arrow[r, swap, "\alpha"]
%		& (A \smsh ((B \smsh C) \smsh D))
%			\arrow[r, swap, "A \smsh \alpha"]
%		& (A \smsh (B \smsh (C \smsh D)))
%	\end{tikzcd}
	\end{center}
\end{thm}
\begin{proof}
	We articulate the proof in several steps. A map homotopic to both sides of the sought homotopy will be constructed via the equivalence
	\begin{align*}
		\alphabar^4 : (A \smsh (B \smsh (C \smsh D)) \to X) &\simeq (((A \smsh B) \smsh C) \smsh D \to X)
		\intertext{(natural in all its arguments), defined as the composite:}
		A \smsh (B \smsh (C \smsh D)) \to X
		&\simeq A \to B \smsh (C \smsh D) \to X && \text{($e\sy$)}\\
		&\simeq A \to B \to C \smsh D \to X &&\text{($A \to e\sy$)}\\
		&\simeq A \to B \to C \to D \to X &&\text{($A \to B \to e\sy$)}\\
		&\simeq A \smsh B \to C \to D \to X &&\text{($e$)}\\
		&\simeq (A \smsh B) \smsh C \to D \to X &&\text{($e$)}\\
		&\simeq ((A \smsh B) \smsh C) \smsh D \to X && \text{($e$)}
		\intertext{giving $\alphabar^4(\idfunc) : ((A \smsh B) \smsh C) \smsh D) \simeq A \smsh (B \smsh (C \smsh D))$. Moreover, in order to simplify the expressions of $\alpha \smsh D$ and $A \smsh \alpha$, we also define:}
		\alphabar^R : ((A \smsh (B \smsh C)) \smsh D \to X) &\simeq (((A \smsh B) \smsh C) \smsh D \to X)
		\intertext{as the composite:}
		(A \smsh (B \smsh C)) \smsh D \to X
		&\simeq A \smsh (B \smsh C) \to D \to X &&\text{($e\sy$)}\\
		&\simeq (A \smsh B) \smsh C \to D \to X &&\text{($\alphabar$)}\\
		&\simeq ((A \smsh B) \smsh C) \smsh D \to X &&\text{($e$)}
		\intertext{and}
		\alphabar^L : (A \smsh (B \smsh (C \smsh D)) \to X) &\simeq (A \smsh ((B \smsh C) \smsh D) \to X)
		\intertext{as the composite:}
		A \smsh (B \smsh (C \smsh D)) \to X
		&\simeq A \to B \smsh (C \smsh D) \to X &&\text{($e\sy$)}\\
		&\simeq A \to (B \smsh C) \smsh D \to X &&\text{($A \to \alphabar$)}\\
		&\simeq A \smsh ((B \smsh C) \smsh D) \to X &&\text{($e$)}
	\end{align*}
	also natural in their arguments. Evaluating these equivalences to the identity function, we get new arrows that fit in the original diagram:
	\begin{center}
	\begin{tikzcd}
		&((A \smsh B) \smsh (C \smsh D))
			\arrow[dr, "\alpha"]
		\\
		(((A \smsh B) \smsh C) \smsh D)
			\arrow[ru, "\alpha"]
			\arrow[d, swap, "\alpha \smsh D"]
			\arrow[d, bend left=40, "\alphabar^R(\idfunc)"]
			\arrow[rr, "\alphabar^4(\idfunc)"]
		&& (A \smsh (B \smsh (C \smsh D)))
		\\
		((A \smsh (B \smsh C)) \smsh D)
			\arrow[rr, swap, "\alpha"]
		&& (A \smsh ((B \smsh C) \smsh D))
			\arrow[u, swap, "A \smsh \alpha"]
			\arrow[u, bend left=40, "\alphabar^L(\idfunc)"]
	\end{tikzcd}
	\end{center}

	The theorem is then proved once we show the chain of homotopies:
	\begin{equation}\label{eq:alphafour}
	\alpha \o \alpha
	\sim \alphabar^4(\idfunc)
	\sim \alphabar^L(\idfunc) \o \alpha \o \alphabar^R(\idfunc)
	\sim (A \smsh \alpha) \o \alpha \o (\alpha \smsh D)
	\end{equation}

	To verify the first homotopy in (\ref{eq:alphafour}), we see that:
	\begin{align*}
		\alpha \o \alpha
		&\judgeq \alphabar(\idfunc) \o \alphabar(\idfunc)\\
		&\sim (\alphabar \o \alphabar) (\idfunc) &&\text{(naturality of $\alphabar$)}\\
		&\judgeq (e \o e \o (A \to e\sy) \o e\sy \o e \o e \o (A \to e\sy) \o e\sy)(\idfunc)\\
		&\sim (e \o e \o (A \to e\sy) \o e \o (A \to e\sy) \o e\sy)(\idfunc) &&\text{(cancelling)}\\
		&\sim (e \o e \o e \o (B \to A \to e\sy) \o (A \to e\sy) \o e\sy)(\idfunc) &&\text{(naturality of $e$)}\\
		&\judgeq \alphabar^4(\idfunc)
	\end{align*}

	The second homotopy in (\ref{eq:alphafour}) is verified by (right-to-left):
	\begin{align*}
		\alphabar^L(\idfunc) \o \alpha \o \alphabar^R(\idfunc)
		&\judgeq \alphabar^L(\idfunc) \o \alphabar(\idfunc) \o \alphabar^R(\idfunc)\\
		&\sim (\alphabar^R \o \alphabar \o \alphabar^L)(\idfunc) &&\text{(nat. of $\alphabar$ and $\alphabar^R$)}\\
		&\judgeq (e \o \alphabar \o e\sy \o e \o e \o (A \to e\sy) \o e\sy \o e \o (A \to \alphabar) \o e\sy)(\idfunc)\\
		&\sim (e \o \alphabar \o e \o (A \to e\sy) \o (A \to \alphabar) \o e\sy)(\idfunc) &&\text{(cancelling)}\\
		&\sim (e \o \alphabar \o e \o (A \to (e\sy \o \alphabar)) \o e\sy)(\idfunc) &&\text{(funct. of $A\to -$)}\\
		&\judgeq (e \o e \o e \o (A \to e\sy) \o e\sy \o e \\
		&\hspace{3em}\o (A \to (e\sy \o e \o e \o (B \to e\sy) \o e\sy)) \o e\sy)(\idfunc)\\
		&\sim (e \o e \o e \o (A \to ((B \to e\sy) \o e\sy)) \o e\sy)(\idfunc) &&\text{(cancelling)}\\
		&\sim (e \o e \o e \o (B \to A \to e\sy) \o (A \to e\sy) \o e\sy)(\idfunc) &&\text{(funct. of $A \to -$)}\\
		&\judgeq \alphabar^4(\idfunc)
	\end{align*}

	In order to prove the last homotopy in (\ref{eq:alphafour}), it is sufficient to show that $\alphabar^R(\idfunc) \sim \alpha \smsh D$ and that $\alphabar^L(\idfunc) \sim A \smsh \alpha$. We have:
	\begin{align*}
		\alphabar^R(\idfunc)
		&\judgeq e(\alphabar (e\sy(\idfunc)))\\
		&\sim e (\alphabar (\eta))\\
		&\sim e (\eta \o \alphabar(\idfunc)) &&\text{(naturality of $\alphabar$)}\\
		&\judgeq \epsilon \o (\eta \o \alpha) \smsh D\\
		&\sim \epsilon \o (\eta \smsh D) \o (\alpha \smsh D) &&\text{(distrib. of $\smsh$)}\\
		&\sim \alpha \smsh D &&\text{(\autoref{lem:unit-counit})}
	\end{align*}
	and, lastly,
	\begin{align*}
		\alphabar^L(\idfunc)
		&\judgeq e(\alphabar \o e\sy(\idfunc))\\
		&\sim e(\alphabar \o \eta)\\
		&\sim e((\alpha \to A \smsh (B \smsh (C \smsh D))) \o \eta) &&\text{(\autoref{lem:bar-homotopy})}\\
		&\sim e((B \smsh (C \smsh D) \to A \smsh \alpha) \o \eta) &&\text{(dinaturality of $\eta$)}\\
		&\sim (A \smsh \alpha) \o e(\eta) &&\text{(naturality of $e$)}\\
		&\sim A \smsh \alpha &&\text{(\autoref{lem:unit-counit})}
	\end{align*}
	thus proving the desired homotopy.
\end{proof}

\begin{thm}[Unitors triangle]\label{thm:smash-unitors-triangle}
	For $A$ and $B$ pointed types, there is a pointed homotopy
	\[(A \smsh \lambda) \o \alpha \sim (\rho \smsh B)\]
	corresponding to the commutativity of the following diagram:
	\begin{center}
	\begin{tikzcd}
	((A \smsh \bool) \smsh B)
		\arrow[rr, "\alpha"]
		\arrow[dr, swap, "\rho \smsh B"]
	&& (A \smsh (\bool \smsh B))
		\arrow[dl, "A \smsh \lambda"]
	\\
	& (A \smsh B)
	\end{tikzcd}
	\end{center}
\end{thm}
\begin{proof}
	By an argument similar to the one for $\alphabar^L$ and $\alphabar^R$ in \autoref{thm:smash-associativity-pentagon}, one can verify the homotopies $A \smsh \lambda \sim (e \o (A \to \lambdabar) \o e\sy)(\idfunc)$ and $\rho \smsh B \sim (e \o \rhobar \o e)(\idfunc)$, simplifying the expressions in the sought homotopy. Then:
	\begin{align*}
		(A \smsh \lambda) \o \alpha
		&\sim e(\lambdabar \o e\sy(\idfunc)) \o \alphabar(\idfunc) &&\text{(simplification)}\\
		&\sim \alphabar(e(\lambdabar \o e\sy(\idfunc)) &&\text{(naturality of $\alphabar$)}\\
		&\judgeq e(e(e\sy \o e\sy (e(\lambdabar \o e\sy(\idfunc)))))\\
		&\sim e(e(e\sy \o \lambdabar \o e\sy(\idfunc))) &&\text{(cancelling)}\\
		&\judgeq e(e(e\sy \o e \o \two\sy \o e\sy(\idfunc)))\\
		&\sim e(e(\two\sy \o e\sy(\idfunc))) &&\text{(cancelling)}\\
		&\judgeq (e \o \rhobar \o e\sy)(\idfunc)\\
		&\sim \rho \smsh B &&\text{(simplification)}
	\end{align*}
	gives the desired homotopy.
\end{proof}

\begin{thm}[Braiding-unitors triangle]\label{thm:smash-braiding-unitors}
	For a pointed type $A$, there is a pointed homotopy
	\[\lambda \o \gamma \sim \rho\]
	corresponding to the commutativity of the following diagram:
	\begin{center}
	\begin{tikzcd}
	(A \smsh \bool)
		\arrow[rr, "\gamma"]
		\arrow[dr, swap, "\rho"]
	&& (\bool \smsh A)
		\arrow[dl, "\lambda"]
	\\
	& A
	\end{tikzcd}
	\end{center}
\end{thm}
\begin{proof}
	We have:
	\begin{align*}
		\lambda \o \gamma
		&\judgeq \lambdabar(\idfunc) \o \gammabar(\idfunc)\\
		&\sim (\gammabar \o \lambdabar)(\idfunc) &&\text{(naturality of $\gammabar$)}\\
		&\judgeq (e \o \twist \o e\sy \o e \o \two\sy)(\idfunc)\\
		&\sim (e \o \twist \o \two\sy)(\idfunc) &&\text{(cancelling)}\\
		&\sim (e \o (A \to \two\sy))(\idfunc)\\
		&\judgeq \rhobar(\idfunc) \judgeq \rho
	\end{align*}
	where the last homotopy is given by $(A \to c) \o \two \sim \twist : (\bool \to A \to X) \to (A \to X)$.
\end{proof}

\begin{lem}\label{lem:pentagon-c}
	The following diagram commutes, for $A$, $B$, $C$ and $X$ pointed types:
	\begin{center}
	\begin{tikzcd}[column sep=7em]
		(B \smsh C \to A \to X)
			\arrow[r, "e\sy"]
			\arrow[dd, swap, "\twist"]
		& (B \to C \to A \to X)
			\arrow[d, "B \to \twist"]
		\\
		& (B \to A \to C \to X)
			\arrow[d, "\twist"]
		\\
		(A \to B \smsh C \to X)
			\arrow[r, swap, "A \to e\sy"]
		& (A \to B \to C \to X)
	\end{tikzcd}
	\end{center}
\end{lem}
\begin{proof}
	Unfolding the definition of $e\sy$, we get the diagram:
	\begin{center}
	\begin{tikzcd}[column sep=6em]
		(B \smsh C \to A \to X)
			\arrow[rr, bend left=10, "e\sy"]
			\arrow[r, swap, "C\to -"]
			\arrow[dd, swap, "\twist"]
		& ((C \to B \smsh C) \to C \to A \to X)
			\arrow[r, swap, "\eta \to C \to A \to X"]
			\arrow[d, swap, "(C \to B \smsh C) \to \twist"]
		& (B \to C \to A \to X)
			\arrow[d, "B \to \twist"]
		\\
		& ((C \to B \smsh C) \to A \to C \to X)
			\arrow[r, swap, "\eta \to A \to C \to X"]
			\arrow[d, swap, "\twist"]
		& (B \to A \to C \to X)
			\arrow[d, "\twist"]
		\\
		(A \to B \smsh C \to X)
			\arrow[rr, swap, bend right=10, "A \to e\sy"]
			\arrow[r, "A \to (C \to -)"]
		& (A \to (C \to B \smsh C) \to C \to X)
			\arrow[r, "A \to (\eta \to C \to X)"]
		& (A \to B \to C \to X)
	\end{tikzcd}
	\end{center}
	The square in the top right is by \autoref{lem:composition-pointed}, the square on the bottom right is naturality of $\twist$. The commutativity of the pentagon on the left is TODO (it is a diagram of a 1-coherent symmetric closed category).
\end{proof}

\begin{thm}[Associativity-braiding hexagon]\label{thm:smash-associativity-braiding}
	For pointed types $A$, $B$ and $C$, there is a pointed homotopy
	\[\alpha \o \gamma \o \alpha \sim (B \smsh \gamma) \o \alpha \o (\gamma \smsh C)\]
	corresponding to the commutativity of the following diagram:
	\begin{center}
	\begin{tikzcd}
		((A \smsh B) \smsh C)
			\arrow[r, "\alpha"]
			\arrow[d, swap, "\gamma \smsh C"]
		&(A \smsh (B \smsh C))
			\arrow[r, "\gamma"]
		& ((B \smsh C) \smsh A)
			\arrow[d, "\alpha"]
		\\
		((B \smsh A) \smsh C))
			\arrow[r, swap, "\alpha"]
		& (B \smsh (A \smsh C))
			\arrow[r, swap, "B \smsh \gamma"]
		& (B \smsh (C \smsh A))
	\end{tikzcd}
	\end{center}
\end{thm}
\begin{proof}
	The proof is structured similarly to the one for \autoref{thm:smash-associativity-pentagon}: the homotopies
	\begin{align*}
	B \smsh \gamma &\sim \gammabar^L(\idfunc) &\text{with\ \ } \gammabar^L &\defeq e \o (B \to \gammabar) \o e\sy\\
	\gamma \smsh C &\sim \gammabar^R(\idfunc) &\text{with\ \ } \gammabar^R &\defeq e \o \gammabar \o e\sy
	\end{align*}
	can be proven in exactly the same way and, using these simplifications, we will show that both sides of the sought homotopy are homotopic to the same equivalence. Indeed we have:
	\begin{align*}
		\alpha \o \gamma \o \alpha
		&\judgeq \alphabar(\idfunc) \o \gammabar(\idfunc) \o \alphabar(\idfunc)\\
		&\sim (\alphabar \o \gammabar \o \alphabar)(\idfunc) &&\text{(naturality of $\gammabar$ and $\alphabar$)}\\
		&\judgeq (e \o e \o (A \to e\sy) \o e\sy \o e \o \twist \o e\sy \o e \o e \o (B \to e\sy) \o e\sy)(\idfunc)\\
		&\sim (e \o e \o (A \to e\sy) \o \twist \o e \o (B \to e\sy) \o e\sy)(\idfunc) &&\text{(cancelling)}\\
		&\sim (e \o e \o \twist \o (B \to \twist) \o e\sy \o e \o (B \to e\sy) \o e\sy)(\idfunc) &&\text{(\autoref{lem:pentagon-c})}\\
		&\sim (e \o e \o \twist \o (B \to \twist) \o (B \to e\sy) \o e\sy)(\idfunc) &&\text{(cancelling)}
	\end{align*}
	and
	\begin{align*}
		(B \smsh \gamma) \o \alpha \o (\gamma \smsh C)
		&\sim \gammabar^L(\idfunc) \o \alphabar \o \gammabar^R(\idfunc) &&\text{(simplification)}\\
		&\sim (\gammabar^R \o \alphabar \o \gammabar^L)(\idfunc) &&\text{(nat. of $\alphabar$ and $\gammabar^R$)}\\
		&\judgeq (e \o \gammabar \o e\sy \o e \o e \o (B \to e\sy) \o e\sy \o e \o (B \to \gammabar) \o e\sy)(\idfunc)\\
		&\sim (e \o \gammabar \o e \o (B \to e\sy) \o (B \to \gammabar) \o e\sy)(\idfunc) &&\text{(cancelling)}\\
		&\sim (e \o \gammabar \o e \o (B \to (e\sy \o \gammabar)) \o e\sy)(\idfunc) &&\text{(funct. of $B \to -$)}\\
		&\judgeq (e \o e \o \twist \o e\sy \o e \o (B \to (e\sy \o e \o \twist \o e\sy)) \o e\sy)(\idfunc)\\
		&\sim (e \o e \o \twist \o (B \to \twist) \o (B \to e\sy) \o e\sy)(\idfunc) &&\text{(cancelling)}
	\end{align*}
	proving the commutativity of the diagram.
\end{proof}

\begin{thm}[Double braiding]\label{thm:smash-double-braiding}
	For $A$ and $B$ pointed types, there is a pointed homotopy
	\[\gamma \o \gamma \sim \idfunc\]
	corresponding to the commutativity of the following diagram:
	\begin{center}
	\begin{tikzcd}
	(A \smsh B)
		\arrow[r, "\gamma"]
		\arrow[dr, equals]
	& (B \smsh A)
		\arrow[d, "\gamma"]
	\\
	& (A \smsh B)
	\end{tikzcd}
	\end{center}
\end{thm}
\begin{proof}
	Using that $\twist \o \twist \sim \idfunc$, we get:
	\begin{align*}
		\gamma \o \gamma
		&\judgeq \gammabar(\idfunc) \o \gammabar(\idfunc)\\
		&\sim (\gammabar \o \gammabar)(\idfunc) &&\text{(naturality of $\gammabar$)}\\
		&\judgeq (e \o \twist \o e\sy \o e \o \twist \o e\sy)(\idfunc)\\
		&\sim \idfunc &&\text{(cancelling)}
	\end{align*}
	as desired.
\end{proof}

\begin{cor}
	$(\type^*,\, \bool,\, \smsh,\, \alpha,\, \lambda,\, \rho,\, \gamma)$ has a structure of a symmetric monoidal category, for $\alpha$, $\lambda$, $\rho$ and $\gamma$ as in \autoref{def:smash-alrg}.
\end{cor}
\begin{proof}
	Follows by the theorems in this section.
\end{proof}

\section{Discussion}

Many results in \autoref{sec:smash} about $({-}) \smsh B$ can be generalized to arbitrary pointed $\infty$-functors $\type^*\to\type^*$. Internally in HoTT we cannot talk about $\infty$-categories and $\infty$-functors (as far as we know), and therefore we cannot express this internally. But we only need finitely many coherences, so that we can formulate these results internally for arbitrary functors with enough coherences. However, when we tried this, we run into the problem that we needed all (or at least, some) coherences in the definition of a tricategory and functor for tricategories, which are harder to check than the result we wanted to prove. Here we sketch this argument.

$\type^*$ is a pointed $(\infty,1)$-category meaning it has an zero object $\unit$, which is an object that is both (homotopy-)initial and (homotopy-)terminal. Given two pointed $(\infty,1)$-categories $\mc{A}$ and $\mc{B}$, we call a map $F:\mc{A}\to\mc{B}$ a 1-coherent functor if it satisfies all the coherences of a functor (i.e. an action on morphisms and a 2-cell stating that $F$ respects compositions and identities), a 2-coherent functor if it satisfies all the coherences of a bifunctor (a functor between bicategories) and a 3-coherent functor if it satisfies all the coherences of a trifunctor (a functor between tricategories).
% Add reference:
% @article{gurski2006algebraic,
% title={An algebraic theory of tricategories},
% author={Gurski, Nick},
% year={2007},
% url={http://gauss.math.yale.edu/~mg622/tricats.pdf}
% }

We call $F:\mc{A}\to\mc{B}$ pointed if it preserves the zero object, i.e. if $F\unit=\unit$. If $F$ is a pointed 1-coherent functor, we can then show that $F(0_{A,B})=0_{FA,FB}$, where $0_{A,B}$ is the zero morphism (the canonical morphism $A\to\unit\to B$).

If $F$ is a pointed 2-coherent functor (or more precisely a 1-coherent functor which a coherence for the associativity 2-cell), then we can show that \autoref{lem:smash-coh} holds for $F$. We can show that the two pentagons have the same filler if $F$ is a 3-coherent functor.

Now we can also show \autoref{thm:smash-functor-right} more generally, but we will only formulate that for functors between pointed types. If $F:\type^*\to\type^*$ is a 2-coherent pointed functor, then it induces a map
$(A\to B)\to(FA\to FB)$ which is natural in $A$ and $B$. Moreover, if $F$ is 3-coherent then this is a pointed natural transformation in $B$.

\section{References}
\begin{itemize}
\item (TODO)
\item An algebraic theory of tricategories, Nick Gurski
\item Closed Categories, Samuel Eilenberg and G. Max Kelly (Chapter 2, Theorem 5.3, 1-categorical account of getting a monoidal category from a enriched adjunction in a closed category)
\item Permutative categories, multicategories, and algebraic K-theory, A D Elmendorf and M A Mandell (Lemma 4.20 gives a 1-categorical account that if C is a symmetric monoidal closed bicomplete 1-category, then the category of pointed objects is a symmetric monoidal closed bicomplete 1-category).
\item On embedding closed categories, B.J. Day and M.L. Laplaza (definition of symmetric closed category).
\item Maybe: Handbook of Categorical Algebra 2  Categories and Structures, F Borceux. (Bjorn used it to look things up about symmetric monoidal closed categories)
\end{itemize}
\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{thm}[Associativity]\label{thm:smash-associativity}
  The smash product is associative: there is an equivalence $\alpha : (A \smsh B) \smsh C \simeq A \smsh (B \smsh C)$ which is natural in $A$, $B$ and $C$.
\end{thm}
\begin{proof}
  For a pointed type $X$, let $\alphabar_X$ be the composite of the following equivalences:
  \begin{align*}
    A \smsh (B \smsh C)\to X&\simeq A \to B\smsh C\to X && (e\sy)\\
    &\simeq A \to B\to C\to X && (A \to e\sy)\\
    &\simeq A \smsh B\to C\to X && (e)\\
    &\simeq (A \smsh B)\smsh C\to X. && (e)
  \end{align*}
  $\alphabar_X$ is natural in $A,B,C,X$ by repeatedly applying \autoref{lem:e-natural}. Let
  $\alpha\defeq\alphabar_{A \smsh (B \smsh C)}(\idfunc)$ and
  $\alpha\sy\defeq\alphabar\sy_{(A \smsh B) \smsh C}(\idfunc)$. These maps are inverses by \autoref{lem:yoneda}; lastly, $\alpha$ is natural in $A$, $B$
  and $C$, since $\alphabar_X$ is.
\end{proof}

\begin{thm}[Unitors]\label{thm:smash-unitors}
	The type of booleans $\bool$ is a left- and right unit for the smash product: there are equivalences
	$\lambda : (\bool \smsh B) \simeq B$ and $\rho : (A \smsh \bool) \simeq A$, respectively natural in $B$ and in $A$.
\end{thm}
\begin{proof}
	We define $\lambdabar_X$ as the following composition of equivalences:
	\begin{align*}
		B \to X &\simeq \bool \to B \to X && (t\sy)\\
			&\simeq \bool \smsh B \to X && (e)
		\end{align*}
	and, similarly, $\rhobar_X$ as the composition:
	\begin{align*}
		A \to X &\simeq A \to \bool \to X && (A \to t\sy)\\
			&\simeq A \smsh \bool \to X && (e)
	\end{align*}
	for any pointed type $X$, where $t : (\bool \to X) \simeq X$ is the pointed equivalence with underlying function sending $f : \bool \to X$ to $f(1_\bool) : X$. Both $\lambdabar_X$ and $\rhobar_X$ are natural in their arguments by multiple applications of \autoref{lem:e-natural}. By an argument similar to \autoref{thm:smash-associativity}, we can define $\lambda \defeq \lambdabar_B(\idfunc)$ and $\rho \defeq \rhobar_A(\idfunc)$ together with the corresponding inverses, yielding the sought natural equivalences.
\end{proof}

\begin{thm}[Braiding]\label{thm:smash-braiding}
	The smash product is symmetric, i.e. there are equivalences $\gamma : A \smsh B \simeq B \smsh A$, natural in $A$ and $B$.
\end{thm}
\begin{proof}
	We define $\gammabar_X$, for $X$ a pointed type, as the composition of the following equivalences:
	\begin{align*}
		B \smsh A \to X &\simeq B \to A \to X && (e\sy)\\
			&\simeq A \to B \to X && (c)\\
			&\simeq A \smsh B \to X && (e)
	\end{align*}
	where $c : (A \to B \to X) \simeq (B \to A \to X)$ is the obvious pointed equivalence, natural in $A$, $B$ and $X$. $\gamma_X$ is then also natural in all its arguments, by myltiple applications of \autoref{lem:e-natural}; then, as in \autoref{thm:smash-associativity}, we can define $\gamma \defeq \gammabar_{B\smsh A} (\idfunc)$ and $\gamma\sy \defeq \gammabar_{A \smsh B}\sy (\idfunc)$
\end{proof}


%!TEX root = main.tex

This chapter contains a condensed version of several sections from~\cite{DBLP:conf/tacas/DijkP16}.

\section{Bisimulation minimisation}

One core challenge in model checking is the state space explosion problem.
The space and time requirements of model checking
increase exponentially with the size of the models.
Bisimulation minimisation computes the smallest equivalent model (maximal bisimulation) under some notion of equivalence, which can significantly reduce the number of states.
This technique is also used to abstract models from internal behavior, when only observable behavior is relevant.

The maximal bisimulation of a model is typically computed using
partition refinement.
Starting with an initially coarse partition (e.g. all states are equivalent),
the partition is refined until states in each equivalence class can no longer be distinguished.
The result is the maximal bisimulation with respect to the initial partition.
%
%
%
Another well-known method to deal with very large state spaces is symbolic model checking, where sets of states are represented by their characteristic function, which is efficiently stored using  binary decision diagrams (BDDs).

One particular application of symbolic bisimulation minimisation is as a bridge between symbolical models and explicit-state analysis algorithms.
Such models can have very large state spaces that are efficiently encoded using BDDs.
If the minimised model is sufficiently small, then it can be analyzed efficiently using explicit-state algorithms.
The symbolic representation of the maximal bisimulation, when effective, often tends to be much larger than the original model.

Blom and Orzan~\cite{DBLP:journals/entcs/BlomO03} introduced a signature-based method for partition refinement, which assigns states to equivalence classes according to a characterizing signature.
This method easily extends to various types of bisimulation.
Wimmer et al. \cite{DBLP:conf/glvlsi/WimmerHB07,DBLP:conf/atva/WimmerHHSB06} implemented symbolic bisimulation minimisation based on the signatures introduced by Blom.
Their tool is called \textsc{Sigref} and their work is the basis for \textsc{SigrefMC}.

To take advantage of computer systems with multiple processors,
developing scalable parallel algorithms is the way forward.
In~\cite{DBLP:conf/tacas/DijkP15},
we implemented the multi-core BDD package Sylvan, applying parallelism to symbolic model checking.
\textsc{SigrefMC} is based on Sylvan to implement multi-core signature-based symbolic partition refinement.

\section{Definitions}

We recall the basic definitions of partitions, of LTSs, of CTMCs, of IMCs, and of various bisimulations as in~\cite{DBLP:journals/entcs/BlomO03,DBLP:conf/fmco/HermannsK09,DBLP:conf/glvlsi/WimmerHB07,DBLP:conf/atva/WimmerHHSB06,atr16}.

%\subsection{Partitions}

\begin{definition}
Given a set $S$, a partition $\pi$ of $S$ is a subset $\pi\subseteq 2^S$ such that
$$\bigcup_{C\in \pi} C=S \qquad \text{and}\qquad \forall C,C'\in \pi\colon (C=C'\vee C\cap C'=\emptyset).$$
\end{definition}

If $\pi'$ and $\pi$ are two partitions, then $\pi'$ is a refinement of $\pi$, written $\pi'\refines \pi$,
%and $\pi$ is coarser than $\pi'$, written $\pi\refinedby \pi'$,
if each block of $\pi'$ is contained in a block of $\pi$.
%
%
The elements of $\pi$ are called equivalence classes or blocks.
%
Each equivalence relation $\equiv$ is associated with a partition $\pi=S/\!\equiv$.
In this paper, we use $\pi$ and $\equiv$ interchangeably.
%

%\subsection{Transition systems}

\begin{definition}
A labeled transition system (LTS) is a tuple $(S,\act,\rightarrow)$, consisting of a set of states $S$, a set of labels $\act$ that may contain the non-observable action $\tau$, and transitions $\rightarrow\,\subseteq S\times\act\times S$.
\end{definition}

We write $s\overset{a}\rightarrow t$ for $(s,a,t)\!\in\,\rightarrow$.
and $s\!\stackrel{\tau}{\nrightarrow}$ when $s$ has no outgoing $\tau$-transitions.
We use $\overset{a*}\rightarrow$ to denote the transitive reflexive closure of $\overset{a}\rightarrow$.
Given an equivalence relation $\equiv$, we write $\smash{\stackrel[\raisebox{1ex}{$\scriptstyle\equiv$}]{a}{\rightarrow}}$ for $\overset{a}\rightarrow\!\cap\!\equiv$, i.e., transitions between equivalent states, called \emph{inert} transitions.
We use $\smash{\stackrel[\raisebox{1ex}{$\scriptstyle\equiv$}]{a*}{\rightarrow}}$
for the transitive reflexive closure of $\smash{\stackrel[\raisebox{1ex}{$\scriptstyle\equiv$}]{a}{\rightarrow}}$.

\begin{definition}
A continuous-time Markov chain (CTMC) is a tuple $(S,\Rightarrow)$, consisting of a set of states $S$ and Markovian transitions $\Rightarrow\,\subseteq S\times \mathbb{R}^{> 0}\times S$.
%,and a labeling function $L\colon S\rightarrow 2^{AP}$, which assigns each state a set of atomic propositions from $AP$.
\end{definition}

We write $s\overset{\lambda}\Rightarrow t$ for $(s,\lambda,t)\!\in\,\Rightarrow$. The interpretation of %a Markovian transition
$s\overset{\lambda}\Rightarrow t$ is that the CTMC can switch from $s$ to $t$ within $d$ time units with probability $1\!-\!e^{-\lambda\cdot d}$.
%
For a state $s$, let $\textbf{R}(s)(s')=\sum\{\lambda\mid s\overset{\lambda}\Rightarrow s'\}$ be the rate to move from state $s$ to state $s'$,
and let $\textbf{R}(s)(C)=\sum_{s'\in C} \textbf{R}(s)(s')$ be the cumulative rate to reach a set of states $C\subseteq S$ from state $s$.

\begin{definition}
An interactive Markov chain (IMC) is a tuple ($S,\act,\rightarrow,\Rightarrow)$, consisting of a set of states $S$, a set of labels $\act$ that may contain the non-observable action $\tau$, transitions $\rightarrow\,\subseteq S\times\act\times S$, and Markovian transitions $\Rightarrow\,\subseteq S\times\mathbb{R}^{> 0}\times S$.
\end{definition}

An IMC basically combines the features of an LTS and a CTMC.
%
One feature of IMCs is the \emph{maximal progress assumption}.
Internal interactive transitions, i.e. $\tau$-transitions, can be assumed to take place immediately, while the probability that a Markovian transition executes immediately is zero.
Therefore, we may remove all Markovian transitions from states that have outgoing $\tau$-transitions: $s\stackrel{\tau}{\rightarrow}$ implies $\textbf{R}(s)(S)=0$.
We call IMCs to which this operation has been applied \emph{maximal-progress-cut} (mp-cut) IMCs.

%\subsection{Bisimulation}
\label{sec:bisim_lit}

\newcommand{\eqs}[0]{\ensuremath{\equiv_{S}}}
\newcommand{\eqb}[0]{\ensuremath{\equiv_{B}}}
%$\thicksim_s$

%
%A partition $\pi$ of $S$ is a subset $\pi\subseteq 2^S$ such that $\mathlarger{\bigcup}_{C\in\pi}C=S$ and $\forall C,C'\in\pi\colon C=C'\vee C\cap C'=\emptyset$.
%
%
%
%Every equivalence relation $\mathcal{R}$ corresponds to a partition $\pi$.
%In the context of bisimulation, the equivalence classes are called {\em blocks}.
%We write $\pi(s)$ to denote the block containing $s$ and
%$\pi(s,t)$ as shorthand for $\pi(s)=\pi(t)$, i.e., $\mathcal{R}(s,t)$.
%Unless otherwise stated,
%we use $\mathcal{R}$ and $\pi$ interchangeably.

%\td{Perhaps modify use of $\mathcal{R}$ and $\pi$, since elsewhere we use $\equiv$ for equivalence relations}

For LTSs, strong and branching bisimulation are typically defined as follows:

\begin{definition}%[strong bisimulation]
\label{def:stronglts}
An equivalence relation $\eqs$ is a strong bisimulation on an LTS if for all states $s,t,s'$ with $s\eqs t$ and for all $s\overset{a}\rightarrow s'$, there exists a state $t'$ with $t\overset{a}\rightarrow t'$ and $s'\eqs t'$.
\end{definition}

\begin{definition}%[branching bisimulation]
\label{def:branchinglts}
An equivalence relation $\eqb$ is a branching bisimulation on an LTS if for all states $s,t,s'$ with $s\eqb t$ and for all $s\overset{a}\rightarrow s'$, either
\begin{compactitem}
\item $a=\tau$ and $s'\eqb t$, or
\item there exist states $t',t''$ with $t\overset{\tau*}\rightarrow t'\overset{a}\rightarrow t''$ and $t\eqb t'$ and $s'\eqb t''$.
\end{compactitem}
\end{definition}

For CTMCs, strong bisimulation is defined as follows:

\begin{definition}
\label{def:strongctmc}
An equivalence relation $\eqs$ is a strong bisimulation on a CTMC if for all $(s,t)\in\;\eqs$ and for all classes $C\in S/\!\eqs$, $\textbf{R}(s)(C)=\textbf{R}(t)(C)$.
\end{definition}

For mp-cut IMCs, strong and branching bisimulation are defined as follows:

%\begin{definition}
%An equivalence relation $\eqs$ is a strong bisimulation on an IMC if for all $(s,t)\in\eqs$ and for all equivalence classes $C$, the following holds:
%\begin{compactitem}
%\item $s\overset{a}\rightarrow s'$ implies $t\overset{a}\rightarrow t'$ for a $t'\in S$ with $s'\eqs t'$
%\item $s\stackrel{\tau}{\nrightarrow}$ implies $\textbf{R}(s)(C)=\textbf{R}(t)(C)$
%\end{compactitem}
%\end{definition}
%
%\begin{definition}
%An equivalence relation $\eqb$ is a branching bisimulation on an IMC if for all $(s,t)\in\eqb$ and for all equivalence classes $C$, the following holds:
%\begin{compactitem}
%\item $s\overset{a}\rightarrow s'$ implies
%\begin{compactitem}
%\item $a=\tau$ and $s'\eqb t$, or
%\item there are $t',t''\in S$ with $t {\stackrel[\raisebox{1ex}{$\scriptstyle\eqb$}]{\tau*}{\rightarrow}} t'\overset{a}\rightarrow t''$ and  $s'\eqb t''$.
%\end{compactitem}
%\item $s\stackrel{\tau}{\nrightarrow}$ implies $\exists t'\in S\colon t \smash{\stackrel[\raisebox{1ex}{$\scriptstyle\eqb$}]{\tau*}{\rightarrow}} t'\stackrel{\tau}{\nrightarrow}\wedge\;\textbf{R}(s)(C)=\textbf{R}(t')(C)$
%\end{compactitem}
%\end{definition}

%For an mp-cut IMC, $s\stackrel{\tau}{\rightarrow}$ implies $\textbf{R}(s)=0$.
%\cite{atr16} defines and proves:

\begin{definition}
\label{def:strongimc}
An equivalence relation $\eqs$ is a strong bisimulation on an mp-cut IMC if for all $(s,t)\in\eqs$ and for all classes $C\in S/\!\eqs$
\begin{compactitem}
%\item $s\overset{a}\rightarrow s'$ for some $s'$ implies $t\overset{a}\rightarrow t'$ for some $t'\in S$ with $(s',t')\in\,\eqs$
\item $s\overset{a}\rightarrow s'$ for some $s'\in C$ implies $t\overset{a}\rightarrow t'$ for some $t'\in C$
\item $\textbf{R}(s)(C)=\textbf{R}(t)(C)$
\end{compactitem}
\end{definition}

\begin{definition}
\label{def:branchingimc}
An equivalence relation $\eqb$ is a branching bisimulation on an mp-cut IMC if for all $(s,t)\in\eqb$ and for all classes $C\in S/\!\eqb$
\begin{compactitem}
\item $s\overset{a}\rightarrow s'$ for some $s'\in C$ implies
\begin{compactitem}
\item $a=\tau$ and $(s,s')\in\,\eqb$, or
\item there exist states $t',t''\in S$ with $t \overset{\tau*}{\rightarrow} t'\overset{a}\rightarrow t''$ and $(t,t')\in\,\eqb$ and $t''\in C$.
\end{compactitem}
\item $\textbf{R}(s)(C)>0$ implies
\begin{compactitem}
\item $\textbf{R}(s)(C)=\textbf{R}(t')(C)$ for some $t'\in S$ such that $t \overset{\tau*}{\rightarrow} t'\!\stackrel{\tau}{\nrightarrow}$ and $(t,t')\in\,\eqb$.
\end{compactitem}
\item $s\!\stackrel{\tau}{\nrightarrow}$ implies $t\overset{\tau*}{\rightarrow} t'\!\stackrel{\tau}{\nrightarrow}$ for some $t'$
\end{compactitem}
\end{definition}

%Branching bisimulation for IMCs is \emph{divergence sensitive}.
%If a state $s$ can do internal $\tau$-transitions to a state without internal $\tau$-transitions ($s\smash{\stackrel[\raisebox{1ex}{$\scriptstyle\eqb$}]{\tau*}{\rightarrow}\stackrel{\tau}{\nrightarrow}}$), it is said to be \emph{time-convergent}, otherwise it is \emph{time-divergent}.

\section{Signature-based Bisimulation}
\label{sec:sigref}

%\subsection{Signature-based partition refinement}

Blom and Orzan~\cite{DBLP:journals/entcs/BlomO03} introduced a signature-based approach to compute the maximal bisimulation of an LTS,
which was further developed into a symbolic method by Wimmer et al.~\cite{DBLP:conf/atva/WimmerHHSB06}.
%The signatures are the same as the signatures defined above.
%
%
%In the literature, signature-based partition refinement is a well-known method to compute the maximal bisimulation of a system.
Each state is characterized by a \emph{signature}, which is the same for all equivalent states in a bisimulation.
These signatures are used to refine a partition of the state space until a fixed point is reached, which is the maximal bisimulation.

%In the current paper, we generalize this approach
%%by redefining bisimulation based on the associated signature
%and define a key property of the signature that causes partition refinement to result in the maximal bisimulation associated with that signature.

In the literature, multiple signatures are sometimes used that together fully characterize states, for example based on the state labels, based on the rates of continous-time transitions, and based on the enabled interactive transitions.
%
%
In the current paper, these multiple signatures are considered elements of a single signature that fully characterizes each state.

\begin{definition}
A signature $\sigma(\pi)(s)$ is a tuple of functions $f_i(\pi)(s)$, that together characterize each state $s$ with respect to a partition $\pi$.
\end{definition}

Two signatures $\sigma(\pi)(s)$ and $\sigma(\pi)(t)$ are equivalent, if and only if for all $f_i$, $f_i(\pi)(s)=f_i(\pi)(t)$.
%
%

The signatures of five bisimulations from Section~\ref{sec:bisim_lit} are known from the literature.
%
%
For all actions $a\in\act$ and equivalence classes $C\in \pi$, we define
%
%\begin{align*}
%\textbf{T}({\pi})(s)&=\{(a,C)\mid \exists s'\in C\colon s\overset{a}\rightarrow s'\} \\
%\textbf{B}({\pi})(s)&=\{(a,C)\mid\exists s'\in C\colon s\smash{\stackrel[\raisebox{1ex}{$\scriptstyle\equiv$}]{\tau*}{\rightarrow}}\overset{a}\rightarrow s' \wedge \neg(a=\tau\wedge s\in C)\} \\
%\textbf{R}^s({\pi})(s)&=C\mapsto\textbf{R}(s)(C) \\
%\textbf{R}^b({\pi})(s)&=C\mapsto\max(\{\textbf{R}(s')(C)\mid s\stackrel[\raisebox{1ex}{$\scriptstyle\equiv$}]{\tau*}{\rightarrow}s'\stackrel{\tau}{\nrightarrow}\})
%\end{align*}
%
%
%
\begin{itemize}
\def\arraystretch{1.1}
\item $\textbf{T}({\pi})(s)=\{(a,C)\mid \exists s'\in C\colon s\overset{a}\rightarrow s'\}$
\item $\textbf{B}({\pi})(s)=\{(a,C)\mid\exists s'\in C\colon s\smash\taustarpi\overset{a}\rightarrow s' \wedge \neg(a=\tau\wedge s\in C)\}$
\item $\textbf{R}^s({\pi})(s)=C\mapsto\textbf{R}(s)(C)$
\item $\textbf{R}^b({\pi})(s)=C\mapsto\max(\{\textbf{R}(s')(C)\mid \exists s'\colon s\smash\taustarpi s'\!\stackrel{\tau}{\nrightarrow}\})$
%\item $\textbf{D}(\pi)(s)=\exists s'\colon s{\stackrel{\tau*}{\rightarrow}s'\stackrel{\tau}{\nrightarrow}}$
\end{itemize}
%
%
The five bisimulations are associated with the following signatures:
%
%The signatures for each type of bisimulation are as follows:
%
\begin{center}
{
%\noindent
\def\arraystretch{1.1}
%\setlength\tabcolsep{0.3em}
%\setlength\tabcolsep{0em}
\begin{tabular}{@{}p{70mm}p{25mm}@{}l@{}}
Strong bisimulation for an LTS & $(\textbf{T})$ & \cite{DBLP:conf/atva/WimmerHHSB06} \\
Branching bisimulation for an LTS & $(\textbf{B})$ & \cite{DBLP:conf/atva/WimmerHHSB06} \\
Strong bisimulation for a CTMC & $(\textbf{R}^s)$ & \cite{DBLP:conf/mmb/WimmerB10} \\
Strong bisimulation for an mp-cut IMC & $(\textbf{T}, \textbf{R}^s)$ & \cite{atr16} \\
Branching bisimulation for an mp-cut IMC & $(\textbf{B}, \textbf{R}^b,s\smash{\stackrel{\tau*}{\rightarrow}\stackrel{\tau}{\nrightarrow}})$ & \cite{atr16} \\
\end{tabular}
}
\end{center}

%The function $\textbf{T}_{\eqs}(s)$ can be understood as describing the \emph{signature} or \emph{fingerprint} of state $s$ with respect to strong bisimulation, and $\textbf{B}_{\eqs}(s)$ with respect to branching bisimulation.
Functions $\textbf{T}$ and $\textbf{B}$ assign to each state $s$ all actions $a$ and equivalence classes $C\in\pi$, such that state $s$ can reach $C$ by an action $a$ either directly ($\textbf{T}$) or via any number of inert $\tau$-steps ($\textbf{B}$).
$\textbf{R}^s$ equals $\textbf{R}$ but with the domain restricted to the equivalence classes $C\in\pi$, and represents the cumulative rate with which state $s$ can go to states in $C$.
%
%
$\textbf{R}^b$ equals $\textbf{R}^s$ for states $s\!\stackrel{\tau}{\nrightarrow}$, and takes the highest ``reachable rate'' for states with inert $\tau$-transitions.
%
In branching bisimulation for mp-cut IMCs, the ``highest reachable rate'' is by definition the rate that all states ${s\!\overset{\tau}{\nrightarrow}}$ in $C$ have.
%
The element $s\smash{\stackrel{\tau*}{\rightarrow}\stackrel{\tau}{\nrightarrow}}$ distinguishes time-convergent states from time-divergent states~\cite{atr16}, and is independent of the partition.
%
%
%This is For branching bisimulation, all internal $\tau$-transitions that converge to a bisimilar state, converge to equivalent states (with the same Markovian rates), otherwise they would be external $\tau$-transitions.
%See further below why computing the maximum is a correct approach.

For the bisimulations of Definitions~\ref{def:stronglts}--\ref{def:branchingimc}, we state:

\begin{lemma}
\label{lem:parbi}
A partition $\pi$ is a bisimulation, if and only if for all $s$ and $t$ that are equivalent in $\pi$, %$C\in\pi_B$, $\forall s,t\in C\colon
$\sigma(\pi)(s)=\sigma(\pi)(t)$.
%all equivalent states
%have the same signature with respect to that equivalence relation.
\end{lemma}

For the above definitions it is fairly straightforward to prove that they are equivalent to the classical definitions of bisimulation.
See e.g.~\cite{DBLP:journals/entcs/BlomO03,DBLP:conf/atva/WimmerHHSB06} for the bisimulations on LTSs and~\cite{atr16} for the bisimulations on IMCs.

\section{Partition refinement}
The definition of signature-based partition refinement is as follows.

\begin{definition}[Partition refinement with full signatures]
\label{def:sigrefpi}
%Bisimulation via signature refinement:
\setlength{\abovedisplayskip}{0.4em}
\setlength{\belowdisplayskip}{0pt}
\begin{align*}
\sigref(\pi,\sig) \defeq\, & \{\{t\in S\mid \sig(\pi)(s) = \sig(\pi)(t)\}\mid s\in S\} \\
\pi^0 \defeq\, & \{S\} \\
\pi^{n+1} \defeq\, & \sigref(\pi^n, \sig) \\
%\pi^{\infty} \defeq\, & \pi \colon \sigref(\pi, \sig)=\pi \\
%\pi^0 \defeq\, & \{S\} \\
%\pi^{n+1} \defeq\, & \{\{t\in S\mid \sig(\pi^n)(s) = \sig(\pi^n)(t)\}\mid s\in S\}
\end{align*}
\end{definition}
%% fix double line after align*+definition
\vspace{-1.5em}

The algorithm iteratively refines the initial coarsest partition $\{S\}$ according to the signatures of the states, until some fixed point $\pi^{n+1}=\pi^{n}$ is obtained.
%
This fixed point is the maximal bisimulation for ``monotone signatures'':

\begin{definition}
%A signature $\sig$ is monotone if
%$\forall \pi'\sqsupseteq \pi\colon \forall s,t\in S\colon \sig(\pi')(s)=\sig(\pi')(t) \implies \sig(\pi)(s)=\sig(\pi)(t)$.
A signature is monotone if for all $\pi,\pi'$ with $\pi'\refines\pi$, whenever $\sig(\pi')(s)=\sig(\pi')(t)$, also $\sig(\pi)(s)=\sig(\pi)(t)$.
%all $s,t$ that have the same signature in $\pi'$ also have the same signature in $\pi$.
\end{definition}
For all monotone signatures, the $\sigref$ operator is monotone: $\pi\refines\pi'$ implies $\sigref(\pi,\sigma)\refines\sigref(\pi',\sigma)$.
Hence, following Kleene's fixed point theorem, the procedure above reaches the greatest fixed point.

%We present a variation of signature-based partition refinement.
In Definition~\ref{def:sigrefpi}, the full signature is computed in every iteration.
We propose to apply partition refinement using parts of the signature. By definition,
$\sigma(\pi)(s)=\sigma(\pi)(t)$ if and only if for all parts $f_i(\pi)(s)=f_i(\pi)(t)$.

\begin{definition}[Partition refinement with partial signatures]
\label{def:sigref2}
\setlength{\abovedisplayskip}{0.4em}
\setlength{\belowdisplayskip}{0pt}
\begin{align*}
\sigref(\pi,f_i) \defeq\, & \{\{t\in S\mid f_i(\pi)(s) = f_i(\pi)(t) \wedge s \equiv_{\pi} t \}\mid s\in S\} \\
\pi^0 \defeq\, & \{S\} \\
\pi^{n+1} \defeq\, & \sigref(\pi^n, f_i) \qquad (\textnormal{select $f_i\in\sig$})\\
%\pi^{\infty} \defeq\, & \pi \colon \forall f_i\in \sig\colon \sigref(\pi, f_i)=\pi \\
\end{align*}
\end{definition}
%% fix double line after align*+definition
\vspace{-1.5em}

We always select some $f_i$ that refines the partition $\pi$.
A fixed point is reached only when no $f_i$ refines the partition further: $\forall f_i\in \sig\colon \sigref(\pi^n, f_i)=\pi^n$.
The extra clause $s \equiv_{\pi} t$ ensures that every application of $\sigref$ refines the partition.

\begin{theorem}If all parts $f_i$ are monotone, Def.~\ref{def:sigref2} yields the greatest fixed point.\end{theorem}
\begin{proof}
The procedure terminates since the chain is decreasing ($\pi^{n+1}\refines\pi^n$), due to the added clause $s \equiv_{\pi} t$.
We reach some fixed point $\pi^n$, since $\forall f_i\in \sig\colon \sigref(\pi^n, f_i)=\pi^n$ implies $\sigref(\pi^n, \sigma)=\pi^n$.
Finally, to prove that we get the {\em greatest} fixed point,
assume there exists another fixed point $\xi=\sigref(\xi,\sigma)$. Then also $\xi=\sigref(\xi,f_i)$ for all $i$.
We prove that $\xi\refines \pi^n$ by induction on $n$. Initially, $\xi\refines {S}=\pi^0$. Assume $\xi\refines \pi^n$, then
for the selected $i$, $\xi=\sigref(\xi,f_i)\refines \sigref(\pi^n,f_i)=\pi^{n+1}$, using monotonicity of $f_i$.
\end{proof}

There are several advantages to this approach due to its flexibility.
First, for any $f_i$ that is independent of the partition, refinement with respect to that $f_i$ only needs to be applied once.
Furthermore, refinements can be applied according to different strategies.
For instance, for the strong bisimulation of an mp-cut IMC, one could refine w.r.t.\ $\textbf{T}$ until there is no more refinement,
then w.r.t.\ $\textbf{R}^s$ until there is no more refinement,
then repeat until neither $\textbf{T}$ nor $\textbf{R}^s$ refines the partition.
%
%
Finally, computing the full signature is the most memory-intensive operation in symbolic signature-based partition refinement.
If the partial signatures are smaller than the full signature, then larger models can be minimised.