bsc-leon-vatthauer/agda/bsc-thesis/Monad.PreElgot.md

66 lines
19 KiB
Markdown
Raw Normal View History

2024-02-09 17:53:52 +01:00
<!--
<pre class="Agda"><a id="14" class="Keyword">open</a> <a id="19" class="Keyword">import</a> <a id="26" href="Level.html" class="Module">Level</a>
<a id="32" class="Keyword">open</a> <a id="37" class="Keyword">import</a> <a id="44" href="Category.Ambient.html" class="Module">Category.Ambient</a> <a id="61" class="Keyword">using</a> <a id="67" class="Symbol">(</a><a id="68" href="Category.Ambient.html#1681" class="Record">Ambient</a><a id="75" class="Symbol">)</a>
<a id="77" class="Keyword">open</a> <a id="82" class="Keyword">import</a> <a id="89" href="Categories.Monad.Construction.Kleisli.html" class="Module">Categories.Monad.Construction.Kleisli</a>
<a id="127" class="Keyword">open</a> <a id="132" class="Keyword">import</a> <a id="139" href="Categories.Monad.html" class="Module">Categories.Monad</a>
<a id="156" class="Keyword">open</a> <a id="161" class="Keyword">import</a> <a id="168" href="Categories.Monad.Strong.html" class="Module">Categories.Monad.Strong</a>
<a id="192" class="Keyword">open</a> <a id="197" class="Keyword">import</a> <a id="204" href="Categories.Monad.Relative.html" class="Module">Categories.Monad.Relative</a> <a id="230" class="Keyword">renaming</a> <a id="239" class="Symbol">(</a><a id="240" href="Categories.Monad.Relative.html#602" class="Record">Monad</a> <a id="246" class="Symbol">to</a> <a id="249" class="Record">RMonad</a><a id="255" class="Symbol">)</a>
<a id="257" class="Keyword">open</a> <a id="262" class="Keyword">import</a> <a id="269" href="Categories.Functor.html" class="Module">Categories.Functor</a>
<a id="288" class="Keyword">open</a> <a id="293" class="Keyword">import</a> <a id="300" href="Data.Product.html" class="Module">Data.Product</a> <a id="313" class="Keyword">using</a> <a id="319" class="Symbol">(</a><a id="320" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">_,_</a><a id="323" class="Symbol">)</a>
</pre>-->
<pre class="Agda"><a id="342" class="Keyword">module</a> <a id="349" href="Monad.PreElgot.html" class="Module">Monad.PreElgot</a> <a id="364" class="Symbol">{</a><a id="365" href="Monad.PreElgot.html#365" class="Bound">o</a> <a id="367" href="Monad.PreElgot.html#367" class="Bound"></a> <a id="369" href="Monad.PreElgot.html#369" class="Bound">e</a><a id="370" class="Symbol">}</a> <a id="372" class="Symbol">(</a><a id="373" href="Monad.PreElgot.html#373" class="Bound">ambient</a> <a id="381" class="Symbol">:</a> <a id="383" href="Category.Ambient.html#1681" class="Record">Ambient</a> <a id="391" href="Monad.PreElgot.html#365" class="Bound">o</a> <a id="393" href="Monad.PreElgot.html#367" class="Bound"></a> <a id="395" href="Monad.PreElgot.html#369" class="Bound">e</a><a id="396" class="Symbol">)</a> <a id="398" class="Keyword">where</a>
<a id="406" class="Keyword">open</a> <a id="411" href="Category.Ambient.html#1681" class="Module">Ambient</a> <a id="419" href="Monad.PreElgot.html#373" class="Bound">ambient</a>
<a id="429" class="Keyword">open</a> <a id="434" href="Categories.Category.Core.html#2462" class="Module">HomReasoning</a>
<a id="449" class="Keyword">open</a> <a id="454" href="Category.Ambient.html#9087" class="Module">MR</a> <a id="457" href="Category.Ambient.html#1757" class="Field">C</a>
<a id="461" class="Keyword">open</a> <a id="466" href="Categories.Category.Core.html#1530" class="Module">Equiv</a>
<a id="474" class="Keyword">open</a> <a id="479" class="Keyword">import</a> <a id="486" href="Algebra.Elgot.html" class="Module">Algebra.Elgot</a> <a id="500" href="Categories.Category.Extensive.html#734" class="Function">cocartesian</a>
</pre>
# (strong) pre-Elgot monads
<pre class="Agda"> <a id="556" class="Keyword">record</a> <a id="IsPreElgot"></a><a id="563" href="Monad.PreElgot.html#563" class="Record">IsPreElgot</a> <a id="574" class="Symbol">(</a><a id="575" href="Monad.PreElgot.html#575" class="Bound">T</a> <a id="577" class="Symbol">:</a> <a id="579" href="Categories.Monad.html#454" class="Record">Monad</a> <a id="585" href="Category.Ambient.html#1757" class="Field">C</a><a id="586" class="Symbol">)</a> <a id="588" class="Symbol">:</a> <a id="590" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="594" class="Symbol">(</a><a id="595" href="Monad.PreElgot.html#365" class="Bound">o</a> <a id="597" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="599" href="Monad.PreElgot.html#367" class="Bound"></a> <a id="601" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="603" href="Monad.PreElgot.html#369" class="Bound">e</a><a id="604" class="Symbol">)</a> <a id="606" class="Keyword">where</a>
<a id="616" class="Keyword">open</a> <a id="621" href="Categories.Monad.html#454" class="Module">Monad</a> <a id="627" href="Monad.PreElgot.html#575" class="Bound">T</a>
<a id="633" class="Keyword">open</a> <a id="638" href="Monad.PreElgot.html#249" class="Module">RMonad</a> <a id="645" class="Symbol">(</a><a id="646" href="Categories.Monad.Construction.Kleisli.html#2851" class="Function">Monad⇒Kleisli</a> <a id="660" href="Category.Ambient.html#1757" class="Field">C</a> <a id="662" href="Monad.PreElgot.html#575" class="Bound">T</a><a id="663" class="Symbol">)</a> <a id="665" class="Keyword">using</a> <a id="671" class="Symbol">(</a><a id="672" href="Categories.Monad.Relative.html#895" class="Field">extend</a><a id="678" class="Symbol">)</a>
<a id="684" class="Keyword">open</a> <a id="689" href="Categories.Functor.Core.html#248" class="Module">Functor</a> <a id="697" href="Categories.Monad.html#525" class="Function">F</a> <a id="699" class="Keyword">renaming</a> <a id="708" class="Symbol">(</a><a id="709" href="Categories.Functor.Core.html#432" class="Field">F₀</a> <a id="712" class="Symbol">to</a> <a id="715" class="Field">T₀</a><a id="717" class="Symbol">;</a> <a id="719" href="Categories.Functor.Core.html#455" class="Field">F₁</a> <a id="722" class="Symbol">to</a> <a id="725" class="Field">T₁</a><a id="727" class="Symbol">)</a>
<a id="734" class="Comment">-- every TX needs to be equipped with an elgot algebra structure</a>
<a id="803" class="Keyword">field</a>
<a id="IsPreElgot.elgotalgebras"></a><a id="815" href="Monad.PreElgot.html#815" class="Field">elgotalgebras</a> <a id="829" class="Symbol">:</a> <a id="831" class="Symbol"></a> <a id="833" class="Symbol">{</a><a id="834" href="Monad.PreElgot.html#834" class="Bound">X</a><a id="835" class="Symbol">}</a> <a id="837" class="Symbol"></a> <a id="839" href="Algebra.Elgot.html#1845" class="Record">Elgot-Algebra-on</a> <a id="856" class="Symbol">(</a><a id="857" href="Monad.PreElgot.html#715" class="Function">T₀</a> <a id="860" href="Monad.PreElgot.html#834" class="Bound">X</a><a id="861" class="Symbol">)</a>
<a id="868" class="Keyword">module</a> <a id="IsPreElgot.elgotalgebras"></a><a id="875" href="Monad.PreElgot.html#875" class="Module">elgotalgebras</a> <a id="889" class="Symbol">{</a><a id="890" href="Monad.PreElgot.html#890" class="Bound">X</a><a id="891" class="Symbol">}</a> <a id="893" class="Symbol">=</a> <a id="895" href="Algebra.Elgot.html#1845" class="Module">Elgot-Algebra-on</a> <a id="912" class="Symbol">(</a><a id="913" href="Monad.PreElgot.html#815" class="Field">elgotalgebras</a> <a id="927" class="Symbol">{</a><a id="928" href="Monad.PreElgot.html#890" class="Bound">X</a><a id="929" class="Symbol">})</a>
<a id="937" class="Comment">-- where kleisli lifting preserves iteration</a>
<a id="986" class="Keyword">field</a>
<a id="IsPreElgot.extend-preserves"></a><a id="998" href="Monad.PreElgot.html#998" class="Field">extend-preserves</a> <a id="1015" class="Symbol">:</a> <a id="1017" class="Symbol"></a> <a id="1019" class="Symbol">{</a><a id="1020" href="Monad.PreElgot.html#1020" class="Bound">X</a> <a id="1022" href="Monad.PreElgot.html#1022" class="Bound">Y</a> <a id="1024" href="Monad.PreElgot.html#1024" class="Bound">Z</a><a id="1025" class="Symbol">}</a> <a id="1027" class="Symbol">(</a><a id="1028" href="Monad.PreElgot.html#1028" class="Bound">f</a> <a id="1030" class="Symbol">:</a> <a id="1032" href="Monad.PreElgot.html#1024" class="Bound">Z</a> <a id="1034" href="Categories.Category.Core.html#575" class="Function Operator"></a> <a id="1036" href="Monad.PreElgot.html#715" class="Function">T₀</a> <a id="1039" href="Monad.PreElgot.html#1020" class="Bound">X</a> <a id="1041" href="Categories.Category.Cocartesian.html#1549" class="Function Operator">+</a> <a id="1043" href="Monad.PreElgot.html#1024" class="Bound">Z</a><a id="1044" class="Symbol">)</a> <a id="1046" class="Symbol">(</a><a id="1047" href="Monad.PreElgot.html#1047" class="Bound">h</a> <a id="1049" class="Symbol">:</a> <a id="1051" href="Monad.PreElgot.html#1020" class="Bound">X</a> <a id="1053" href="Categories.Category.Core.html#575" class="Function Operator"></a> <a id="1055" href="Monad.PreElgot.html#715" class="Function">T₀</a> <a id="1058" href="Monad.PreElgot.html#1022" class="Bound">Y</a><a id="1059" class="Symbol">)</a>
<a id="1069" class="Symbol"></a> <a id="1071" href="Algebra.Elgot.html#1938" class="Function Operator">elgotalgebras._#</a> <a id="1088" class="Symbol">((</a><a id="1090" href="Categories.Monad.Relative.html#895" class="Function">extend</a> <a id="1097" href="Monad.PreElgot.html#1047" class="Bound">h</a> <a id="1099" href="Categories.Category.Cocartesian.html#2133" class="Function Operator">+₁</a> <a id="1102" href="Category.Ambient.html#2115" class="Function">idC</a><a id="1105" class="Symbol">)</a> <a id="1107" href="Categories.Category.Core.html#656" class="Function Operator"></a> <a id="1109" href="Monad.PreElgot.html#1028" class="Bound">f</a><a id="1110" class="Symbol">)</a> <a id="1112" href="Categories.Category.Core.html#595" class="Function Operator"></a> <a id="1114" href="Categories.Monad.Relative.html#895" class="Function">extend</a> <a id="1121" href="Monad.PreElgot.html#1047" class="Bound">h</a> <a id="1123" href="Categories.Category.Core.html#656" class="Function Operator"></a> <a id="1125" href="Algebra.Elgot.html#1938" class="Function Operator">elgotalgebras._#</a> <a id="1142" class="Symbol">{</a><a id="1143" href="Monad.PreElgot.html#1020" class="Bound">X</a><a id="1144" class="Symbol">}</a> <a id="1146" href="Monad.PreElgot.html#1028" class="Bound">f</a>
<a id="1153" class="Keyword">record</a> <a id="PreElgotMonad"></a><a id="1160" href="Monad.PreElgot.html#1160" class="Record">PreElgotMonad</a> <a id="1174" class="Symbol">:</a> <a id="1176" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="1180" class="Symbol">(</a><a id="1181" href="Monad.PreElgot.html#365" class="Bound">o</a> <a id="1183" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="1185" href="Monad.PreElgot.html#367" class="Bound"></a> <a id="1187" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="1189" href="Monad.PreElgot.html#369" class="Bound">e</a><a id="1190" class="Symbol">)</a> <a id="1192" class="Keyword">where</a>
<a id="1202" class="Keyword">field</a>
<a id="PreElgotMonad.T"></a><a id="1214" href="Monad.PreElgot.html#1214" class="Field">T</a> <a id="1216" class="Symbol">:</a> <a id="1218" href="Categories.Monad.html#454" class="Record">Monad</a> <a id="1224" href="Category.Ambient.html#1757" class="Field">C</a>
<a id="PreElgotMonad.isPreElgot"></a><a id="1232" href="Monad.PreElgot.html#1232" class="Field">isPreElgot</a> <a id="1243" class="Symbol">:</a> <a id="1245" href="Monad.PreElgot.html#563" class="Record">IsPreElgot</a> <a id="1256" href="Monad.PreElgot.html#1214" class="Field">T</a>
<a id="1263" class="Keyword">open</a> <a id="1268" href="Monad.PreElgot.html#563" class="Module">IsPreElgot</a> <a id="1279" href="Monad.PreElgot.html#1232" class="Field">isPreElgot</a> <a id="1290" class="Keyword">public</a>
<a id="1300" class="Keyword">record</a> <a id="IsStrongPreElgot"></a><a id="1307" href="Monad.PreElgot.html#1307" class="Record">IsStrongPreElgot</a> <a id="1324" class="Symbol">(</a><a id="1325" href="Monad.PreElgot.html#1325" class="Bound">SM</a> <a id="1328" class="Symbol">:</a> <a id="1330" href="Categories.Monad.Strong.html#1832" class="Record">StrongMonad</a> <a id="1342" href="Category.Ambient.html#2297" class="Function">monoidal</a><a id="1350" class="Symbol">)</a> <a id="1352" class="Symbol">:</a> <a id="1354" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="1358" class="Symbol">(</a><a id="1359" href="Monad.PreElgot.html#365" class="Bound">o</a> <a id="1361" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="1363" href="Monad.PreElgot.html#367" class="Bound"></a> <a id="1365" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="1367" href="Monad.PreElgot.html#369" class="Bound">e</a><a id="1368" class="Symbol">)</a> <a id="1370" class="Keyword">where</a>
<a id="1380" class="Keyword">open</a> <a id="1385" href="Categories.Monad.Strong.html#1832" class="Module">StrongMonad</a> <a id="1397" href="Monad.PreElgot.html#1325" class="Bound">SM</a> <a id="1400" class="Keyword">using</a> <a id="1406" class="Symbol">(</a><a id="1407" href="Categories.Monad.Strong.html#1918" class="Field">M</a><a id="1408" class="Symbol">;</a> <a id="1410" href="Categories.Monad.Strong.html#1060" class="Function">strengthen</a><a id="1420" class="Symbol">)</a>
<a id="1426" class="Keyword">open</a> <a id="1431" href="Categories.Monad.html#454" class="Module">Monad</a> <a id="1437" href="Categories.Monad.Strong.html#1918" class="Function">M</a> <a id="1439" class="Keyword">using</a> <a id="1445" class="Symbol">(</a><a id="1446" href="Categories.Monad.html#525" class="Field">F</a><a id="1447" class="Symbol">)</a>
<a id="1454" class="Comment">-- M is pre-Elgot</a>
<a id="1476" class="Keyword">field</a>
<a id="IsStrongPreElgot.preElgot"></a><a id="1488" href="Monad.PreElgot.html#1488" class="Field">preElgot</a> <a id="1497" class="Symbol">:</a> <a id="1499" href="Monad.PreElgot.html#563" class="Record">IsPreElgot</a> <a id="1510" href="Categories.Monad.Strong.html#1918" class="Function">M</a>
<a id="1521" class="Keyword">open</a> <a id="1526" href="Monad.PreElgot.html#563" class="Module">IsPreElgot</a> <a id="1537" href="Monad.PreElgot.html#1488" class="Field">preElgot</a> <a id="1546" class="Keyword">public</a>
<a id="1558" class="Comment">-- and strength is iteration preserving</a>
<a id="1602" class="Keyword">field</a>
<a id="IsStrongPreElgot.strengthen-preserves"></a><a id="1614" href="Monad.PreElgot.html#1614" class="Field">strengthen-preserves</a> <a id="1635" class="Symbol">:</a> <a id="1637" class="Symbol"></a> <a id="1639" class="Symbol">{</a><a id="1640" href="Monad.PreElgot.html#1640" class="Bound">X</a> <a id="1642" href="Monad.PreElgot.html#1642" class="Bound">Y</a> <a id="1644" href="Monad.PreElgot.html#1644" class="Bound">Z</a><a id="1645" class="Symbol">}</a> <a id="1647" class="Symbol">(</a><a id="1648" href="Monad.PreElgot.html#1648" class="Bound">f</a> <a id="1650" class="Symbol">:</a> <a id="1652" href="Monad.PreElgot.html#1644" class="Bound">Z</a> <a id="1654" href="Categories.Category.Core.html#575" class="Function Operator"></a> <a id="1656" href="Categories.Functor.Core.html#797" class="Function">F.₀</a> <a id="1660" href="Monad.PreElgot.html#1642" class="Bound">Y</a> <a id="1662" href="Categories.Category.Cocartesian.html#1549" class="Function Operator">+</a> <a id="1664" href="Monad.PreElgot.html#1644" class="Bound">Z</a><a id="1665" class="Symbol">)</a>
<a id="1676" class="Symbol"></a> <a id="1678" href="Categories.NaturalTransformation.Core.html#783" class="Function">strengthen.η</a> <a id="1691" class="Symbol">(</a><a id="1692" href="Monad.PreElgot.html#1640" class="Bound">X</a> <a id="1694" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">,</a> <a id="1696" href="Monad.PreElgot.html#1642" class="Bound">Y</a><a id="1697" class="Symbol">)</a> <a id="1699" href="Categories.Category.Core.html#656" class="Function Operator"></a> <a id="1701" class="Symbol">(</a><a id="1702" href="Category.Ambient.html#2115" class="Function">idC</a> <a id="1706" href="Categories.Category.BinaryProducts.html#1465" class="Function Operator"></a> <a id="1708" href="Algebra.Elgot.html#1938" class="Function Operator">elgotalgebras._#</a> <a id="1725" href="Monad.PreElgot.html#1648" class="Bound">f</a><a id="1726" class="Symbol">)</a> <a id="1728" href="Categories.Category.Core.html#595" class="Function Operator"></a> <a id="1730" href="Algebra.Elgot.html#1938" class="Function Operator">elgotalgebras._#</a> <a id="1747" class="Symbol">((</a><a id="1749" href="Categories.NaturalTransformation.Core.html#783" class="Function">strengthen.η</a> <a id="1762" class="Symbol">(</a><a id="1763" href="Monad.PreElgot.html#1640" class="Bound">X</a> <a id="1765" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">,</a> <a id="1767" href="Monad.PreElgot.html#1642" class="Bound">Y</a><a id="1768" class="Symbol">)</a> <a id="1770" href="Categories.Category.Cocartesian.html#2133" class="Function Operator">+₁</a> <a id="1773" href="Category.Ambient.html#2115" class="Function">idC</a><a id="1776" class="Symbol">)</a> <a id="1778" href="Categories.Category.Core.html#656" class="Function Operator"></a> <a id="1780" href="Categories.Category.Distributive.html#3168" class="Function">distributeˡ⁻¹</a> <a id="1794" href="Categories.Category.Core.html#656" class="Function Operator"></a> <a id="1796" class="Symbol">(</a><a id="1797" href="Category.Ambient.html#2115" class="Function">idC</a> <a id="1801" href="Categories.Category.BinaryProducts.html#1465" class="Function Operator"></a> <a id="1803" href="Monad.PreElgot.html#1648" class="Bound">f</a><a id="1804" class="Symbol">))</a>
<a id="1812" class="Keyword">record</a> <a id="StrongPreElgotMonad"></a><a id="1819" href="Monad.PreElgot.html#1819" class="Record">StrongPreElgotMonad</a> <a id="1839" class="Symbol">:</a> <a id="1841" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="1845" class="Symbol">(</a><a id="1846" href="Monad.PreElgot.html#365" class="Bound">o</a> <a id="1848" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="1850" href="Monad.PreElgot.html#367" class="Bound"></a> <a id="1852" href="Agda.Primitive.html#961" class="Primitive Operator"></a> <a id="1854" href="Monad.PreElgot.html#369" class="Bound">e</a><a id="1855" class="Symbol">)</a> <a id="1857" class="Keyword">where</a>
<a id="1867" class="Keyword">field</a>
<a id="StrongPreElgotMonad.SM"></a><a id="1879" href="Monad.PreElgot.html#1879" class="Field">SM</a> <a id="1882" class="Symbol">:</a> <a id="1884" href="Categories.Monad.Strong.html#1832" class="Record">StrongMonad</a> <a id="1896" href="Category.Ambient.html#2297" class="Function">monoidal</a>
<a id="StrongPreElgotMonad.isStrongPreElgot"></a><a id="1911" href="Monad.PreElgot.html#1911" class="Field">isStrongPreElgot</a> <a id="1928" class="Symbol">:</a> <a id="1930" href="Monad.PreElgot.html#1307" class="Record">IsStrongPreElgot</a> <a id="1947" href="Monad.PreElgot.html#1879" class="Field">SM</a>
<a id="1959" class="Keyword">open</a> <a id="1964" href="Monad.PreElgot.html#1307" class="Module">IsStrongPreElgot</a> <a id="1981" href="Monad.PreElgot.html#1911" class="Field">isStrongPreElgot</a> <a id="1998" class="Keyword">public</a>
</pre>