Skip to content

Commit

Permalink
Replacing \textfb{Set} with a macro $\Set$
Browse files Browse the repository at this point in the history
  • Loading branch information
hmemcpy committed Oct 2, 2017
1 parent 5d7b751 commit a21cab6
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 117 deletions.
10 changes: 5 additions & 5 deletions src/content/1.2/Types and Functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ \section{What Are Types?}\label{what-are-types}
sets tricky. There are problems with polymorphic functions that involve
circular definitions, and with the fact that you can't have a set of all
sets; but as I promised, I won't be a stickler for math. The great thing
is that there is a category of sets, which is called \textbf{Set}, and
we'll just work with it. In \textbf{Set}, objects are sets and morphisms
is that there is a category of sets, which is called $\Set$, and
we'll just work with it. In $\Set$, objects are sets and morphisms
(arrows) are functions.

\textbf{Set} is a very special category, because we can actually peek
$\Set$ is a very special category, because we can actually peek
inside its objects and get a lot of intuitions from doing that. For
instance, we know that an empty set has no elements. We know that there
are special one-element sets. We know that functions map elements of one
Expand Down Expand Up @@ -180,12 +180,12 @@ \section{What Are Types?}\label{what-are-types}
functions, which return valid results for every possible argument.

Because of the bottom, you'll see the category of Haskell types and
functions referred to as \textbf{Hask} rather than \textbf{Set}. From
functions referred to as \textbf{Hask} rather than $\Set$. From
the theoretical point of view, this is the source of never-ending
complications, so at this point I will use my butcher's knife and
terminate this line of reasoning. From the pragmatic point of view, it's
okay to ignore non-terminating functions and bottoms, and treat
\textbf{Hask} as bona fide \textbf{Set}.\footnote{Nils Anders Danielsson,
\textbf{Hask} as bona fide $\Set$.\footnote{Nils Anders Danielsson,
John Hughes, Patrik Jansson, Jeremy Gibbons, \href{http://www.cs.ox.ac.uk/jeremy.gibbons/publications/fast+loose.pdf}{
Fast and Loose Reasoning is Morally Correct}. This paper provides justification for ignoring bottoms in most contexts.}

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 @@ -170,7 +170,7 @@ \section{Monoid as Set}\label{monoid-as-set}
mappend s1 s2 = (++) s1 s2
\end{Verbatim}
The former translates into equality of morphisms in the category
\textbf{Hask} (or \textbf{Set}, if we ignore bottoms, which is the name
\textbf{Hask} (or $\Set$, if we ignore bottoms, which is the name
for never-ending calculations). Such equations are not only more
succinct, but can often be generalized to other categories. The latter
is called \newterm{extensional} equality, and states the fact that for any
Expand Down
2 changes: 1 addition & 1 deletion src/content/1.5/Products and Coproducts.tex
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ \section{Asymmetry}\label{asymmetry}
from the terminal end.

This is not an intrinsic property of sets, it's a property of functions,
which we use as morphisms in \textbf{Set}. Functions are, in general,
which we use as morphisms in $\Set$. Functions are, in general,
asymmetric. Let me explain.

A function must be defined for every element of its domain set (in
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 @@ -611,7 +611,7 @@ \section{Profunctors}\label{profunctors}

We've seen that the function-arrow operator is contravariant in its
first argument and covariant in the second. Is there a name for such a
beast? It turns out that, if the target category is \textbf{Set}, such a
beast? It turns out that, if the target category is $\Set$, such a
beast is called a \newterm{profunctor}. Because a contravariant functor is
equivalent to a covariant functor from the opposite category, a
profunctor is defined as:\\
Expand Down
30 changes: 15 additions & 15 deletions src/content/1.9/Function Types.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
\code{a->b} is more than that: it's a set of morphisms
between objects \code{a} and \code{b}. A set of morphisms between
two objects in any category is called a hom-set. It just so happens that
in the category \textbf{Set} every hom-set is itself an object in the
in the category $\Set$ every hom-set is itself an object in the
same category ---because it is, after all, a \newterm{set}.

The same is not true of other categories where hom-sets are external to
Expand All @@ -26,7 +26,7 @@
\end{wrapfigure}

\noindent
It's the self-referential nature of the category \textbf{Set} that makes
It's the self-referential nature of the category $\Set$ that makes
function types special. But there is a way, at least in some categories,
to construct objects that represent hom-sets. Such objects are called
\newterm{internal} hom-sets.
Expand All @@ -35,7 +35,7 @@ \section{Universal Construction}\label{universal-construction}

Let's forget for a moment that function types are sets and try to
construct a function type, or more generally, an internal hom-set, from
scratch. As usual, we'll take our cues from the \textbf{Set} category,
scratch. As usual, we'll take our cues from the $\Set$ category,
but carefully avoid using any properties of sets, so that the
construction will automatically work for other categories.

Expand All @@ -52,7 +52,7 @@ \section{Universal Construction}\label{universal-construction}
The obvious pattern that connects these three types is called
\newterm{function application} or \newterm{evaluation}. Given a candidate for
a function type, let's call it \code{z} (notice that, if we are not in
the category \textbf{Set}, this is just an object like any other
the category $\Set$, this is just an object like any other
object), and the argument type \code{a} (an object), the application
maps this pair to the result type \code{b} (an object). We have three
objects, two of them fixed (the ones representing the argument type and
Expand All @@ -77,7 +77,7 @@ \section{Universal Construction}\label{universal-construction}
well talk about the whole \newterm{product} of the function type \code{z}
and the argument type \code{a}. The product \code{z×a} is an object,
and we can pick, as our application morphism, an arrow \code{g} from
that object to \code{b}. In \textbf{Set}, \code{g} would be the
that object to \code{b}. In $\Set$, \code{g} would be the
function that maps every pair \code{(f,\ x)} to \code{f\ x}.

So that's the pattern: a product of two objects \code{z} and
Expand All @@ -102,7 +102,7 @@ \section{Universal Construction}\label{universal-construction}

Let's review the universal construction. We start with a pattern of
objects and morphisms. That's our imprecise query, and it usually yields
lots and lots of hits. In particular, in \textbf{Set}, pretty much
lots and lots of hits. In particular, in $\Set$, pretty much
everything is connected to everything. We can take any object
\code{z}, form its product with \code{a}, and there's going to be a
function from it to \code{b} (except when \code{b} is an empty set).
Expand Down Expand Up @@ -202,7 +202,7 @@ \section{Universal Construction}\label{universal-construction}
\noindent
Of course, there is no guarantee that such an object \code{a\ensuremath{\Rightarrow}b} exists
for any pair of objects \code{a} and \code{b} in a given category.
But it always does in \textbf{Set}. Moreover, in \textbf{Set}, this
But it always does in $\Set$. Moreover, in $\Set$, this
object is isomorphic to the hom-set \emph{Set(a, b)}.

This is why, in Haskell, we interpret the function type
Expand All @@ -219,7 +219,7 @@ \section{Currying}\label{currying}
g :: z × a -> b
\end{Verbatim}
Being a morphism from a product comes as close as it gets to being a
function of two variables. In particular, in \textbf{Set}, \code{g} is
function of two variables. In particular, in $\Set$, \code{g} is
a function from pairs of values, one from the set \code{z} and one
from the set \code{a}.

Expand All @@ -230,7 +230,7 @@ \section{Currying}\label{currying}
\begin{Verbatim}[commandchars=\\\{\}]
h :: z -> (a⇒b)
\end{Verbatim}
In \textbf{Set}, this just means that \code{h} is a function that
In $\Set$, this just means that \code{h} is a function that
takes one variable of type \code{z} and returns a function from
\code{a} to \code{b}. That makes \code{h} a higher order function.
Therefore the universal construction establishes a one-to-one
Expand Down Expand Up @@ -408,7 +408,7 @@ \section{Cartesian Closed
Although I will continue using the category of sets as a model for types
and functions, it's worth mentioning that there is a larger family of
categories that can be used for that purpose. These categories are
called \newterm{cartesian closed}, and \textbf{Set} is just one example of
called \newterm{cartesian closed}, and $\Set$ is just one example of
such a category.

A cartesian closed category must contain:
Expand Down Expand Up @@ -442,7 +442,7 @@ \section{Cartesian Closed
(b + c) × a = b × a + c × a
\end{Verbatim}
is called a \newterm{bicartesian closed} category. We'll see in the next
section that bicartesian closed categories, of which \textbf{Set} is a
section that bicartesian closed categories, of which $\Set$ is a
prime example, have some interesting properties.

\section{Exponentials and Algebraic Data
Expand All @@ -468,8 +468,8 @@ \subsection{Zeroth Power}\label{zeroth-power}
set of morphisms going from the initial object to an arbitrary object
\code{a}. By the definition of the initial object, there is exactly
one such morphism, so the hom-set \emph{C(0, a)} is a singleton set. A
singleton set is the terminal object in \textbf{Set}, so this identity
trivially works in \textbf{Set}. What we are saying is that it works in
singleton set is the terminal object in $\Set$, so this identity
trivially works in $\Set$. What we are saying is that it works in
any bicartesian closed category.

In Haskell, we replace 0 with \code{Void}; 1 with the unit type
Expand All @@ -492,7 +492,7 @@ \subsection{Powers of One}\label{powers-of-one}
\begin{Verbatim}[commandchars=\\\{\}]
1\textsuperscript{a} = 1
\end{Verbatim}
This identity, when interpreted in \textbf{Set}, restates the definition
This identity, when interpreted in $\Set$, restates the definition
of the terminal object: There is a unique morphism from any object to
the terminal object. In general, the internal hom-object from \code{a}
to the terminal object is isomorphic to the terminal object itself.
Expand All @@ -510,7 +510,7 @@ \subsection{First Power}\label{first-power}
This is a restatement of the observation that morphisms from the
terminal object can be used to pick ``elements'' of the object
\code{a}. The set of such morphisms is isomorphic to the object
itself. In \textbf{Set}, and in Haskell, the isomorphism is between
itself. In $\Set$, and in Haskell, the isomorphism is between
elements of the set \code{a} and functions that pick those elements,
\code{()->a}.

Expand Down
12 changes: 6 additions & 6 deletions src/content/2.2/Limits and Colimits.tex
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ \section{Limit as a Natural Isomorphism}\label{limit-as-a-natural-isomorphism}
But what are the functors that are related by this transformation?

One functor is the mapping of \code{c} to the set
\code{C(c, Lim D)}. It's a functor from \mathtext{C} to \textbf{Set} ---
\code{C(c, Lim D)}. It's a functor from \mathtext{C} to $\Set$ ---
it maps objects to sets. In fact it's a contravariant functor. Here's
how we define its action on morphisms: Let's take a morphism \code{f}
from \code{c'} to \code{c}:
Expand Down Expand Up @@ -311,13 +311,13 @@ \section{Limit as a Natural Isomorphism}\label{limit-as-a-natural-isomorphism}
c -> Nat(\ensuremath{\Delta_c}, D)
\end{Verbatim}
What I have just done is to show you that we have two (contravariant)
functors from \mathtext{C} to \textbf{Set}. I haven't made any assumptions
functors from \mathtext{C} to $\Set$. I haven't made any assumptions
--- these functors always exist.

Incidentally, the first of these functors plays an important role in
category theory, and we'll see it again when we talk about Yoneda's
lemma. There is a name for contravariant functors from any category
\mathtext{C} to \textbf{Set}: they are called ``presheaves''. This one is
\mathtext{C} to $\Set$: they are called ``presheaves''. This one is
called a \newterm{representable presheaf}. The second functor is also a
presheaf.

Expand All @@ -337,7 +337,7 @@ \section{Limit as a Natural Isomorphism}\label{limit-as-a-natural-isomorphism}
I'm not going to go through the proof of this statement. The procedure
is pretty straightforward if not tedious. When dealing with natural
transformations, you usually focus on components, which are morphisms.
In this case, since the target of both functors is \textbf{Set}, the
In this case, since the target of both functors is $\Set$, the
components of the natural isomorphism will be functions. These are
higher order functions, because they go from the hom-set to the set of
natural transformations. Again, you can analyze a function by
Expand Down Expand Up @@ -409,7 +409,7 @@ \section{Examples of Limits}\label{examples-of-limits}
f . p = g . p
\end{Verbatim}
The way to think about it is that, if we restrict our attention to
\textbf{Set}, the image of the function \code{p} selects a subset of
$\Set$, the image of the function \code{p} selects a subset of
\code{a}. When restricted to this subset, the functions \code{f} and
\code{g} are equal.

Expand Down Expand Up @@ -680,7 +680,7 @@ \section{Continuity}\label{continuity}
\end{Verbatim}
When its second argument is fixed, the hom-set functor (which becomes
the representable presheaf) maps colimits in \mathtext{C} to limits in
\textbf{Set}; and when its first argument is fixed, it maps limits to
$\Set$; and when its first argument is fixed, it maps limits to
limits.

In Haskell, a hom-functor is the mapping of any two types to a function
Expand Down
10 changes: 5 additions & 5 deletions src/content/2.3/Free Monoids.tex
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ \section{Free Monoid Universal Construction}\label{free-monoid-universal-constru
\textbf{Mon} to sets, but we can also map morphisms of \textbf{Mon}
(homomorphisms) to functions. Again, this seems sort of trivial, but it
will become useful soon. This mapping of objects and morphisms from
\textbf{Mon} to \textbf{Set} is in fact a functor. Since this functor
\textbf{Mon} to $\Set$ is in fact a functor. Since this functor
``forgets'' the monoidal structure --- once we are inside a plain set,
we no longer distinguish the unit element or care about multiplication
--- it's called a \newterm{forgetful functor}. Forgetful functors come up
Expand Down Expand Up @@ -183,17 +183,17 @@ \section{Free Monoid Universal Construction}\label{free-monoid-universal-constru
those blobs. Here's how it works:

We start with a set of generators, \code{x}. That's a set in
\textbf{Set}.
$\Set$.

The pattern we are going to match consists of a monoid \code{m} --- an
object of \textbf{Mon} --- and a function \code{p} in \textbf{Set}:
object of \textbf{Mon} --- and a function \code{p} in $\Set$:

\begin{Verbatim}[commandchars=\\\{\}]
p :: x -> U m
\end{Verbatim}
where \code{U} is our forgetful functor from \textbf{Mon} to
\textbf{Set}. This is a weird heterogeneous pattern --- half in
\textbf{Mon} and half in \textbf{Set}.
$\Set$. This is a weird heterogeneous pattern --- half in
\textbf{Mon} and half in $\Set$.

The idea is that the function \code{p} will identify the set of
generators inside the X-ray image of \code{m}. It doesn't matter that
Expand Down
26 changes: 13 additions & 13 deletions src/content/2.4/Representable Functors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
mathematics --- at least it used to be. Category theory tries to step
away from set theory, to some extent. For instance, it's a known fact
that the set of all sets doesn't exist, but the category of all sets,
\textbf{Set}, does. So that's good. On the other hand, we assume that
$\Set$, does. So that's good. On the other hand, we assume that
morphisms between any two objects in a category form a set. We even
called it a hom-set. To be fair, there is a branch of category theory
where morphisms don't form sets. Instead they are objects in another
Expand Down Expand Up @@ -46,14 +46,14 @@
\section{The Hom Functor}\label{the-hom-functor}

Every category comes equipped with a canonical family of mappings to
\textbf{Set}. Those mappings are in fact functors, so they preserve the
$\Set$. Those mappings are in fact functors, so they preserve the
structure of the category. Let's build one such mapping.

Let's fix one object \code{a} in \emph{C} and pick another object
\code{x} also in \emph{C}. The hom-set \code{C(a, x)} is a set, an
object in \textbf{Set}. When we vary \code{x}, keeping \code{a}
fixed, \code{C(a, x)} will also vary in \textbf{Set}. Thus we have a
mapping from \code{x} to \textbf{Set}.
object in $\Set$. When we vary \code{x}, keeping \code{a}
fixed, \code{C(a, x)} will also vary in $\Set$. Thus we have a
mapping from \code{x} to $\Set$.

\begin{figure}[H]
\centering
Expand Down Expand Up @@ -163,16 +163,16 @@ \section{The Hom Functor}\label{the-hom-functor}
\section{Representable Functors}\label{representable-functors}

We've seen that, for every choice of an object \code{a} in \emph{C},
we get a functor from \emph{C} to \textbf{Set}. This kind of
structure-preserving mapping to \textbf{Set} is often called a
we get a functor from \emph{C} to $\Set$. This kind of
structure-preserving mapping to $\Set$ is often called a
\newterm{representation}. We are representing objects and morphisms of
\emph{C} as sets and functions in \textbf{Set}.
\emph{C} as sets and functions in $\Set$.

The functor \code{C(a, -)} itself is sometimes called representable.
More generally, any functor \code{F} that is naturally isomorphic to
the hom-functor, for some choice of \code{a}, is called
\newterm{representable}. Such functor must necessarily be
\textbf{Set}-valued, since \code{C(a, -)} is.
$\Set$-valued, since \code{C(a, -)} is.

I said before that we often think of isomorphic sets as identical. More
generally, we think of isomorphic \newterm{objects} in a category as
Expand Down Expand Up @@ -203,7 +203,7 @@ \section{Representable Functors}\label{representable-functors}
natural transformation.

Let's look at the component of α at some object \code{x}. It's a
function in \textbf{Set}:
function in $\Set$:

\begin{Verbatim}[commandchars=\\\{\}]
α\textsubscript{x} :: C(a, x) -> F x
Expand Down Expand Up @@ -248,7 +248,7 @@ \section{Representable Functors}\label{representable-functors}
α ◦ β = id = β ◦ α
\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
to any $\Set$-valued functor always exists (Yoneda's lemma) but it
is not necessarily invertible.

Let me give you an example in Haskell with the list functor and
Expand Down Expand Up @@ -328,7 +328,7 @@ \section{Representable Functors}\label{representable-functors}
Representability for contravariant functors is similarly defined, except
that we keep the second argument of \code{C(-, a)} fixed. Or,
equivalently, we may consider functors from \emph{C}\textsuperscript{op}
to \textbf{Set}, because \code{C\textsuperscript{op}(a, -)} is the same as
to $\Set$, because \code{C\textsuperscript{op}(a, -)} is the same as
\code{C(-, a)}.

There is an interesting twist to representability. Remember that
Expand Down Expand Up @@ -370,7 +370,7 @@ \section{Challenges}\label{challenges}
\tightlist
\item
Show that the hom-functors map identity morphisms in \emph{C} to
corresponding identity functions in \textbf{Set}.
corresponding identity functions in $\Set$.
\item
Show that \code{Maybe} is not representable.
\item
Expand Down
Loading

0 comments on commit a21cab6

Please sign in to comment.