work on slides
This commit is contained in:
parent
10cd2f9bc9
commit
ae9e451bf3
14 changed files with 621 additions and 55 deletions
|
@ -9,7 +9,7 @@ EXAMPLE_PDF = example.pdf
|
||||||
|
|
||||||
CACHE_DIR := $(shell pwd)/.latex-cache
|
CACHE_DIR := $(shell pwd)/.latex-cache
|
||||||
|
|
||||||
COMPILE_TEX := latexmk -lualatex -output-directory="$(CACHE_DIR)"
|
COMPILE_TEX := latexmk -lualatex -latexoption="-shell-escape" -output-directory="$(CACHE_DIR)"
|
||||||
|
|
||||||
.PHONY: install uninstall example all clean
|
.PHONY: install uninstall example all clean
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,16 @@
|
||||||
\usepackage[dvipsnames]{xcolor}
|
\usepackage[dvipsnames]{xcolor}
|
||||||
\usepackage{mathpartir}
|
\usepackage{mathpartir}
|
||||||
\usepackage{stmaryrd}
|
\usepackage{stmaryrd}
|
||||||
|
%\usepackage{minted}
|
||||||
|
%\usemintedstyle{tango}
|
||||||
|
|
||||||
|
|
||||||
|
\usepackage{listings}% http://ctan.org/pkg/listings
|
||||||
|
\lstset{
|
||||||
|
basicstyle=\ttfamily,
|
||||||
|
mathescape
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
\newcommand{\metavariable}[1]{\textcolor{teal}{#1}}
|
\newcommand{\metavariable}[1]{\textcolor{teal}{#1}}
|
||||||
\newcommand{\typeterminal}[1]{\textcolor{brown}{#1}}
|
\newcommand{\typeterminal}[1]{\textcolor{brown}{#1}}
|
||||||
|
@ -28,9 +38,11 @@
|
||||||
\titlepage
|
\titlepage
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}
|
\begin{frame}
|
||||||
\frametitle{Type Systems}
|
\frametitle{Type Systems}
|
||||||
\framesubtitle{Tension between Safety and Flexibility}
|
\framesubtitle{Safety <> Flexibility}
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item<1-> Goal: eliminate undefined behaviour,
|
\item<1-> Goal: eliminate undefined behaviour,
|
||||||
|
@ -47,46 +59,213 @@
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{How to get fast code?}
|
|
||||||
\framesubtitle{Requirements for a type system}
|
\begin{frame}[t, fragile]{Type Systems}
|
||||||
\begin{itemize}
|
\framesubtitle{Safety <> Flexibility}
|
||||||
\item<1-> algorithmic optimization
|
|
||||||
|
\begin{lstlisting}
|
||||||
|
/* this is an angle in degrees */
|
||||||
|
double hue = 156.4;
|
||||||
|
\end{lstlisting}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Performance Checklist}
|
||||||
|
\framesubtitle{(singlethreaded)}
|
||||||
|
\begin{enumerate}
|
||||||
|
\item<1-> algorithmic
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item see which methods are used most frequently
|
\item choose appropriate data structures\\
|
||||||
\item switch structures to reduce complexity there
|
(reduce complexity in frequent cases)
|
||||||
|
|
||||||
\item identify special cases
|
\item identify special cases
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\item<2-> optimize implementation detail:
|
\item<2-> implementation detail:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item remove indirection
|
\item optimize memory bottleneck
|
||||||
\item bottleneck? memory!\\
|
|
||||||
(plenty of Main-memory, but FAST memory is scarce\\
|
|
||||||
\(\rightarrow\) improve cache \& bus efficiency with compact representations)
|
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item<3-> Balance De-/Encode Overhead
|
\item improve cache \& bus efficiency with compact representations
|
||||||
vs. Fetch-Overhead
|
\item<3-> Synchronize locality in access order and memory layout.
|
||||||
|
(elements accessed in succession shall be close in memory,
|
||||||
|
AoS vs SoA)
|
||||||
|
|
||||||
\item<4-> Synchronize locality in access order and memory layout.
|
\item<4-> \(\rightarrow\) De-/Encode Overhead
|
||||||
-> elements accessed in succession shall be close in memory.
|
vs. Fetch-Overhead,\\
|
||||||
(e.g. AoS vs SoA)
|
account for machine specific cache-sizes
|
||||||
|
\end{itemize}
|
||||||
|
\item
|
||||||
|
|
||||||
|
\item<6-> use SIMD instructions
|
||||||
|
\item<7-> interfacing with kernels running on accelerator devices
|
||||||
|
\end{itemize}
|
||||||
|
\end{enumerate}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}[t, fragile]{Example - Image Processing}
|
||||||
|
\begin{lstlisting}
|
||||||
|
image-read :: FilePath -> [Color]
|
||||||
|
image-write :: FilePath -> [Color] -> ()
|
||||||
|
|
||||||
|
image-mix :: $\mathbb{R}$ -> [Color] -> [Color] -> [Color]
|
||||||
|
image-saturate :: $\mathbb{R}$ -> [Color] -> [Color]
|
||||||
|
|
||||||
|
let im1 = image-read "in1.png"
|
||||||
|
let im2 = image-read "in2.png"
|
||||||
|
let im3 = image-mix 0.5
|
||||||
|
im1
|
||||||
|
(image-saturate 0.8 im2)
|
||||||
|
|
||||||
|
image-write "out.png" im3
|
||||||
|
\end{lstlisting}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Example - Image Processing}
|
||||||
|
\framesubtitle{More Types}
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item \texttt{ColorRGBu8}
|
||||||
|
\item \texttt{ColorRGBf32}
|
||||||
|
\item \texttt{ColorHSVu8}
|
||||||
|
\item \texttt{ColorHSVf32}
|
||||||
|
\end{itemize}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}[t, fragile]{Example - Image Processing}
|
||||||
|
\framesubtitle{More Types}
|
||||||
|
|
||||||
|
\begin{lstlisting}
|
||||||
|
image-read :: FilePath -> [ColorRGBu8]
|
||||||
|
image-write :: FilePath -> [ColorRGBu8] -> ()
|
||||||
|
|
||||||
|
image-mix :: f32 -> [ColorRGBf32] -> [ColorRGBf32] -> [ColorRGBf32]
|
||||||
|
image-saturate:: f32->[ColorHSVf32]->[ColorHSVf32]
|
||||||
|
|
||||||
|
let im1 = image-read "in1.png"
|
||||||
|
let im2 = image-read "in2.png"
|
||||||
|
let im3 = image-mix 0.5
|
||||||
|
im1
|
||||||
|
(image-saturate 0.8 im2)
|
||||||
|
|
||||||
|
image-write "out.png" im3
|
||||||
|
\end{lstlisting}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}[t, fragile]{Example - Image Processing}
|
||||||
|
|
||||||
|
\framesubtitle{AoS vs SoA}
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
[cacheline][cacheline][cacheline]
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
[RGBRGBRG][BRGBRGBR][GBRGBRGB]
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
[HSVHSVHS][VHSVHSVH][SVHSVHSV]
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
[HHHHHHHH][SSSSSSSS][VVVVVVVV]
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
\item<5-> accounting for machine specific cache-sizes
|
|
||||||
\item<6-> accounting for SIMD instructions
|
|
||||||
\item<7-> interfacing with kernels running on accelerator devices
|
|
||||||
\end{itemize}
|
|
||||||
\end{itemize}
|
|
||||||
\end{itemize}
|
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Abstract Concept - Multiple Representations}
|
\begin{frame}{Abstract Concept - Multiple Representations}
|
||||||
\framesubtitle{Requirements for a type system}
|
\framesubtitle{OpenGL Image Formats}
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item
|
\item \texttt{GL\_R3\_G3\_B2}
|
||||||
|
\item \texttt{GL\_RGB10\_A2}
|
||||||
|
\item \texttt{GL\_R11F\_G11F\_B10F}
|
||||||
|
\item \texttt{GL\_SRGB8\_ALPHA8}
|
||||||
|
\item \ldots
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.5\textwidth]{sea-of-types/target/sea-of-types-0-bytes.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.5\textwidth]{sea-of-types/target/sea-of-types-1-ieee754.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.5\textheight]{sea-of-types/target/sea-of-types-2-real.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.5\textheight]{sea-of-types/target/sea-of-types-3-real.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.8\textheight]{sea-of-types/target/sea-of-types-4-degrees.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.8\textheight]{sea-of-types/target/sea-of-types-5-turns.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.8\textheight]{sea-of-types/target/sea-of-types-6-radians.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.8\textheight]{sea-of-types/target/sea-of-types-7-angle.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.8\textheight]{sea-of-types/target/sea-of-types-8-hue.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.8\textheight]{sea-of-types/target/sea-of-types-9-u8.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Sea of Types}
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=\textwidth]{sea-of-types/target/sea-of-types-10-u8.png}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Solutions (I): Traits / Typeclasses / Interfaces}
|
||||||
|
\begin{itemize}
|
||||||
|
\item todo
|
||||||
|
\end{itemize}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Solutions (II): Wrapper structs / newtype}
|
||||||
|
\begin{itemize}
|
||||||
|
\item todo
|
||||||
|
\end{itemize}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}{Coercions: (In-)Coherence with Transitivity}
|
\begin{frame}{Coercions: (In-)Coherence with Transitivity}
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item<1-> Common example: coerce \texttt{Int -> Real}
|
\item<1-> Common example: coerce \texttt{Int -> Real}
|
||||||
|
@ -114,15 +293,16 @@
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Sea of Types}
|
|
||||||
\includegraphics[width=\textwidth]{sot-int.png}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Sea of Types}
|
\begin{frame}{Related Work}
|
||||||
\includegraphics[width=\textwidth]{sot-json.png}
|
\begin{itemize}
|
||||||
|
\item TODO
|
||||||
|
\item cite
|
||||||
|
\item some
|
||||||
|
\item stuff
|
||||||
|
\end{itemize}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}{Ladder Types}
|
\begin{frame}{Ladder Types}
|
||||||
\begin{block}{Intuition}
|
\begin{block}{Intuition}
|
||||||
Encode "represented-as" relation into type terms
|
Encode "represented-as" relation into type terms
|
||||||
|
@ -142,6 +322,38 @@
|
||||||
\)\end{example}
|
\)\end{example}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Morphisms}
|
||||||
|
\begin{block}{Intuition}
|
||||||
|
Transform between semantically equivalent representations of the same abstract concept
|
||||||
|
\end{block}
|
||||||
|
|
||||||
|
\begin{block}{Type}
|
||||||
|
\( \tau \sim \tau_1 \rightarrow_\text{morph} \tau \sim \tau_2 \)
|
||||||
|
\end{block}
|
||||||
|
|
||||||
|
\begin{example}\(
|
||||||
|
Angle \sim Degrees \sim \mathbb{R}
|
||||||
|
\rightarrow_\text{morph}
|
||||||
|
Angle \sim Radians \sim \mathbb{R}
|
||||||
|
\)\end{example}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Morphisms}
|
||||||
|
\framesubtitle{Coherence}
|
||||||
|
\begin{block}{Coherence Condition}
|
||||||
|
Assume\\
|
||||||
|
\(\metavariable{m_\sigma} : \typeterminal{\metavariable{\sigma} \sim \metavariable{\sigma_1} \rightarrow_\text{morph} \metavariable{\sigma} \sim \metavariable{\sigma_2}}\)\\
|
||||||
|
\(\metavariable{m_\tau} : \typeterminal{\metavariable{\tau} \sim \metavariable{\tau_1} \rightarrow_\text{morph} \metavariable{\tau} \sim \metavariable{\tau_2}}\)\\
|
||||||
|
\(\metavariable{f_1} : \typeterminal{\metavariable{\sigma} \sim \metavariable{\sigma_1} \rightarrow \metavariable{\tau} \sim \metavariable{\tau_1} }\)\\
|
||||||
|
\(\metavariable{f_2} : \typeterminal{\metavariable{\sigma} \sim \metavariable{\sigma_2} \rightarrow \metavariable{\tau} \sim \metavariable{\tau_2} }\)\\
|
||||||
|
then it holds that:\\
|
||||||
|
\(\forall x:\typeterminal{\metavariable{\sigma}\sim\metavariable{\sigma_1}},\quad
|
||||||
|
\metavariable{m_\tau}(\metavariable{f_1} x) = \metavariable{f_2} (\metavariable{m_\sigma} x) \)
|
||||||
|
\end{block}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}{Extending System F}
|
\begin{frame}{Extending System F}
|
||||||
\small
|
\small
|
||||||
\begin{grammar}
|
\begin{grammar}
|
||||||
|
@ -238,10 +450,10 @@ $$\\$$
|
||||||
}{Descension}
|
}{Descension}
|
||||||
|
|
||||||
\end{grammar}
|
\end{grammar}
|
||||||
|
|
||||||
|
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}{Morphism Graph}
|
\begin{frame}{Morphism Graph}
|
||||||
|
|
||||||
\begin{definition}[Morphism Paths]
|
\begin{definition}[Morphism Paths]
|
||||||
|
@ -278,8 +490,8 @@ $$\\$$
|
||||||
\end{definition}
|
\end{definition}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Morphism Graph}
|
|
||||||
|
|
||||||
|
\begin{frame}{Morphism Graph}
|
||||||
\begin{example}[Morphism Graph]
|
\begin{example}[Morphism Graph]
|
||||||
\begin{mathpar}
|
\begin{mathpar}
|
||||||
\small
|
\small
|
||||||
|
@ -290,12 +502,11 @@ $$\\$$
|
||||||
\}.
|
\}.
|
||||||
\end{mathpar}
|
\end{mathpar}
|
||||||
\end{example}
|
\end{example}
|
||||||
|
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}{Morphism Graph}
|
|
||||||
|
|
||||||
|
\begin{frame}{Morphism Graph}
|
||||||
\begin{example}[Morphism Graph]
|
\begin{example}[Morphism Graph]
|
||||||
Then ..
|
Then ..
|
||||||
\small
|
\small
|
||||||
|
@ -305,23 +516,9 @@ Then ..
|
||||||
\item \(\Gamma \vdash \typeterminal{\langle\text{Seq }\text{Angle}\sim\text{Degrees}\sim\mathbb{R}\rangle} \leadsto \typeterminal{\langle\text{Seq }\text{Angle}\sim\text{Radians}\sim\mathbb{R}\rangle}\) (by \textsc{M-MapSeq})
|
\item \(\Gamma \vdash \typeterminal{\langle\text{Seq }\text{Angle}\sim\text{Degrees}\sim\mathbb{R}\rangle} \leadsto \typeterminal{\langle\text{Seq }\text{Angle}\sim\text{Radians}\sim\mathbb{R}\rangle}\) (by \textsc{M-MapSeq})
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{example}
|
\end{example}
|
||||||
|
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Typing}
|
|
||||||
|
|
||||||
\begin{definition}[Typing Relation]
|
|
||||||
\begin{mathpar}
|
|
||||||
\inferrule[T-App]{
|
|
||||||
\Gamma \vdash \metavariable{f} : \metavariable{\sigma} \typeterminal{\rightarrow} \metavariable{\tau}\\
|
|
||||||
\Gamma \vdash \metavariable{a} : \metavariable{\sigma'}\\
|
|
||||||
\Gamma \vdash \metavariable{\sigma'} \leadsto \metavariable{\sigma}
|
|
||||||
}{
|
|
||||||
\Gamma \vdash (\metavariable{f} \quad \metavariable{a}) : \metavariable{\tau}
|
|
||||||
}
|
|
||||||
\end{mathpar}
|
|
||||||
\end{definition}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Translation}
|
\begin{frame}{Translation}
|
||||||
\begin{definition}[Morphism Translation]
|
\begin{definition}[Morphism Translation]
|
||||||
|
@ -382,8 +579,46 @@ Then ..
|
||||||
\end{definition}
|
\end{definition}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Translation}
|
|
||||||
|
|
||||||
|
\begin{frame}{Translation}
|
||||||
|
\begin{example}[Morphism Translation]
|
||||||
|
\begin{mathpar}
|
||||||
|
\small
|
||||||
|
\Big{\llbracket}
|
||||||
|
\inferrule[M-Chain]{
|
||||||
|
\ldots
|
||||||
|
}{
|
||||||
|
\Gamma \vdash \typeterminal{\langle\text{Seq}\quad\text{Angle}\sim\text{Degrees}\sim\mathbb{R}\rangle}\\
|
||||||
|
\leadsto \typeterminal{\langle\text{Seq}\quad\text{Angle}\sim\text{Radians}\sim\mathbb{R}\rangle}
|
||||||
|
}
|
||||||
|
\Big{\rrbracket} =
|
||||||
|
\exprterminal{\lambda \text{xs}:\typeterminal{\langle\text{Seq}\quad \text{Angle}\sim\text{Degrees}\sim\mathbb{R} \rangle}}
|
||||||
|
\newline
|
||||||
|
\exprterminal{\mapsto (map \text{ }(\lambda \text{x}:\metavariable{\tau} \mapsto \text{turns-to-radians } (\text{degrees-to-turns } x)) \text{ } xs) }
|
||||||
|
\end{mathpar}
|
||||||
|
\end{example}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Typing}
|
||||||
|
\begin{definition}[Typing Relation]
|
||||||
|
\begin{mathpar}
|
||||||
|
\inferrule[T-App]{
|
||||||
|
\Gamma \vdash \metavariable{f} : \metavariable{\sigma} \typeterminal{\rightarrow} \metavariable{\tau}\\
|
||||||
|
\Gamma \vdash \metavariable{a} : \metavariable{\sigma'}\\
|
||||||
|
\Gamma \vdash \metavariable{\sigma'} \leadsto \metavariable{\sigma}
|
||||||
|
}{
|
||||||
|
\Gamma \vdash (\metavariable{f} \quad \metavariable{a}) : \metavariable{\tau}
|
||||||
|
}
|
||||||
|
\end{mathpar}
|
||||||
|
\end{definition}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Translation}
|
||||||
\begin{definition}[Expression Translation]
|
\begin{definition}[Expression Translation]
|
||||||
Translates a type-derivation tree into a fully expanded expression
|
Translates a type-derivation tree into a fully expanded expression
|
||||||
|
|
||||||
|
@ -424,8 +659,10 @@ D :: \Gamma \vdash \metavariable{e} : \metavariable{\tau}\\
|
||||||
\end{lemma}
|
\end{lemma}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Soundness}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{frame}{Soundness}
|
||||||
\begin{theorem}[Preservation]
|
\begin{theorem}[Preservation]
|
||||||
\begin{mathpar} \forall \Gamma, \metavariable{e}, \metavariable{\tau},\\
|
\begin{mathpar} \forall \Gamma, \metavariable{e}, \metavariable{\tau},\\
|
||||||
D :: \Gamma \vdash \metavariable{e} : \metavariable{\tau}\\
|
D :: \Gamma \vdash \metavariable{e} : \metavariable{\tau}\\
|
||||||
|
@ -436,19 +673,26 @@ D :: \Gamma \vdash \metavariable{e} : \metavariable{\tau}\\
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}{Soundness}
|
\begin{frame}{Soundness}
|
||||||
\begin{theorem}[Progress]
|
\begin{theorem}[Progress]
|
||||||
\begin{mathpar} \forall \Gamma, \metavariable{e}, \metavariable{\tau},\\
|
\begin{mathpar} \forall \Gamma, \metavariable{e}, \metavariable{\tau},\\
|
||||||
D :: \Gamma \vdash \metavariable{e} : \metavariable{\tau}\\
|
D :: \Gamma \vdash \metavariable{e} : \metavariable{\tau}\\
|
||||||
\Rightarrow \llbracket D \rrbracket \text{ is a value} \\ \vee \\
|
\Rightarrow \llbracket D \rrbracket \text{ is a value} \\ \vee
|
||||||
\exists \metavariable{e'} . \llbracket D \rrbracket \rightarrow_{eval} \metavariable{e'} \\
|
\exists \metavariable{e'} . \llbracket D \rrbracket \rightarrow_{eval} \metavariable{e'} \\
|
||||||
\end{mathpar}
|
\end{mathpar}
|
||||||
\end{theorem}
|
\end{theorem}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\begin{frame}{Summary}
|
\begin{frame}{Summary}
|
||||||
todo
|
todo
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
||||||
|
|
8
beamer/lc-beamer/sea-of-types/makefile
Normal file
8
beamer/lc-beamer/sea-of-types/makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
TARGETS=$(shell find -name '*.dot' | sed -E 's~\.dot~\.png~')
|
||||||
|
|
||||||
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
%.png: %.dot
|
||||||
|
dot -Tpng $< -o target/$@
|
||||||
|
|
6
beamer/lc-beamer/sea-of-types/sea-of-types-0-bytes.dot
Normal file
6
beamer/lc-beamer/sea-of-types/sea-of-types-0-bytes.dot
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=24, shape=plaintext];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
9
beamer/lc-beamer/sea-of-types/sea-of-types-1-ieee754.dot
Normal file
9
beamer/lc-beamer/sea-of-types/sea-of-types-1-ieee754.dot
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=24, shape=plaintext];
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=24, shape=plaintext];
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
}
|
||||||
|
|
||||||
|
|
69
beamer/lc-beamer/sea-of-types/sea-of-types-10-u8.dot
Normal file
69
beamer/lc-beamer/sea-of-types/sea-of-types-10-u8.dot
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte1 [label="[Byte; 1]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
Degrees [label="Degrees", fontsize=18, shape=plaintext];
|
||||||
|
Turns [label="Turns", fontsize=18, shape=plaintext];
|
||||||
|
Radians [label="Radians", fontsize=18, shape=plaintext];
|
||||||
|
|
||||||
|
Angle [label="Angle", fontsize=20, shape=plaintext];
|
||||||
|
RealUnit [label="ℝ_[0,1]", fontsize=24, shape=plaintext];
|
||||||
|
HSV [label="HSV", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
U8 [label="machine.UInt8", fontsize=18, shape=plaintext];
|
||||||
|
Z256 [label="ℤ_256", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
Real360 [label="ℝ_[0,360)", fontsize=18, shape=plaintext];
|
||||||
|
Real1 [label="ℝ_[0,1)", fontsize=18, shape=plaintext];
|
||||||
|
Real2pi [label="ℝ_[0,2π)", fontsize=18, shape=plaintext];
|
||||||
|
|
||||||
|
QuantizedLinear [label="<QuantizedLinear[0,1] 256>", fontsize=20, shape=plaintext];
|
||||||
|
QuantizedLinear1 [label="<QuantizedLinear[0,1) 256>", fontsize=20, shape=plaintext];
|
||||||
|
QuantizedLinear360 [label="<QuantizedLinear[0,360) 256>", fontsize=20, shape=plaintext];
|
||||||
|
QuantizedLinear2pi [label="<QuantizedLinear[0,2π) 256>", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
|
||||||
|
Real360 -> Real
|
||||||
|
Real1 -> Real
|
||||||
|
Real2pi -> Real
|
||||||
|
|
||||||
|
Real360 -> QuantizedLinear360
|
||||||
|
Real1 -> QuantizedLinear1
|
||||||
|
Real2pi -> QuantizedLinear2pi
|
||||||
|
|
||||||
|
Degrees -> Real360
|
||||||
|
Turns -> Real1
|
||||||
|
Radians -> Real2pi
|
||||||
|
RealUnit -> Real
|
||||||
|
|
||||||
|
RealUnit -> QuantizedLinear
|
||||||
|
QuantizedLinear -> Z256
|
||||||
|
QuantizedLinear1 -> Z256
|
||||||
|
QuantizedLinear360 -> Z256
|
||||||
|
QuantizedLinear2pi -> Z256
|
||||||
|
Z256 -> U8
|
||||||
|
U8 -> Byte1
|
||||||
|
|
||||||
|
Angle -> Degrees
|
||||||
|
Angle -> Turns
|
||||||
|
Angle -> Radians
|
||||||
|
|
||||||
|
HSV -> Angle [label="hue"]
|
||||||
|
HSV -> RealUnit [label="saturation"]
|
||||||
|
HSV -> RealUnit [label="value"]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
11
beamer/lc-beamer/sea-of-types/sea-of-types-2-real.dot
Normal file
11
beamer/lc-beamer/sea-of-types/sea-of-types-2-real.dot
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=24, shape=plaintext];
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=24, shape=plaintext];
|
||||||
|
Real [label="ℝ", fontsize=28, shape=plaintext];
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
Real -> IEEE754single
|
||||||
|
}
|
||||||
|
|
20
beamer/lc-beamer/sea-of-types/sea-of-types-3-real.dot
Normal file
20
beamer/lc-beamer/sea-of-types/sea-of-types-3-real.dot
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=24, shape=plaintext];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=24, shape=plaintext];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=24, shape=plaintext];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=24, shape=plaintext];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=28, shape=plaintext];
|
||||||
|
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
}
|
||||||
|
|
||||||
|
|
24
beamer/lc-beamer/sea-of-types/sea-of-types-4-degrees.dot
Normal file
24
beamer/lc-beamer/sea-of-types/sea-of-types-4-degrees.dot
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=28, shape=plaintext];
|
||||||
|
|
||||||
|
Degrees [label="Degrees", fontsize=24, shape=plaintext];
|
||||||
|
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
|
||||||
|
Degrees -> Real
|
||||||
|
}
|
||||||
|
|
||||||
|
|
25
beamer/lc-beamer/sea-of-types/sea-of-types-5-turns.dot
Normal file
25
beamer/lc-beamer/sea-of-types/sea-of-types-5-turns.dot
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=28, shape=plaintext];
|
||||||
|
|
||||||
|
Degrees [label="Degrees", fontsize=24, shape=plaintext];
|
||||||
|
Turns [label="Turns", fontsize=24, shape=plaintext];
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
|
||||||
|
Degrees -> Real
|
||||||
|
Turns -> Real
|
||||||
|
}
|
||||||
|
|
||||||
|
|
27
beamer/lc-beamer/sea-of-types/sea-of-types-6-radians.dot
Normal file
27
beamer/lc-beamer/sea-of-types/sea-of-types-6-radians.dot
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=12, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=28, shape=plaintext];
|
||||||
|
|
||||||
|
Degrees [label="Degrees", fontsize=24, shape=plaintext];
|
||||||
|
Turns [label="Turns", fontsize=24, shape=plaintext];
|
||||||
|
Radians [label="Radians", fontsize=24, shape=plaintext];
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
|
||||||
|
Degrees -> Real
|
||||||
|
Turns -> Real
|
||||||
|
Radians -> Real
|
||||||
|
}
|
||||||
|
|
||||||
|
|
33
beamer/lc-beamer/sea-of-types/sea-of-types-7-angle.dot
Normal file
33
beamer/lc-beamer/sea-of-types/sea-of-types-7-angle.dot
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=24, shape=plaintext];
|
||||||
|
|
||||||
|
Degrees [label="Degrees", fontsize=20, shape=plaintext];
|
||||||
|
Turns [label="Turns", fontsize=20, shape=plaintext];
|
||||||
|
Radians [label="Radians", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
Angle [label="Angle", fontsize=24, shape=plaintext, color=brown];
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
|
||||||
|
Degrees -> Real
|
||||||
|
Turns -> Real
|
||||||
|
Radians -> Real
|
||||||
|
|
||||||
|
Angle -> Degrees
|
||||||
|
Angle -> Turns
|
||||||
|
Angle -> Radians
|
||||||
|
}
|
||||||
|
|
||||||
|
|
40
beamer/lc-beamer/sea-of-types/sea-of-types-8-hue.dot
Normal file
40
beamer/lc-beamer/sea-of-types/sea-of-types-8-hue.dot
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
Degrees [label="Degrees", fontsize=18, shape=plaintext];
|
||||||
|
Turns [label="Turns", fontsize=18, shape=plaintext];
|
||||||
|
Radians [label="Radians", fontsize=18, shape=plaintext];
|
||||||
|
|
||||||
|
Angle [label="Angle", fontsize=20, shape=plaintext];
|
||||||
|
RealUnit [label="ℝ_[0,1]", fontsize=24, shape=plaintext];
|
||||||
|
HSV [label="HSV", fontsize=24, shape=plaintext];
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
|
||||||
|
Degrees -> Real
|
||||||
|
Turns -> Real
|
||||||
|
Radians -> Real
|
||||||
|
RealUnit -> Real
|
||||||
|
|
||||||
|
Angle -> Degrees
|
||||||
|
Angle -> Turns
|
||||||
|
Angle -> Radians
|
||||||
|
|
||||||
|
HSV -> Angle [label="hue", textcolor=blue]
|
||||||
|
HSV -> RealUnit [label="saturation", textcolor=blue]
|
||||||
|
HSV -> RealUnit [label="value", textcolor=blue]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
50
beamer/lc-beamer/sea-of-types/sea-of-types-9-u8.dot
Normal file
50
beamer/lc-beamer/sea-of-types/sea-of-types-9-u8.dot
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
digraph SeaOfTypes {
|
||||||
|
|
||||||
|
Byte1 [label="[Byte; 1]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
Byte4 [label="[Byte; 4]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
Byte8 [label="[Byte; 8]", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
IEEE754single [label="IEEE-754.single", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
IEEE754double [label="IEEE-754.double", fontsize=10, shape=plaintext, color=lightgrey];
|
||||||
|
|
||||||
|
Real [label="ℝ", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
Degrees [label="Degrees", fontsize=18, shape=plaintext];
|
||||||
|
Turns [label="Turns", fontsize=18, shape=plaintext];
|
||||||
|
Radians [label="Radians", fontsize=18, shape=plaintext];
|
||||||
|
|
||||||
|
Angle [label="Angle", fontsize=20, shape=plaintext];
|
||||||
|
RealUnit [label="ℝ_[0,1]", fontsize=24, shape=plaintext];
|
||||||
|
HSV [label="HSV", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
U8 [label="machine.UInt8", fontsize=18, shape=plaintext];
|
||||||
|
Z256 [label="ℤ_256", fontsize=20, shape=plaintext];
|
||||||
|
QuantizedLinear [label="<QuantizedLinear[0,1] 256>", fontsize=20, shape=plaintext];
|
||||||
|
|
||||||
|
IEEE754single -> Byte4
|
||||||
|
IEEE754double -> Byte8
|
||||||
|
|
||||||
|
Real -> IEEE754single
|
||||||
|
Real -> IEEE754double
|
||||||
|
|
||||||
|
Degrees -> Real
|
||||||
|
Turns -> Real
|
||||||
|
Radians -> Real
|
||||||
|
RealUnit -> Real
|
||||||
|
|
||||||
|
RealUnit -> QuantizedLinear
|
||||||
|
QuantizedLinear -> Z256
|
||||||
|
Z256 -> U8
|
||||||
|
U8 -> Byte1
|
||||||
|
|
||||||
|
Angle -> Degrees
|
||||||
|
Angle -> Turns
|
||||||
|
Angle -> Radians
|
||||||
|
|
||||||
|
HSV -> Angle [label="hue"]
|
||||||
|
HSV -> RealUnit [label="saturation"]
|
||||||
|
HSV -> RealUnit [label="value"]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue