Provenance Semiring slides

pull/1/head
Oliver Kennedy 2019-04-26 01:07:03 -04:00
parent e53f1c4bab
commit 56c031a970
2 changed files with 460 additions and 1 deletions

View File

@ -26,7 +26,10 @@ def data_table(schema, data, params = {})
end
end
if params.has_key? :annotations
data = data.zip(params[:annotations]).map { |row, annot| row+[tag("td", ""+annot, annotation_style)] }
data = data.zip(params[:annotations]).map do |row, annot|
if annot.nil? then row
else row+[tag("td", ""+annot.to_s, annotation_style)] end
end
num_cols += 1
end

View File

@ -0,0 +1,456 @@
---
template: templates/cse4562_2019_slides.erb
title: Provenance
date: April 26, 2019
textbook: Readings Only
dependencies:
- lib/slide_utils.rb
---
<!--
* How is provenance useful
- Debugging: Why am I seeing these results (bug, meaningful data feature)
- Access Control / Security: What went into these results? Do they leak data?
- "What If" queries: What happens to my result if I change an input.
- View Maintenance: Which outputs does this result change?
-->
<%
require "slide_utils.rb"
%>
<section>
<section>
<p>Think of the relation as a function from <i>potential facts</i> to their truth value.</p>
<%= data_table(
["A", "B"],
[[1, 2], [1, 3], [2, 3], [2, 4], [1, 1], "..."],
name: "R", rowids: true,
annotations: ["T", "T", "T", "T", "F", "F"],
build_in: [0, 0, 0, 0, 2, 3],
table_args: { class: "fragment", "data-fragment-index" => 1 }
) %>
<p class="fragment">Every row not explicitly listed is mapped to False</p>
</section>
<section>
<p class="fragment fade-out" data-fragment-index="1">$Q(A) :-~~ R(A, B), S(B, C)$</p>
<p class="fragment" data-fragment-index="1">$Q(1) :-~~ R(1, B), S(B, C)$</p>
</section>
<section>
<p>$Q(1) \equiv R(1, 1) \wedge S(1, 1)$</p>
<p class="fragment" data-fragment-index="1">$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 1)$</p>
<p class="fragment" data-fragment-index="1">$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 1)$</p>
<p class="fragment" data-fragment-index="1">...
<p class="fragment" data-fragment-index="2">$~~~~~~~~ \vee ~~ R(1, 1) \wedge S(1, 2)$</p>
<p class="fragment" data-fragment-index="2">$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 2)$</p>
<p class="fragment" data-fragment-index="2">$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 2)$</p>
<p class="fragment" data-fragment-index="2">...
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true) %>
</div>
<p>$Q(1) \equiv R(1, 1) \wedge S(1, 1)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 1)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 1)$</p>
<p>...</p>
<p>$~~~~~~~~ \vee ~~ R(1, 1) \wedge S(1, 2)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 2)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 2)$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true) %>
</div>
<p>$Q(1) \equiv R(1, 1) \wedge S(1, 1)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(2, 1)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(3, 1)$</p>
<p>...</p>
<p>$~~~~~~~~ \vee ~~ R(1, 1) \wedge S(1, 2)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(2, 2)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(3, 2)$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true) %>
</div>
<p>$Q(1) \equiv ~~~~~F~~~~ \wedge S(1, 1)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(2, 1)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(3, 1)$</p>
<p>...</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~F~~~~ \wedge S(1, 2)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(2, 2)$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge S(3, 2)$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true) %>
</div>
<p>$Q(1) \equiv ~~~~~F~~~~ \wedge ~~~~F~~~~~$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~T~~~~~$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~F~~~~~$</p>
<p>...</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~F~~~~ \wedge ~~~~F~~~~~$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~T~~~~~$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~F~~~~~$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true) %>
</div>
<p>$Q(1) \equiv$<span style="color: lightgrey;">$~~~~~~F~~~~ \wedge ~~~~F~~~~~$</span></p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~T~~~~~$</p>
<p style="color: lightgrey;">$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~F~~~~~$</p>
<p>...</p>
<p style="color: lightgrey;">$~~~~~~~~ \vee ~~ ~~~~~F~~~~ \wedge ~~~~F~~~~~$</p>
<p>$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~T~~~~~$</p>
<p style="color: lightgrey;">$~~~~~~~~ \vee ~~ ~~~~~T~~~~ \wedge ~~~~F~~~~~$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true) %>
</div>
<p>$Q(1) \equiv$<span style="color: lightgrey;">$~R(1, 1) \wedge S(1, 1)$</span></p>
<p>$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 1)$</p>
<p style="color: lightgrey;">$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 1)$</p>
<p>...</p>
<p style="color: lightgrey;">$~~~~~~~~ \vee ~~ R(1, 1) \wedge S(1, 2)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 2)$</p>
<p style="color: lightgrey;">$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 2)$</p>
<p>...</p>
</section>
</section>
<section>
<section>
<%= data_table(["A", "B"], [[1, 2], [1, 2], [1, 2], [1, 3], [2, 3], [2, 3], [2, 4]], name: "R", rowids: true) %>
</section>
<section>
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: [3, 1, 2, 1]) %>
</section>
<section>
<table><tr><td>
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: [3, 1, 2, 1]) %>
</td><td>
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: [1, 2, 3]) %>
</td></tr></table>
<p>$Q(1) =~?$</p>
</section>
<section>
<table><tr><td>
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: [3, 1, 2, 1]) %>
</td><td>
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: [1, 2, 3]) %>
</td></tr></table>
<p>$Q(1) = 3\times 1 + 3 \times 2 + 1 \times 3 = 12$</p>
</section>
<section>
<p>$Q(1) \equiv R(1, 1) \wedge S(1, 1)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 1)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 1)$</p>
<p>...</p>
<p>$~~~~~~~~ \vee ~~ R(1, 1) \wedge S(1, 2)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 2) \wedge S(2, 2)$</p>
<p>$~~~~~~~~ \vee ~~ R(1, 3) \wedge S(3, 2)$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: [3, 1, 2, 1]) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: [1, 2, 3]) %>
</div>
<p>$Q(1) \equiv R(1, 1) \times S(1, 1)$</p>
<p>$~~~~~~~~ + ~~ R(1, 2) \times S(2, 1)$</p>
<p>$~~~~~~~~ + ~~ R(1, 3) \times S(3, 1)$</p>
<p>...</p>
<p>$~~~~~~~~ + ~~ R(1, 1) \times S(1, 2)$</p>
<p>$~~~~~~~~ + ~~ R(1, 2) \times S(2, 2)$</p>
<p>$~~~~~~~~ + ~~ R(1, 3) \times S(3, 2)$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: [3, 1, 2, 1]) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: [1, 2, 3]) %>
</div>
<p>$Q(1) \equiv 0 \times 0$</p>
<p>$~~~~~~~~ + ~~ 3 \times 1$</p>
<p>$~~~~~~~~ + ~~ 1 \times 0$</p>
<p>...</p>
<p>$~~~~~~~~ + ~~ 0 \times 0$</p>
<p>$~~~~~~~~ + ~~ 3 \times 2$</p>
<p>$~~~~~~~~ + ~~ 1 \times 0$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: [3, 1, 2, 1]) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: [1, 2, 3]) %>
</div>
<p>$Q(1) \equiv $<span style="color: lightgrey;">$~0 \times 0$</span></p>
<p>$~~~~~~~~ + ~~ 3 \times 1$</p>
<p style="color: lightgrey;">$~~~~~~~~ + ~~ 1 \times 0$</p>
<p>...</p>
<p style="color: lightgrey;">$~~~~~~~~ + ~~ 3 \times 0$</p>
<p>$~~~~~~~~ + ~~ 3 \times 2$</p>
<p style="color: lightgrey;">$~~~~~~~~ + ~~ 1 \times 0$</p>
<p>...</p>
</section>
</section>
<section>
<section>
<table><tr><td>
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: ["a", "b", "c", "d"]) %>
</td><td>
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: ["e", "f", "g"]) %>
</td></tr></table>
</section>
<section>
<table><tr><td>
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4], "..."], name: "R", rowids: true, annotations: ["a", "b", "c", "d", "$\\mathbf{0}$"]) %>
</td><td>
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3], "..."], name: "S", rowids: true, annotations: ["e", "f", "g", "$\\mathbf{0}$"]) %>
</td></tr></table>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4], "..."], name: "R", rowids: true, annotations: ["a", "b", "c", "d", "$\\mathbf{0}$"]) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3], "..."], name: "S", rowids: true, annotations: ["e", "f", "g", "$\\mathbf{0}$"]) %>
<p><br/></p>
</div>
<p>$Q(1) \equiv R(1, 1) \otimes S(1, 1)$</p>
<p>$~~~~~~~~ \oplus ~~ R(1, 2) \otimes S(2, 1)$</p>
<p>$~~~~~~~~ \oplus ~~ R(1, 3) \otimes S(3, 1)$</p>
<p>...</p>
<p>$~~~~~~~~ \oplus ~~ R(1, 1) \otimes S(1, 2)$</p>
<p>$~~~~~~~~ \oplus ~~ R(1, 2) \otimes S(2, 2)$</p>
<p>$~~~~~~~~ \oplus ~~ R(1, 3) \otimes S(3, 2)$</p>
<p>...</p>
</section>
<section>
<div style="float:left; font-size: 80%;">
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4], "..."], name: "R", rowids: true, annotations: ["a", "b", "c", "d", "$\\mathbf{0}$"]) %>
</div>
<div style="float:right; font-size: 80%;">
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3], "..."], name: "S", rowids: true, annotations: ["e", "f", "g", "$\\mathbf{0}$"]) %>
<p><br/></p>
</div>
<p>$Q(1) \equiv \mathbf{0} \otimes \mathbf{0}$</p>
<p>$~~~~~~~~ \oplus ~~ a \otimes e$</p>
<p>$~~~~~~~~ \oplus ~~ b \otimes \mathbf{0}$</p>
<p>...</p>
<p>$~~~~~~~~ \oplus ~~ \mathbf{0} \otimes \mathbf{0}$</p>
<p>$~~~~~~~~ \oplus ~~ a \otimes f$</p>
<p>$~~~~~~~~ \oplus ~~ b \otimes \mathbf{0}$</p>
<p>...</p>
</section>
<section>
<p>$(a\otimes e) \oplus (a \otimes f) \oplus (b \otimes g) \oplus \mathbf{0} \oplus \ldots$</p>
<p style="margin-top: 50px;" class="fragment">$(T\wedge T) \vee (T \wedge T) \vee (T \wedge T) \vee F \vee \ldots$</p>
<p style="margin-top: 50px;" class="fragment">$(3\times 1) + (3 \times 1) + (1 \times 3) + 0 + \ldots$</p>
<p style="margin-top: 50px;" class="fragment">... and more</p>
</section>
</section>
<section>
<section>
<h3>Ground Rules for $\oplus$, $\otimes$</h3>
<ul>
<li class="fragment">Commutative, Associative</li>
<li class="fragment">Must be some $\mathbf{0}$ s.t. $a \oplus \mathbf{0} = a$</li>
<li class="fragment">Must be some $\mathbf{1}$ s.t. $a \otimes \mathbf{1} = a$</li>
<li class="fragment">$a \otimes \mathbf{0} = \mathbf{0}$</li>
<li class="fragment">$a \otimes (b \oplus c) = (a \otimes b) \oplus (a \otimes c)$</li>
</ul>
<p class="fragment">Any pair of operators (along with their domain) that follows these rules is called a commutative semiring</p>
</section>
<section>
<h3>Commutative Semirings</h3>
$$\left< \mathbb S, \oplus, \otimes, \mathbf{0}, \mathbf{1} \right>$$
<ul>
<li>$\left< \mathbb N^0, +, \times, 0, 1 \right>$ (Natural Arithmetic)</li>
<li>$\left< \mathbb B, \vee, \wedge, F, T \right>$ (Boolean Algebra)</li>
<li class="fragment" data-fragment-index="1">$\left< \text{Set}, \cup, \cap, \emptyset, \infty \right>$ (Set Algebra)</li>
<li class="fragment" data-fragment-index="1">$\left< \text{Bag}, \uplus, \cap, \emptyset, \infty \right>$ (Bag Algebra)</li>
<li class="fragment" data-fragment-index="2">$\left< \mathbb N^{0,\infty}, \max, \min, \infty, 0 \right>$ (Access Control)</li>
<li class="fragment" data-fragment-index="2">$\left< \mathbb R^{-\infty}, \min, +, -\infty, 0 \right>$ (Tropical)</li>
</ul>
</section>
</section>
<section>
<section>
<h3>Bringing it Back to RA</h3>
<p>If a Table is a function, so is a query result!</p>
<div class="fragment">
$$[[\pi_A R(A, B)]](x)$$<br/>
$$[[\sigma_\phi R(A, B)]](x, y)$$<br/>
$$[[R(A, B) \cup S(A, B)]](x, y)$$<br/>
$$[[R(A, B) \times S(B, C)]](x, y, z)$$
</div>
</section>
<section>
$$[[\pi_A R(A, B)]](x) = \sum_{B} R(x, B)$$
<p class="fragment">Sum over all projected-away variables</p>
</section>
<section>
$$[[\sigma_\phi R(A, B)]](x, y) =~~~~~\\~~~~~ \begin{cases} R(x, y) & \textbf{if } \phi(x, y) \\ \mathbf{0} & \textbf{otherwise}\end{cases}$$
<p class="fragment">Truncate filtered rows to 0.</p>
</section>
<section>
$$[[R(A, B) \cup S(A, B)]](x, y) =~~~~~\\~~~~~ R(x, y) \oplus S(x, y)$$
<p class="fragment">Sum annotations through union.</p>
</section>
<section>
$$[[R(A, B) \times S(B, C)]](x, y, z) =~~~~~\\~~~~~ R(x, y) \otimes S(y, z)$$
<p class="fragment">Multiply annotations through cross product.</p>
</section>
<section>
<h3>Mimicking RA</h3>
<dl>
<dt class="fragment">Set-Relational Algebra</dt>
<dd class="fragment">Plug in the Boolean Algebra Semiring</dd>
<dt class="fragment">Bag-Relational Algebra</dt>
<dd class="fragment">Plug in the Natural Arithmetic Semiring</dd>
</dl>
</section>
</section>
<section>
<section>
<p class="fragment">Domain of Tuple IDs: $\mathbb T$</p>
<p class="fragment">A Set of Tuple IDs: $2^{\mathbb T}$</p>
<p class="fragment">A Set of Sets of Tuple IDs: $2^{2^{\mathbb T}}$</p>
<p class="fragment">e.g., $\{ \{t_1, t_5\}, \{t_1, t_6\}, \{t_2, t_7\} \}$</p>
</section>
<section>
<h3>Adding sets of sets</h3>
<div style="margin-top: 50px;">
$$\{ \{t_1, t_5\}, \{t_1, t_6\} \} \cup \{ \{t_2, t_7\} \}$$<br/>
$$ = \{ \{t_1, t_5\}, \{t_1, t_6\}, \{t_2, t_7\} \}$$
</div>
<div style="margin-top: 50px;" class="fragment">
$$A \cup \{ \} = A$$
</div>
</section>
<section>
<h3>Multiplying sets of sets</h3>
<div style="margin-top: 100px;">
$$\{ \{t_1\}, \{t_2\} \} \times \{ \{t_3\}, \{t_4\} \}$$<br/>
$$ = \{ \{t_1, t_3\}, \{t_2, t_3\}, \{t_1, t_4\}, \{t_2, t_4\} \}$$
</div>
<div style="margin-top: 50px;" class="fragment">
$$A \times \{ \{\} \} = A$$
</div>
<div style="margin-top: 50px;" class="fragment">
$$A \times \{ \} = \{ \}$$
</div>
</section>
<section>
$$\left< 2^{2^{\mathbb T}}, \cup, \times, \{ \}, \{ \{\} \} \right>$$
</section>
<section>
<table><tr><td>
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: ["$\\{\\{t_1\\}\\}$", "$\\{\\{t_2\\}\\}$", "$\\{\\{t_3\\}\\}$", "$\\{\\{t_4\\}\\}$"]) %>
</td><td>
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: ["$\\{\\{t_5\\}\\}$", "$\\{\\{t_6\\}\\}$", "$\\{\\{t_7\\}\\}$"]) %>
</td></tr></table>
<div style="font-size: 70%; margin-top: 50px;" class="fragment">
$$Q(1) = \{\{t_1\}\}\times\{\{t_5\}\} \cup \{\{t_1\}\}\times\{\{t_6\}\} \cup \{\{t_2\}\}\times\{\{t_6\}\}$$
</div>
<div style="font-size: 70%; margin-top: 50px;" class="fragment">
$$Q(1) = \{\{t_1, t_5\}\} \cup \{\{t_1, t_6\}\} \cup \{\{t_2, t_6\}\}$$
</div>
<div style="font-size: 70%; margin-top: 50px;" class="fragment">
$$Q(1) = \{\{t_1, t_5\}, \{t_1, t_6\}, \{t_2, t_6\}\}$$
</div>
</section>
</section>
<section>
<section>
<p>Polynomials are also a semiring</p>
</section>
<section>
<table><tr><td>
<%= data_table(["A", "B"], [[1, 2], [1, 3], [2, 3], [2, 4]], name: "R", rowids: true, annotations: ["a", "b", "c", "d"]) %>
</td><td>
<%= data_table(["B", "C"], [[2, 1], [2, 2], [3, 3]], name: "S", rowids: true, annotations: ["e", "f", "g"]) %>
</td></tr></table>
<p class="fragment">$ae + af + bg$</p>
<p class="fragment">Plug in boolean annotations: $T$</p>
<p class="fragment">Plug in multiplicities: $12$</p>
<p class="fragment">Plug in tuple IDs:<br/>$\{\{t_1, t_5\}, \{t_1, t_6\}, \{t_2, t_6\}\}$</p>
</section>
<section>
<p>$ae + af + bg$</p>
<dl>
<div class="fragment">
<dt>$a: T \rightarrow F$ (Booleans)</dt>
<dd>$Q(1) = bg = T$</dd>
</div>
<div class="fragment">
<dt>$a: 3 \rightarrow 4$ (Naturals)</dt>
<dd>$Q(1) \texttt{ += } e + f$</dd>
<dd class="fragment">$\frac{d}{da}Q(1) = e+f$</dd>
</div>
</dl>
</section>
</section>