diff --git a/src/content/1.1/Category - The Essence of Composition.tex b/src/content/1.1/Category - The Essence of Composition.tex index 5e2d77f4..5adfe646 100644 --- a/src/content/1.1/Category - The Essence of Composition.tex +++ b/src/content/1.1/Category - The Essence of Composition.tex @@ -34,7 +34,7 @@ \section{Arrows as Functions}\label{arrows-as-functions} \end{Verbatim} or the chevron \code{>>} in F\#, which both go from left to right. But in mathematics and in Haskell functions -compose right to left. It helps if you read \code{g◦f} as ``g \emph{after} f.'' +compose right to left. It helps if you read \code{g \ensuremath{\circ} f} as ``g \emph{after} f.'' Let's make this even more explicit by writing some C code. We have one function \code{f} that takes an argument of type \code{A} and @@ -83,7 +83,7 @@ \section{Arrows as Functions}\label{arrows-as-functions} composition as: \begin{Verbatim}[commandchars=\\\{\}] -g ◦ f +g \ensuremath{\circ} f \end{Verbatim} You can even use Unicode double colons and arrows: @@ -108,7 +108,7 @@ \section{Properties of Composition}\label{properties-of-composition} expressed as: \begin{Verbatim}[commandchars=\\\{\}] -h◦(g◦f) = (h◦g)◦f = h◦g◦f +h \ensuremath{\circ} (g \ensuremath{\circ} f) = (h \ensuremath{\circ} g) \ensuremath{\circ} f = h \ensuremath{\circ} g \ensuremath{\circ} f \end{Verbatim} In (pseudo) Haskell: @@ -131,11 +131,11 @@ \section{Properties of Composition}\label{properties-of-composition} object A is called \code{id\textsubscript{A}} (\newterm{identity} on A). In math notation, if \code{f} goes from A to B then -\code{f◦id\textsubscript{A} = f} +\code{f \ensuremath{\circ} id\textsubscript{A} = f} and -\code{id\textsubscript{B}◦f = f} +\code{id\textsubscript{B} \ensuremath{\circ} f = f} \end{enumerate} When dealing with functions, the identity arrow is implemented as the identity function that just returns back its argument. The diff --git a/src/content/1.10/Natural Transformations.tex b/src/content/1.10/Natural Transformations.tex index d58bd9a3..a8b22f5a 100644 --- a/src/content/1.10/Natural Transformations.tex +++ b/src/content/1.10/Natural Transformations.tex @@ -86,7 +86,7 @@ condition} that holds for any \code{f}: \begin{Verbatim}[commandchars=\\\{\}] -G f ◦ α\textsubscript{a} = α\textsubscript{b} ◦ F f +G f \ensuremath{\circ} α\textsubscript{a} = α\textsubscript{b} \ensuremath{\circ} F f \end{Verbatim} The naturality condition is a pretty stringent requirement. For instance, if the morphism \code{F f} is invertible, naturality @@ -94,7 +94,7 @@ \code{α\textsubscript{a}} along \code{f}: \begin{Verbatim}[commandchars=\\\{\}] -α\textsubscript{b} = (G f) ◦ α\textsubscript{a} ◦ (F f)\textsuperscript{-1} +α\textsubscript{b} = (G f) \ensuremath{\circ} α\textsubscript{a} \ensuremath{\circ} (F f)\textsuperscript{-1} \end{Verbatim} \begin{wrapfigure}[7]{R}{0pt} @@ -201,7 +201,7 @@ \section{Polymorphic Functions}\label{polymorphic-functions} is a function \code{f::a->b}): \begin{Verbatim}[commandchars=\\\{\}] -G f ◦ α\textsubscript{a} = α\textsubscript{b} ◦ F f +G f \ensuremath{\circ} α\textsubscript{a} = α\textsubscript{b} \ensuremath{\circ} F f \end{Verbatim} In Haskell, the action of a functor \code{G} on a morphism \code{f} is implemented using \code{fmap}. I'll first write it in @@ -476,13 +476,13 @@ \section{Functor Category}\label{functor-category} morphism: \begin{Verbatim}[commandchars=\\\{\}] -β\textsubscript{a} ◦ α\textsubscript{a} :: F a -> H a +β\textsubscript{a} \ensuremath{\circ} α\textsubscript{a} :: F a -> H a \end{Verbatim} We will use this morphism as the component of the natural transformation β ⋅ α --- the composition of two natural transformations β after α: \begin{Verbatim}[commandchars=\\\{\}] -(β \ensuremath{⋅} α)a = β\textsubscript{a} ◦ α\textsubscript{a} +(β \ensuremath{⋅} α)a = β\textsubscript{a} \ensuremath{\circ} α\textsubscript{a} \end{Verbatim} \begin{figure}[H] @@ -495,7 +495,7 @@ \section{Functor Category}\label{functor-category} composition is indeed a natural transformation from F to H: \begin{Verbatim}[commandchars=\\\{\}] -H f ◦ (β \ensuremath{⋅} α)\textsubscript{a} = (β \ensuremath{⋅} α)\textsubscript{b} ◦ F f +H f \ensuremath{\circ} (β \ensuremath{⋅} α)\textsubscript{a} = (β \ensuremath{⋅} α)\textsubscript{b} \ensuremath{\circ} F f \end{Verbatim} \begin{figure}[H] @@ -611,7 +611,7 @@ \section{2-Categories}\label{categories} Instead of a Hom-set between two categories C and D, we have a Hom-category --- the functor category D\textsuperscript{C}. We have regular functor composition: a functor F from D\textsuperscript{C} -composes with a functor G from E\textsuperscript{D} to give G ◦ F from +composes with a functor G from E\textsuperscript{D} to give G \ensuremath{\circ} F from E\textsuperscript{C}. But we also have composition inside each Hom-category --- vertical composition of natural transformations, or 2-morphisms, between functors. @@ -629,7 +629,7 @@ \section{2-Categories}\label{categories} and their composition: \begin{Verbatim}[commandchars=\\\{\}] -G ◦ F :: C -> E +G \ensuremath{\circ} F :: C -> E \end{Verbatim} Suppose we have two natural transformations, α and β, that act, respectively, on functors F and G: @@ -650,10 +650,10 @@ \section{2-Categories}\label{categories} members of two different functor categories: D \textsuperscript{C} and E \textsuperscript{D}. We can, however, apply composition to the functors F' and G', because the target of F' is the source of G' --- it's the -category D. What's the relation between the functors G'◦ F' and G ◦ F? +category D. What's the relation between the functors G' \ensuremath{\circ} F' and G \ensuremath{\circ} F? Having α and β at our disposal, can we define a natural transformation -from G ◦ F to G'◦ F'? Let me sketch the construction. +from G \ensuremath{\circ} F to G' \ensuremath{\circ} F'? Let me sketch the construction. \begin{figure}[H] \centering @@ -690,26 +690,26 @@ \section{2-Categories}\label{categories} \end{Verbatim} That's a lot of morphisms. Our goal is to find a morphism that goes from \code{G (F a)} to \code{G'(F'a)}, a candidate for the -component of a natural transformation connecting the two functors G ◦ F -and G'◦ F'. In fact there's not one but two paths we can take from +component of a natural transformation connecting the two functors G \ensuremath{\circ} F +and G' \ensuremath{\circ} F'. In fact there's not one but two paths we can take from \code{G (F a)} to \code{G'(F'a)}: \begin{Verbatim}[commandchars=\\\{\}] -G'α\textsubscript{a} ◦ β\textsubscript{F a} -β\textsubscript{F'a} ◦ G α\textsubscript{a} +G'α\textsubscript{a} \ensuremath{\circ} β\textsubscript{F a} +β\textsubscript{F'a} \ensuremath{\circ} G α\textsubscript{a} \end{Verbatim} Luckily for us, they are equal, because the square we have formed turns out to be the naturality square for β. -We have just defined a component of a natural transformation from G ◦ F -to G'◦ F'. The proof of naturality for this transformation is pretty +We have just defined a component of a natural transformation from G \ensuremath{\circ} F +to G' \ensuremath{\circ} F'. The proof of naturality for this transformation is pretty straightforward, provided you have enough patience. We call this natural transformation the \newterm{horizontal composition} of α and β: \begin{Verbatim}[commandchars=\\\{\}] -β ◦ α :: G ◦ F -> G' ◦ F' +β \ensuremath{\circ} α :: G \ensuremath{\circ} F -> G' \ensuremath{\circ} F' \end{Verbatim} Again, following Mac Lane I use the small circle for horizontal composition, although you may also encounter star in its place. @@ -746,7 +746,7 @@ \section{2-Categories}\label{categories} Finally, the two compositions satisfy the interchange law: \begin{Verbatim}[commandchars=\\\{\}] -(β' \ensuremath{\cdot} α') ◦ (β \ensuremath{\cdot} α) = (β' ◦ β) \ensuremath{\cdot} (α' ◦ α) +(β' \ensuremath{\cdot} α') \ensuremath{\circ} (β \ensuremath{\cdot} α) = (β' \ensuremath{\circ} β) \ensuremath{\cdot} (α' \ensuremath{\circ} α) \end{Verbatim} I will quote Saunders Mac Lane here: The reader may enjoy writing down @@ -761,7 +761,7 @@ \section{2-Categories}\label{categories} notation: \begin{Verbatim}[commandchars=\\\{\}] -F ◦ α +F \ensuremath{\circ} α \end{Verbatim} where F is a functor from D to E, and α is a natural transformation between two functors going from C to D. Since you can't compose a @@ -772,7 +772,7 @@ \section{2-Categories}\label{categories} Similarly: \begin{Verbatim}[commandchars=\\\{\}] -α ◦ F +α \ensuremath{\circ} F \end{Verbatim} is a horizontal composition of α after 1\textsubscript{F}. diff --git a/src/content/1.3/Categories Great and Small.tex b/src/content/1.3/Categories Great and Small.tex index f374fbb9..4700d830 100644 --- a/src/content/1.3/Categories Great and Small.tex +++ b/src/content/1.3/Categories Great and Small.tex @@ -297,7 +297,7 @@ \section{Monoid as Category}\label{monoid-as-category} element corresponding to the composition of the corresponding morphisms. If you give me two elements of \code{M(m, m)} corresponding to \code{f} and \code{g}, their product will correspond to the composition -\code{g◦f}. The composition always exists, because the source and the +\code{g \ensuremath{\circ} f}. The composition always exists, because the source and the target for these morphisms are the same object. And it's associative by the rules of category. The identity morphism is the neutral element of this product. So we can always recover a set monoid from a category diff --git a/src/content/1.5/Products and Coproducts.tex b/src/content/1.5/Products and Coproducts.tex index 898ebc79..0a291363 100644 --- a/src/content/1.5/Products and Coproducts.tex +++ b/src/content/1.5/Products and Coproducts.tex @@ -142,10 +142,10 @@ \section{Duality}\label{duality} all the requirements of a category, as long as we simultaneously redefine composition. If original morphisms \code{f::a->b} and \code{g::b->c} composed -to \code{h::a->c} with \code{h=g◦f}, then the reversed +to \code{h::a->c} with \code{h=g \ensuremath{\circ} f}, then the reversed morphisms \code{f\textsuperscript{op}::b->a} and \code{g\textsuperscript{op}::c->b} will compose to -\code{h\textsuperscript{op}::c->a} with \code{h\textsuperscript{op}=f\textsuperscript{op}◦g\textsuperscript{op}}. And reversing +\code{h\textsuperscript{op}::c->a} with \code{h\textsuperscript{op}=f\textsuperscript{op} \ensuremath{\circ} g\textsuperscript{op}}. And reversing the identity arrows is a (pun alert!) no-op. Duality is a very important property of categories because it doubles @@ -211,13 +211,13 @@ \section{Isomorphisms}\label{isomorphisms} \end{figure} \noindent -The composition \emph{g◦f} must be a morphism from i\textsubscript{1} to +The composition \emph{g \ensuremath{\circ} f} must be a morphism from i\textsubscript{1} to i\textsubscript{1}. But i\textsubscript{1} is initial so there can only be one morphism going from i\textsubscript{1} to i\textsubscript{1}. Since we are in a category, we know that there is an identity morphism from i\textsubscript{1} to i\textsubscript{1}, and since there is room -for only one, that must be it. Therefore \emph{g◦f} is equal to -identity. Similarly, \emph{f◦g} must be equal to identity, because there +for only one, that must be it. Therefore \emph{g \ensuremath{\circ} f} is equal to +identity. Similarly, \emph{f \ensuremath{\circ} g} must be equal to identity, because there can be only one morphism from i\textsubscript{2} back to i\textsubscript{2}. This proves that \emph{f} and \emph{g} must be the inverse of each other. Therefore any two initial objects are isomorphic. diff --git a/src/content/1.8/Functoriality.tex b/src/content/1.8/Functoriality.tex index b7e1c077..6493c76b 100644 --- a/src/content/1.8/Functoriality.tex +++ b/src/content/1.8/Functoriality.tex @@ -32,7 +32,7 @@ \section{Bifunctors}\label{bifunctors} way: \begin{Verbatim}[commandchars=\\\{\}] -(f, g) ◦ (f', g') = (f ◦ f', g ◦ g') +(f, g) \ensuremath{\circ} (f', g') = (f \ensuremath{\circ} f', g \ensuremath{\circ} g') \end{Verbatim} The composition is associative and it has an identity --- a pair of identity morphisms \emph{(id, id)}. So a cartesian product of categories diff --git a/src/content/1.9/Function Types.tex b/src/content/1.9/Function Types.tex index 2d050258..42a14002 100644 --- a/src/content/1.9/Function Types.tex +++ b/src/content/1.9/Function Types.tex @@ -144,7 +144,7 @@ \section{Universal Construction}\label{universal-construction} application \code{g'}: \begin{Verbatim}[commandchars=\\\{\}] -g' = g ◦ (h × id) +g' = g \ensuremath{\circ} (h × id) \end{Verbatim} The key here is the action of the product on morphisms. @@ -192,7 +192,7 @@ \section{Universal Construction}\label{universal-construction} that factors \code{g} through \code{eval}: \begin{Verbatim}[commandchars=\\\{\}] -g = eval ◦ (h × id) +g = eval \ensuremath{\circ} (h × id) \end{Verbatim} \strut \end{minipage}\tabularnewline @@ -244,7 +244,7 @@ \section{Currying}\label{currying} the two-argument function \code{g} using the formula: \begin{Verbatim}[commandchars=\\\{\}] -g = eval ◦ (h × id) +g = eval \ensuremath{\circ} (h × id) \end{Verbatim} The function \code{g} can be called the \newterm{uncurried} version of \code{h}. diff --git a/src/content/2.4/Representable Functors.tex b/src/content/2.4/Representable Functors.tex index 081c61a5..a1271015 100644 --- a/src/content/2.4/Representable Functors.tex +++ b/src/content/2.4/Representable Functors.tex @@ -87,7 +87,7 @@ \section{The Hom Functor}\label{the-hom-functor} \code{h} matches the source of \code{f}, so their composition: \begin{Verbatim}[commandchars=\\\{\}] -f ◦ h :: a -> y +f \ensuremath{\circ} h :: a -> y \end{Verbatim} is a morphism going from \code{a} to \code{y}. It is therefore a member of \code{C(a, y)}. @@ -104,7 +104,7 @@ \section{The Hom Functor}\label{the-hom-functor} and its action on a morphism \code{h} as: \begin{Verbatim}[commandchars=\\\{\}] -C(a, f) h = f ◦ h +C(a, f) h = f \ensuremath{\circ} h \end{Verbatim} Since this construction works in any category, it must also work in the category of Haskell types. In Haskell, the hom-functor is better known @@ -213,7 +213,7 @@ \section{Representable Functors}\label{representable-functors} commutes: \begin{Verbatim}[commandchars=\\\{\}] -F f ◦ α\textsubscript{x} = α\textsubscript{y} ◦ C(a, f) +F f \ensuremath{\circ} α\textsubscript{x} = α\textsubscript{y} \ensuremath{\circ} C(a, f) \end{Verbatim} In Haskell, we would replace natural transformations with polymorphic functions: @@ -245,7 +245,7 @@ \section{Representable Functors}\label{representable-functors} It must respect naturality conditions, and it must be the inverse of α: \begin{Verbatim}[commandchars=\\\{\}] -α ◦ β = id = β ◦ α +α \ensuremath{\circ} β = id = β \ensuremath{\circ} α \end{Verbatim} We will see later that a natural transformation from \code{C(a, -)} to any \textbf{Set}-valued functor always exists (Yoneda's lemma) but it diff --git a/src/content/2.5/The Yoneda Lemma.tex b/src/content/2.5/The Yoneda Lemma.tex index fd4f4a57..ecdb3348 100644 --- a/src/content/2.5/The Yoneda Lemma.tex +++ b/src/content/2.5/The Yoneda Lemma.tex @@ -68,7 +68,7 @@ So the naturality square for \code{α}: \begin{Verbatim}[commandchars=\\\{\}] -α\textsubscript{y} ◦ C(a, f) = F f ◦ α\textsubscript{x} +α\textsubscript{y} \ensuremath{\circ} C(a, f) = F f \ensuremath{\circ} α\textsubscript{x} \end{Verbatim} becomes, point-wise, when acting on \code{h}: @@ -80,12 +80,12 @@ precomposition: \begin{Verbatim}[commandchars=\\\{\}] -C(a, f) h = f ◦ h +C(a, f) h = f \ensuremath{\circ} h \end{Verbatim} which leads to: \begin{Verbatim}[commandchars=\\\{\}] -αy (f ◦ h) = (F f) (αx h) +αy (f \ensuremath{\circ} h) = (F f) (αx h) \end{Verbatim} Just how strong this condition is can be seen by specializing it to the case of \code{x} equal to \code{a}. @@ -178,7 +178,7 @@ \noindent Now let's consider the action of \code{C(a, g)} on our original \code{p} which, as you remember, corresponds to \code{id\textsubscript{a}}. It is -defined as precomposition, \code{g◦id\textsubscript{a}}, which is equal to \code{g}, +defined as precomposition, \code{g \ensuremath{\circ} id\textsubscript{a}}, which is equal to \code{g}, which corresponds to our point \code{p'}. So the morphism \code{g} is mapped to a function that, when acting on \code{p} produces \code{p'}, which is \code{g}. We have come full @@ -206,7 +206,7 @@ F g :: F a -> F x \end{Verbatim} Again, \code{C(a, g)} acting on our \code{p} is given by the -precomposition: \code{g ◦ id\textsubscript{a}}, which corresponds to a point +precomposition: \code{g \ensuremath{\circ} id\textsubscript{a}}, which corresponds to a point \code{p'} in \code{C(a, x)}. Naturality determines the value of \code{αx} acting on \code{p'} to be: diff --git a/src/content/2.6/Yoneda Embedding.tex b/src/content/2.6/Yoneda Embedding.tex index 44542eab..1b4b715b 100644 --- a/src/content/2.6/Yoneda Embedding.tex +++ b/src/content/2.6/Yoneda Embedding.tex @@ -298,12 +298,12 @@ \section{Naturality}\label{naturality} \code{f} lifted by \code{G}: \begin{Verbatim}[commandchars=\\\{\}] -(G f) ◦ Φ\textsubscript{a} +(G f) \ensuremath{\circ} Φ\textsubscript{a} \end{Verbatim} Notice that, because of naturality of \code{Φ}, this is the same as: \begin{Verbatim}[commandchars=\\\{\}] -Φ\textsubscript{b} ◦ (F f) +Φ\textsubscript{b} \ensuremath{\circ} (F f) \end{Verbatim} I'm not going to prove the naturality of the whole isomorphism --- after you've established what the functors are, the proof is pretty diff --git a/src/content/3.1/It's All About Morphisms.tex b/src/content/3.1/It's All About Morphisms.tex index 250aaeb0..92e5e368 100644 --- a/src/content/3.1/It's All About Morphisms.tex +++ b/src/content/3.1/It's All About Morphisms.tex @@ -134,7 +134,7 @@ \section{Hom-Sets}\label{hom-sets} with \code{f} is different than that with \code{g}, for instance: \begin{Verbatim}[commandchars=\\\{\}] -h ◦ f ≠ h ◦ g +h \ensuremath{\circ} f ≠ h \ensuremath{\circ} g \end{Verbatim} then we can directly ``observe'' the difference between \code{f} and \code{g}. But even if the difference is not directly observable, we @@ -148,7 +148,7 @@ \section{Hom-Sets}\label{hom-sets} resolution, e.g., \begin{Verbatim}[commandchars=\\\{\}] -h' ◦ F f ≠ h' ◦ F g +h' \ensuremath{\circ} F f ≠ h' \ensuremath{\circ} F g \end{Verbatim} where \code{h'} is not in the image of \code{F}. diff --git a/src/content/3.10/Ends and Coends.tex b/src/content/3.10/Ends and Coends.tex index a4132d11..5fadbaa4 100644 --- a/src/content/3.10/Ends and Coends.tex +++ b/src/content/3.10/Ends and Coends.tex @@ -155,7 +155,7 @@ \section{Ends}\label{ends} This is called the wedge condition. It can be written as: \begin{Verbatim}[commandchars=\\\{\}] -p id\textsubscript{a} f ◦ α\textsubscript{a} = p f id\textsubscript{b} ◦ α\textsubscript{b} +p id\textsubscript{a} f \ensuremath{\circ} α\textsubscript{a} = p f id\textsubscript{b} \ensuremath{\circ} α\textsubscript{b} \end{Verbatim} Or, using Haskell notation: @@ -169,7 +169,7 @@ \section{Ends}\label{ends} \code{h::a->e} that makes all triangles commute: \begin{Verbatim}[commandchars=\\\{\}] -π\textsubscript{a} ◦ h = α\textsubscript{a} +π\textsubscript{a} \ensuremath{\circ} h = α\textsubscript{a} \end{Verbatim} \begin{figure}[H] @@ -332,12 +332,12 @@ \section{Natural Transformations as post-composition. When acting on \code{τ\textsubscript{a}} the lifted pair gives us: \begin{Verbatim}[commandchars=\\\{\}] -G f ◦ τ\textsubscript{a} ◦ id\textsubscript{a} +G f \ensuremath{\circ} τ\textsubscript{a} \ensuremath{\circ} id\textsubscript{a} \end{Verbatim} The other branch of the diagram gives us: \begin{Verbatim}[commandchars=\\\{\}] -id\textsubscript{b} ◦ τ\textsubscript{b} ◦ F f +id\textsubscript{b} \ensuremath{\circ} τ\textsubscript{b} \ensuremath{\circ} F f \end{Verbatim} Their equality, demanded by the wedge condition, is nothing but the naturality condition for \code{τ}. @@ -549,7 +549,7 @@ \section{Profunctor Composition}\label{profunctor-composition} formula: \begin{Verbatim}[commandchars=\\\{\}] -(q ◦ p) a b = ∫ \textsuperscript{c} p c a × q b c +(q \ensuremath{\circ} p) a b = ∫ \textsuperscript{c} p c a × q b c \end{Verbatim} Here's the equivalent Haskell definition from \code{Data.Profunctor.Composition}, after some renaming: diff --git a/src/content/3.11/Kan Extensions.tex b/src/content/3.11/Kan Extensions.tex index 3a9e7b46..5eaf616e 100644 --- a/src/content/3.11/Kan Extensions.tex +++ b/src/content/3.11/Kan Extensions.tex @@ -31,8 +31,8 @@ \end{figure} \noindent -A cone is a natural transformation \code{ε} from \code{F ◦ K} to -\code{D}. Notice that \code{F ◦ K} does exactly the same thing as +A cone is a natural transformation \code{ε} from \code{F \ensuremath{\circ} K} to +\code{D}. Notice that \code{F \ensuremath{\circ} K} does exactly the same thing as our original \code{\ensuremath{\Delta}\textsubscript{c}}. The following diagram shows this transformation. @@ -45,14 +45,14 @@ We can now define a universal property that picks the ``best'' such functor \code{F}. This \code{F} will map \textbf{1} to the object that is the limit of \code{D} in \emph{C}, and the natural -transformation \code{ε} from \code{F ◦ K} to \code{D} will +transformation \code{ε} from \code{F \ensuremath{\circ} K} to \code{D} will provide the corresponding projections. This universal functor is called the right Kan extension of \code{D} along \code{K} and is denoted by \code{Ran\textsubscript{K}D}. Let's formulate the universal property. Suppose we have another cone --- that is another functor \code{F'} together with a natural -transformation \code{ε'} from \code{F' ◦ K} to +transformation \code{ε'} from \code{F' \ensuremath{\circ} K} to \code{D}. \begin{figure}[H] @@ -66,9 +66,9 @@ that \code{ε'} factorizes through \code{ε}, that is: \begin{Verbatim}[commandchars=\\\{\}] -ε' = ε . (σ ◦ K) +ε' = ε . (σ \ensuremath{\circ} K) \end{Verbatim} -Here, \code{σ ◦ K} is the horizontal composition of two natural +Here, \code{σ \ensuremath{\circ} K} is the horizontal composition of two natural transformations (one of them being the identity natural transformation on \code{K}). This transformation is then vertically composed with \code{ε}. @@ -82,7 +82,7 @@ In components, when acting on an object \code{i} in \emph{I}, we get: \begin{Verbatim}[commandchars=\\\{\}] -ε'\textsubscript{i} = ε\textsubscript{i} ◦ σ \textsubscript{K i} +ε'\textsubscript{i} = ε\textsubscript{i} \ensuremath{\circ} σ \textsubscript{K i} \end{Verbatim} In our case, \code{σ} has only one component corresponding to the single object of \textbf{1}. So, indeed, this is the unique morphism @@ -102,13 +102,13 @@ \section{Right Kan Extension}\label{right-kan-extension} natural transformation \begin{Verbatim}[commandchars=\\\{\}] -ε :: F ◦ K -> D +ε :: F \ensuremath{\circ} K -> D \end{Verbatim} such that for any other functor \code{F'::A->C} and a natural transformation \begin{Verbatim}[commandchars=\\\{\}] -ε' :: F' ◦ K -> D +ε' :: F' \ensuremath{\circ} K -> D \end{Verbatim} there is a unique natural transformation @@ -118,7 +118,7 @@ \section{Right Kan Extension}\label{right-kan-extension} that factorizes \code{ε'}: \begin{Verbatim}[commandchars=\\\{\}] -ε' = ε . (σ ◦ K) +ε' = ε . (σ \ensuremath{\circ} K) \end{Verbatim} This is quite a mouthful, but it can be visualized in this nice diagram: @@ -136,7 +136,7 @@ \section{Right Kan Extension}\label{right-kan-extension} cancellation: \begin{Verbatim}[commandchars=\\\{\}] -ε :: D/K ◦ K -> D +ε :: D/K \ensuremath{\circ} K -> D \end{Verbatim} There is another interpretation of Kan extensions. Consider that the functor \code{K} embeds the category \emph{I} inside \emph{A}. In the @@ -144,11 +144,11 @@ \section{Right Kan Extension}\label{right-kan-extension} a functor \code{D} that maps \emph{I} to \emph{C}. Can we extend \code{D} to a functor \code{F} that is defined on the whole of \emph{A}? Ideally, such an extension would make the composition -\code{F ◦ K} be isomorphic to \code{D}. In other words, \code{F} +\code{F \ensuremath{\circ} K} be isomorphic to \code{D}. In other words, \code{F} would be extending the domain of \code{D} to \code{A}. But a full-blown isomorphism is usually too much to ask, and we can do with just half of it, namely a one-way natural transformation \code{ε} from\\ -\code{F ◦ K} to \code{D}. (The left Kan extension picks the other +\code{F \ensuremath{\circ} K} to \code{D}. (The left Kan extension picks the other direction.) \begin{figure}[H] @@ -170,11 +170,11 @@ \section{Kan Extension as replacing \code{D}) is a functor from the functor category \code{{[}I, C{]}} to the functor category \code{{[}A, C{]}}. It turns out that this functor is the right adjoint to the precomposition -functor \code{-◦K}. The latter maps functors in \code{{[}A, C{]}} +functor \code{- \ensuremath{\circ} K}. The latter maps functors in \code{{[}A, C{]}} to functors in \code{{[}I, C{]}}. The adjunction is: \begin{Verbatim}[commandchars=\\\{\}] -[I, C](F' ◦ K, D) \ensuremath{\cong} [A, C](F', Ran\textsubscript{K}D) +[I, C](F' \ensuremath{\circ} K, D) \ensuremath{\cong} [A, C](F', Ran\textsubscript{K}D) \end{Verbatim} It is just a restatement of the fact that to every natural transformation we called \code{ε'} corresponds a unique natural @@ -191,7 +191,7 @@ \section{Kan Extension as \code{D}. We get the following identity: \begin{Verbatim}[commandchars=\\\{\}] -[C, C](F' ◦ K, IC) \ensuremath{\cong} [A, C](F', Ran\textsubscript{K}I\textsubscript{C}) +[C, C](F' \ensuremath{\circ} K, IC) \ensuremath{\cong} [A, C](F', Ran\textsubscript{K}I\textsubscript{C}) \end{Verbatim} We can now chose \code{F'} to be the same as \code{Ran\textsubscript{K}I\textsubscript{C}}. In that case the right hand side contains the identity natural @@ -199,7 +199,7 @@ \section{Kan Extension as following natural transformation: \begin{Verbatim}[commandchars=\\\{\}] -ε :: Ran\textsubscript{K}I\textsubscript{C} ◦ K -> I\textsubscript{C} +ε :: Ran\textsubscript{K}I\textsubscript{C} \ensuremath{\circ} K -> I\textsubscript{C} \end{Verbatim} This looks very much like the counit of an adjunction: @@ -216,7 +216,7 @@ \section{Kan Extension as simplifies to: \begin{Verbatim}[commandchars=\\\{\}] -K ◦ Ran\textsubscript{K}I\textsubscript{C} \ensuremath{\cong} Ran\textsubscript{K}K +K \ensuremath{\circ} Ran\textsubscript{K}I\textsubscript{C} \ensuremath{\cong} Ran\textsubscript{K}K \end{Verbatim} Notice that, using the division-by-K notation, the adjunction can be written as: @@ -228,7 +228,7 @@ \section{Kan Extension as an inverse. The preservation condition becomes: \begin{Verbatim}[commandchars=\\\{\}] -K ◦ I/K \ensuremath{\cong} K/K +K \ensuremath{\circ} I/K \ensuremath{\cong} K/K \end{Verbatim} The right Kan extension of a functor along itself, \code{K/K}, is called a codensity monad. @@ -252,7 +252,7 @@ \section{Left Kan Extension}\label{left-kan-extension} \noindent The sides of the cocone, the injections, are components of a natural -transformation \code{η} from \code{D} to \code{F ◦ K}. +transformation \code{η} from \code{D} to \code{F \ensuremath{\circ} K}. \begin{figure}[H] \centering @@ -264,7 +264,7 @@ \section{Left Kan Extension}\label{left-kan-extension} \code{F'} and a natural transformation \begin{Verbatim}[commandchars=\\\{\}] -η' :: D -> F'◦ K +η' :: D -> F' \ensuremath{\circ} K \end{Verbatim} \begin{figure}[H] @@ -285,7 +285,7 @@ \section{Left Kan Extension}\label{left-kan-extension} such that: \begin{Verbatim}[commandchars=\\\{\}] -η' = (σ ◦ K) . η +η' = (σ \ensuremath{\circ} K) . η \end{Verbatim} This is illustrated in the following diagram: @@ -308,7 +308,7 @@ \section{Left Kan Extension}\label{left-kan-extension} The natural transformation: \begin{Verbatim}[commandchars=\\\{\}] -η :: D -> Lan\textsubscript{K}D ◦ K +η :: D -> Lan\textsubscript{K}D \ensuremath{\circ} K \end{Verbatim} is called the unit of the left Kan extension. @@ -316,12 +316,12 @@ \section{Left Kan Extension}\label{left-kan-extension} transformations: \begin{Verbatim}[commandchars=\\\{\}] -η' = (σ ◦ K) . η +η' = (σ \ensuremath{\circ} K) . η \end{Verbatim} in terms of the adjunction: \begin{Verbatim}[commandchars=\\\{\}] -[A, C](Lan\textsubscript{K}D, F') \ensuremath{\cong} [I, C](D, F' ◦ K) +[A, C](Lan\textsubscript{K}D, F') \ensuremath{\cong} [I, C](D, F' \ensuremath{\circ} K) \end{Verbatim} In other words, the left Kan extension is the left adjoint, and the right Kan extension is the right adjoint of the postcomposition with @@ -374,18 +374,18 @@ \section{Kan Extensions as Ends}\label{kan-extensions-as-ends} Notice that this hom-functor is a composition of two functors: \begin{Verbatim}[commandchars=\\\{\}] -A(a, K -) = A(a, -) ◦ K +A(a, K -) = A(a, -) \ensuremath{\circ} K \end{Verbatim} The right Kan extension is the right adjoint of functor composition: \begin{Verbatim}[commandchars=\\\{\}] -[I, Set](F' ◦ K, D) \ensuremath{\cong} [A, Set](F', Ran\textsubscript{K}D) +[I, Set](F' \ensuremath{\circ} K, D) \ensuremath{\cong} [A, Set](F', Ran\textsubscript{K}D) \end{Verbatim} Let's see what happens when we replace \code{F'} with the hom functor: \begin{Verbatim}[commandchars=\\\{\}] -[I, Set](A(a, -) ◦ K, D) \ensuremath{\cong} [A, Set](A(a, -), Ran\textsubscript{K}D) +[I, Set](A(a, -) \ensuremath{\circ} K, D) \ensuremath{\cong} [A, Set](A(a, -), Ran\textsubscript{K}D) \end{Verbatim} and then inline the composition: @@ -413,7 +413,7 @@ \section{Kan Extensions as Ends}\label{kan-extensions-as-ends} adjoint to functor composition: \begin{Verbatim}[commandchars=\\\{\}] -[A, Set](Lan\textsubscript{K}D, F') \ensuremath{\cong} [I, Set](D, F'◦ K) +[A, Set](Lan\textsubscript{K}D, F') \ensuremath{\cong} [I, Set](D, F' \ensuremath{\circ} K) \end{Verbatim} Let's substitute our formula in the left hand side: @@ -458,7 +458,7 @@ \section{Kan Extensions as Ends}\label{kan-extensions-as-ends} hand side of the adjunction we set out to prove: \begin{Verbatim}[commandchars=\\\{\}] -[I, Set](D, F'◦ K) +[I, Set](D, F' \ensuremath{\circ} K) \end{Verbatim} These kinds of calculations using ends, coends, and the Yoneda lemma are pretty typical for the ``calculus'' of ends. diff --git a/src/content/3.12/Enriched Categories.tex b/src/content/3.12/Enriched Categories.tex index 09dc18c4..852966f9 100644 --- a/src/content/3.12/Enriched Categories.tex +++ b/src/content/3.12/Enriched Categories.tex @@ -120,7 +120,7 @@ \section{Monoidal Category}\label{monoidal-category} whose ``square is one'': \begin{Verbatim}[commandchars=\\\{\}] -γ\textsubscript{b a} ◦ γ\textsubscript{a b} = id\textsubscript{a\ensuremath{\otimes}b} +γ\textsubscript{b a} \ensuremath{\circ} γ\textsubscript{a b} = id\textsubscript{a\ensuremath{\otimes}b} \end{Verbatim} and which is consistent with the monoidal structure. @@ -171,7 +171,7 @@ \section{Enriched Category}\label{enriched-category} of morphisms is replaced by a family of morphisms in \emph{V}: \begin{Verbatim}[commandchars=\\\{\}] -◦ :: C(b, c) \ensuremath{\otimes} C(a, b) -> C(a, c) + \ensuremath{\circ} :: C(b, c) \ensuremath{\otimes} C(a, b) -> C(a, c) \end{Verbatim} \begin{figure}[H] diff --git a/src/content/3.14/Lawvere Theories.tex b/src/content/3.14/Lawvere Theories.tex index b6b68e20..cbd22d7a 100644 --- a/src/content/3.14/Lawvere Theories.tex +++ b/src/content/3.14/Lawvere Theories.tex @@ -192,7 +192,7 @@ \section{Lavwere Theories}\label{lavwere-theories} \begin{Verbatim}[commandchars=\\\{\}] F (m × n) = F m × F n -F ◦ I\textsubscript{L} = I'\textsubscript{L'} +F \ensuremath{\circ} I\textsubscript{L} = I'\textsubscript{L'} \end{Verbatim} Morphisms between Lawvere theories encapsulate the idea of the interpretation of one theory inside another. For instance, group @@ -274,7 +274,7 @@ \section{Models of Lawvere Theories}\label{models-of-lawvere-theories} n-ary operations: \begin{Verbatim}[commandchars=\\\{\}] -N f ◦ μ\textsubscript{n} = μ\textsubscript{1} ◦ M f +N f \ensuremath{\circ} μ\textsubscript{n} = μ\textsubscript{1} \ensuremath{\circ} M f \end{Verbatim} where \code{f :: n -> 1} is an n-ary operation in \textbf{L}. @@ -410,7 +410,7 @@ \section{Lawvere Theories and Monads}\label{lawvere-theories-and-monads} \end{Verbatim} Together, the forgetful and the free functor define a \hyperref[monads-categorically]{monad} -\code{T = U◦F} on \textbf{Set}. Thus every Lawvere theory generates +\code{T = U \ensuremath{\circ} F} on \textbf{Set}. Thus every Lawvere theory generates a monad. It turns out that the category of diff --git a/src/content/3.15/Monads, Monoids, and Categories.tex b/src/content/3.15/Monads, Monoids, and Categories.tex index 65805aa1..e6852971 100644 --- a/src/content/3.15/Monads, Monoids, and Categories.tex +++ b/src/content/3.15/Monads, Monoids, and Categories.tex @@ -95,7 +95,7 @@ \section{Bicategories}\label{bicategories} words, there is a 2-cell: \begin{Verbatim}[commandchars=\\\{\}] -ρ :: f ◦ id\textsubscript{a} -> f +ρ :: f \ensuremath{\circ} id\textsubscript{a} -> f \end{Verbatim} that has an inverse. @@ -157,7 +157,7 @@ \section{Bicategories}\label{bicategories} such that: \begin{Verbatim}[commandchars=\\\{\}] -g ◦ h = f' ◦ h' +g \ensuremath{\circ} h = f' \ensuremath{\circ} h' \end{Verbatim} which is universal among all such objects. @@ -218,7 +218,7 @@ \section{Monads}\label{monads} we get: \begin{Verbatim}[commandchars=\\\{\}] -μ :: T ◦ T -> T +μ :: T \ensuremath{\circ} T -> T \end{Verbatim} \begin{figure}[H] @@ -239,7 +239,7 @@ \section{Monads}\label{monads} \begin{Verbatim}[commandchars=\\\{\}] η :: I -> T -μ :: T ◦ T -> T +μ :: T \ensuremath{\circ} T -> T \end{Verbatim} satisfying the monoid laws. We call \emph{this} a monad. @@ -285,8 +285,8 @@ \section{Monads}\label{monads} commutation conditions --- in this case: \begin{Verbatim}[commandchars=\\\{\}] -dom ◦ η = id -cod ◦ η = id +dom \ensuremath{\circ} η = id +cod \ensuremath{\circ} η = id \end{Verbatim} \begin{figure}[H] diff --git a/src/content/3.2/Adjunctions.tex b/src/content/3.2/Adjunctions.tex index 9b5d49d8..1ebedac4 100644 --- a/src/content/3.2/Adjunctions.tex +++ b/src/content/3.2/Adjunctions.tex @@ -33,8 +33,8 @@ \section{Adjunction and Unit/Counit which is invertible. In other words, there exists another functor \code{L} (``left'') from \emph{D} back to \emph{C} which, when composed with \code{R}, is equal to the identity functor \code{I}. -There are two possible compositions, \code{R ◦ L} and -\code{L ◦ R}; and two possible identity functors: one in \emph{C} +There are two possible compositions, \code{R \ensuremath{\circ} L} and +\code{L \ensuremath{\circ} R}; and two possible identity functors: one in \emph{C} and another in \emph{D}. \begin{figure}[H] @@ -47,12 +47,12 @@ \section{Adjunction and Unit/Counit \emph{equal}? What do we mean by this equality: \begin{Verbatim}[commandchars=\\\{\}] -R ◦ L = I\textsubscript{D} +R \ensuremath{\circ} L = I\textsubscript{D} \end{Verbatim} or this one: \begin{Verbatim}[commandchars=\\\{\}] -L ◦ R = I\textsubscript{C} +L \ensuremath{\circ} R = I\textsubscript{C} \end{Verbatim} It would be reasonable to define functor equality in terms of equality of objects. Two functors, when acting on equal objects, should produce @@ -80,19 +80,19 @@ \section{Adjunction and Unit/Counit and forth between them, whose composition (either way) is \newterm{naturally isomorphic} to the identity functor. In other words, there is a two-way natural transformation between the composition -\code{R ◦ L} and the identity functor \code{I\textsubscript{D}}, and another -between \code{L ◦ R} and the identity functor \code{I\textsubscript{C}}. +\code{R \ensuremath{\circ} L} and the identity functor \code{I\textsubscript{D}}, and another +between \code{L \ensuremath{\circ} R} and the identity functor \code{I\textsubscript{C}}. Adjunction is even weaker than equivalence, because it doesn't require that the composition of the two functors be \newterm{isomorphic} to the identity functor. Instead it stipulates the existence of a \newterm{one -way} natural transformation from \code{ID} to \code{R◦L}, and -another from \code{L◦R} to \code{IC}. Here are the signatures of +way} natural transformation from \code{ID} to \code{R \ensuremath{\circ} L}, and +another from \code{L \ensuremath{\circ} R} to \code{IC}. Here are the signatures of these two natural transformations: \begin{Verbatim}[commandchars=\\\{\}] -η :: I\textsubscript{D} -> R ◦ L -ε :: L ◦ R -> I\textsubscript{C} +η :: I\textsubscript{D} -> R \ensuremath{\circ} L +ε :: L \ensuremath{\circ} R -> I\textsubscript{C} \end{Verbatim} η is called the unit, and ε the counit of the adjunction. @@ -100,8 +100,8 @@ \section{Adjunction and Unit/Counit have the two remaining mappings: \begin{Verbatim}[commandchars=\\\{\}] -R ◦ L -> I\textsubscript{D} -- not necessarily -I\textsubscript{C} -> L ◦ R -- not necessarily +R \ensuremath{\circ} L -> I\textsubscript{D} -- not necessarily +I\textsubscript{C} -> L \ensuremath{\circ} R -- not necessarily \end{Verbatim} Because of this asymmetry, the functor \code{L} is called the \newterm{left adjoint} to the functor \code{R}, while the functor @@ -125,17 +125,17 @@ \section{Adjunction and Unit/Counit Let's start with the unit. It's a natural transformation, so it's a family of morphisms. Given an object \code{d} in \emph{D}, the component of η is a morphism between \code{I d}, which is equal to -\code{d}, and \code{(R ◦ L) d}; which, in the picture, is called +\code{d}, and \code{(R \ensuremath{\circ} L) d}; which, in the picture, is called \code{d'}: \begin{Verbatim}[commandchars=\\\{\}] -η\textsubscript{d} :: d -> (R ◦ L) d +η\textsubscript{d} :: d -> (R \ensuremath{\circ} L) d \end{Verbatim} -Notice that the composition \code{R◦L} is an endofunctor in \emph{D}. +Notice that the composition \code{R \ensuremath{\circ}L} is an endofunctor in \emph{D}. This equation tells us that we can pick any object \code{d} in \emph{D} as our starting point, and use the round trip functor -\code{R ◦ L} to pick our target object \code{d'}. Then we +\code{R \ensuremath{\circ} L} to pick our target object \code{d'}. Then we shoot an arrow --- the morphism \code{η\textsubscript{d}} --- to our target. \begin{figure}[H] @@ -147,28 +147,28 @@ \section{Adjunction and Unit/Counit By the same token, the component of of the counit ε can be described as: \begin{Verbatim}[commandchars=\\\{\}] -ε\textsubscript{c'} :: (L ◦ R) c -> c +ε\textsubscript{c'} :: (L \ensuremath{\circ} R) c -> c \end{Verbatim} -where \code{c'} is \code{(L ◦ R) c}. It tells us that we +where \code{c'} is \code{(L \ensuremath{\circ} R) c}. It tells us that we can pick any object \code{c} in \emph{C} as our target, and use the -round trip functor \code{L ◦ R} to pick the source +round trip functor \code{L \ensuremath{\circ} R} to pick the source \code{c'}. Then we shoot the arrow --- the morphism \code{ε\textsubscript{c'}} --- from the source to the target. Another way of looking at unit and counit is that unit lets us -\emph{introduce} the composition \code{R ◦ L} anywhere we could +\emph{introduce} the composition \code{R \ensuremath{\circ} L} anywhere we could insert an identity functor on \emph{D}; and counit lets us -\emph{eliminate} the composition \code{L ◦ R}, replacing it with the +\emph{eliminate} the composition \code{L \ensuremath{\circ} R}, replacing it with the identity on \emph{C}. That leads to some ``obvious'' consistency conditions, which make sure that introduction followed by elimination doesn't change anything: \begin{Verbatim}[commandchars=\\\{\}] -L = L ◦ I\textsubscript{D} -> L ◦ R ◦ L -> I\textsubscript{C} ◦ L = L +L = L \ensuremath{\circ} I\textsubscript{D} -> L \ensuremath{\circ} R \ensuremath{\circ} L -> I\textsubscript{C} \ensuremath{\circ} L = L \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -R = I\textsubscript{D} ◦ R -> R ◦ L ◦ R -> R ◦ I\textsubscript{C} = R +R = I\textsubscript{D} \ensuremath{\circ} R -> R \ensuremath{\circ} L \ensuremath{\circ} R -> R \ensuremath{\circ} I\textsubscript{C} = R \end{Verbatim} These are called triangular identities because they make the following diagrams commute: @@ -192,8 +192,8 @@ \section{Adjunction and Unit/Counit natural transformations. In components, these identities become: \begin{Verbatim}[commandchars=\\\{\}] -ε \textsubscript{L d} ◦ L η \textsubscript{d} = id \textsubscript{L d} -R ε c ◦ η \textsubscript{R c} = id \textsubscript{R c} +ε \textsubscript{L d} \ensuremath{\circ} L η \textsubscript{d} = id \textsubscript{L d} +R ε c \ensuremath{\circ} η \textsubscript{R c} = id \textsubscript{R c} \end{Verbatim} We often see unit and counit in Haskell under different names. Unit is known as \code{return} (or \code{pure}, in the definition of @@ -207,8 +207,8 @@ \section{Adjunction and Unit/Counit \begin{Verbatim}[commandchars=\\\{\}] extract :: w c -> c \end{Verbatim} -Here, \code{m} is the (endo-) functor corresponding to \code{R◦L}, -and \code{w} is the (endo-) functor corresponding to \code{L◦R}. As +Here, \code{m} is the (endo-) functor corresponding to \code{R \ensuremath{\circ} L}, +and \code{w} is the (endo-) functor corresponding to \code{L \ensuremath{\circ} R}. As we'll see later, they are part of the definition of a monad and a comonad, respectively. @@ -338,19 +338,19 @@ \section{Adjunctions and Hom-Sets}\label{adjunctions-and-hom-sets} work for \code{c = L d}: \begin{Verbatim}[commandchars=\\\{\}] -C(L d, L d) \ensuremath{\cong} D(d, (R ◦ L) d) +C(L d, L d) \ensuremath{\cong} D(d, (R \ensuremath{\circ} L) d) \end{Verbatim} We know that the left hand side must contain at least one morphism, the identity. The natural transformation will map this morphism to an -element of \code{D(d, (R ◦ L) d)} or, inserting the identity +element of \code{D(d, (R \ensuremath{\circ} L) d)} or, inserting the identity functor \code{I}, a morphism in: \begin{Verbatim}[commandchars=\\\{\}] -D(I d, (R ◦ L) d) +D(I d, (R \ensuremath{\circ} L) d) \end{Verbatim} We get a family of morphisms parameterized by \code{d}. They form a natural transformation between the functor \code{I} and the functor -\code{R ◦ L} (the naturality condition is easy to verify). This is +\code{R \ensuremath{\circ} L} (the naturality condition is easy to verify). This is exactly our unit, \code{η}. Conversely, starting from the existence of the unit and co-unit, we can @@ -362,15 +362,15 @@ \section{Adjunctions and Hom-Sets}\label{adjunctions-and-hom-sets} There isn't really much choice. One thing we can try is to lift \code{f} using \code{R}. That will produce a morphism \code{R f} from \code{R (L d)} to \code{R c} --- a morphism that's an -element of \code{D((R ◦ L) d, R c)}. +element of \code{D((R \ensuremath{\circ} L) d, R c)}. What we need for a component of \code{φ}, is a morphism from \code{d} to \code{R c}. That's not a problem, since we can use a component of \code{η\textsubscript{d}} to get from \code{d} to -\code{(R ◦ L) d}. We get: +\code{(R \ensuremath{\circ} L) d}. We get: \begin{Verbatim}[commandchars=\\\{\}] -φ\textsubscript{f} = R f ◦ η\textsubscript{d} +φ\textsubscript{f} = R f \ensuremath{\circ} η\textsubscript{d} \end{Verbatim} The other direction is analogous, and so is the derivation of \code{ψ}. @@ -584,8 +584,8 @@ \section{Product from Adjunction}\label{product-from-adjunction} \code{fst} and \code{snd}. \begin{Verbatim}[commandchars=\\\{\}] -p = fst ◦ m -q = snd ◦ m +p = fst \ensuremath{\circ} m +q = snd \ensuremath{\circ} m \end{Verbatim} To complete the proof of the equivalence of the two ways of defining a product we also need to show that the mapping between hom-sets is @@ -664,7 +664,7 @@ \section{Exponential from where: \begin{Verbatim}[commandchars=\\\{\}] -(a\ensuremath{\Rightarrow}b) × a = (L ◦ R) b +(a\ensuremath{\Rightarrow}b) × a = (L \ensuremath{\circ} R) b \end{Verbatim} I have previously mentioned that a universal construction defines a unique object, up to isomorphism. That's why we have ``the'' product and diff --git a/src/content/3.6/Monads Categorically.tex b/src/content/3.6/Monads Categorically.tex index afce539c..0aef8097 100644 --- a/src/content/3.6/Monads Categorically.tex +++ b/src/content/3.6/Monads Categorically.tex @@ -59,7 +59,7 @@ μ is a natural transformation from the square of the functor \code{T2} back to \code{T}. The square is simply the functor composed with -itself, \code{T ◦ T} (we can only do this kind of squaring for +itself, \code{T \ensuremath{\circ} T} (we can only do this kind of squaring for endofunctors). \begin{Verbatim}[commandchars=\\\{\}] @@ -97,7 +97,7 @@ implemented using μ: \begin{Verbatim}[commandchars=\\\{\}] -g ◦\textsubscript{T} f = μ\textsubscript{c} ◦ (T g) ◦ f +g \ensuremath{\circ}\textsubscript{T} f = μ\textsubscript{c} \ensuremath{\circ} (T g) \ensuremath{\circ} f \end{Verbatim} where @@ -140,7 +140,7 @@ horizontal composition of two natural transformations: \begin{Verbatim}[commandchars=\\\{\}] -I\textsubscript{T} ◦ μ +I\textsubscript{T} \ensuremath{\circ} μ \end{Verbatim} \begin{wrapfigure}[8]{R}{0pt} @@ -149,11 +149,11 @@ \end{wrapfigure} \noindent -and get \code{T◦T}; which can be further reduced to \code{T} by +and get \code{T \ensuremath{\circ} T}; which can be further reduced to \code{T} by applying \code{μ}. \code{I\textsubscript{T}} is the identity natural transformation from \code{T} to \code{T}. You will often see the notation for this -type of horizontal composition \code{I\textsubscript{T} ◦ μ} shortened to -\code{T◦μ}. This notation is unambiguous because it makes no sense to +type of horizontal composition \code{I\textsubscript{T} \ensuremath{\circ} μ} shortened to +\code{T \ensuremath{\circ} μ}. This notation is unambiguous because it makes no sense to compose a functor with a natural transformation, therefore \code{T} must mean \code{I\textsubscript{T}} in this context. @@ -167,8 +167,8 @@ \noindent Alternatively, we can treat \code{T\textsuperscript{3}} as the composition of -\code{T\textsuperscript{2}◦T} and apply \code{μ◦T} to it. The result is also -\code{T◦T} which, again, can be reduced to \code{T} using μ. We +\code{T\textsuperscript{2} \ensuremath{\circ} T} and apply \code{μ \ensuremath{\circ} T} to it. The result is also +\code{T \ensuremath{\circ} T} which, again, can be reduced to \code{T} using μ. We require that the two paths produce the same result. \begin{figure}[H] @@ -177,12 +177,12 @@ \end{figure} \noindent -Similarly, we can apply the horizontal composition \code{η◦T} to the +Similarly, we can apply the horizontal composition \code{η \ensuremath{\circ} T} to the composition of the identity functor \code{I} after \code{T} to obtain \code{T\textsuperscript{2}}, which can then be reduced using \code{μ}. The result should be the same as if we applied the identity natural transformation directly to \code{T}. And, by analogy, the same should -be true for \code{T◦η}. +be true for \code{T \ensuremath{\circ} η}. \begin{figure}[H] \centering @@ -458,7 +458,7 @@ \section{Monads as Monoids}\label{monads-as-monoids} objects are endofunctors, and morphisms are natural transformations between them. We can take any two objects from this category, say endofunctors \code{F} and \code{G}, and produce a third object\\ -\code{F ◦ G} --- an endofunctor that's their composition. +\code{F \ensuremath{\circ} G} --- an endofunctor that's their composition. Is endofunctor composition a good candidate for a tensor product? First, we have to establish that it's a bifunctor. Can it be used to lift a @@ -473,7 +473,7 @@ \section{Monads as Monoids}\label{monads-as-monoids} transformations, and tensor products by composition, you get: \begin{Verbatim}[commandchars=\\\{\}] -(F -> F') -> (G -> G') -> (F ◦ G -> F' ◦ G') +(F -> F') -> (G -> G') -> (F \ensuremath{\circ} G -> F' \ensuremath{\circ} G') \end{Verbatim} which you may recognize as the special case of horizontal composition. @@ -495,7 +495,7 @@ \section{Monads as Monoids}\label{monads-as-monoids} transformations: \begin{Verbatim}[commandchars=\\\{\}] -μ :: T ◦ T -> T +μ :: T \ensuremath{\circ} T -> T η :: I -> T \end{Verbatim} Not only that, here are the monoid laws: @@ -525,30 +525,30 @@ \section{Monads from Adjunctions}\label{monads-from-adjunctions} An \hyperref[adjunctions]{adjunction}, \code{L \ensuremath{\dashv} R}, is a pair of functors going back and forth between two categories \emph{C} and \emph{D}. There are two ways of composing them -giving rise to two endofunctors, \code{R ◦ L} and \code{L ◦ R}. +giving rise to two endofunctors, \code{R \ensuremath{\circ} L} and \code{L \ensuremath{\circ} R}. As per an adjunction, these endofunctors are related to identity functors through two natural transformations called unit and counit: \begin{Verbatim}[commandchars=\\\{\}] -η :: I\textsubscript{D} -> R ◦ L -ε :: L ◦ R -> I\textsubscript{C} +η :: I\textsubscript{D} -> R \ensuremath{\circ} L +ε :: L \ensuremath{\circ} R -> I\textsubscript{C} \end{Verbatim} Immediately we see that the unit of an adjunction looks just like the -unit of a monad. It turns out that the endofunctor \code{R ◦ L} is +unit of a monad. It turns out that the endofunctor \code{R \ensuremath{\circ} L} is indeed a monad. All we need is to define the appropriate μ to go with the η. That's a natural transformation between the square of our endofunctor and the endofunctor itself or, in terms of the adjoint functors: \begin{Verbatim}[commandchars=\\\{\}] -R ◦ L ◦ R ◦ L -> R ◦ L +R \ensuremath{\circ} L \ensuremath{\circ} R \ensuremath{\circ} L -> R \ensuremath{\circ} L \end{Verbatim} -And, indeed, we can use the counit to collapse the \code{L ◦ R} in +And, indeed, we can use the counit to collapse the \code{L \ensuremath{\circ} R} in the middle. The exact formula for μ is given by the horizontal composition: \begin{Verbatim}[commandchars=\\\{\}] -μ = R ◦ ε ◦ L +μ = R \ensuremath{\circ} ε \ensuremath{\circ} L \end{Verbatim} Monadic laws follow from the identities satisfied by the unit and counit of the adjunction and the interchange law. @@ -613,7 +613,7 @@ \section{Monads from Adjunctions}\label{monads-from-adjunctions} of three natural transformations: \begin{Verbatim}[commandchars=\\\{\}] -μ = R ◦ ε ◦ L +μ = R \ensuremath{\circ} ε \ensuremath{\circ} L \end{Verbatim} In other words, we need to sneak the counit ε across one level of the reader functor. We can't just call \code{fmap} directly, because the @@ -646,5 +646,5 @@ \section{Monads from Adjunctions}\label{monads-from-adjunctions} composition of two adjoint functors. Such factorization is not unique though. -We'll talk about the other endofunctor \code{L ◦ R} in the next +We'll talk about the other endofunctor \code{L \ensuremath{\circ} R} in the next section. \ No newline at end of file diff --git a/src/content/3.7/Comonads.tex b/src/content/3.7/Comonads.tex index 9df0a239..a607087b 100644 --- a/src/content/3.7/Comonads.tex +++ b/src/content/3.7/Comonads.tex @@ -301,21 +301,21 @@ \section{Comonad Categorically}\label{comonad-categorically} Then there is the derivation of the monad from an adjunction. Duality reverses an adjunction: the left adjoint becomes the right adjoint and -vice versa. And, since the composition \code{R ◦ L} defines a monad, -\code{L ◦ R} must define a comonad. The counit of the adjunction: +vice versa. And, since the composition \code{R \ensuremath{\circ} L} defines a monad, +\code{L \ensuremath{\circ} R} must define a comonad. The counit of the adjunction: \begin{Verbatim}[commandchars=\\\{\}] -ε :: L ◦ R -> I +ε :: L \ensuremath{\circ} R -> I \end{Verbatim} is indeed the same ε that we see in the definition of the comonad --- or, in components, as Haskell's \code{extract}. We can also use the unit of the adjunction: \begin{Verbatim}[commandchars=\\\{\}] -η :: I -> R ◦ L +η :: I -> R \ensuremath{\circ} L \end{Verbatim} -to insert an \code{R ◦ L} in the middle of \code{L ◦ R} and -produce \code{L ◦ R ◦ L ◦ R}. Making \code{T\textsuperscript{2}} from \code{T} +to insert an \code{R \ensuremath{\circ} L} in the middle of \code{L \ensuremath{\circ} R} and +produce \code{L \ensuremath{\circ} R \ensuremath{\circ} L \ensuremath{\circ} R}. Making \code{T\textsuperscript{2}} from \code{T} defines the δ, and that completes the definition of the comonad. We've also seen that the monad is a monoid. The dual of this statement @@ -404,7 +404,7 @@ \section{The Store Comonad}\label{the-store-comonad} R a = s \ensuremath{\Rightarrow} a \end{Verbatim} We'll use the same adjunction to define the costate comonad. A comonad -is defined by the composition \code{L ◦ R}: +is defined by the composition \code{L \ensuremath{\circ} R}: \begin{Verbatim}[commandchars=\\\{\}] L (R a) = (s ⇒ a) × s @@ -446,8 +446,8 @@ \section{The Store Comonad}\label{the-store-comonad} We construct δ, or \code{duplicate}, as the horizontal composition: \begin{Verbatim}[commandchars=\\\{\}] -δ :: L ◦ R -> L ◦ R ◦ L ◦ R -δ = L ◦ η ◦ R +δ :: L \ensuremath{\circ} R -> L \ensuremath{\circ} R \ensuremath{\circ} L \ensuremath{\circ} R +δ = L \ensuremath{\circ} η \ensuremath{\circ} R \end{Verbatim} We have to sneak η through the leftmost \code{L}, which is the \code{Prod} functor. It means acting with η, or \code{Store f}, on diff --git a/src/content/3.8/F-Algebras.tex b/src/content/3.8/F-Algebras.tex index 9182a2d6..240dc1bd 100644 --- a/src/content/3.8/F-Algebras.tex +++ b/src/content/3.8/F-Algebras.tex @@ -274,7 +274,7 @@ \section{Category of F-Algebras}\label{category-of-f-algebras} be equal: \begin{Verbatim}[commandchars=\\\{\}] -g ◦ F m = m ◦ f +g \ensuremath{\circ} F m = m \ensuremath{\circ} f \end{Verbatim} \begin{figure}[H] @@ -341,13 +341,13 @@ \section{Category of F-Algebras}\label{category-of-f-algebras} \noindent This diagram may, in turn, be interpreted as showing that -\code{j ◦ m} is a homomorphism of algebras. Only in this case the +\code{j \ensuremath{\circ} m} is a homomorphism of algebras. Only in this case the two algebras are the same. Moreover, because \code{(i, j)} is initial, there can only be one homomorphism from it to itself, and that's the identity morphism \code{id\textsubscript{i}} --- which we know is a -homomorphism of algebras. Therefore \code{j ◦ m = id\textsubscript{i}}. Using this +homomorphism of algebras. Therefore \code{j \ensuremath{\circ} m = id\textsubscript{i}}. Using this fact and the commuting property of the left diagram we can prove that -\code{m ◦ j = id\textsubscript{Fi}}. This shows that \code{m} is the inverse of +\code{m \ensuremath{\circ} j = id\textsubscript{Fi}}. This shows that \code{m} is the inverse of \code{j} and therefore \code{j} is an isomorphism between \code{F i} and \code{i}: diff --git a/src/content/3.9/Algebras for Monads.tex b/src/content/3.9/Algebras for Monads.tex index 044696cd..d3a5931b 100644 --- a/src/content/3.9/Algebras for Monads.tex +++ b/src/content/3.9/Algebras for Monads.tex @@ -36,7 +36,7 @@ gives us back the original value: \begin{Verbatim}[commandchars=\\\{\}] -alg ◦ η\textsubscript{a} = id\textsubscript{a} +alg \ensuremath{\circ} η\textsubscript{a} = id\textsubscript{a} \end{Verbatim} The second condition arises from the fact that there are two ways of evaluating the doubly nested expression \code{m (m a)}. We can first @@ -46,7 +46,7 @@ the two strategies to be equivalent: \begin{Verbatim}[commandchars=\\\{\}] -alg ◦ μ\textsubscript{a} = alg ◦ m alg +alg \ensuremath{\circ} μ\textsubscript{a} = alg \ensuremath{\circ} m alg \end{Verbatim} Here, \code{m alg} is the morphism resulting from lifting \code{alg} using the functor \code{m}. The following commuting @@ -134,10 +134,10 @@ \section{T-algebras}\label{t-algebras} conditions must be satisified: \begin{Verbatim}[commandchars=\\\{\}] -alg ◦ η\textsubscript{Ta} = id\textsubscript{Ta} +alg \ensuremath{\circ} η\textsubscript{Ta} = id\textsubscript{Ta} \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -alg ◦ μ\textsubscript{a} = alg ◦ T alg +alg \ensuremath{\circ} μ\textsubscript{a} = alg \ensuremath{\circ} T alg \end{Verbatim} But these are just monadic laws, if you plug in \code{μ} for the algebra. @@ -159,7 +159,7 @@ \section{T-algebras}\label{t-algebras} The unit of the adjunction is the natural transformation: \begin{Verbatim}[commandchars=\\\{\}] -η :: I -> U\textsuperscript{T} ◦ F\textsuperscript{T} +η :: I -> U\textsuperscript{T} \ensuremath{\circ} F\textsuperscript{T} \end{Verbatim} Let's calculate the \code{a} component of this transformation. The identity functor gives us \code{a}. The free functor produces the free @@ -171,7 +171,7 @@ \section{T-algebras}\label{t-algebras} Let's look at the counit: \begin{Verbatim}[commandchars=\\\{\}] -ε :: F\textsuperscript{T} ◦ U\textsuperscript{T} -> I +ε :: F\textsuperscript{T} \ensuremath{\circ} U\textsuperscript{T} -> I \end{Verbatim} Let's calculate its component at some T-algebra \code{(a, f)}. The forgetful functor forgets the \code{f}, and the free functor produces @@ -218,7 +218,7 @@ \section{T-algebras}\label{t-algebras} Every adjunction gives rise to a monad. The round trip \begin{Verbatim}[commandchars=\\\{\}] -U\textsuperscript{T} ◦ F\textsuperscript{T} +U\textsuperscript{T} \ensuremath{\circ} F\textsuperscript{T} \end{Verbatim} is the endofunctor in C that gives rise to the corresponding monad. Let's see what its action on an object \code{a} is. The free algebra @@ -226,7 +226,7 @@ \section{T-algebras}\label{t-algebras} \code{F\textsuperscript{T}} drops the evaluator. So, indeed, we have: \begin{Verbatim}[commandchars=\\\{\}] -U\textsuperscript{T} ◦ F\textsuperscript{T} = T +U\textsuperscript{T} \ensuremath{\circ} F\textsuperscript{T} = T \end{Verbatim} As expected, the unit of the adjunction is the unit of the monad \code{T}. @@ -235,7 +235,7 @@ \section{T-algebras}\label{t-algebras} muliplication through the following formula: \begin{Verbatim}[commandchars=\\\{\}] -μ = R ◦ ε ◦ L +μ = R \ensuremath{\circ} ε \ensuremath{\circ} L \end{Verbatim} This is a horizontal composition of three natural transformations, two of them being identity natural transformations mapping, respectively, @@ -280,13 +280,13 @@ \section{The Kleisli Category}\label{the-kleisli-category} We define the composition: \begin{Verbatim}[commandchars=\\\{\}] -h\textsubscript{K} = g\textsubscript{K} ◦ f\textsubscript{K} +h\textsubscript{K} = g\textsubscript{K} \ensuremath{\circ} f\textsubscript{K} \end{Verbatim} as a Kleisli arrow in \emph{C} \begin{Verbatim}[commandchars=\\\{\}] h :: a -> T c -h = μ ◦ (T g) ◦ f +h = μ \ensuremath{\circ} (T g) \ensuremath{\circ} f \end{Verbatim} In Haskell we would write it as: @@ -306,7 +306,7 @@ \section{The Kleisli Category}\label{the-kleisli-category} corresponding Kleisli arrow: \begin{Verbatim}[commandchars=\\\{\}] -η ◦ f +η \ensuremath{\circ} f \end{Verbatim} In Haskell we'd write it as: @@ -329,7 +329,7 @@ \section{The Kleisli Category}\label{the-kleisli-category} given by first lifting \code{f} and then applying \code{μ}: \begin{Verbatim}[commandchars=\\\{\}] -μ\textsubscript{T b} ◦ T f +μ\textsubscript{T b} \ensuremath{\circ} T f \end{Verbatim} In Haskell notation this would read: @@ -344,7 +344,7 @@ \section{The Kleisli Category}\label{the-kleisli-category} \begin{Verbatim}[commandchars=\\\{\}] F \ensuremath{\dashv} G \end{Verbatim} -and their composition \code{G ◦ F} reproduces the original monad +and their composition \code{G \ensuremath{\circ} F} reproduces the original monad \code{T}. So this is the second adjunction that produces the same monad. In fact @@ -387,7 +387,7 @@ \section{Coalgebras for Comonads}\label{coalgebras-for-comonads} \code{F\textsuperscript{W}} generates cofree coalgebras. It assigns, to an object \code{a} in \emph{C}, the coalgebra \code{(W a, δ\textsubscript{a})}. The adjunction reproduces the original comonad as the composite -\code{F\textsuperscript{W} ◦ U\textsuperscript{W}}. +\code{F\textsuperscript{W} \ensuremath{\circ} U\textsuperscript{W}}. Similarly, we can construct a co-Kleisli category with co-Kleisli arrows and regenerate the comonad from the corresponding adjunction. @@ -431,7 +431,7 @@ \section{Lenses}\label{lenses} comonad? The first coherence condition: \begin{Verbatim}[commandchars=\\\{\}] -ε\textsubscript{a} ◦ coalg = id\textsubscript{a} +ε\textsubscript{a} \ensuremath{\circ} coalg = id\textsubscript{a} \end{Verbatim} translates to: @@ -444,7 +444,7 @@ \section{Lenses}\label{lenses} The second condition: \begin{Verbatim}[commandchars=\\\{\}] -fmap coalg ◦ coalg = δ\textsubscript{a} ◦ coalg +fmap coalg \ensuremath{\circ} coalg = δ\textsubscript{a} \ensuremath{\circ} coalg \end{Verbatim} requires a little more work. First, recall the definition of \code{fmap} for the \code{Store} functor: