Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ◦ with \circ in math mode #54

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/content/1.1/Category - The Essence of Composition.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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{gf} 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
Expand Down Expand Up @@ -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:

Expand All @@ -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:

Expand All @@ -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{fid\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
Expand Down
40 changes: 20 additions & 20 deletions src/content/1.10/Natural Transformations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@
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
determines \code{α\textsubscript{b}} in terms of \code{α\textsubscript{a}}. It \newterm{transports}
\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}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}.

Expand Down
2 changes: 1 addition & 1 deletion src/content/1.3/Categories Great and Small.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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{gf}. 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
Expand Down
10 changes: 5 additions & 5 deletions src/content/1.5/Products and Coproducts.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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=gf}, 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
Expand Down Expand Up @@ -211,13 +211,13 @@ \section{Isomorphisms}\label{isomorphisms}
\end{figure}

\noindent
The composition \emph{gf} 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{gf} is equal to
identity. Similarly, \emph{fg} 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.
Expand Down
2 changes: 1 addition & 1 deletion src/content/1.8/Functoriality.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/content/1.9/Function Types.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}.
Expand Down
8 changes: 4 additions & 4 deletions src/content/2.4/Representable Functors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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)}.
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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} α
Copy link
Contributor

@mseri mseri Oct 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about moving also \neq, \alpha, \beta, \gamma, delta, \epsilon, ... to their LaTex math counterparts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the Unicode gives the same result (with the right packages like unicode-math, not sure it's setup here), and the source is more readable. Maybe we should move the Unicode alpha inside math mode.

Copy link
Contributor

@mseri mseri Oct 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the change should be part of #56

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm inclined to leave the unicode symbols as is, if they render fine. Most of them do.

\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
Expand Down
10 changes: 5 additions & 5 deletions src/content/2.5/The Yoneda Lemma.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}:

Expand All @@ -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}.
Expand Down Expand Up @@ -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{gid\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
Expand Down Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions src/content/2.6/Yoneda Embedding.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/content/3.1/It's All About Morphisms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}.

Expand Down
Loading