ycategories-presentation/categories.html

411 lines
12 KiB
HTML
Raw Normal View History

2012-10-27 12:41:18 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=1024, user-scalable=no">
<title>Category Theory for Programming</title>
<!-- Required stylesheet -->
<link rel="stylesheet" href="core/deck.core.css">
<!-- Extension CSS files go here. Remove or add as needed. -->
<link rel="stylesheet" href="extensions/goto/deck.goto.css">
<link rel="stylesheet" href="extensions/menu/deck.menu.css">
<link rel="stylesheet" href="extensions/navigation/deck.navigation.css">
<link rel="stylesheet" href="extensions/status/deck.status.css">
<link rel="stylesheet" href="extensions/hash/deck.hash.css">
<link rel="stylesheet" href="extensions/scale/deck.scale.css">
<!-- Transition theme. More available in /themes/transition/ or create your own. -->
2012-11-02 16:21:45 +00:00
<link rel="stylesheet" href="themes/transition/fade.css">
2012-10-27 12:41:18 +00:00
<!-- Style theme. More available in /themes/style/ or create your own. -->
<!-- <link rel="stylesheet" href="themes/style/web-2.0.css"> -->
<link rel="stylesheet" href="themes/style/y/main.css" />
<link rel="stylesheet" href="themes/style/y/solarized.css" />
<!-- Required Modernizr file -->
<script src="modernizr.custom.js"></script>
</head>
<body class="deck-container">
2012-11-02 14:25:55 +00:00
<div style="display:none">
\(\newcommand{\F}{\mathbf{F}}\)
\(\newcommand{\C}{\mathcal{C}}\)
\(\newcommand{\D}{\mathcal{D}}\)
\(\newcommand{\id}{\mathrm{id}}\)
\(\newcommand{\ob}[1]{\mathrm{ob}(#1)}\)
\(\newcommand{\hom}[1]{\mathrm{hom}(#1)}\)
2012-11-07 13:50:33 +00:00
\(\newcommand{\Set}{\mathbf{Set}}\)
2012-11-02 14:25:55 +00:00
</div>
2012-10-27 12:41:18 +00:00
<!-- Begin slides. Just make elements with a class of slide. -->
<section class="slide">
2012-11-02 14:25:55 +00:00
<h1>Category Theory <span class="and"><span class="and">&amp;</span></span> Programming
<div><author style="font-size: .4em"><em class="base01">by</em> Yann Esposito
<div>
<twitter style="font-size: .5em">
<a href="http://twitter.com/yogsototh">@yogsototh</a>,
</twitter>
<googleplus style="font-size: .5em">
<a href="https://plus.google.com/117858550730178181663">+yogsototh</a>
</googleplus>
</div>
</author></div>
</h1>
2012-10-27 12:41:18 +00:00
</section>
<section class="slide">
2012-11-02 14:25:55 +00:00
<h2>Plan</h2>
<ul style="font-size: 2em">
<li class="yellow">Why?</li>
<li>What?</li>
<li>How?</li>
</ul>
2012-10-27 12:41:18 +00:00
</section>
<section class="slide">
2012-11-07 17:12:48 +00:00
<h2>Abstraction</h2>
<p>A common concept you see often in multiple instances.</p>
2012-11-02 14:25:55 +00:00
<div class="slide">
<p>Numbers: 1,2,3,... <em class="small">3400 BC, real numbers 760 BC</em></p>
<figure class="left">
2012-11-07 17:12:48 +00:00
<img src="categories/img/tally-count.png" style="height:5em" alt="Aboriginal Tally System"/>
2012-11-02 14:25:55 +00:00
<figcaption>Aboriginal Tally System</figcaption>
</figure>
2012-11-07 17:12:48 +00:00
<div class="slide">
<div class="left">amelioration ⇒</div>
<figure class="left">
<img src="categories/img/first-real-numbers.png" style="height:5em" alt="Mesopotamian Numbers"/>
<figcaption>Mesopotamian base 60 system</figcaption>
</figure>
</div>
2012-11-02 14:25:55 +00:00
<div class="flush"></div>
2012-11-07 17:12:48 +00:00
<div class="slide">
Operators: <b>=, &lt;, &gt;, +, ×, ...</b>
</div>
2012-10-27 12:41:18 +00:00
</section>
<section class="slide">
2012-11-07 17:12:48 +00:00
<h2>Abstraction</h2>
<h3>Generalizations</h3>
<div class="right">
<img src="categories/img/egyptian-hieroglyphics.jpg" alt="Egyptian Fractions"/>
<img src="categories/img/negative-numbers.jpg" alt="Negative Numbers (Chinese)"/>
2012-11-07 17:12:48 +00:00
</div>
2012-11-02 14:25:55 +00:00
<ul>
2012-11-07 17:12:48 +00:00
<li>Rational (Weight/Distance/Time): \(\frac{p}{q}\)
</li>
<li>Negative (Debts): ..., -2, -1, ? , 1, 2, ...
</li>
<li>Irrational (Geometry): 500 BC, Pythogoras killed Hippasus for \(\sqrt{2}\)</li>
<li>Complex (Algebra): \(\mathbb{C}\) ; 100 AD, then 16th century</li>
<li>\(0\): nothing become a number!</li>
2012-11-02 14:25:55 +00:00
</ul>
2012-11-07 17:12:48 +00:00
<p><b>More "things" can be understood as numbers</b></p>
<p><b>More "operator" to manipulate numbers</b></p>
2012-10-27 12:41:18 +00:00
</section>
<section class="slide">
2012-10-30 13:22:52 +00:00
<h2>Numbers ⇒ Sets</h2>
2012-11-02 14:25:55 +00:00
<table>
<tr>
<th>Numbers</th>
<th>Set Theory (∞)/Abstract Algebra/Topology</th>
</tr>
<tr>
<td>\(\mathbb{N}\): \((+,0)\)</td>
<td>Semigroups</td>
</tr>
<tr>
<td>\(\mathbb{Z}\): \((+,0,\times,1)\)</td>
<td>Rings</td>
</tr>
<tr>
<td>\(\mathbb{Q}\)</td>
<td>Fields</td>
</tr>
<tr>
<td>\(\mathbb{R}\)</td>
<td>Complete Fields (<em class="base01">topology</em>)</td>
</tr>
<tr>
<td>\(\mathbb{C}\)</td>
<td>Algebræ</td>
</tr>
<tr><td></td><td>Modules,Vector Spaces, Monoids, ...</td></tr>
</table>
<p><span class="and" style="visibility:hidden"><span class="and">&amp;</span></span> More <strong>general</strong>: more things are sets.<br/>
<span class="and"><span class="and">&amp;</span></span> More <strong>precise</strong>: clear distinction between concepts.</p>
2012-10-27 12:41:18 +00:00
</section>
<section class="slide">
2012-11-02 14:25:55 +00:00
<h2>Sets ⇒? <span class="yellow">Categories</span></h2>
<table>
<tr>
<th>Numbers</th>
<th>Sets</th>
<th>Categories</th>
</tr>
<tr>
<td>\(\mathbb{N}\): \((+,0)\)</td>
<td>Semigroups</td>
<td>?</td>
</tr>
<tr>
<td>\(\mathbb{Z}\): \((+,0,\times,1)\)</td>
<td>Rings</td>
<td>?</td>
</tr>
<tr>
<td>\(\mathbb{Q}\)</td>
<td>Fields</td>
<td>?</td>
</tr>
<tr>
<td>\(\mathbb{R}\)</td>
<td>Complete Fields (<em class="base01">topology</em>)</td>
<td>?</td>
</tr>
<tr>
<td>\(\mathbb{C}\)</td>
<td>Algebræ</td>
<td>?</td>
</tr>
<tr><td></td><td>Modules,Vector Spaces, Monoids, ...</td><td>?</td></tr>
</table>
2012-10-27 12:41:18 +00:00
</section>
<section class="slide">
2012-11-02 14:25:55 +00:00
<h2><span class="yellow">/.*/</span> ⇒? Category Theory</h2>
<p>Extend <span class="and"><span class="and">&amp;</span></span> Merge different scientific fields</p>
<ul>
<li>Topology</li>
<li>Quantum Physics</li>
<li>Logic</li>
<li><b>Programming</b></li>
</ul>
<p><span class="and" style="visibility:hidden"><span class="and">&amp;</span></span> More <strong>general</strong>: more things are Categories.<br/>
<span class="and"><span class="and">&amp;</span></span> More <strong>precise</strong>: better distinction between concepts.</p>
<p>Young field: <b>194245</b>, Samuel Eilenberg <span class="and"><span class="and">&amp;</span></span> Saunders Mac Lane
2012-10-27 12:41:18 +00:00
</section>
<section class="slide">
2012-11-07 13:50:33 +00:00
<h2>Type Theory ⇒ Categories</h2>
<ul>
<li>Type theory helped to remove paradoxes in Set Theory.</li>
<li>Prevent relations between different kind of objects.</li>
<li>Used in computer science</li>
</ul>
<ul>
<li>typed λ-calculus ⇒ cartesian closed categories</li>
<li>untyped λ-calculus ⇒ C-monoids (subclass of categories)</li>
<li>Martin-Löf type theories ⇒ locally cartesian closed categories</li>
2012-11-02 14:25:55 +00:00
</ul>
2012-10-27 12:41:18 +00:00
</section>
2012-10-29 16:17:38 +00:00
<section class="slide">
2012-11-07 17:23:26 +00:00
<h2>Plan</h2>
<ul style="font-size: 2em">
<li>Why?</li>
<li class="yellow">What?</li>
<li>How?</li>
</ul>
</section>
<section class="slide">
2012-11-07 13:50:33 +00:00
<h2>Category Definition</h2>
2012-11-05 16:43:28 +00:00
<p> A Category \(\mathcal{C}\) is defined by:</p>
<ul>
<li> <em>Objects (\(\ob{C}\))</em>,</li>
<li> <em>Morphisms (\(\hom{C}\))</em>,</li>
<li> a <em>Composition law (∘)</em></li>
<li> obeying some <em>Properties</em>.</li>
</ul>
2012-10-29 16:17:38 +00:00
</section>
<section class="slide">
2012-11-07 13:50:33 +00:00
<h2>Category Definition: Objects</h2>
2012-11-05 16:43:28 +00:00
<img src="categories/img/mp/objects.png" alt="objects" />
2012-11-07 13:50:33 +00:00
<p>\(\ob{\mathcal{C}}\) is a collection</p>
</section>
<section class="slide">
<h2>Category Definition: Morphisms</h2>
<img src="categories/img/mp/morphisms.png" alt="morphisms"/>
2012-11-07 13:50:33 +00:00
<p>\(\hom{A,B}\) is a collection</p>
2012-10-29 16:17:38 +00:00
</section>
<section class="slide">
2012-11-07 13:50:33 +00:00
<h2>Category Definition: Composition</h2>
2012-11-02 14:25:55 +00:00
<p>Composition (∘): \(f:A\rightarrow B, g:B\rightarrow C\)
$$g\circ f:A\rightarrow C$$
</p>
<img src="categories/img/mp/composition.png" alt="composition"/>
2012-10-29 16:17:38 +00:00
</section>
<section class="slide">
2012-11-07 13:50:33 +00:00
<h2>Category laws: neutral element</h2>
<p>for all \(X\), there is an \(\id_X\), s.t. for all \(f:A\to B\):</p>
<img src="categories/img/mp/identity.png" alt="identity"/>
2012-11-07 13:50:33 +00:00
</section>
<section class="slide">
<h2>Category laws: Associativity</h2>
<p> Composition is associative:</p>
<img src="categories/img/mp/associativecomposition.png" alt="associative composition"/>
2012-10-29 16:17:38 +00:00
</section>
2012-10-30 13:22:52 +00:00
<section class="slide">
2012-11-02 14:25:55 +00:00
<h2>Can this be a category? <span style="font-size: .5em">(\(\id_X\) implicit)</span></h2>
<figure class="left">
<img src="categories/img/mp/cat-example1.png" alt="Category example 1"/>
2012-11-02 14:25:55 +00:00
<figcaption class="slide">
<span class="green">OK</span>
</figcaption>
</figure>
<figure class="left">
<img src="categories/img/mp/cat-example2.png" alt="Category example 2"/>
2012-11-02 14:25:55 +00:00
<figcaption class="slide">
no candidate for \(g\circ f\)
<span class="red">NO</span>
</figcaption>
</figure>
<figure class="left">
<img src="categories/img/mp/cat-example3.png" alt="Category example 3"/>
2012-11-02 14:25:55 +00:00
<figcaption class="slide">
<span class="green">YES</span>
</figcaption>
</figure>
<figure class="left">
<img src="categories/img/mp/cat-example4.png" alt="Category example 4"/>
2012-11-02 14:25:55 +00:00
<figcaption class="slide">
no candidate for \(f:C\to B\)
<span class="red">NO</span>
</figcaption>
</figure>
<figure class="left">
<img src="categories/img/mp/cat-example5.png" alt="Category example 5"/>
2012-11-02 14:25:55 +00:00
<figcaption class="slide">
\((h∘g)∘f=\id_B∘f=f≠h=h∘\id_A=h∘(g∘f)\)
<span class="red">NO</span>
</figcaption>
</figure>
</section>
<section class="slide">
2012-11-07 13:50:33 +00:00
<h2>Categories Everywhere?</h2>
<h3>\(\Set\)</h3>
<ul>
<li> \(\ob{\Set}\) are sets</li>
<li> \(\hom{\Set}\) are functions</li>
<li> ∘ is functions composition </li>
</ul>
<ul class="slide">
<li>\(\ob{\Set}\) is a proper class ; not a set</li>
<li>\(\hom{E,F}\) is a set</li>
<li>\(\Set\) is a <em>locally small category</em></li>
</ul>
</section>
<section class="slide">
<h2>Categories Everywhere?</h2>
<h3>Strings</h3>
<ul>
<li> \(\ob{Str}\) is a singleton </li>
<li> \(\hom{Str}\) each string </li>
<li> ∘ is concatenation <code>(++)</code> </li>
</ul>
<ul>
<li> <code>"" ++ u = u = u ++ ""</code> </li>
<li> <code>(u ++ v) ++ w = u ++ (v ++ w)</code> </li>
</ul>
</section>
<section class="slide">
2012-11-02 14:25:55 +00:00
<h2>Definition: Functor</h2>
<p> A functor is a mapping between two categories.
Let \(\C\) and \(\D\) be two categories.
A <em>functor</em> \(\F\) from \(\C\) to \(\D\):</p>
<ul>
2012-11-02 16:21:45 +00:00
<li> Associate objects: \(A\in\ob{\C}\) to \(\F(A) \in\ob{\D}\) </li>
<li> Associate morphisms: \(f:A\to B\) to \(\F(f) : \F(A) \to \F(B)\)
2012-11-02 14:25:55 +00:00
such that
<ul>
2012-11-02 16:21:45 +00:00
<li>\( \F (\id_X) = \id_{\F(X)} \),</li>
<li>\( \F (g \circ_\C f) = \F(g) \circ_\D \F(f) \)</li>
2012-11-02 14:25:55 +00:00
</ul>
</li>
</ul>
2012-10-30 13:22:52 +00:00
</section>
2012-11-02 16:21:45 +00:00
<section class="slide">
2012-11-05 16:43:28 +00:00
<h2>Functor: Example</h2>
2012-11-02 16:21:45 +00:00
<img src="categories/img/mp/functor.png" alt="Functor"/>
2012-11-05 16:43:28 +00:00
</section>
<section class="slide">
<h2>Functor: Example</h2>
<img src="categories/img/mp/functor-morphism.png" alt="Functor"/>
2012-11-05 16:43:28 +00:00
</section>
<section class="slide">
<h2>Functor: Example</h2>
<img src="categories/img/mp/functor-morphism-color.png" alt="Functor"/>
2012-11-02 16:21:45 +00:00
</section>
2012-10-27 12:41:18 +00:00
<!-- End slides. -->
<!-- Begin extension snippets. Add or remove as needed. -->
<!-- deck.navigation snippet -->
<a href="#" class="deck-prev-link" title="Previous">&#8592;</a>
<a href="#" class="deck-next-link" title="Next">&#8594;</a>
<!-- deck.status snippet -->
<p class="deck-status">
<span class="deck-status-current"></span>
/
<span class="deck-status-total"></span>
</p>
<!-- deck.goto snippet -->
<form action="." method="get" class="goto-form">
<label for="goto-slide">Go to slide:</label>
<input type="text" name="slidenum" id="goto-slide" list="goto-datalist">
<datalist id="goto-datalist"></datalist>
<input type="submit" value="Go">
</form>
<!-- deck.hash snippet -->
<a href="." title="Permalink to this slide" class="deck-permalink">#</a>
<!-- End extension snippets. -->
<!-- Required JS files. -->
<script src="jquery-1.7.2.min.js"></script>
<script src="core/deck.core.js"></script>
<!-- Extension JS files. Add or remove as needed. -->
<script src="core/deck.core.js"></script>
<script src="extensions/hash/deck.hash.js"></script>
<script src="extensions/menu/deck.menu.js"></script>
<script src="extensions/goto/deck.goto.js"></script>
<script src="extensions/status/deck.status.js"></script>
<script src="extensions/navigation/deck.navigation.js"></script>
<script src="extensions/scale/deck.scale.js"></script>
<!-- Initialize the deck. You can put this in an external file if desired. -->
<script>
$(function() {
$.deck('.slide');
});
</script>
<!-- Y theme -->
2012-11-05 16:43:28 +00:00
<script src="js/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
2012-10-27 12:41:18 +00:00
<script src="js/highlight/highlight.pack.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
</body>
</html>