Website/slides/talks/2018-2-DBCategoryTheory/index.html

226 lines
7.2 KiB
HTML
Raw Normal View History

2018-01-15 23:43:28 -05:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Category Theory for DB-ies</title>
<meta name="description" content="Mimir">
<meta name="author" content="Oliver Kennedy">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="../reveal.js-3.5.0/css/reveal.css">
<link rel="stylesheet" href="ubodin.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="../reveal.js-3.5.0/lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? '../reveal.js-3.5.0/css/print/pdf.css' : '../reveal.js-3.5.0/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="../reveal.js-3.5.0/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="header">
<!-- Any Talk-Specific Header Content Goes Here -->
Category Theory for DB-ies
</div>
<div class="footer">
<!-- Any Talk-Specific Footer Content Goes Here -->
<div style="float: left; margin-top: 15px; ">
Exploring <u><b>O</b></u>nline <u><b>D</b></u>ata <u><b>In</b></u>teractions
</div>
<img src="graphics/FullText-white.png" height="40" style="float: right;"/>
</div>
<div class="slides">
<section>
<section>
<h2>Category Theory for DB-ies</h2>
<h4>(Or how I learned that mathematicians don't know how to name things)<h4>
</section>
<section>
<img src="graphics/bake_pi.jpg" height="400px">
</section>
<section>
<p>People always say that SQL is "Declarative"</p>
</section>
<section>
<h3>Why is the following replacement ok?</h3>
<pre><code class="sql">
SELECT * FROM R WHERE A = 1 AND B = 2
</code></pre>
<pre><code class="sql">
SELECT * FROM (SELECT * FROM R WHERE A = 1) WHERE B = 2
</code></pre>
<p class="fragment">(and how is it the same as computing $x + 1 + 2$?)</p>
</section>
</section>
<section>
<section>
<h2>Addition is Cool</h2>
<p class="fragment" data-fragment-index="1">
<b class="fragment" data-fragment-index="4">Commutative</b>
$$a + b = b + a$$
</p>
<p class="fragment" data-fragment-index="2">
<b class="fragment" data-fragment-index="4">Associative</b>
$$(a + b) + c = a + (b + c)$$
</p>
<p class="fragment" data-fragment-index="3">
<b class="fragment" data-fragment-index="4">Neutral Element</b>
$$0 + a = a$$
</p>
</section>
<section>
<h2>Addition is Cool</h2>
<pre><code class="java">
public int add(int a, int b) { ... }
add(a, b) == add(b, a)
add(add(a, b), c) == add(a, add(b, c))
add(a, 0) == a
</code></pre>
</section>
<section>
<h2>Math is about Patterns</h2>
<table style="font-size: smaller;">
<tr><th>Commutativity</th><th>Associativity</th><th>Neutral Element</th></tr>
<tr>
<td>$a + b = b + a$</td>
<td>$(a + b) + c = a + (b + c)$</td>
<td>0</td>
</tr>
<tr class="fragment">
<td>$a \texttt{ AND } b = b \texttt{ AND } a$</td>
<td>$(a \texttt{ AND } b) \texttt{ AND } c = a \texttt{ AND } (b \texttt{ AND } c)$</td>
<td>TRUE</td>
</tr>
<tr class="fragment">
<td>$a \texttt{ OR } b = b \texttt{ OR } a$</td>
<td>$(a \texttt{ OR } b) \texttt{ OR } c = a \texttt{ OR } (b \texttt{ OR } c)$</td>
<td>FALSE</td>
</tr>
<tr class="fragment">
<td>$A \cup B = B \cup A$</td>
<td>$(A \cup B) \cup C = A \cup (B \cup C)$</td>
<td>$\emptyset$</td>
</tr>
<tr class="fragment" style="font-size: smaller">
<td>$min(A, B) = min(B, A)$</td>
<td>$min(min(A, B), C) = min(A, min(B, C))$</td>
<td>$\infty$</td>
</tr>
</table>
<p class="fragment">Mathematicians call this a <b>Group</b></p>
</section>
<section>
<pre><code class="java">
interface Group&lt;K&gt; {
public K getZero() { ... }
public K add(K a, K b) { ... }
}
</code></pre>
<br/>
<p class="fragment">
$$\left<\; K,\; +,\; 0\;\right>$$
</p>
</section>
<section>
$$\left<\; \mathbb R,\; +,\; 0\;\right>$$
$$\left<\; \mathbb N,\; +,\; 0\;\right>$$
$$\left<\; \mathbb B,\; \texttt{AND},\; \texttt{TRUE}\;\right>$$
$$\left<\; \mathbb B,\; \texttt{OR},\; \texttt{FALSE}\;\right>$$
$$\left<\; Sets,\; \cup,\; \emptyset\;\right>$$
$$\left<\; Multisets,\; \uplus,\; \emptyset\;\right>$$
$$\left<\; \mathbb R,\; min,\; \infty;\right>$$
</section>
</section>
<section>
<section>
<h2>Fun With Groups</h2>
<p>Say define function <tt>size()</tt> that returns the size of a Multisets</p>
</section>
</section>
</div></div>
<script src="../reveal.js-3.5.0/lib/js/head.min.js"></script>
<script src="../reveal.js-3.5.0/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/../reveal.js#configuration
Reveal.initialize({
controls: false,
progress: true,
history: true,
center: true,
slideNumber: true,
transition: 'fade', // none/fade/slide/convex/concave/zoom
// Optional ../reveal.js plugins
dependencies: [
{ src: '../reveal.js-3.5.0/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '../reveal.js-3.5.0/plugin/math/math.js',
condition: function() { return true; },
mathjax: '../reveal.js-3.5.0/js/MathJax.js'
},
{ src: '../reveal.js-3.5.0/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../reveal.js-3.5.0/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../reveal.js-3.5.0/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../reveal.js-3.5.0/plugin/zoom-js/zoom.js', async: true },
{ src: '../reveal.js-3.5.0/plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>