-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTFG.tex
362 lines (319 loc) · 11 KB
/
TFG.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
%!TEX TS-program = pdflatex
%!TEX encoding = utf8
%!TEX options=--shell-escape
\documentclass[\OPTfontsize, twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{bussproofs}
\usepackage[utf8]{inputenc}
\usepackage[english, spanish, es-noshorthands]{babel}
\usepackage{hyperref}
\usepackage{url}
\usepackage{epigraph}
\usepackage{tikz}
\usetikzlibrary{babel}
\usetikzlibrary{cd}
%% FONTS: libertine+biolinum+stix
\usepackage{mathpazo}
% =====================
% = Datos importantes =
% =====================
% hay que rellenar estos datos y luego
% ir a \begin{document}
\title{Teoría de Categorías y Programación Funcional}
\author{Diego Pedraza López}
\date{\today}
\newcommand{\tutores}[1]{\newcommand{\guardatutores}{#1}}
\tutores{Prof. Tutor José A. Alonso Jiménez}
\makeatletter
\AtBeginDocument{
\hypersetup{
pdftitle = {\@title},
pdfauthor = {\@author},
pdfsubject= {Matemáticas}
}
}
\makeatother
\newenvironment{dedication}
{\clearpage % we want a new page
\thispagestyle{empty}% no header and footer
\vspace*{\stretch{1}}% some space at the top
\itshape % the text is in italics
\raggedleft % flush to the right margin
}
{\par % end the paragraph
\vspace{\stretch{3}} % space at bottom is three times that at the top
\clearpage % finish off the page
}
% ======================
% = Páginas de títulos =
% ======================
\makeatletter
\edef\maintitle{\@title}
\renewcommand\maketitle{%
\begin{titlepage}
\parindent=0pt
\begin{flushleft}
\vspace*{1.5mm}
\setlength\baselineskip{0pt}
\setlength\parskip{0mm}
\begin{center}
%\leavevmode\includegraphics[totalheight=4.5cm]{sello.pdf}
\end{center}
\end{flushleft}
\vspace{1cm}
\bgroup
\Large \bfseries
\begin{center}
\@title
\end{center}
\egroup
\vspace*{.5cm}
\begin{center}
\@author
\end{center}
\begin{center}
2018
\end{center}
\vspace*{1.8cm}
\begin{flushright}
\begin{minipage}{8.45cm}
Memoria presentada como parte de los requisitos para la obtención del título de
Grado en Matemáticas por la Universidad de Sevilla.
\vspace*{7.5mm}
Tutorizada por
% \vspace*{5mm}
\end{minipage}\par
\begin{tabularx}{8.45cm}[b]{@{}l}
\guardatutores
\end{tabularx}
\end{flushright}
\vspace*{\fill}
\end{titlepage}
%%% Esto es necesario...
\pagestyle{tfg}
\renewcommand{\chaptermark}[1]{\markright{\thechapter.\space ##1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
}
\makeatother
\usepackage{minted}
\newcommand{\newterm}[1]{\index{#1}\emph{#1}}
\newcommand{\code}[1]{\Verb+{#1}+}
% ======================================
% = Color de la Universidad de Sevilla =
% ======================================
\definecolor{USred}{cmyk}{0,1.00,0.65,0.34}
% =========
% = Otros =
% =========
\usepackage[]{tabularx}
\usepackage[]{enumitem}
\setlist{noitemsep}
% ==========================
% = Matemáticas y teoremas =
% ==========================
\usepackage[]{amsmath}
\usepackage[]{amsthm}
\usepackage[]{mathtools}
\usepackage[]{bm}
\usepackage[]{thmtools}
\usepackage[]{amsfonts}
\newcommand{\marcador}{\vrule height 10pt depth 2pt width 2pt \hskip .5em\relax}
\newcommand{\cabeceraespecial}{%
\color{USred}%
\normalfont\bfseries}
\declaretheoremstyle[
spaceabove=\medskipamount,
spacebelow=\medskipamount,
headfont=\cabeceraespecial\marcador,
notefont=\cabeceraespecial,
notebraces={(}{)},
bodyfont=\normalfont\itshape,
postheadspace=1em,
numberwithin=chapter,
headindent=0pt,
headpunct={.}
]{importante}
\declaretheoremstyle[
spaceabove=\medskipamount,
spacebelow=\medskipamount,
headfont=\normalfont\itshape\color{USred},
notefont=\normalfont,
notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=1em,
numberwithin=chapter,
headindent=0pt,
headpunct={.}
]{normal}
\declaretheoremstyle[
spaceabove=\medskipamount,
spacebelow=\medskipamount,
headfont=\normalfont\itshape\color{USred},
notefont=\normalfont,
notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=1em,
headindent=0pt,
headpunct={.},
numbered=no,
qed=\color{USred}\marcador
]{demostracion}
% Los nombres de los enunciados. Añade los que necesites.
\declaretheorem[name=Observaci\'on, style=normal]{remark}
\declaretheorem[name=Corolario, style=normal]{corollary}
\declaretheorem[name=Proposici\'on, style=normal]{proposition}
\declaretheorem[name=Lema, style=normal]{lemma}
\declaretheorem[name=Ejemplo, style=normal]{example}
\declaretheorem[name=Teorema, style=importante]{theorem}
\declaretheorem[name=Definici\'on, style=importante]{definition}
\let\proof=\undefined
\declaretheorem[name=Demostraci\'on, style=demostracion]{proof}
\usepackage{scalerel}
\newcommand{\cat}{{\mathcal{C}}}
\newcommand{\Set}{{Set}}
\newcommand{\Grp}{{Grp}}
\newcommand{\Ab}{{Ab}}
\newcommand{\Vect}{{Vect}}
\newcommand{\Ring}{{Ring}}
\newcommand{\Cat}{{Cat}}
\newcommand{\Z}{{\mathbb{Z}}}
\newcommand{\Top}{{Top}}
\newcommand{\Hask}{{Hask}}
\newcommand{\sii}{{\ \Leftrightarrow\ }}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\cod}{cod}
\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\Id}{Id}
\DeclareMathOperator{\Const}{Const}
\newcommand{\underoverset}[3]{\underset{#1}{\overset{#2}{#3}}}
\hyphenation{func-tor}
\hyphenation{func-to-res}
% ============================
% = Composición de la página =
% ============================
\usepackage[papersize={\OPTpagesize},
twoside,
includehead,
top=\OPTtopmargin,
bottom=\OPTbottommargin,
inner=\OPTinnermargin,
outer=\OPToutermargin,
bindingoffset=\OPTbindingoffset]{geometry}
\linespread{1.069}
\parskip=10pt plus 1pt minus .5pt
\frenchspacing
% \raggedright
\setlength{\headheight}{20pt}
% ==============================
% = Composición de los títulos =
% ==============================
\usepackage[explicit]{titlesec}
\titleformat{\chapter}[hang]
{\Huge\sffamily\bfseries}
{\thechapter\hspace{20pt}\textcolor{USred}{\vrule width 2pt}\hspace{20pt}}{0pt}
{#1}
\titleformat{\section}
{\normalfont\Large\sffamily\bfseries}{\thesection\space\space}
{1ex}
{#1}
\titleformat{\subsection}
{\normalfont\large\sffamily}{\thesubsection\space\space}
{1ex}
{#1}
% =======================
% = Cabeceras de página =
% =======================
\usepackage[]{fancyhdr}
\usepackage[]{emptypage}
\fancypagestyle{tfg}{%
\fancyhf{}%
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead[LE]{{\normalsize\color{USred}\bfseries\thepage}\quad
\small\textsc{\MakeLowercase{\maintitle}}}
\fancyhead[RO]{\small\textsc{\MakeLowercase{\rightmark}}%
\quad{\normalsize\bfseries\color{USred}\thepage}}%
}
\usepackage{makeidx}
\makeindex
\usepackage{csquotes} % comillas españolas
% =============================
% = El documento empieza aquí =
% =============================
\begin{document}
\begin{titlepage}
\centering
{\scshape\Large Trabajo Fin de Grado\par}
\vspace{1.5cm}
{\huge\bfseries Teoría de Categorías y Programación Funcional\par}
\vspace{0.025cm}
\rule{0.4\textwidth}{0.4pt}
\vspace{1cm}
{\Large\itshape Diego Pedraza López\par}
\vspace{1cm}
tutorizado por\par
Prof.~Tutor~José A. Alonso Jiménez\par
\vspace{1cm}
%\includegraphics[width=0.6\textwidth]{bookworm}
\vspace{7cm}
{\scshape\LARGE Universidad de Sevilla \par}
\vfill
\end{titlepage}
\maketitle
\begin{dedication}
Dedicado a Mila.
\end{dedication}
\frontmatter
\tableofcontents
\mainmatter
\chapter*{Sumario}
\addcontentsline{toc}{chapter}{Sumario}
\markright{Sumario}
En esencia, la teoría de categorías es el estudio de la composición.
Una categoría es una colección de objetos y morfismos entre ellos de manera que la composición tenga sentido.
Este tipo de estructura ressulta ser muy común en la mayoría de los campos de las matemáticas.
Es más, tiene un fuerte vínculo con la lógica y la teoría de tipos a través de las categorías cartesianamente cerradas.
En programación funcional, algunos diseños como las mónadas son originarias de la teoría de categorías.
Para poder hablar de estos temas, primero tendremos que entender las construcciones comunes que pueden ser definidas sobre una categoría o incluso entre categorías.
Exploraremos el campo de la teoría de categorías y sus conexiones con otros campos de la matemáticas usando programación funcional, específicamente Haskell.
\section*{Abstract}
\begin{otherlanguage}{english}
In essence, category theory is the study of the composition.
A category is a collection of objects and morphism between them where composition of morphism makes sense.
This kind of structure happens to be very common in most fields of mathematics.
Furthermore, it has strong links with logic and type theory through cartesian closed categories.
In functional programming, some design patterns like monads originate from category theory.
In order to discuss this topics, first we'll have to understand common constructions that can be defined over a category or even between categories.
We will explore the realm of category theory and its connections with other fields of mathematics using functional programming, specifically Haskell.
\end{otherlanguage}
\include{introduccion}
\include{fundamentos}
\include{yoneda}
\include{cartesianas}
\include{monoides}
\include{monadas}
\include{f-algebras}
\include{epilogo}
\backmatter
\chapter*{Bibliografía}
\markright{Bibliografía}
\addcontentsline{toc}{chapter}{Bibliografía}
%\nocite{milewski}
%\bibliographystyle{acm}
%\bibliography{bibliografia}
\begin{itemize}
\setlength\itemsep{1em}
\item \textsc{Awodey, Steve}, \emph{Category Theory}, Oxford University Press, 2006.
\item \textsc{Buurlage, Jan-Willem}, \emph{Lecture Notes on Categories and Haskell}, 2017. Disponible en \url{https://jwbuurlage.github.io/}.
\item \textsc{Lambek, Joachim} y \textsc{Scott, Philip J.}, \emph{Introduction to Higher Order Categorical Logic}, Cambridge University Press, 1986.
\item \textsc{Lipovača, Miran}, \emph{Learn You a Haskell for Great Good!: A Beginner's Guide}, No Starch Press (2011). Disponible en \url{http://learnyouahaskell.com/}.
\item \textsc{Mac Lane, Saunder}, \emph{Categories for the Working Mathematician}, Springer, 2ª edición, 1998.
\item \textsc{Milewski, Bartosz}, \emph{Category Theory for Programmers}, 2018. Disponible en \url{https://github.com/hmemcpy/milewski-ctfp-pdf}.
\item \textsc{Pierce, Benjamin C.}, \emph{A taste of category theory for computer scientist}, Carnegie Mellon University, 1988.
\item \textsc{Riehl, Emily}, \emph{Categorical homotopy theory}, Cambridge University Press, 2014.
\item \textsc{Riehl, Emily}, \emph{Category Theory in Context}, Cambridge University Press, 2016.
\item \textsc{Thompson, Simon}, \emph{Type theory \& functional programming}, Addison-Wesley, 1991.
\end{itemize}
\printindex
\end{document}