-
Notifications
You must be signed in to change notification settings - Fork 0
/
algebra.tex
106 lines (96 loc) · 2.28 KB
/
algebra.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
\begin{frame}[fragile]
\frametitle{Algebra}
\begin{block}{}
\begin{lstlisting}[style=java]
boolean boolean2boolean(boolean b) {
// hidden from view
}
\end{lstlisting}
\end{block}
\begin{center}
How many possible programs can be written that satisfy the type?
We can calculate this \emph{algebraically}
\end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{Counting inhabitants}
\begin{block}{}
\begin{lstlisting}[style=java]
boolean boolean2boolean(boolean b) {
// hidden from view
}
\end{lstlisting}
\end{block}
\begin{center}
The inhabitants of a function's type \ldots
is the return type raised to the power of its argument type
\end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{Counting inhabitants}
\begin{block}{}
\begin{lstlisting}[style=java]
boolean boolean2boolean(boolean b) {
// hidden from view
}
\end{lstlisting}
\end{block}
\begin{block}{}
\lstinline{boolean} \textsuperscript{\lstinline{boolean}}
\lstinline{= 4}
\end{block}
\end{frame}
\begin{frame}[fragile]
\frametitle{Counting inhabitants}
\begin{block}{}
\begin{lstlisting}[style=java]
boolean boolean2boolean(boolean b) {
// hidden from view
}
\end{lstlisting}
\end{block}
\begin{block}{Here are all the possible functions}
\begin{lstlisting}[style=java]
return true; // 1
return false; // 2
return b; // 3
return !b; // 4
\end{lstlisting}
\end{block}
\end{frame}
\begin{frame}[fragile]
\frametitle{Counting inhabitants}
\begin{block}{What about this one?}
\begin{lstlisting}[style=java]
<A> A anything2anything(A a) {
// hidden from view
}
\end{lstlisting}
\end{block}
\end{frame}
\begin{frame}[fragile]
\frametitle{Counting inhabitants}
\begin{block}{What about this one?}
\begin{lstlisting}[style=java]
<A> A anything2anything(A a) {
// hidden from view
}
\end{lstlisting}
\end{block}
\begin{center}
\begin{itemize}
\item<1-> Assume \lstinline{= 1}
\item<1-> Prove \lstinline{= 1} using \emph{the yoneda lemma}
\item<2-> \ldots using Java \ldots
\item<2-> you know, for giggles
\end{itemize}
\end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{Proof}
\begin{block}{Yoneda Lemma}
\begin{center}
\href{https://github.com/simple-machines/types-and-tests/blob/master/source/yoneda.java}{https://github.com/simple-machines/types-and-tests/blob/master/source/yoneda.java}
\end{center}
\end{block}
\end{frame}