Add secon batch of corrections

This commit is contained in:
Leon Vatthauer 2024-02-21 15:56:15 +01:00
parent 72c790f941
commit 294392b212
Signed by: leonv
SSH key fingerprint: SHA256:G4+ddwoZmhLPRB1agvXzZMXIzkVJ36dUYZXf5NxT+u8
4 changed files with 76 additions and 62 deletions

View file

@ -1,5 +1,7 @@
\chapter{Preliminaries}
\todo[inline]{Also note that we require some knowledge with type theory}
We assume familiarity with basic categorical notions, in particular: categories, functors, functor algebras and natural transformations, as well as special objects like (co-)products, terminal and initial objects and special morphisms like isos, epis and monos.
In this chapter we will introduce notation that will be used throughout the thesis and also introduce some notions that are crucial to this thesis in more detail.
We write $\obj{C}$ for the objects of a category $\C$, $id_X$ for the identity morphism on $X$, $(-) \circ (-)$ for the composition of morphisms and $\C(X,Y)$ for the set of morphisms between $X$ and $Y$.
@ -25,7 +27,7 @@ Let us first introduce notation for binary (co-)products by giving their usual d
\arrow["g", from=1-11, to=3-9]
\arrow["{\exists ! [f , g]}", dashed, from=1-9, to=3-9]
\end{tikzcd}\]
\caption{The defining diagrams of products and coproducts}
\caption{The defining diagrams of products and coproducts}
\end{figure}
We will furthermore overload this notation and write $f \times g := \langle f \circ \pi_1 , g \circ \pi_2 \rangle$ and $f + g := \lbrack i_1 \circ f , i_2 \circ g \rbrack$ on morphisms. To avoid parentheses we will use the convention that products bind stronger than coproducts.
@ -108,7 +110,28 @@ Categories with finite products (i.e. binary products and a terminal object) are
\end{definition}
A cartesian closed category is a cartesian category $\C$ that also has an exponential object $X^Y$ for any $X, Y \in \C$.
The internal logic of cartesian closed categories is the simply typed $\lambda$-calculus, which makes them a suitable target for interpreting programming languages. But in this thesis we will not assume a cartesian closed category as to be more general.
The internal logic of cartesian closed categories is the simply typed $\lambda$-calculus, which makes them a suitable target for interpreting programming languages. For the rest of this thesis we will work in an ambient distributive category that however does not have to be cartesian closed as to be more general.
\section{Coalgebras}
\todo[inline]{Maybe introduce (co-)induction here via (co-)algebras}
\todo[inline]{introduce (terminal) coalgebras, proof lambeks lemma}
\section{Adjunctions and Free Objects}
\todo[inline]{introduce adjunctions}
Free objects are constructions capturing the essence of structures in a minimal way, we will rely on free structures in chapter~\ref{chp:iteration} to define a monad in a general setting. We recall the definition to establish some notation:
\begin{definition}[Free Object]
Let $\C, \D$ be categories and $U : \C \rightarrow \D$ be a forgetful functor (whose construction usually is obvious). A free object on some object $X \in \obj{\D}$ is an object $FX \in \obj{\C}$ together with a morphism $\eta : X \rightarrow UFX$ such that the following universal property holds for any $Y \in \obj{\C}$ and $f : X \rightarrow UY$:
% https://q.uiver.app/#q=WzAsMyxbMCwwLCJYIl0sWzEsMCwiVVkiXSxbMCwxLCJGWCJdLFswLDEsImYiXSxbMCwyLCJcXGV0YSIsMl0sWzIsMSwiXFxleGlzdHMhXFxsbGJyYWNrZXQgZiBcXHJyYnJhY2tldCIsMl1d
\[\begin{tikzcd}
X & UY \\
FX
\arrow["f", from=1-1, to=1-2]
\arrow["\eta"', from=1-1, to=2-1]
\arrow["{\exists!\llbracket f \rrbracket}"', from=2-1, to=1-2]
\end{tikzcd}\]
\end{definition}
\section{Monads}
Monads are widely known among programmers as a way of modelling effects in pure languages and are also central to this thesis. Let us recall the basic definitions\cite{Lane1971}\cite{moggi}.
@ -260,25 +283,3 @@ Now we can express the above condition:
\arrow["{\sigma^*}", from=1-3, to=3-3]
\end{tikzcd}\]
\end{definition}
\section{Free Objects}
Free objects are constructions capturing the essence of structures in a minimal way, we will rely on free structures in chapter~\ref{chp:iteration} to define a monad in a general setting. We recall the definition to establish some notation:
\begin{definition}[Free Object]
Let $\C, \D$ be categories and $U : \C \rightarrow \D$ be a forgetful functor (whose construction usually is obvious). A free object on some object $X \in \obj{\D}$ is an object $FX \in \obj{\C}$ together with a morphism $\eta : X \rightarrow UFX$ such that the following universal property holds for any $Y \in \obj{\C}$ and $f : X \rightarrow UY$:
% https://q.uiver.app/#q=WzAsMyxbMCwwLCJYIl0sWzEsMCwiVVkiXSxbMCwxLCJGWCJdLFswLDEsImYiXSxbMCwyLCJcXGV0YSIsMl0sWzIsMSwiXFxleGlzdHMhXFxsbGJyYWNrZXQgZiBcXHJyYnJhY2tldCIsMl1d
\[\begin{tikzcd}
X & UY \\
FX
\arrow["f", from=1-1, to=1-2]
\arrow["\eta"', from=1-1, to=2-1]
\arrow["{\exists!\llbracket f \rrbracket}"', from=2-1, to=1-2]
\end{tikzcd}\]
\end{definition}
\todo[inline]{adjunction}
\todo[inline]{monad}
\section{Coalgebras}
\todo[inline]{introduce (terminal) coalgebras, proof lambeks lemma}

View file

@ -64,6 +64,6 @@ From this it should be clear how other basic notions like functors or natural tr
\improvement{explain more}
The agda formalization of this thesis is structured similar to the agda-categories library, e.g. 'big' concepts like monads and categories get a top-level folder, that itself contains the core definitions, folders for sub-concepts and their properties, and possibly folders 'Instances' for specific instances and 'Construction' for blueprints for constructing this concept (e.g. the kleisli category of a monad would be in 'Category.Construction.Kleisli'.
The agda formalization of this thesis is structured similar to the agda-categories library, e.g. key concepts like monads and categories correspond to separate top-level folders, which contain the core definitions as well as folders for sub-concepts and their properties, and possibly folders 'Instances' for specific instances, and 'Construction' for blueprints for constructing this concept (e.g. the Kleisli category of a monad would be in 'Category.Construction.Kleisli'.
The source code of the formalization can be found \href{https://git8.cs.fau.de/theses/bsc-leon-vatthauer}{here} (internal) or as clickable HTML \href{https://wwwcip.cs.fau.de/~hy84coky/bsc-thesis/}{here} (public).

View file

@ -6,15 +6,17 @@ For this thesis we will restrict ourselves to monads for modelling partiality, t
\section{Properties of Partiality Monads}
We will now look at how to express the following non-controversial properties of partiality monads categorically:
\todo[inline]{Not happy with third point}
\begin{itemize}
\item Commutativity of programs
\item Programs should be partial
\item There should be no other effect besides partiality
\item Irrelevance of execution order
\item Partiality of programs
\item No other effect besides partiality
\end{itemize}
The first property of course holds for any commutative monad, the other two are more interesting.
To ensure that programs are partial, we recall the following notion by Cockett and Lack~\cite{restriction}, that ensures that morphisms of a category are partial maps:
To ensure that programs are partial, we recall the following notion by Cockett and Lack~\cite{restriction}, that axiomatizes the notion of partiality in a category:
\newcommand{\tdom}{\text{dom}\;}
\begin{definition}[Restriction Structure]
@ -27,16 +29,18 @@ To ensure that programs are partial, we recall the following notion by Cockett a
\end{alignat*}
for any $X, Y, Z \in \vert\mathcal{C}\vert, f : X \rightarrow Y, g : X \rightarrow Z, h: Y \rightarrow Z$.
\end{definition}
\todo[inline]{be more precise}
Intuitively $\tdom f$ captures the domain of definedness of $f$.
\begin{definition}[Restriction Category]
Every category has a trivial restriction structure by taking $dom (f : X \rightarrow Y) = id_X$.
A \textit{restriction category} is a category with a non-trivial restriction structure.
We call categories with a non-trivial restriction structure \textit{restriction categories}.
\end{definition}
A partiality monad $T$ should then have the property that $\mathcal{C}^T$ is a restriction category.
A suitably defined partiality monad $T$ should then have the property that $\mathcal{C}^T$ is a restriction category.
Lastly we also recall the following notion by Bucalo et al.~\cite{eqlm} which captures what it means for a monad to have no other side effect besides partiality:
Lastly we also recall the following notion by Bucalo et al.~\cite{eqlm} which captures what it means for a monad to have no other side effect besides some sort of non-termination:
\begin{definition}[Equational Lifting Monad]
\label{def:eqlm}
@ -53,6 +57,7 @@ Lastly we also recall the following notion by Bucalo et al.~\cite{eqlm} which ca
where $\Delta : X \rightarrow X \times X$ is the diagonal morphism.
\end{definition}
\todo[inline]{proof?}
\begin{theorem}[no proof]
Let $T$ be an equational lifting monad, then $\mathcal{C}^T$ is a restriction category~\cite{eqlm}.
\end{theorem}
@ -60,7 +65,7 @@ Lastly we also recall the following notion by Bucalo et al.~\cite{eqlm} which ca
Definition~\ref{def:eqlm} combines all three properties stated above, so when studying partiality monads in this thesis, we ideally expect them to be equational lifting monads. For the rest of this chapter we will use these definitions to compare two common examples of monads that are used to model partiality.
\section{The Maybe Monad}
The endofunctor $MX = X + 1$ extends to a monad by taking $\eta_X : X \rightarrow X + 1 = i_1$ and $\mu_X : (X + 1) + 1 \rightarrow X + 1 = [ id , i_2 ]$. The monad laws follow easily. This is generally known as the maybe monad and can be viewed as the prototypical example of an equational lifting monad:
The endofunctor $MX = X + 1$ extends to a monad by taking $\eta_X = i_1 : X \rightarrow X + 1$ and $\mu_X = [ id , i_2 ] : (X + 1) + 1 \rightarrow X + 1$. The monad laws follow easily. This is generally known as the maybe monad and can be viewed as the prototypical example of an equational lifting monad:
\begin{theorem} M is an equational lifting monad.
\end{theorem}
@ -91,7 +96,7 @@ The endofunctor $MX = X + 1$ extends to a monad by taking $\eta_X : X \rightarro
\arrow["{id+\;!}", from=3-4, to=5-4]
\arrow["{\langle i_1,id\rangle + \;!}"', from=1-1, to=5-4]
\end{tikzcd}\]
By postcomposing $i_1$ and $i_2$ it suffices to show that:
By pre-composing with $i_1$ and $i_2$ it suffices to show that
\[i_1 \circ \langle i_1 , id \rangle = (id\;+\;!) \circ dstl \circ \langle i_1 , i_1 \rangle\]
and
\[i_2 \;\circ \;! = (id\;+\;!) \circ dstl \circ \langle i_2 , i_2 \rangle\]
@ -101,27 +106,30 @@ The endofunctor $MX = X + 1$ extends to a monad by taking $\eta_X : X \rightarro
\[dstl \circ (id \times i_2) = i_2\]
\end{proof}
In a classical setting this monad is therefore sufficient for modelling partiality, but in general it won't be useful for modelling programming languages that have non-termination as a side effect, since one would need to know beforehand whether a program terminates or not. For the purpose of modelling possibly non-terminating computations another monad has been developed by Venanzio Capretta.
In the setting of classical mathematics this monad is therefore sufficient for modelling partiality, but in general it will not be useful for modelling non-termination as a side effect, since one would need to know beforehand whether a program terminates or not. For the purpose of modelling possibly non-terminating computations another monad has been developed by Capretta~\cite{delay}.
\section{The Delay Monad}
Capretta's delay monad~\cite{delay} is a coinductive datatype whose inhabitants can be viewed as suspended computations.
It is usually defined by the two coinductive constructors $now$ and $later$, where $now$ is for lifting a value to a computation and $later$ intuitively delays a computation by one time unit:
This monad is usually defined by the two coinductive constructors $now$ and $later$, where $now$ is for lifting a value to a computation and $later$ intuitively delays a computation by one time unit:
\todo[inline]{Explain coinduction in introduction or here?}
\todo[inline]{Explain convention of double lines vs single lines}
\[\mprset{fraction={===}}
\inferrule {x : X} {now\; x : DX}\hskip 2cm
\inferrule {c : DX} {later\; c : DX}\]
Categorically we get this monad by the final coalgebras $DX = \nu A. X + A$, which we assume to exist. In this section we will show that $\mathbf{D}$ is a strong and commutative monad.
Categorically we obtain this monad by the final coalgebras $DX = \nu A. X + A$, which we assume to exist. In this section we will show that $\mathbf{D}$ is a strong and commutative monad.
Since $DX$ is defined as a final coalgebra, we can define morphisms via corecursion and prove theorems by coinduction. By Lambek's lemma the coalgebra structure $out : DX \rightarrow X + DX$ is an isomorphism, whose inverse can be decomposed into the two constructors mentioned before: $out^{-1} = [ now , later ] : X + DX \rightarrow DX$.
\begin{corollary}
\begin{proposition}
\label{col:delay}
The following conditions hold:
\begin{itemize}
\item There exists a unit morphism $\eta : X \rightarrow DX$ for any DX, satisfying
\item There exists a unit morphism $now : X \rightarrow DX$ for any DX, satisfying
\begin{equation*}
out \circ unit = i_1 \tag*{(D1)}\label{D1}
out \circ now = i_1 \tag*{(D1)}\label{D1}
\end{equation*}
\item For any $f : X \rightarrow DY$ there exists a unique morphism $f^* : DX \rightarrow DY$ satisfying:
\begin{equation*}
@ -149,11 +157,14 @@ Since $DX$ is defined as a final coalgebra, we can define morphisms via corecurs
\end{tikzcd}\tag*{(D3)}\label{D3}
\end{equation*}
\end{itemize}
\end{corollary}
\end{proposition}
\begin{proof}
\begin{itemize}
\item[\ref{D1}] Take $\eta = now$ then $out \circ now = i_1$ follows by definition of $now$.
We will make use of the fact that every $DX$ is a final coalgebra:
\begin{itemize}
\item[\ref{D1}] This follows by definition of $now$.
\item[\ref{D2}] We define $f^* = \;! \circ i_1$, where $!$ is the unique coalgebra-morphism in this diagram:
\todo[inline]{Use other name than '!' for unique morphism}
% https://q.uiver.app/#q=WzAsNSxbMCwxLCJEWCArIERZIl0sWzcsMSwiWSArIChEWCArIERZKSJdLFswLDAsIkRYIl0sWzAsMiwiRFkiXSxbNywyLCJZICsgRFkiXSxbMCwxLCJbIFsgWyBpXzEgLCBpXzIgXFxjaXJjIGlfMiBdIFxcY2lyYyAob3V0IFxcY2lyYyBmKSAsIGlfMiBcXGNpcmMgaV8xIF0gXFxjaXJjIG91dCAsIChpZCArIGlfMikgXFxjaXJjIG91dCBdIl0sWzIsMCwiaV8xIl0sWzAsMywiISIsMCx7InN0eWxlIjp7ImJvZHkiOnsibmFtZSI6ImRhc2hlZCJ9fX1dLFszLDQsIm91dCJdLFsxLDQsImlkICsgISIsMCx7InN0eWxlIjp7ImJvZHkiOnsibmFtZSI6ImRhc2hlZCJ9fX1dXQ==
\[\begin{tikzcd}
DX \\
@ -167,10 +178,10 @@ Since $DX$ is defined as a final coalgebra, we can define morphisms via corecurs
\end{tikzcd}\]
$out \circ f^* = [ out \circ f , i_2 \circ f^* ] \circ out$ then follows from this diagram.
We are left to check uniqueness, let $g : DX \rightarrow DY$ and $out \circ g = [ out \circ f , i_2 \circ g ] \circ out$.
Then $[ g , id ] : DX + DY \rightarrow DY$ is a coalgebra morphism, we get $[ g , id ] =\;!$ by uniqueness of $!$, it follows:
\[g = [ g , id ] \circ i_1 =\;! \circ i_1 = f^*\]
\item[\ref{D3}] This follows immediately, $\tau$ is the unique coalgebra morphism from $(X \times DY, dstl \circ (id \times out))$ into the terminal coalgebra $(D(X \times Y) , out)$.
We are left to check uniqueness. Let $g : DX \rightarrow DY$ and $out \circ g = [ out \circ f , i_2 \circ g ] \circ out$.
Then $[ g , id ] : DX + DY \rightarrow DY$\improvement{details of why it is coalgebra morphism} is a coalgebra morphism and thus $[ g , id ] =\;!$ by uniqueness of $!$.
It follows: \[g = [ g , id ] \circ i_1 =\;! \circ i_1 = f^*\]
\item[\ref{D3}] This follows immediately since $\tau$ is the unique coalgebra morphism from $(X \times DY, dstl \circ (id \times out))$ into the terminal coalgebra $(D(X \times Y) , out)$.
\end{itemize}
\end{proof}
@ -178,24 +189,23 @@ Since $DX$ is defined as a final coalgebra, we can define morphisms via corecurs
$\mathbf{D} = (D, now, (-)^*)$ is a kleisli triple.
\end{theorem}
\begin{proof}
We will use the properties proven in corollary~\ref{col:delay} to prove the kleisli triple and strength laws.
First we show that $(D , now, (-)^*)$ is a kleisli triple:
We will now use the properties proven in Corollary~\ref{col:delay} to prove the Kleisli triple laws:
\begin{itemize}
\item[\ref{K1}]
By uniqueness of $now^*$ it suffices to show that $out \circ id = [ out \circ now , i_2 \circ id ] \circ out$ which instantly follows by \ref{D1}.
\item[\ref{K2}] Let $f : X \rightarrow DY$, we use the fact that $out$ is monic:
\item[\ref{K2}] Let $f : X \rightarrow DY$. We use the fact that $out$ is monic and the following equation:
\[out \circ f^* \circ now \overset{\ref{D2}}{=} [ out \circ f , i_2 \circ f^* ] \circ out \circ now \overset{\ref{D1}}{=} out \circ f \]
\item[\ref{K3}] Using uniqueness of $(h^* \circ g)^*$ we need to show $out \circ h^* \circ g^* = [ out \circ h^* \circ g , i_2 \circ h^* \circ g^* ] \circ out$ which follows by multiple uses of \ref{D2}.
\todo[inline]{More details probably for both K2 and K3}
\end{itemize}
\end{proof}
Since $(DX, out)$ is a final coalgebra we get the following proof principle:
\begin{remark}[Proof by coinduction]
\label{rem:coinduction}
Given two morphisms $f, g : X \rightarrow DY$.
To show that $f = g$ it suffices to show that there exists a coalgebra structure $\alpha : X \rightarrow Y + X$ such that the following diagrams commute:
Given two morphisms $f, g : X \rightarrow DY$, to show that $f = g$ it suffices to show that there exists a coalgebra structure $\alpha : X \rightarrow Y + X$ such that the following diagrams commute:
% https://q.uiver.app/#q=WzAsOCxbMCwwLCJYIl0sWzAsMSwiRFkiXSxbMiwxLCJZICsgRFkiXSxbMiwwLCJZICsgWCJdLFs0LDAsIlgiXSxbNCwxLCJEWSJdLFs2LDAsIlkgKyBYIl0sWzYsMSwiWSArIERZIl0sWzEsMiwib3V0Il0sWzAsMywiXFxhbHBoYSJdLFswLDEsImYiXSxbMywyLCJpZCArIGYiXSxbNCw2LCJcXGFscGhhIl0sWzQsNSwiZyJdLFs2LDcsImlkICsgZyJdLFs1LDcsIm91dCIsMl1d
\[\begin{tikzcd}
X && {Y + X} && X && {Y + X} \\
@ -216,7 +226,7 @@ Since $(DX, out)$ is a final coalgebra we get the following proof principle:
$\mathbf{D}$ is a strong monad.
\end{theorem}
\begin{proof}
Most of the following proofs are done via coinduction (remark~\ref{rem:coinduction}), we will only give the needed coalgebra structure, the proofs that the diagrams commute can be looked up in the agda formalization.
Most of the following proofs are done via coinduction (Remark~\ref{rem:coinduction}). We will only give the requisite coalgebra structure. The proofs that the diagrams commute can be looked up in the Agda formalization.
First we need to show naturality of $\tau$, i.e. we need to show that
\[\tau \circ (f \times (now \circ g)^*) = (now \circ (f \times g))^* \circ \tau\]
@ -289,10 +299,11 @@ Since $(DX, out)$ is a final coalgebra we get the following proof principle:
\end{itemize}
\end{proof}
To show that $\mathbf{D}$ is commutative we will use another proof principle previously called the \textit{Solution Theorem}~\cite{sol-thm} and \textit{Parametric Corecursion}~\cite{param-corec}. In our setting this takes the following form:
To show that $\mathbf{D}$ is commutative we will use another proof principle previously called the \textit{Solution Theorem}~\cite{sol-thm} or \textit{Parametric Corecursion}~\cite{param-corec}. In our setting this takes the following form:
\begin{definition}
We call a morphism $g : X \rightarrow D (Y + X)$ \textit{guarded} if there exists an $h : X \rightarrow Y + D(Y+X)$ such that the following diagram commutes:
\todo[inline]{change name of morphism}
% https://q.uiver.app/#q=WzAsNCxbMCwwLCJYIl0sWzMsMCwiRCAoWSArWCkiXSxbMywxLCIoWSArIFgpICsgRChZICsgWCkiXSxbMCwxLCJZICsgRChZK1gpIl0sWzAsMSwiZyJdLFsxLDIsIm91dCJdLFszLDIsImlfMSArIGlkIiwyXSxbMCwzLCJoIiwyXV0=
\[\begin{tikzcd}[ampersand replacement=\&]
X \&\&\& {D (Y +X)} \\

View file

@ -81,7 +81,7 @@ We can form products and exponentials of Elgot algebras in a canonical way, for
Pre-Elgot monads on $\C$ form a category that is a subcategory of $\monads{\C}$.
\begin{definition}[Category of pre-Elgot monads]
Let $\C$ be a category. We define the category $\preelgot{\C}$ where objects are pre-Elgot monads and a morphism between two pre-Elgot monads $(S, \eta^S, \mu^S, (-)^{\#_S})$ and $(T, \eta^T, \mu^T, (-)^{\#_T})$ is a natural transformation $\alpha : S \rightarrow T$ satisfying the following diagrams:
Let $\C$ be a category. We define the category $\preelgot{\C}$ where objects are pre-Elgot monads and morphisms between two pre-Elgot monads $(S, \eta^S, \mu^S, (-)^{\#_S})$ and $(T, \eta^T, \mu^T, (-)^{\#_T})$ are natural transformations $\alpha : S \rightarrow T$ satisfying the following diagrams:
% https://q.uiver.app/#q=WzAsMTEsWzAsMCwiWCJdLFsyLDAsIlNYIl0sWzIsMSwiVFgiXSxbMywwLCJTU1giXSxbNSwwLCJTVFgiXSxbMywxLCJTWCJdLFs1LDEsIlRUWCJdLFs0LDIsIlRYIl0sWzYsMCwiWCJdLFs4LDAsIlNBIl0sWzgsMSwiVEEiXSxbMCwxLCJcXGV0YV5TIl0sWzEsMiwiXFxhbHBoYSJdLFswLDIsIlxcZXRhXlQiLDJdLFszLDQsIlNcXGFscGhhIl0sWzMsNSwiXFxtdV5TIiwyXSxbNCw2LCJcXGFscGhhIl0sWzUsNywiXFxhbHBoYSIsMl0sWzYsNywiXFxtdV5UIl0sWzksMTAsIlxcYWxwaGEiXSxbOCw5LCJoXntcXCNfU30iXSxbOCwxMCwiKChcXGFscGhhICsgaWQpIFxcY2lyYyBmKV57XFwjX1R9IiwyXV0=
\[\begin{tikzcd}
X && SX & SSX && STX & X && SA \\
@ -103,7 +103,7 @@ Pre-Elgot monads on $\C$ form a category that is a subcategory of $\monads{\C}$.
\todo[inline]{Category of (strong) pre-Elgot monads, introduce category of monads in preliminaries}
\section{The Initial Pre-Elgot Monad}
\section{The Initial Strong Pre-Elgot Monad}
In this section we will study the monad that arises from existence of all free Elgot algebras. We will show that this is an equational lifting monad and also the initial pre-Elgot monad.
\begin{lemma}
@ -181,11 +181,15 @@ Of course there is also a symmetric version of this:
Given two morphisms $g, h : KY \times X \rightarrow A$ where $X, Y \in \obj{\C}, A \in \obj{\elgotalgs{\C}}$ to show that $g = h$ it suffices to find a morphism $f : Y \times X \rightarrow A$ such that $g$ and $h$ satisfy \ref{sharpl1} and \ref{sharpl2}.
\end{remark}
\todo[inline]{Maybe do a helper proposition first that characterizes tau with the three laws in the file}
\begin{theorem}
$\mathbf{K}$ is a strong monad.
\end{theorem}
\begin{proof}
We define strength as $\tau : (\eta : X \times Y \rightarrow K(X \times Y))^\sharp : X \times KY \rightarrow K(X \times Y)$
We define strength as $\tau = (\eta : X \times Y \rightarrow K(X \times Y))^\sharp : X \times KY \rightarrow K(X \times Y)$
\change[inline]{Maybe put complete proof}
To check naturality and the strength laws we will use remark~\ref{rem:proofbystability} and for brevity only state the needed unifying morphism by pasting \ref{sharpl1} into the required diagram. The proofs of \ref{sharpr1} and \ref{sharpr2} can then be looked up in the formalization.
@ -220,7 +224,7 @@ Of course there is also a symmetric version of this:
The strength laws are proven similarly:
\begin{itemize}
\item[\ref{S1}]
\item[\ref{S1}] This is an instance of the following more general law that holds on $\mathbf{K}$:
% https://q.uiver.app/#q=WzAsNCxbMCwwLCJYIFxcdGltZXMgS1kiXSxbMiwwLCJLKFhcXHRpbWVzIFkpIl0sWzIsMiwiS1kiXSxbMCwyLCJYIFxcdGltZXMgWSJdLFswLDEsIlxcdGF1Il0sWzEsMiwiS1xccGlfMiJdLFswLDIsIlxccGlfMiIsMl0sWzMsMCwiaWQgXFx0aW1lcyBcXGV0YSIsMl0sWzMsMiwiXFxldGEgXFxjaXJjIFxccGlfMiIsMl1d
\[\begin{tikzcd}
{X \times KY} && {K(X\times Y)} \\
@ -232,7 +236,6 @@ Of course there is also a symmetric version of this:
\arrow["{id \times \eta}"', from=3-1, to=1-1]
\arrow["{\eta \circ \pi_2}"', from=3-1, to=3-3]
\end{tikzcd}\]
\todo{this is more general than S1}
\item[\ref{S2}]
This is an instance of \ref{sharpr1}.
@ -268,8 +271,6 @@ Of course there is also a symmetric version of this:
\end{itemize}
\end{proof}
\change[inline]{Use sigma instead of hat(tau)}
\begin{theorem}
$\mathbf{K}$ is a commutative monad.
\end{theorem}
@ -288,6 +289,7 @@ Of course there is also a symmetric version of this:
\arrow["{id \times \eta}", curve={height=-12pt}, from=4-1, to=1-2]
\arrow["{\sigma}"', curve={height=12pt}, from=4-1, to=3-4]
\end{tikzcd}\]
\todo[inline]{Maybe don't omit proofs, give them point by point?}
The proofs for \ref{sharpr1} and the proof that $\sigma^* \circ \tau$ is right iteration preserving are straightforward and can be looked up in the formalization.
The proof that $\tau^* \circ \sigma$ is right iteration preserving is non-trivial, so we will look at it in more detail:
Let $Z \in \obj{\C}, h : Z \rightarrow KY + Z$ and let us introduce a definition for brevity: $\psi = \tau^* \circ \sigma$. We now use remark~\ref{rem:proofbyleftstability} to show that $\psi$ is right iteration preserving:
@ -320,6 +322,6 @@ Of course there is also a symmetric version of this:
$\mathbf{K}$ is the initial (strong) pre-Elgot monad.
\end{theorem}
\begin{proof}
$\mathbf{K}$ is by definition a pre-Elgot monad, we are left to show that it is the initial one.
Note that $\mathbf{K}$ is by definition a pre-Elgot monad.
\todo[inline]{proof that K is initial strong pre-Elgot}
\end{proof}