Compare commits

...

2 commits

Author SHA1 Message Date
031df0312d
sync todays work 2024-02-14 16:59:30 +01:00
896dc3d296
update index 2024-02-14 12:03:57 +01:00
7 changed files with 212 additions and 31 deletions

2
.gitignore vendored
View file

@ -2,7 +2,7 @@
*.agdai
*.log
Everything.agda
public/
agda/public/
.direnv
.DS_Store

View file

@ -21,9 +21,10 @@ clean:
# push compiled html to my cip directory
push: all
chmod +w public/Agda.css
mv public bsc-thesis
scp -r bsc-thesis hy84coky@cip2a7.cip.cs.fau.de:.www/
mv bsc-thesis public
rm -rf bsc-thesis
mv -T public bsc-thesis
scp -r bsc-thesis hy84coky@cip1d1.cip.cs.fau.de:.www/
mv -T bsc-thesis public
Everything.agda:
echo "{-# OPTIONS --guardedness #-}" > src/Everything.agda

View file

@ -57,6 +57,13 @@ Afterwards we also introduce categories of iteration algebras with iteration pre
open import Category.Construction.ElgotAlgebras
```
we can form products and exponentials in a canonical way:
```agda
open import Category.Construction.ElgotAlgebras.Products
open import Category.Construction.ElgotAlgebras.Exponentials
```
Free Elgot algebras are free objects in the category of Elgot algebras, we will be needing a notion of stability for them:
```agda
@ -83,7 +90,7 @@ open import Monad.Instance.K.Commutative
open import Monad.Instance.K.EquationalLifting
```
and lastly we formalize the notion of *pre-Elgot monad* and show that **K** is the initial (strong) pre-Elgot monad.
and lastly we formalize the notion of *(strong) pre-Elgot monad* and show that **K** is the initial (strong) pre-Elgot monad.
```agda
open import Monad.PreElgot

View file

@ -28,6 +28,7 @@
\usepackage{tikz}
\usetikzlibrary{cd, babel, quotes}
\usepackage{quiver}
\usepackage{stmaryrd} % for \llbracket and \rrbracket
\usepackage{ifthen}
\usepackage{xspace}
\usepackage{hyperref}
@ -108,6 +109,7 @@
%\setmonofont{Noto Sans Mono}
\newcommand{\obj}[1]{\ensuremath{\vert \mathcal{#1} \vert}}
\newcommand{\elgotobj}[1]{\ensuremath{\vert \mathit{Elgot}(\mathcal{#1}) \vert}}
\begin{document}
\pagestyle{plain}
\input{src/titlepage}%

View file

@ -213,6 +213,16 @@ Now we can express the above condition:
\end{definition}
\section{Free Objects}
\todo[inline]{Definition of 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:
For the rest of this thesis we will work in an ambient distributive category $\mathcal{C}$ that has a stable natural numbers object $\mathbb{N}$.
\begin{definition}[Free Object]
Let $\mathcal{C}, \mathcal{D}$ be categories and $U : C \rightarrow D$ a forgetful functor (whose construction usually is obvious). A free object on some object $X \in \mathcal{D}$ is an object $FX \in \mathcal{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}

View file

@ -3,11 +3,10 @@
There are many formalizations of category theory in proof assistants like Coq or Agda. The benefits are clear, having a usable formalization allows one to reason about categorical notions in a typechecked environment that makes errors less likely.
Also ideally such a development will bring researchers together and enable them to work in a unified setting.
In this thesis we will work with the dependently typed programming language Agda~\cite{agda} and the agda-categories~\cite{agda-categories} library by Jason Hu and Jacques Carette that gives us a good foundation of categorical definitions to work with.
This section shall serve as a quick introduciton to the library.
\change[inline]{rewrite intro text, goal of chapter changed to introducing the thesis project}
This chapter shall serve as a quick introduction to the library and the formalization of this thesis.
\section{Setoid Enriched Categories}
The usual textbook definition of category hides some design decisions that have to be made when implementing it in type theory. One would usually see something like this:
The usual textbook definition of a category hides some design decisions that have to be made when implementing it in type theory. One would usually see something like this:
\begin{definition}[Category]
A category consists of
\begin{itemize}

View file

@ -1,4 +1,4 @@
\chapter{Iteration Algebras and Monads}
\chapter{Iteration Algebras and Monads}\label{chp:iteration}
In this chapter we will draw on the inherent connection between recursion and iteration to establish a partiality monad in a general setting without axioms that comes from previous results in the research on iteration theories.
\section{Elgot Algebras}
@ -38,7 +38,7 @@ A morphism between Elgot algebras $h : (A, (-)^{\#_a}) \rightarrow (B, (-)^{\#_a
The laws concerning $id$ and composition follow directly since they hold in $\mathcal{C}$.
\end{proof}
\improvement{Add some text}
We can form products and exponentials of Elgot algebras in a canonical way, for products this is even stronger:
\begin{lemma}
If $\mathcal{C}$ is a cartesian category, so is $\mathit{Elgot}(\mathcal{C})$.
@ -54,12 +54,13 @@ A morphism between Elgot algebras $h : (A, (-)^{\#_a}) \rightarrow (B, (-)^{\#_a
The product diagram of $A \times B$ in $\mathcal{C}$ then also holds in $\mathit{Elgot}(\mathcal{C})$, we just have to check that the projections are iteration preserving, which follows instantly, and that the unique morphism $\langle f , g \rangle$ is iteration preserving for any $f : (Z, (-)^{\#_z}) \rightarrow (X, (-)^{\#_x}), g : (Z, (-)^{\#_z}) \rightarrow (Y, (-)^{\#_y})$, which follows since $f$ and $g$ are iteration preserving.
\end{proof}
\improvement{Add some text}
\todo[inline]{add Exponentials}
\begin{lemma}
\begin{lemma}\label{lem:elgotexp}
Given $X \in \obj{C}$ and $(A, (-)^{\#_a}) \in \vert\mathit{Elgot}(\mathcal{C})\vert$. The exponential $X^A$ (if it exists) can be equipped with an Elgot algebra structure.
\end{lemma}
\begin{proof}
Take $f^\# = curry (((eval + id) \circ dstr \circ (f \times id))^{\#_a})$ for any $f : Z \rightarrow A^X + Z$.
The \textbf{Fixpoint}, \textbf{Uniformity} and \textbf{Folding} laws for $(A^X, (-)^\#)$ follow by the laws of $(A, (-)^{\#_a})$ and some rewriting using properties of distributive categories.
\end{proof}
\section{Pre-Elgot Monads}
@ -77,6 +78,8 @@ A morphism between Elgot algebras $h : (A, (-)^{\#_a}) \rightarrow (B, (-)^{\#_a
\change[inline]{be more concrete with types here}
\end{remark}
\todo[inline]{Category of (strong) pre-Elgot monads, introduce category of monads in preliminaries}
\section{The Initial 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.
@ -90,10 +93,10 @@ In this section we will study the monad that arises from existence of all free E
To show that $\mathbf{K}$ is strong we will need a notion of stability:
\begin{definition}[Right-Stable Free Elgot Algebra]\label{def:rightstablefreeelgot}
Let $KY$ be a free Elgot algebra on $Y \in \obj{C}$. We call $KY$ \textit{right-stable} if for every $A \in \mathit{Elgot}(\mathcal{C})$ and $f : X \times Y \rightarrow A$ there exists a unique $f^\sharp_r : X \times KY \rightarrow A$ satisfying:
Let $KY$ be a free Elgot algebra on $Y \in \obj{C}$. We call $KY$ \textit{right-stable} if for every $A \in \mathit{Elgot}(\mathcal{C})$ and $f : X \times Y \rightarrow A$ there exists a unique $f^{\sharp_r} : X \times KY \rightarrow A$ satisfying:
\begin{alignat*}{1}
&f = f^\sharp_r \circ (id \times \eta)\tag*{($\sharp_r 1$)}\label{sharpr1}\\
&f^\sharp_r \circ (id \times h^\#) = ((f + id) \circ dstl \circ (id \times h))^\#\tag*{($\sharp_r 2$)}\label{sharpr2}
&f = f^{\sharp_r} \circ (id \times \eta)\tag*{($\sharp_r 1$)}\label{sharpr1}\\
&f^{\sharp_r} \circ (id \times h^\#) = ((f + id) \circ dstl \circ (id \times h))^\#\tag*{($\sharp_r 2$)}\label{sharpr2}
\end{alignat*}
We also call the property that \ref{sharpr2} establishes \textit{right iteration preserving}.
\end{definition}
@ -101,10 +104,10 @@ To show that $\mathbf{K}$ is strong we will need a notion of stability:
We get the following dual definition:
\begin{definition}[Left-Stable Free Elgot Algebra]\label{def:leftstablefreeelgot}
Let $KY$ be a free Elgot algebra on $Y \in \obj{C}$. We call $KY$ \textit{left-stable} if for every $A \in \mathit{Elgot}(\mathcal{C})$ and $f : Y \times X \rightarrow A$ there exists a unique $f^\sharp_l : KY \times X \rightarrow A$ satisfying:
Let $KY$ be a free Elgot algebra on $Y \in \obj{C}$. We call $KY$ \textit{left-stable} if for every $A \in \mathit{Elgot}(\mathcal{C})$ and $f : Y \times X \rightarrow A$ there exists a unique $f^{\sharp_l} : KY \times X \rightarrow A$ satisfying:
\begin{alignat*}{1}
&f = f^\sharp_l \circ (\eta \times id)\tag*{($\sharp_l 1$)}\label{sharpl1}\\
&f^\sharp_l \circ (h^\# \times id) = ((f + id) \circ dstr \circ (h \times id))^\#\tag*{($\sharp_l 2$)}\label{sharpl2}
&f = f^{\sharp_l} \circ (\eta \times id)\tag*{($\sharp_l 1$)}\label{sharpl1}\\
&f^{\sharp_l} \circ (h^\# \times id) = ((f + id) \circ dstr \circ (h \times id))^\#\tag*{($\sharp_l 2$)}\label{sharpl2}
\end{alignat*}
We also call the property that \ref{sharpl2} establishes \textit{left iteration preserving}.
\end{definition}
@ -122,19 +125,178 @@ We get the following dual definition:
\end{itemize}
\end{proof}
We will usually refer to right-stable free Elgot algebras as just stable Elgot algebras.
We will usually refer to right-stable free Elgot algebras as just stable Elgot algebras and omit the index of the operator.
\todo[inline]{proof that KX stable in CCC}
Stability of $KX$ expresses that it somehow behaves like it would in a cartesian closed category, the following theorem should then follow trivially:
\begin{theorem}
In a cartesian closed category every free Elgot algebra is stable.
\end{theorem}
\begin{proof}
TODO
Let $X \in \obj{C}$ and $((KX, (-)^\#), \llbracket - \rrbracket)$ be a free Elgot algebra on $X$.
We will show that $KX$ is left-stable, i.e. given $X \in \obj{C}, A \in \vert\mathit{Elgot}(\mathcal{C})\vert$ and $f : Y \times X \rightarrow A$ we define
$f^{\sharp_l} := eval \circ (\llbracket curry\;f \rrbracket \times id)$.
Note that we are using the universal property of a free object over $\textit{Elgot}(\mathcal{C})$ which when spelled out requires us to show that $A^X$ is an Elgot algebra, for that we reference lemma~\ref{lem:elgotexp}.
\ref{sharpl1} and \ref{sharpl2} then follow by properties of the exponential and of distributive categories, uniqueness is more interesting:
Let $g : KY \times X \rightarrow A$ be a morphism satisfying \ref{sharpl1} and \ref{sharpl2}, we need to show that $g = eval \circ (\llbracket curry\;f \rrbracket \times id)$. We use that fact that $curry$ is an injective mapping, i.e. it suffices to show that:
\[curry\; g = \llbracket curry\;f \rrbracket = curry (eval \circ (\llbracket curry\;f \rrbracket \times id))\]
Where the second step holds for any exponential and the first step is proven by the universal property of free objects, i.e. we need to show that $curry\;g \circ \eta = curry\;f$ which follows by \ref{sharpl1} and we need to check that $curry\;g$ is left iteration preversing which follows from \ref{sharpl2}.
\end{proof}
\todo[inline]{proof that K is strong and commutative}
For the rest of this chapter we will assume every $KX$ to exist and be stable to show that it is an equational lifting monad and in fact the initial strong pre-Elgot monad.
\todo[inline]{proof that K is equational lifting}
Before proving strength, we will introduce a proof principle similar to remark~\ref{rem:coinduction}.
\todo[inline]{proof that K is initial strong pre-Elgot}
\begin{remark}[Proof by stability]~\label{rem:proofbystability}
Given two morphisms $g, h : X \times KY \rightarrow A$ where $X, Y \in \obj{C}, A \in \elgotobj{C}$ to show that $g = h$ it suffices to find a morphism $f : X \times Y \rightarrow A$ such that $g$ and $h$ satisfy \ref{sharpr1} and \ref{sharpr2}.
\end{remark}
Of course there is also a symmetric version of this:
\begin{remark}[Proof by left-stability]~\label{rem:proofbyleftstability}
Given two morphisms $g, h : KY \times X \rightarrow A$ where $X, Y \in \obj{C}, A \in \elgotobj{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}
\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)$
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.
% For naturality of $\tau$, i.e. $\tau \circ (f \times Kg) = K(f \times g) \circ \tau$ for $f : A \rightarrow X, g : B \rightarrow Y$ we use:
For naturality of $\tau$ we use:
% % https://q.uiver.app/#q=WzAsMyxbMCwwLCJBIFxcdGltZXMgS0IiXSxbMiwwLCJLKFggXFx0aW1lcyBZKSJdLFswLDIsIkEgXFx0aW1lcyBCIl0sWzAsMSwiXFx0YXUgXFxjaXJjIChmIFxcdGltZXMgS2cpIiwwLHsib2Zmc2V0IjotMX1dLFswLDEsIksoZlxcdGltZXMgZykgXFxjaXJjIFxcdGF1IiwyLHsib2Zmc2V0IjoxfV0sWzIsMCwiaWQgXFx0aW1lcyBcXGV0YSIsMl0sWzIsMSwiXFxldGEgXFxjaXJjIEsoZiBcXHRpbWVzIGcpIiwyXV0=
% \[\begin{tikzcd}
% {A \times KB} && {K(X \times Y)} \\
% \\
% {A \times B}
% \arrow["{\tau \circ (f \times Kg)}", shift left, from=1-1, to=1-3]
% \arrow["{K(f\times g) \circ \tau}"', shift right, from=1-1, to=1-3]
% \arrow["{id \times \eta}"', from=3-1, to=1-1]
% \arrow["{\eta \circ K(f \times g)}"', from=3-1, to=1-3]
% \end{tikzcd}\]
% https://q.uiver.app/#q=WzAsNSxbMSwwLCJBIFxcdGltZXMgS0IiXSxbMCwzLCJBIFxcdGltZXMgQiJdLFsxLDIsIksoQSBcXHRpbWVzIEIpIl0sWzMsMiwiSyhYIFxcdGltZXMgWSkiXSxbMywwLCJYIFxcdGltZXMgS1kiXSxbMSwwLCJpZCBcXHRpbWVzIFxcZXRhIiwwLHsiY3VydmUiOi0yfV0sWzAsMiwiXFx0YXUiLDJdLFsyLDMsIksoZlxcdGltZXMgZykiLDJdLFswLDQsImYgXFx0aW1lcyBLZyJdLFs0LDMsIlxcdGF1Il0sWzEsMywiXFxldGEgXFxjaXJjIChmIFxcdGltZXMgZykiLDIseyJjdXJ2ZSI6Mn1dXQ==
\[\begin{tikzcd}
& {A \times KB} && {X \times KY} \\
\\
& {K(A \times B)} && {K(X \times Y)} \\
{A \times B}
\arrow["{id \times \eta}", curve={height=-12pt}, from=4-1, to=1-2]
\arrow["\tau"', from=1-2, to=3-2]
\arrow["{K(f\times g)}"', from=3-2, to=3-4]
\arrow["{f \times Kg}", from=1-2, to=1-4]
\arrow["\tau", from=1-4, to=3-4]
\arrow["{\eta \circ (f \times g)}"', curve={height=12pt}, from=4-1, to=3-4]
\end{tikzcd}\]
The strength laws are proven similarly:
\begin{itemize}
\item[\ref{S1}]
% https://q.uiver.app/#q=WzAsNCxbMCwwLCJYIFxcdGltZXMgS1kiXSxbMiwwLCJLKFhcXHRpbWVzIFkpIl0sWzIsMiwiS1kiXSxbMCwyLCJYIFxcdGltZXMgWSJdLFswLDEsIlxcdGF1Il0sWzEsMiwiS1xccGlfMiJdLFswLDIsIlxccGlfMiIsMl0sWzMsMCwiaWQgXFx0aW1lcyBcXGV0YSIsMl0sWzMsMiwiXFxldGEgXFxjaXJjIFxccGlfMiIsMl1d
\[\begin{tikzcd}
{X \times KY} && {K(X\times Y)} \\
\\
{X \times Y} && KY
\arrow["\tau", from=1-1, to=1-3]
\arrow["{K\pi_2}", from=1-3, to=3-3]
\arrow["{\pi_2}"', from=1-1, to=3-3]
\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}.
\item[\ref{S3}]
% https://q.uiver.app/#q=WzAsNSxbMSwwLCJYIFxcdGltZXMgS0tZIl0sWzMsMCwiWCBcXHRpbWVzIEtZIl0sWzMsMiwiSyhYXFx0aW1lcyBZKSJdLFsxLDIsIksoWCBcXHRpbWVzIEtZKSJdLFswLDMsIlggXFx0aW1lcyBLWSJdLFswLDEsImlkIFxcdGltZXMgXFxtdSIsMl0sWzEsMiwiXFx0YXUiLDJdLFswLDMsIlxcdGF1Il0sWzMsMiwiXFx0YXVeKiJdLFs0LDAsImlkIFxcdGltZXMgXFxldGEiLDAseyJjdXJ2ZSI6LTJ9XSxbNCwyLCJcXHRhdSIsMCx7ImN1cnZlIjoyfV1d
\[\begin{tikzcd}
& {X \times KKY} && {X \times KY} \\
\\
& {K(X \times KY)} && {K(X\times Y)} \\
{X \times KY}
\arrow["{id \times \mu}"', from=1-2, to=1-4]
\arrow["\tau"', from=1-4, to=3-4]
\arrow["\tau", from=1-2, to=3-2]
\arrow["{\tau^*}", from=3-2, to=3-4]
\arrow["{id \times \eta}", curve={height=-12pt}, from=4-1, to=1-2]
\arrow["\tau", curve={height=12pt}, from=4-1, to=3-4]
\end{tikzcd}\]
\item[\ref{S4}]
% https://q.uiver.app/#q=WzAsNixbMSwwLCIoWCBcXHRpbWVzIFkpIFxcdGltZXMgS1oiXSxbMSwyLCJYIFxcdGltZXMgWSBcXHRpbWVzIEtZIl0sWzMsMCwiSygoWCBcXHRpbWVzIFkpIFxcdGltZXMgWikiXSxbMywyLCJLKFggXFx0aW1lcyBZIFxcdGltZXMgWikiXSxbMiwyLCJYIFxcdGltZXMgSyhZIFxcdGltZXMgWikiXSxbMCwzLCIoWCBcXHRpbWVzIFkpIFxcdGltZXMgWiJdLFswLDEsIlxcYWxwaGEiXSxbMiwzLCJLXFxhbHBoYSJdLFswLDIsIlxcdGF1Il0sWzEsNCwiaWQgXFx0aW1lc1xcdGF1Il0sWzQsMywiXFx0YXUiXSxbNSwwLCJpZCBcXHRpbWVzIFxcZXRhIiwwLHsiY3VydmUiOi0yfV0sWzUsMywiXFxldGEgXFxjaXJjIFxcYWxwaGEiLDIseyJjdXJ2ZSI6Mn1dXQ==
\[\begin{tikzcd}
& {(X \times Y) \times KZ} && {K((X \times Y) \times Z)} \\
\\
& {X \times Y \times KY} & {X \times K(Y \times Z)} & {K(X \times Y \times Z)} \\
{(X \times Y) \times Z}
\arrow["\alpha", from=1-2, to=3-2]
\arrow["K\alpha", from=1-4, to=3-4]
\arrow["\tau", from=1-2, to=1-4]
\arrow["{id \times\tau}", from=3-2, to=3-3]
\arrow["\tau", from=3-3, to=3-4]
\arrow["{id \times \eta}", curve={height=-12pt}, from=4-1, to=1-2]
\arrow["{\eta \circ \alpha}"', curve={height=12pt}, from=4-1, to=3-4]
\end{tikzcd}\]
\end{itemize}
\end{proof}
\change[inline]{Use sigma instead of hat(tau)}
\begin{theorem}
$\mathbf{K}$ is a commutative monad.
\end{theorem}
\begin{proof}
We use remark~\ref{rem:proofbystability} again:
% https://q.uiver.app/#q=WzAsNSxbMSwwLCJLWCBcXHRpbWVzIEtZIl0sWzMsMCwiSyhLWCBcXHRpbWVzIFkpIl0sWzEsMiwiSyhYIFxcdGltZXMgS1kpIl0sWzMsMiwiSyhYIFxcdGltZXMgWSkiXSxbMCwzLCJLWCBcXHRpbWVzIFkiXSxbMCwxLCJcXHRhdSJdLFswLDIsIlxcaGF0e1xcdGF1fSIsMl0sWzEsMywiXFxoYXR7XFx0YXV9XioiXSxbMiwzLCJcXHRhdV4qIiwyXSxbNCwwLCJpZCBcXHRpbWVzIFxcZXRhIiwwLHsiY3VydmUiOi0yfV0sWzQsMywiXFxoYXR7XFx0YXV9IiwyLHsiY3VydmUiOjJ9XV0=
\[\begin{tikzcd}
& {KX \times KY} && {K(KX \times Y)} \\
\\
& {K(X \times KY)} && {K(X \times Y)} \\
{KX \times Y}
\arrow["\tau", from=1-2, to=1-4]
\arrow["{\hat{\tau}}"', from=1-2, to=3-2]
\arrow["{\hat{\tau}^*}", from=1-4, to=3-4]
\arrow["{\tau^*}"', from=3-2, to=3-4]
\arrow["{id \times \eta}", curve={height=-12pt}, from=4-1, to=1-2]
\arrow["{\hat{\tau}}"', curve={height=12pt}, from=4-1, to=3-4]
\end{tikzcd}\]
The proofs for \ref{sharpr1} and the proof that $\hat{\tau}^* \circ \tau$ is right iteration preserving are straightforward and can be looked up in the formalization.
The proof that $\tau^* \circ \hat{\tau}$ 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 \hat{\tau}$. We now use remark~\ref{rem:proofbyleftstability} to show that $\psi$ is right iteration preserving:
% https://q.uiver.app/#q=WzAsNCxbNCwwLCJLWCBcXHRpbWVzIEtZIl0sWzQsMSwiSyhYIFxcdGltZXMgWSkiXSxbMCwxLCJLWCBcXHRpbWVzIFoiXSxbMCwzLCJYIFxcdGltZXMgWiJdLFswLDEsIlxccHNpIl0sWzIsMCwiaWQgXFx0aW1lcyBoXlxcIyJdLFsyLDEsIigoXFxwc2kgKyBpZCkgXFxjaXJjIGRzdGwgXFxjaXJjIChpZCBcXHRpbWVzIGgpKV5cXCMiLDJdLFszLDIsIlxcZXRhIFxcdGltZXMgaWQiXSxbMywxLCJcXHRhdSBcXGNpcmMgKGlkIFxcdGltZXMgaF5cXCMpIiwyXV0=
\[\begin{tikzcd}
&&&& {KX \times KY} \\
{KX \times Z} &&&& {K(X \times Y)} \\
\\
{X \times Z}
\arrow["\psi", from=1-5, to=2-5]
\arrow["{id \times h^\#}", from=2-1, to=1-5]
\arrow["{((\psi + id) \circ dstl \circ (id \times h))^\#}"', from=2-1, to=2-5]
\arrow["{\eta \times id}", from=4-1, to=2-1]
\arrow["{\tau \circ (id \times h^\#)}"', from=4-1, to=2-5]
\end{tikzcd}\]
\change[inline]{Be more specific}
\todo[inline]{introduce Diamond and Stutter laws}
\end{proof}
\begin{theorem}
$\mathbf{K}$ is an equational lifting monad.
\end{theorem}
\begin{proof}
\todo[inline]{proof that K is equational lifting}
\end{proof}
\begin{theorem}
$\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.
\todo[inline]{proof that K is initial strong pre-Elgot}
\end{proof}