\documentclass{beamer}

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}

\usepackage{mathtools, stmaryrd}

\input{beamer-macros}

\usepackage[					% use biblatex for bibliography
	backend=biber,		            % 	- use biber backend (bibtex replacement) or bibtex
	bibencoding=utf8,				% 	- use auto file encode
	style=alphabetic,				% 	- use alphabetic (or numeric) bib style
	natbib=true,					% 	- allow natbib commands
	hyperref=true,					% 	- activate hyperref support
	backref=true,					% 	- activate backrefs
	isbn=false,						% 	- don't show isbn tags
	url=false,						% 	- don't show url tags
	doi=false,						% 	- don't show doi tags
	urldate=long,					% 	- display type for dates
  giveninits=false,               %   - [true] to only display first initials of authors.
  sorting=none,       % Do not change the order of citations.
	maxnames=3,%
	minnames=1,%
	maxbibnames=3,%
	minbibnames=1,%
	maxcitenames=3,%
	mincitenames=1%
]{biblatex}
\bibliography{../dossiers/biblio}

\newtoggle{bbx:boldentries}
\DeclareBibliographyCategory{boldentry}
\AtEveryBibitem{\ifboolexpr{togl {bbx:boldentries} and test {\ifcategory{boldentry}}}{\bfseries}{}}

\newcommand\ifempty[3]{\expandafter\ifstrempty{#1}{#2}{#3}}
\newcommand\ifnempty[2]{\expandafter\ifstrempty{#1}{}{#2}}
\newcommand\defaultempty[2]{\expandafter\ifstrempty{#1}{#2}{#1}}
\newcommand\ignore[1]{}

\input{mintedSettings}

\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}
\newcommand{\xmark}{\ding{55}}

\makeatletter
\newcommand\mpar@math[3]{\ensuremath{\left(#1\right)\ifnempty{#2}{_{#2}}\ifnempty{#3}{^{#3}}}}
\newcommand\mpar@text[3]{\ensuremath{(#1)\ifnempty{#2}{_{#2}}\ifnempty{#3}{^{#3}}}}
\newcommand\mpar@belowabove[3]{\mathchoice{\mpar@math{#1}{#2}{#3}}{\mpar@text{#1}{#2}{#3}}{\mpar@text{#1}{#2}{#3}}{\mpar@text{#1}{#2}{#3}}}

\def\mpar@grabbelow#1#2#3_#4{%
  \mpar@grab{\ifnempty{#1}{#1, }#4}{#2}{#3}%
}
\def\mpar@grabbove#1#2#3^#4{%
  \mpar@grab{#1}{\ifnempty{#2}{#2, }#4}{#3}%
}
\newcommand\mpar@grab[3]{%
  \@ifnextchar_{\mpar@grabbelow{#1}{#2}{#3}}%
  {\@ifnextchar^{\mpar@grababove{#1}{#2}{#3}}%
  {\mpar@belowabove{#3}{#1}{#2}}}%
}

\newcommand\mpar{\mpar@grab{}{}}
\makeatother

\newcommand\funp{\mpar}
\newcommand\funu[1]{\ifnempty{#1}{\funp{#1}}}
\newcommand\fund[2]{\ifnempty{#1#2}{\funp{\sep{#1}{#2}}}}
\newcommand\funt[3]{\ifnempty{#1#2#3}{\funp{\sept{#1}{#2}{#3}}}}
\newcommand\funq[4]{\ifnempty{#1#2#3#4}{\funp{\sepq{#1}{#2}{#3}{#4}}}}

\newcommand\sep[2]{#1\ifnempty{#1}{\ifnempty{#2}{,}}#2}
\newcommand\sept[3]{\sep{#1}{#2}\ifnempty{#1#2}{\ifnempty{#3}{,}}#3}
\newcommand\sepq[4]{\sept{#1}{#2}{#3}\ifnempty{#1#2#3}{\ifnempty{#4}{,}}#4}

\newcommand\evalr{\ensuremath{\Downarrow}}

\renewcommand\le{\leqslant}

\newcommand*\seq[2]{\mathit{seq}\ #1\ #2}
\newcommand*\seqx[1]{\mathit{seq}_1\ #1}
\newcommand*\seqxx{\mathit{seq}_2}
\newcommand*\rseq[2]{#1 ; #2}

\newcommand*\abort[1]{\mathbf{abort}\ifnempty{#1}{\,#1}}

\usepackage{mathpartir}

\newcommand\emphb{\textbf}

\tikzset{
	box/.style = {
		draw = black,
        fill = white,
		rectangle,
		rounded corners = 2pt,
		text centered,
		minimum height = 5mm,
		minimum width = 10mm
	}
}

\newcommand\mset[2][]{%
    \ifempty{#2#1}%
	    {\emptyset}%
	    {\left\{%
		    %\begin{gathered}{c}%
            #1%
            \ifnempty{#1}{\middle|}%
		    #2%
		    %\end{gathered}%
	    \right\}}%
}
\newcommand\st{\,\middle|\,}
\newcommand\powerset{\mathcal{P}\funu}
\newcommand\dom{\mathit{dom}\funu}

\newcommand\rulen[1]{\textsc{#1}}
\newcommand\Rule[3]{\ensuremath{\rulen{#1}{\mpar{#2}} \coloneqq #3}}
\newcommand\Rulea[3]{\ensuremath{\rulen{#1}{\mpar{#2}} & \coloneqq #3}} % Only to be used in an {align*} environment.

\newcommand\letS{\mathit{let}\,}
\newcommand\inS{\,\mathit{in}\,}

\newcommand\wildcard{\rule[-.319ex]{1ex}{.26pt}}

\newcommand\iname{\mathit{if}}
\newcommand\sif[3]{\iname\ifnempty{#1#2#3}{\,#1\,#2\ifnempty{#3}{\,#3}}}
\newcommand\derivH{H}
\newcommand\derivb[2]{\left[#1\ifnempty{#1}{,}#2\right]}
\newcommand\letinS[2]{\letS\, {#1} = {#2} \inS}
\newcommand\deriv[3]{\letinS{#3}{\derivb{#1}{#2}}}
\newcommand\branches[2][\bvar]{\mpar{#2}_{#1}}
\newcommand\branchesV{\branches}
\newcommand\eqp{\mathrel{?\!\vartriangleright}}
\newcommand\filterb[2]{#1\funu{#2}}
\newcommand\filter[3]{\letinS{\ifempty{#3}{\wildcard}\ifnempty{#3}{#3}}{\filterb{#1}{#2}}}

\newcommand\emptylist{[]}
\newcommand\cons[2]{#1; #2}

\newcommand{\tlit}[1]{\mathit{lit}\mpar{#1}}
\newcommand{\tadd}[2]{#1 + #2}

\newcommand{\tvar}[1][]{x_{t\ifnempty{#1}{_{#1}}}}
\newcommand{\fvar}[1][]{x_{f\ifnempty{#1}{_{#1}}}}
\DeclareDocumentCommand{\svar}{ m O{} }{#1{\ifnempty{#2}{_{#2}}}}
\newcommand{\ivar}{x_\sigma}
\newcommand{\ovar}{x_o}

\newcommand\myvecbase[3][]{\ifnempty{#1}{#1\funu}{#2{1}}..\ifnempty{#1}{#1\funu}{#2{#3}}}

% The p and s variants respectively add parentheses and braces.
\newcommand\myvecm{\myvecbase}
\newcommand\myvecmp[3][]{\mpar{\myvecm[#1]{#2}{#3}}}
\newcommand\myvecms[3][]{\mset{\myvecm[#1]{#2}{#3}}}

% Same, but the #2 function takes a facultative argument (possibly followed
% by a third mandatory one, which will be instanciated empty).
\newcommand\mandatorytofacultative[2]{#1[#2]{}}
\newcommand\myvec[2][]{\myvecbase[#1]{\mandatorytofacultative{#2}}}
\newcommand\myvecp[3][]{\mpar{\myvec[#1]{#2}{#3}}}
\newcommand\myvecs[3][]{\mset{\myvec[#1]{#2}{#3}}}

\newcommand\skel[1][]{S{\ifnempty{#1}{_{#1}}}}

\newcommand\term[1][]{t\ifnempty{#1}{_{#1}}}

 \newcommand\pinterp[1]{\left\llbracket #1 \right\rrbracket}
 \newcommand<>\pinterpbi[2]{%
   \mathrlap{\alt#3%
     {\left\llbracket #1 \right\rrbracket_{#2}}%
     {\left\llbracket #1 \right\rrbracket}}%
   \phantom{\left\llbracket #1 \right\rrbracket_{#2}}%
 }

\newcommand\OKst[1][]{\mathit{OKst}\ifnempty{#1}{_{#1}}\fund}
\newcommand\OKout[1][]{\mathit{OKout}\ifnempty{#1}{_{#1}}\fund}

\newcommand*\cloudabstr[4]{
  \node [#1, draw = Aluminium5,
  cloud, cloud puffs = 15, minimum width = #2, minimum height = #3,
  top color = Aluminium1, bottom color = LightPlum] (#4) {};}

\title{Auditions Inria CR/ISFP}
\subtitle{Grenoble — Rhône–Alpes \\ Équipe d’accueil~: Spades~\includegraphics[width=1.2em]{images/spades.png}}
\author{Martin Bodin}
\institute{}
\date{17 juin}

\begin{document}

\begin{frame}
    \titlepage
\end{frame}

\newcommand\meyear[1]{\textcolor{DarkPlum}{#1}} % \textbf
\newcommand\mesubject[1]{\\\hspace{23mm}\onslide<1->{\textcolor{DarkPlum}{#1}}}
\begin{frame}
    \frametitle{Parcours}

    % \begin{changemargin}{-1cm}{-1cm}
  \begin{itemize}
		\item\anchorm{meens}{} \meyear{2009–2013~:} ENS Lyon.
			\vspace{2mm}
		\item\anchorm{merennes}{} \meyear{2013–2016~:} Doctorat, Inria Rennes.
			\mesubject{JavaScript en Coq}
			\vspace{2mm}
		\item\anchorm{mesantiago}{} \meyear{2017–2018~:} Postdoc, CMM (Santiago de Chile).
			\mesubject{R en Coq}
			\vspace{2mm}
		\item\anchorm{melondon}{} \meyear{2018–2020~:} Postdoc, Imperial College (Londres).
			\mesubject{Squelettes}
			\mesubject{WebAssembly en Coq}
  \end{itemize}
    % \end{changemargin}

 %\begin{tikzpicture}[overlay, remember picture]
 %  \node [right = 9cm of merennes] (merennes2) {} ;
 %  \node [right = 9cm of melondon] (melondon2) {} ;
 %  \draw<1-> [->, DarkPlum, thick] (merennes2.north) to node [right] {Squelettes} (melondon2.south) ;
 %\end{tikzpicture}

\end{frame}

\begin{frame}
	\frametitle{Mon Credo}

	\begin{center}
		\includegraphics[height=15mm]{images/js.png}
		\quad
		\includegraphics[height=15mm]{images/Rlogo.png}
	\end{center}

	\begin{changemargin}{-4mm}{-4mm}
	\begin{itemize}
		\item Les langages de programmation \textbf{populaires} sont \textbf{complexes},
		\item Leur complexité est une \textbf{source d’erreurs} importante,
		\item Il y a ainsi un besoin d’\textbf{analyse} et d’\textbf{outils} pour ces langages,
			\begin{itemize}
				\item Détecter des débordements de mémoire, divisions par 0, etc.
				\item Intégration continue.\anchor{credoci}{}
			\end{itemize}
			\vspace{7mm}
		\item 
			\begin{minipage}[t]{8cm}
			\vspace{-8.5mm}
			\begin{align*}
				\text{Les langages sont complexes}
				&\implies \text{le code des outils est complexe,} \\
				&\implies \text{\textbf{erreur dans l’outil} probable,} \\
				&\implies \text{crise de la \textbf{confiance}.}
			\end{align*}
			\end{minipage}
		\item L’\textbf{assistant de preuve Coq}\minicoqlogo{} est nécessaire pour ces outils.
	\end{itemize}
	\end{changemargin}

	\begin{tikzpicture}[overlay, remember picture]
		\node [right = 5mm of credoci, yshift = -2mm] (infer) {\includegraphics[height=8mm]{images/infer.png}} ;
		\node [right = 0pt of infer, xshift = -2mm] {Infer} ;
		\node [right = 1cm of infer] (sapienz) {\includegraphics[height=8mm]{images/sapienz.jpg}} ;
		\node [right = 0pt of sapienz, xshift = -2mm] {Sapienz} ;
	\end{tikzpicture}

\end{frame}

\section{Les langages populaires sont complexes}

\begin{frame}

	\begin{center}
	\includegraphics[width=3cm]{images/js.png}
	\end{center}

		\begin{itemize}
			\item Premier langage sur Github,
			\item Présent sur 95~\% des sites web, % \(\sim\)1~520~000~000 sites web avec JavaScript,
			\item Utilisé dans de nombreuses interfaces.
		\end{itemize}
		\begin{center}
			\includegraphics[height=2cm]{images/FirefoxOS.png}
			\quad
			\includegraphics[height=2cm]{images/JS_in_space.jpg}
		\end{center}

\end{frame}

\begin{frame}[fragile]
  \frametitle{JavaScript \hfill\hfill\hfill\hfill\includegraphics[height=2.5ex]{images/js.png}}

  \def\jsreduces{~\(\to\)~}
  \begin{changemargin}{-2mm}{-2mm}
  \begin{itemize}
    \item \jsinline|![]| \jsreduces \jsinline|false|
    \item \jsinline|+![]| \jsreduces \jsinline|+false| \jsreduces \jsinline|0|
		\item \jsinline|![]+[]| \jsreduces \jsinline|false+[]| \jsreduces \jsinline|"false"|
    \item \jsinline|(![]+[])[+![]]| \jsreduces \jsinline|"false"[0]| \jsreduces \jsinline|"f"|
  \end{itemize}
  \end{changemargin}

  \vfill

\begin{jscode}
(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]
  +[+[]])+[])[+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+!+[]]
  +([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[+!+[]]
@\jsreduces@ "Inria"
\end{jscode}

\pause

	\parbox[t][0pt]{\textwidth}{
		\vspace{-3cm}
		\hspace{3cm}
		\href{https://www.lemondeinformatique.fr/actualites/lire-une-vulnerabilite-transforme-ebay-en-site-de-phishing-63824.html}{\XeTeXLinkBox{\includegraphics[width=8cm]{images/jsfuck_1.png}}}
	}
	% \parbox[t][0pt]{\textwidth}{
	% 	\vspace{-5cm}\hspace{3cm}
	% 	\href{https://news.softpedia.com/news/ebay-flaw-lets-attackers-push-malware-and-launch-phishing-sites-499788.shtml}{\XeTeXLinkBox{\includegraphics[width=8cm]{images/jsfuck_2.png}}}
	% }
	% \parbox[t][0pt]{\textwidth}{
	% 	\vspace{-2cm}\hspace{2cm}
	% 	\href{https://news.softpedia.com/news/jsf-ebay-xss-bug-exploited-in-the-wild-despite-the-company-s-fix-500651.shtml}{\XeTeXLinkBox{\includegraphics[width=7cm]{images/jsfuck_3.png}}}
	% }

\end{frame}

\frame{\tableofcontents}

% \sectionframe*{\includegraphics[width=5cm]{images/js.png}}

\section{Formaliser ces langages en Coq}

\sectionframe**{Formaliser en Coq~\makebox[1ex]{\includegraphics[width=1cm]{images/CoqLogo.png}} \\ des languages complexes}{
  %\begin{itemize}
  %\item

	\begin{widemargin}
	\begin{center}
	\parbox{11cm}{
		Servir de \textbf{base de confiance} à des analyses/compilations certifiées.
		% \item Thèse~: la complexité des langages est une source d’erreurs.
	%\item[\(\Longrightarrow\)]
	\\
	\(\Longrightarrow\)
	Prendre le langage tel qu’il est, \anchor{complexlanguagessizes}{sans simplification.}
  %\end{itemize}
}
	\end{center}
	\end{widemargin}

    \begin{tikzpicture}[overlay, remember picture]
  \onslide<2>{
      \node [fit = (complexlanguagessizes), ellipse, draw = DarkPlum, thick] (complexlanguagessizese) {} ;
			\node [below = 0pt of complexlanguagessizese, DarkPlum] {\parbox{5cm}{Formalisation très large…\\Comment lui faire confiance ?}} ;
    }
    \end{tikzpicture}
}

\begin{frame}

	\begin{block}{JSCert~: \url{https://github.com/jscert/jscert}}
\begin{refsection}
  \addtocategory{boldentry}{popl14jscert}
  \toggletrue{bbx:boldentries}
	\nocite{bodin2013certified}
	\nocite{popl14jscert}
	\printbibliography
\end{refsection}
	\end{block}

	\begin{block}{CoqR~: \url{https://github.com/Mbodin/CoqR}}
\begin{refsection}
  \addtocategory{boldentry}{bodin2018R}
  \toggletrue{bbx:boldentries}
	\nocite{CoqRCoqPL}
	\nocite{bodin2018R}
	\printbibliography
\end{refsection}
	\end{block}

	\begin{block}{WebAssembly}
		Projet en cours.
		% \url{https://github.com/rems-project/wasm_coq}
	\end{block}

\end{frame}

\begin{frame}
    \frametitle{JSCert~: faire confiance à JavaScript}

 ~\vspace{-1cm}

		\begin{widemargin}
\begin{centertikz}[node distance = 1.5cm]

	\begin{scope}% [alt=<2-3>{opacity=.3}]
    \node (realworldleft) {};
    \node [right of = realworldleft, node distance = 11cm] (realworldright) {} ;

    \node [right of = realworldleft, node distance = 15mm] (semlim) {} ;
    \node [left of = realworldright, node distance = 15mm] (testlim) {} ;

    % \draw [dashed] (realworldleft) to node [above, pos = 0.9] {Définitions Coq} node [below, pos = 0.9] {Monde industriel} (realworldright) ;
	\end{scope}

	\onslide<2->{
	\begin{scope}% [alt=<2>{opacity=.3}]
    \node [above of = testlim, locnode brown] (jsref) {JSRef} ;

    \node [locnode blue, below of = jsref, node distance = 45mm] (tests) {\includegraphics[width = 4cm]{images/test262_small.png}} ;
    \node [below = 0pt of tests] {Suites de test} ;

    \draw [<->, thick, Plum] (tests) --
				node [sloped, above, fill = white] (testsa) {Tests}
        (jsref) ;
	\end{scope}
	}

	\begin{scope}[alt=<2>{opacity=.3}]
    \node [above of = semlim, locnode brown] (jscert) {JSCert} ;

    \node [locnode orange, below of = semlim, node distance = 32mm] (ecma) {\includegraphics[width = 15mm]{images/ecmastandard.png}} ;
    \node [below = 0pt of ecma] {Spécification} ;

    \draw [<->, thick, Plum] (ecma) --
				node (lineByLinea) [sloped, above, fill = white] {Correspondance}
        node (lineByLineb) [sloped, below, fill = white] {ligne à ligne} (jscert) ;
	\end{scope}

	\onslide<3->{
		\draw [->, thick, DarkPlum] (jsref) -- node [above] {Correction\provedincoq{}} (jscert) ;
	}

		\onslide<1>{
			% \node [fit = (lineByLinea) (lineByLineb), ellipse, draw = DarkOrange, thick] (lineByLinec) {} ;
			\node [right = 1cm of lineByLineb, draw = DarkPlum, thick, fill = white, rounded corners = 2pt, yshift = -2cm] (lineByLinei) {\includegraphics[width=8cm]{images/ECMA_JSCert.png}} ;
			% \draw [thick, DarkOrange] (lineByLinec) -- (lineByLinei) ;
		}

		\onslide<2>{
			\node [left = 2cm of testsa, draw = DarkPlum, thick, fill = white, rounded corners = 2pt, yshift = -13mm]
				{\href{http://jsexplain.gforge.inria.fr/index.html}{\XeTeXLinkBox{\includegraphics[width=6cm]{images/jsexplain.png}}}} ;
		}

		\onslide<4>{
			\node [locnode plum, bottom color = white, top color = white, thick, below right = 1cm of jscert, xshift = -7mm, yshift = 2mm] {\parbox{65mm}{
				\begin{itemize}
					\item Premier lien entre la spécification et les tests officiels,
					\item JSCert est digne de confiance~: \textbf{référence} pour JavaScript en Coq.
				\end{itemize}
				}} ;
			}

\end{centertikz}
		\end{widemargin}

\end{frame}

\begin{frame}
    \frametitle{Tailles de sémantiques}

    \vspace{-5mm}

    \begin{centertikz}[scale=.5, node distance = 2cm]

        \node (lambda) {\(\lambda\)-calcul} ;
        % \node [right = 5mm of lambda] (ml) {CoreML} ;
        \node [right of = lambda] (compcert) {C} ;
        \node [right of = compcert] (jscert) {JavaScript{}} ;
        \node [right of = jscert] (coqR) {R{}} ;
        \node [right of = coqR] (wasm) {WebAssembly{}} ;

        % Scale: 1 rule/filter = .005.

        \onslide<1-2>{
            \draw [DarkPlum, fill = LightPlum] ($(lambda.north) + (-.5, .1)$) rectangle ++ (1, .015) ;
            \node [above = 1mm of lambda] {\(3\)~règles} ;
        }
        \onslide<3>{
            \draw [DarkSkyBlue, fill = LightSkyBlue] ($(lambda.north) + (-.5, .1)$) rectangle ++ (1, .02) ;
            \node [above = 1mm of lambda] {\(4\)~fonctions} ;
        }
%       \onslide<4>{
%           \draw [DarkPlum, fill = LightPlum] ($(lambda.north) + (-1, .1)$) rectangle ++ (1, .015) ;
%           \node [above = 1mm of lambda] {\(3\)~règles} ;
%           \draw [DarkSkyBlue, fill = LightSkyBlue] ($(lambda.north) + (0, .1)$) rectangle ++ (1, .02) ;
%       }


%       \onslide<1>{
%           \draw [DarkPlum, fill = LightPlum] ($(ml.north) + (-.5, .1)$) rectangle ++ (1, .25) ;
%           \node [above = 2mm of ml] {\(\sim{}50\)~règles} ; % 61 in pretty-big-step.
%           % Source: http://www.chargueraud.org/research/2012/pretty/
%       }
%       \onslide<2>{
%           \draw [DarkSkyBlue, fill = LightSkyBlue] ($(ml.north) + (-.5, .1)$) rectangle ++ (1, .16) ;
%           \node [above = 2mm of ml, xshift = 1mm] {\(\sim{}30\)~fonctions} ; % 13 value constructors, 19 utility fonctions or predicate.
%           % Source: estimented from http://www.chargueraud.org/research/2012/pretty/
%       }

        \onslide<1-2>{
            \draw [DarkPlum, fill = LightPlum] ($(compcert.north) + (-.5, .1)$) rectangle ++ (1, 1) ;
            \node [above = 6mm of compcert] {\(\sim{}200\)~règles} ; % 110 in big step + 77 in denotational.
            % Source: estimated from http://compcert.inria.fr/doc/html/Csem.html and http://compcert.inria.fr/doc/html/Cop.html
        }
        \onslide<3>{
            \draw [DarkSkyBlue, fill = LightSkyBlue] ($(compcert.north) + (-.5, .1)$) rectangle ++ (1, 0.6) ;
							\node [above = 6mm of compcert] {\(\sim{}120\)~fonctions} ; % 68 value constructors, 56 utility fonctions.
            % Source: estimated from http://compcert.inria.fr/doc/html/Cop.html
        }
%       \onslide<4>{
%           \draw [DarkPlum, fill = LightPlum] ($(compcert.north) + (-1, .1)$) rectangle ++ (1, 1) ;
%           \node [above = 6mm of compcert] {\(\sim{}200\)~règles} ; % 110 in big step + 77 in denotational.
%           \draw [DarkSkyBlue, fill = LightSkyBlue] ($(compcert.north) + (0, .1)$) rectangle ++ (1, 0.6) ;
%       }

				\onslide<2->{
					\node [locnode red, bottom color = white, top color = white, thick, above = 3cm of compcert] (warning) {\parbox{21mm}{\centering{}Arithmétique pointeur}} ;
					\draw [DarkScarletRed, thick, ->] (warning.south) -- ++ (0, -1) ;
					\node [locnode plum, bottom color = white, top color = white, thick, right = 1mm of warning] (new) {\parbox{18mm}{\centering{}Difficulté nouvelle}} ;
					\draw [DarkPlum, thick, ->] (new.east) to[out=0, in=90] ++ (.3, -1) ;
					}


        \onslide<1-2>{
            \draw [DarkPlum, fill = LightPlum] ($(jscert.north) + (-.5, .1)$) rectangle ++ (1, 4.5) ;
            \node [above = 23mm of jscert] {\(\sim{}900\)~règles} ; % ~900 in pretty-big-step.
        }
        \onslide<3>{
            \draw [DarkSkyBlue, fill = LightSkyBlue] ($(jscert.north) + (-.5, .1)$) rectangle ++ (1, 0.4) ;
            \node [above = 2mm of jscert] {\(\sim{}80\)~fonctions} ; % 44 value constructors, 8 records (counts double), 23 monadic binders.
        }
%       \onslide<4>{
%           \draw [DarkPlum, fill = LightPlum] ($(jscert.north) + (-1, .1)$) rectangle ++ (1, 4.5) ;
%           \node [above = 23mm of jscert] {\(\sim{}900\)~règles} ; % ~900 in pretty-big-step.
%           \draw [DarkSkyBlue, fill = LightSkyBlue] ($(jscert.north) + (0, .1)$) rectangle ++ (1, 0.4) ;
%       }

        \onslide<1-2>{
            \draw [DarkPlum, fill = LightPlum] ($(coqR.north) + (-.5, .1)$) rectangle ++ (1, 10) ;
            \node [above = 50mm of coqR] {\(\sim{}2 000\)~règles} ; % 2028 occurrences of 'let%'.
        }
        \onslide<3>{
            \draw [DarkSkyBlue, fill = LightSkyBlue] ($(coqR.north) + (-.5, .1)$) rectangle ++ (1, 0.8) ;
            \node [above = 6mm of coqR] {\(\sim{}160\)~fonctions} ; % 51 value constructors, 17 records (counts double), 77 monadic binders.
        }
%       \onslide<4>{
%           \draw [DarkPlum, fill = LightPlum] ($(coqR.north) + (-1, .1)$) rectangle ++ (1, 10) ;
%           \node [above = 50mm of coqR] {\(\sim{}2 000\)~règles} ; % 2028 occurrences of 'let%'.
%           \draw [DarkSkyBlue, fill = LightSkyBlue] ($(coqR.north) + (0, .1)$) rectangle ++ (1, 0.8) ;
%       }

        \onslide<1-2>{
            \draw [DarkPlum, fill = LightPlum] ($(wasm.north) + (-.5, .1)$) rectangle ++ (1, 1.9) ;
            \node [above = 9mm of wasm] {\(\sim{}350\)~règles} ; % 67 rules + 315 low-level equations.
        }
        \onslide<3>{
            \draw [DarkSkyBlue, fill = LightSkyBlue] ($(wasm.north) + (-.5, .1)$) rectangle ++ (1, 0.23) ;
            \node [above = 2mm of wasm] {\(\sim{}50\)~fonctions} ; % 11 value constructors, 17 records (counts double), 1 monadic binder.
        }
%       \onslide<4>{
%           \draw [DarkPlum, fill = LightPlum] ($(wasm.north) + (-1, .1)$) rectangle ++ (1, 1.9) ;
%           \node [above = 9mm of wasm] {\(\sim{}350\)~règles} ; % 67 rules + 315 low-level equations.
%           \draw [DarkSkyBlue, fill = LightSkyBlue] ($(wasm.north) + (0, .1)$) rectangle ++ (1, 0.23) ;
%       }

%        \draw [thick, dashed, ->] (compcert) to [bend right] ($(compcert) + (-1, -1)$) ;

    \end{centertikz}
%    \vspace{-5mm}

    ~\vfill

		\begin{widemargin}
    \begin{center}
        \tiny\centering{}
				(Estimation grossière
				\rlap{%
					\only<1-2>{de la taille de chaque sémantique si reformulées en petit-pas.)}%
					\only<3>{du nombre de fonctions basiques dans chaque sémantique.)}%
					% \only<4>{du nombre de fonctions basiques et de la taille de chaque sémantique si reformulées en petit-pas.)}
					}%
				% \phantom{du nombre de fonctions basiques et de la taille de chaque sémantique si reformulées en petit-pas.)}
				\phantom{de la taille de chaque sémantique si reformulées en petit-pas.)}
    \end{center}
		\end{widemargin}

%   \begin{overlayarea}{\textwidth}{1cm}
%       \tiny\centering{}
%       \only<1-2>{(Estimation grossière de la taille de chaque sémantique si reformulées en petit-pas.)}
%       \only<3>{(Estimation grossière du nombre de fonctions basiques dans chaque sémantique.)}
%       \only<4>{(Estimation grossière de la taille et du nombre de fonctions basiques de chaque sémantique si reformulées en petit-pas.)}
%   \end{overlayarea}

\end{frame}

\section{Squelettes~: une syntaxe pour la sémantique}

\sectionframe**{Squelettes}{

	\begin{centertikz}
	\begin{scope}[scale=.5]
		\node (jscert) {} ;
		\node [right = 5cm of jscert] (jscert2) {} ;

  \draw [DarkPlum, fill = LightPlum] ($(jscert.north) + (-.5, .1)$) rectangle ++ (1, 4.5) ;
  \node [above = 23mm of jscert] {\(\sim{}900\)~règles} ;

	\draw [DarkSkyBlue, fill = LightSkyBlue] ($(jscert2.north) + (-.5, .1)$) rectangle ++ (1, 0.4) ;
	\node [above = 3mm of jscert2] {\(\sim{}80\)~fonctions} ; % 44 value constructors, 8 records (counts double), 23 monadic binders.
	\end{scope}

		\draw [->, thick, DarkPlum] ($(jscert)+(1,.5)$) -- ($(jscert2)+(-1.5,.5)$) ;
	\end{centertikz}

	\vfill

	\begin{itemize}
		\item Une syntaxe \textbf{simple} pour exprimer des sémantiques,
		\item Pour pouvoir en déduire des analyses statiques de programme.
	\end{itemize}

%   \begin{tikzpicture}[overlay, remember picture]
% \onslide<2>{
%     \node [fit = (simplesyntax), ellipse, draw = DarkPlum, thick] (simplesyntaxe) {} ;
% 		% \node [above right = 0pt of simplesyntaxe, DarkPlum] {\parbox{5cm}{Peu de fonctionalités}} ;
%   }
%   \end{tikzpicture}
}

\begin{frame}

	\begin{block}{Squelettes: \url{https://gitlab.inria.fr/skeletons/Coq}}
\begin{refsection}
  \addtocategory{boldentry}{bodin2019skeletal}
  \toggletrue{bbx:boldentries}
	\nocite{bodin2014pretty}
	\nocite{cpp2015pbs}
	\nocite{bodin2019skeletal}
	\printbibliography
\end{refsection}
	\end{block}

\end{frame}

% \subsection{Définition}

\newcommand\colorSequence{DarkPlum}
\newcommand\colorRecursion{DarkOrange}
\newcommand\colorBranchements{DarkChameleon}
\newcommand\colorAtome{DarkSkyBlue}

\begin{frame}[fragile]
  \frametitle{Les Ingrédients d’une sémantique}

  \begin{widemargin}
\begin{mathpar}
\anchorm{choicea1}{}
\inferrule{
  \anchorm{sequencea1}{} \sigma, e \evalr v \\
	\anchorm{computationa1}{}v = \mbox{\jsinline|true|\anchorm{computationb1}{}} \\
  \anchorm{resulta1}{} \sigma, s_1 \evalr o \anchorm{resultb1}{}\anchorm{sequenceb1}{}
}{
\sigma, \textmath{if } e \textmath{ then } s_1 \textmath{ else } s_2 \evalr o
}
\and
\inferrule{
  \sigma, e \evalr v \\
	v = \mbox{\jsinline|false|} \\
  \sigma, s_2 \evalr o
}{
  \sigma, \textmath{if } e \textmath{ then } s_1 \textmath{ else } s_2 \evalr o
}
\anchorm{choiceb1}{}
\end{mathpar}
  \end{widemargin}

\vfill

	\begin{widemargin}
		\begin{center}
		\begin{minipage}{1.08\textwidth}
\begin{block}{Évaluation de \textinline~if e then s1 else s2~ dans l’état $\sigma$}
\begin{enumerate}
\item \anchorm{sequencea}{}Soit \textinline~v~ le résultat de l’évaluation de \textinline~e~ dans l’état $\sigma$.
\item \anchorm{choicea}{}Si\anchorm{computationa}{} \textinline~v~ est \jsinline|true|\anchorm{computationb}{}, soit \textinline~o~ le résultat de \anchorm{resulta}{}l’évaluation de \textinline~s1~ dans l’état $\sigma$.\anchorm{resultb}{}
\item \anchorm{sequenceb}{}Si \textinline~v~ est \jsinline|false|,\anchorm{choiceb}{} soit \textinline~o~ le résultat de l’évaluation de \textinline~s2~ dans l’état $\sigma$.
\item Retourner \textinline~o~.
\end{enumerate}
\end{block}
		\end{minipage}
		\end{center}
	\end{widemargin}

\begin{tikzpicture}[remember picture, overlay]
    \node<5> (computation) [ellipse, thick, draw = \colorAtome, fit = (computationa) (computationb)] {} ;
    \node<5> [below = 3em of computation, \colorAtome] {Atome} ;
    \node<5> (computation1) [ellipse, thick, draw = \colorAtome, fit = (computationa1) (computationb1)] {} ;
    \node<5> [above = 1pt of computation1, \colorAtome] {Atome} ;
    \node<2> (sequence) [ellipse, thick, draw = \colorSequence, fit = (choicea) (sequenceb), minimum width = 6mm, minimum height = 25mm, xshift = -4mm] {} ;
    \node<2> [below right = 0pt of sequence, xshift = -2mm, yshift = -2mm, \colorSequence] {Séquence} ;
    \node<2> (sequence1) [ellipse, thick, draw = \colorSequence, xscale = 0.75, fit = (sequencea1) (sequenceb1)] {} ;
    \node<2> [above = 0pt of sequence1, \colorSequence] {Séquence} ;
    \node<3> (result) [ellipse, thick, draw = \colorRecursion, fit = (resulta) (resultb)] {} ;
    \node<3> [above = 0pt of result, xshift = 15mm, \colorRecursion] {Récursion} ;
    \node<3> (result1) [ellipse, thick, draw = \colorRecursion, fit = (resulta1) (resultb1)] {} ;
    \node<3> [above = 0pt of result1, \colorRecursion] {Récursion} ;
    %\node (result2) [ellipse, thick, draw = \colorRecursion, fit = (result2a) (result2b)] {} ;
    % \node [below = 1pt of result2, \colorRecursion, xshift = -2ex] {Recursive call} ;
    \node<4> (choice) [ellipse, thick, draw = \colorBranchements, fit = (choicea) (choiceb)] {} ;
    \node<4> [below right = 0pt of choice, \colorBranchements] {Branchement} ;
    \node<4> (choice1) [ellipse, thick, draw = \colorBranchements, xscale = 0.75, yscale = 2.6, fit = (choicea1) (choiceb1)] {} ;
    \node<4> [above = 0pt of choice1, \colorBranchements] {Branchement} ;
    %\node [left = 1pt of pattern1, yshift = 0pt, xshift = 5pt, \colorBranchements] {\parbox{4em}{\centering{}Pattern\\matching}} ;
    %\node (pattern2) [ellipse, thick, draw = \colorBranchements, fit = (pattern2a) (pattern2b)] {} ;
    % \node [left = 1pt of pattern2, yshift = -1ex, \colorBranchements] {Pattern matching} ;
\end{tikzpicture}

%   “! e” is evaluated as follows:
%   Let expr be the result of evaluating UnaryExpression.
%   Let oldValue be ToBoolean(GetValue(expr)).
%   If oldValue is true, return false.
%   Return true.

\end{frame}

\begin{frame}
  \frametitle{Structure d’un squelette}

\begin{align*}
	\derivb{\sigma}{e_1 + e_2} &\coloneqq \left[
  \begin{aligned}
    &\deriv{\sigma}{\anchorm{skrec}{e_1}}{v_1} \\
    &\deriv{\sigma}{e_2}{v_2}\!\!\anchorm{skseqa}{}\,\anchorm{skseqb}{} \\
    &\anchorm{skata}{}\filterb{\texttt{add}}{v_1, v_2}\anchorm{skatb}{}
  \end{aligned}
  \right]
\\[1.5em]
	\derivb{\sigma}{\sif{e}{s_1}{s_2}} &\coloneqq \left[
  \begin{aligned}
    & \deriv{\sigma}{e}{v}\\
    & \branchesV[]{\begin{aligned}
      &\anchorm{skchoicea}{}\filter{\texttt{isTrue}}{v}{}
      \derivb{\sigma}{s_1}\\
      &\filter{\texttt{isFalse}}{v}{}\anchorm{skchoiceb}{}
      \derivb{\sigma}{s_2}
  \end{aligned}}
  \end{aligned}
\right]
\end{align*}

    \begin{tikzpicture}[remember picture, overlay]
        \node<4-> (skat) [ellipse, xscale = 0.7, thick, draw = \colorAtome, fit = (skata) (skatb)] {} ;
        \node<4-> [below = 1pt of skat, \colorAtome] {Atome} ;
        \node<3-> (skseq) [ellipse, thick, draw = \colorSequence, fit = (skseqa) (skseqb), xshift = -3pt] {} ;
        \node<3-> [right = 2pt of skseq, \colorSequence] {Séquence} ;
        \node<2-> (skrec) [ellipse, thick, draw = \colorRecursion, fit = (skrec), xscale = 2, xshift = -1mm] {} ;
        \node<2-> [above = 1pt of skrec, \colorRecursion] {Récursion} ;
        \node<5-> (skchoice) [ellipse, thick, draw = \colorBranchements, fit = (skchoicea) (skchoiceb), xshift = 75mm, yshift = 37.5mm, xscale = 5, yscale = 2, minimum width = 12mm] {} ;
        \node<5-> [below = 1pt of skchoice, \colorBranchements] {Branchement} ;
    \end{tikzpicture}

		\vfill

	\onslide<6->{
		\[
	\skel \Coloneqq
      ~ \derivb{x}{t}
      ~\mid~ \letinS{x}{\skel} \skel'
      ~\mid~ \filterb{F}{\myvec{\svar{x}}{n}}
      ~\mid~ \branches[]{\begin{gathered}
                           \skel[1]\\
                           ..\\
                           \skel[n]
                         \end{gathered}}
		\]
		}

		\vfill

\end{frame}

\sectionframe**{Analyses}{

\begin{block}{Intérêt des squelettes}
	Définir et montrer correcte une analyse \textbf{une fois pour toutes},\\
	pour l’instancier à tous les languages (via leurs squelettes).
\end{block}
	}

% \sectionframe**{Squelettes}{

% 	\begin{centertikz}
% 	\begin{scope}[scale=.5]
% 		\node (jscert) {} ;
% 		\node [right = 5cm of jscert] (jscert2) {} ;

%   \draw [DarkPlum, fill = LightPlum] ($(jscert.north) + (-.5, .1)$) rectangle ++ (1, 4.5) ;
%   \node [above = 23mm of jscert] {\(\sim{}900\)~règles} ;

% 	\draw [DarkSkyBlue, fill = LightSkyBlue] ($(jscert2.north) + (-.5, .1)$) rectangle ++ (1, 0.4) ;
% 	\node [above = 3mm of jscert2] {\(\sim{}80\)~fonctions} ; % 44 value constructors, 8 records (counts double), 23 monadic binders.
% 	\end{scope}

% 		\draw [->, thick, DarkPlum] ($(jscert)+(1,.5)$) -- ($(jscert2)+(-1.5,.5)$) ;
% 	\end{centertikz}


% 	\begin{itemize}
% 		\item Une syntaxe simple pour exprimer des sémantiques,
% 		\item Pour pouvoir en déduire des \textbf{analyses statiques de programme}.
% 	\end{itemize}

% }
% \addtocounter{framenumber}{-1}
% \subsection*{Interprétations}

% \sectionframe**{Interprétations}{
% \begin{centertikz}
%   \node [locnode yellow] (skel) {Squelettes} ;
%   \node [locnode, above right = 2cm of skel] (concr) {\parbox{6em}{\centering interprétation concrète}} ;
%   \node [locnode, below right = 2cm of skel] (abs) {\parbox{6em}{\centering interprétation abstraite}} ;
% 	\draw [->, thick, DarkPlum] (skel.north east) -- (concr.south west) ;
%   \draw [->, thick, DarkPlum] (skel.south east) -- (abs.north west) ;
% 	\draw [->, thick, DarkPlum] (skel.north east) -- node[below, rotate=45] {générique} (concr.south west) ;
%   \draw [->, thick, DarkPlum] (skel.south east) -- node[above, rotate=-45] {générique} (abs.north west) ;
% % \node [locnode, right = 2cm of skel] (interp) {...};
% %  \draw [->, thick, DarkPlum] (skel.east) -- (interp.west);
%  %\onslide<2->{
%  %\draw [<->, double, thick, DarkPlum] (concr.-40) -- node[above, fill = white] {cohérence} (abs.40) ;
%  %}
% \end{centertikz}
% }

\begin{frame}
    \frametitle{Interprétation abstraite}

  \begin{centertikz}[auto]

    \node[locnode brown] (txt) {Programme};

		\node [above = 3cm of txt] (polyspace) {\includegraphics[width = 3cm]{images/polyspace.png}} ;
		\node [right = 2mm of polyspace] {\includegraphics[width = 3cm]{images/mathworks.png}} ;
		\node [below = 3mm of polyspace] {\includegraphics[width = 2cm]{images/absint.png}} ;

    \begin{pgfonlayer}{background}
        \node [right of = txt, node distance = 7cm, draw = Plum, fill = LightPlum, fill opacity = .2, ellipse, minimum width = 5cm, minimum height = 65mm] (allstates) {} ;
        \node [above = 0pt of allstates] {États} ;
    \end{pgfonlayer}

    \only<1,3->{
    \node[above of = allstates, node distance = 1cm, star, star points = 10, star point ratio = .8, draw = DarkPlum, top color = LightPlum, bottom color = Plum] (facts)
        {\small{}\parbox{1.6cm}{\centering{}\color{Aluminium1}{États accessibles}}} ;
    }
    \only<2>{
    \begin{pgfonlayer}{background}
    \node [circle, above of = allstates, node distance = 1cm, minimum width = 43mm, inner color = Plum, middle color = Plum, outer color = LightPlum!20!white] (facts)
    {\small \parbox{2cm}{\centering{}\color{Aluminium1}{États du programme}}} ;
    \end{pgfonlayer}
    }

   \begin{pgfonlayer}{background}
     \onslide<3->{
%       \cloudabstr{below of = facts, node distance = 2mm}{4.5cm}{4cm}{approx2}
%       \cloudabstr{right of = facts, node distance = 0pt}{3.5cm}{3cm}{approx}
        \cloudabstr{right of = facts, node distance = 0pt, yshift = 1mm}{35mm}{31mm}{approx1}
     }
   \end{pgfonlayer}

    \node[below of = allstates, node distance = 1.8cm, rounded corners = 1mm,
      rectangle, draw = Aluminium6, bottom color = Aluminium2, top color = Aluminium1]
      (prop) {\scriptsize{}États dangereux} ;
    \begin{pgfonlayer}{background}
        \draw[bottom color = ScarletRed, top color = LightScarletRed!50!Aluminium1,
            draw = Aluminium6] (prop) circle (1.3cm);
%     \onslide<6->{
%       \cloudabstr{below of = facts, node distance = 2mm, fill opacity = .3}{4.5cm}{4cm}{approx2}
%     }
    \end{pgfonlayer}

		\onslide<1>{
        \draw[thick, ->, DarkPlum] (txt) to [bend left = 15] node [above, near start, DarkPlum, yshift = 1mm] {Sémantique} (facts.180) ;
				}
		\onslide<2>{
        \draw[thick, ->, DarkPlum] (txt) to [bend left = 15] node [above, near start, DarkPlum, yshift = 1mm] {Sémantique} ($(facts)+(-.7, .2)$) ;
				}
		\onslide<3>{
        \draw[thick, ->, DarkPlum] (txt) to [bend left = 15] node [above, pos = .4, DarkPlum, yshift = 2mm] {Sémantique abstraite} (approx1.167) ;
				}

  \end{centertikz}

%\parbox{\textwidth}{%
%\vspace{-3cm}%
%\onslide<6>{\raisebox{-.5\height}{\includegraphics[width = 1cm]{images/CoqLogo.png}}
%    The \coqn{} proof assistant}
%}

\end{frame}

\sectionframe**{Interprétations}{
\begin{centertikz}
  \node [locnode yellow] (skel) {Squelettes} ;
  \node [locnode, above right = 2cm of skel] (concr) {\parbox{6em}{\centering interprétation concrète}} ;
  \node [locnode, below right = 2cm of skel] (abs) {\parbox{6em}{\centering interprétation abstraite}} ;
	\draw [->, thick, DarkPlum] (skel.north east) -- node[below, rotate=45] {générique} (concr.south west) ;
  \draw [->, thick, DarkPlum] (skel.south east) -- node[above, rotate=-45] {générique} (abs.north west) ;
% \node [locnode, right = 2cm of skel] (interp) {...};
%  \draw [->, thick, DarkPlum] (skel.east) -- (interp.west);
	\onslide<3>{
	\draw [<->, double, thick, DarkPlum] (concr.-40) -- node[above, fill = white] (coh) {cohérence} (abs.40) ;
	\node [right = 3pt of coh] {\includegraphics[width=1cm]{images/CoqLogo.png}} ;
	}

	\onslide<2->{
	\draw [draw = DarkPlum, thick, decorate, decoration = brace] ($(skel) + (-1.3, 1.5)$) -- ($(skel) + (-1.3, -1.5)$) ;
	\draw [draw = DarkSkyBlue, thick, decorate, decoration = brace] ($(abs) + (-1.6, .5)$) -- ($(abs) + (-1.6, -.5)$) ;
	\draw [draw = DarkSkyBlue, thick, decorate, decoration = brace] ($(concr) + (-1.6, .5)$) -- ($(concr) + (-1.6, -.5)$) ;

	\node [left = 8mm of skel, yshift = -15mm] (jscert) {JavaScript} ;
	\node [left = 15mm of abs, yshift = -5mm] (jscert2) {} ;
	\node [left = 15mm of concr, yshift = -5mm] (jscert3) {} ;

	\begin{scope}[scale=.5]
  \draw [DarkPlum, fill = LightPlum] ($(jscert.north) + (-.5, .1)$) rectangle ++ (1, 4.5) ;
  \node [above = 23mm of jscert] {\(\sim{}900\)~règles} ;

	\draw [DarkSkyBlue, fill = LightSkyBlue] ($(jscert2.north) + (-.5, .1)$) rectangle ++ (1, 0.4) ;
	\node [above = 3mm of jscert2] {\(\sim{}80\)~fonctions} ; % 44 value constructors, 8 records (counts double), 23 monadic binders.

	\draw [DarkSkyBlue, fill = LightSkyBlue] ($(jscert3.north) + (-.5, .1)$) rectangle ++ (1, 0.4) ;
	\node [above = 3mm of jscert3] {\(\sim{}80\)~fonctions} ; % 44 value constructors, 8 records (counts double), 23 monadic binders.
	\end{scope}
		}
\end{centertikz}
}

\frame{\tableofcontents}

\section{Projet de recherche}

\sectionframe**{Projet de recherche}{

	\begin{center}
		\textcolor{DarkPlum}{
			Une infrastructure pour des analyses et des compilateurs certifiés\minicoqlogo{}\\
			pour des langages de programmation complexes.
		}
	\end{center}

	\begin{changemargin}{-5mm}{-5mm}
	\begin{itemize}
		\item \textcolor{DarkPlum}{Pourquoi~?}
			\begin{itemize}
				\item Un \textbf{usage important} dans l’industrie,
				\item Les sémantiques complexes sont \textbf{peu étudiées} dans leur intégralité.
					% \textbf{aucun analyseur} pour JavaScript et R incluant la totalité du langage.
			\end{itemize}
		\item \textcolor{DarkPlum}{Difficultés}
			\begin{itemize}
				\item Formalisation très larges~: crise de \textbf{confiance},
				\item Passage à l’échelle,
				\item Des analyses clefs en main pour tous les langages.
			\end{itemize}
		\item \textcolor{DarkPlum}{Comment~?}
			\begin{itemize}
				\item Les \textbf{squelettes} offrent un cadre qui \textbf{passe à l’échelle},
				% \item Construire de nouvelles interprétations,
				\item Appliquer les squelettes à des \textbf{systèmes réels}.
			\end{itemize}
	\end{itemize}
	\end{changemargin}

%\begin{block}{Construire une infrastructure autour des squelettes}
%	\begin{itemize}
%		\item Des squelettes pour tous les paradigmes de programmation,
%		\item Une large gamme 
%			\(
%			\left\{
%				\begin{tabular}{l}
%					\text{d’analyses statiques}\\
%					\text{de compilateurs}
%				\end{tabular}
%			\right.
%			\) certifiées en Coq\minicoqlogo{},
%		\item Une «~boîte à outil~» pour analyseurs et compilateurs.
%	\end{itemize}
%\end{block}

	%% \begin{widemargin}
	%\begin{itemize}
	%	\item Construire une \textbf{infrastructure} autour des squelettes
	%	\begin{itemize}
	%		\item Objectif à court-terme~: L’appliquer sur des exemples concrets.
	%		\item Objectif à long-terme~: pouvoir appliquer facilement
	%			\textbf{une gamme d’analyses} certifiées en Coq
	%			sur des langages de programmation complexes.
	%	\end{itemize}
	%	\item Appliquer les squelettes aux problématiques de Spades
	%	\begin{itemize}
	%		\item Exprimer conjointement la \textbf{sémantique} et le \textbf{coût} des programmes.
	%	\end{itemize}
	%\end{itemize}
	%% \end{widemargin}
	}

% \newcommand\projetitem[1]{\\\onslide<1->{\textcolor{DarkPlum}{#1}}}
% \begin{frame}
% 	\frametitle{Projet de recherche}

% 	\begin{enumerate}
% 		\item Analyses de programme,
% 			\projetitem{Coûts temps/énergie, explicabilité des fautes.}
% 		\item Compilation,
% 			\projetitem{Prédictibilité, compilation multi-critères.}
% 		\item Applications sur des systèmes réels.
% 			\projetitem{Modèles dataflow, applications pratiques.}
% 	\end{enumerate}
% \end{frame}

	\newcommand\spadesnames{\textcolor{DarkPlum}}
\begin{frame}
	\frametitle{Intégration dans Spades \hfill \parbox[b][0pt][t]{0pt}{\vspace{-7mm}~\hspace{15mm}\includegraphics[width = 13mm]{images/spades.png}}}
	\framesubtitle{Méthodes formelles pour les systèmes embarqués}

% \begin{centertikz}
% 	\node (spades) {\includegraphics[width = 4cm]{images/spades.png}} ;
% 
% 	\node [locnode, above left = 2cm of spades] (spades1) {Modèles formels, langages, et outils} ;
% 	\node [locnode, below = 5mm of spades1] (spades2) {Programmation temps-réel certifiée\minicoqlogo{}} ;
% 	\node [locnode, below = 5mm of spades2] (spades3) {Gestion des fautes et analyse causale} ;
% 
% pour les systèmes embarqués
% \end{centertikz}

	%	TODO: \item Analyses de coûts temps/énergie~: Alain Girault

	\begin{widemargin}
	\begin{itemize}
		\item Modèles formels, langages, et outils ;
			\begin{itemize}
				\item \textbf{Analyses de programme dataflow}~: \spadesnames{Pascal Fradet, Alain Girault.}
				\item Dataflow reconfigurable~: \spadesnames{Pascal Fradet, Alain Girault, Xavier Nicollin.}
				\item Hypercells~: \spadesnames{Jean-Bernard Stefani.}
			\end{itemize}
		\item Programmation temps-réel certifiée en Coq\minicoqlogo{} ;
			\begin{itemize}
				\item \textbf{Analyses d'ordonnançabilité certifiées}~: \spadesnames{Pascal Fradet, Sophie Quinton.}
				\item \textbf{Compilation multi-critères} (temps/énergie, prédictibilité)~: \spadesnames{Alain Girault.}
			\end{itemize}
		\item Gestion des fautes et analyse causale.
			\begin{itemize}
				\item \spadesnames{Gregor Gössler, Jean-Bernard Stefani.}
			\end{itemize}
	\end{itemize}

	\pause

		\begin{center}
		\begin{minipage}{1.125\textwidth}
	\begin{block}{J’apporte mes compétences}
		\begin{itemize}
			\item Coq,
			\item Analyse de programmes, interprétation abstraite, logique de séparation.
			\item Théorie des langages de programmation.
		\end{itemize}
	\end{block}
		\end{minipage}
		\end{center}
	\end{widemargin}

\end{frame}

\sectionframe**{Squelettes~: présent et futur}{
	\vfill
	~\vfill

	\begin{widemargin}
\begin{centertikz}
  \node [locnode yellow] (skel) {Squelettes} ;

	\begin{scope}[alt=<3-4>{opacity=.3}]
  \node [locnode, above left = 2cm of skel, yshift = 9.5mm] (while) {While} ;
  \node [locnode, below = 5mm of while, dashed] (js) {JavaScript} ;
  \node [locnode, below = 5mm of js, dashed] (wasm) {WebAssembly} ;

	\onslide<2->{
		\node [locnode plum, below = 5mm of wasm, dashed] (lustre) {Lustre} ;
		\node [locnode plum, below = 5mm of lustre, dashed] (realsystems) {\parbox{4em}{\centering{}Systèmes réels}} ;
		\node [locnode plum, below = 5mm of realsystems, dashed] {R} ;
	}

	\draw [draw = DarkPlum, thick, decorate, decoration = brace] ($(skel) + (-1.5, 3.2)$) -- ($(skel) + (-1.5, -3.2)$) ;

  \node [locnode, above right = 2cm of skel] (concr) {\parbox{6em}{\centering interprétation concrète}} ;
	\end{scope}

	\begin{scope}[alt=<4>{opacity=.3}]
  \node [locnode, below = 5mm of concr] (abs) {\parbox{6em}{\centering interprétation abstraite}} ;
	\end{scope}

	\begin{scope}[alt=<3-4>{opacity=.3}]
	\node [locnode, right = 7mm of concr] (ocaml) {OCaml, Coq} ;
	\node [locnode, right = 7mm of abs] (cfa) {\(k\)-CFA} ;
	\end{scope}

	\begin{scope}[alt=<4>{opacity=.3}]
	\onslide<2->{
  \node [locnode plum, below = 5mm of abs, dashed] (cost) {\parbox{6em}{\centering analyses\\de coûts}} ;
	}
	\end{scope}

	\begin{scope}[alt=<3>{opacity=.3}]
  \node [locnode, below = 5mm of cost, dashed] (comp) {\parbox{6em}{\centering compilation}} ;
	\onslide<2->{
  \node [locnode plum, right = 7mm of comp, dashed] (compmulti) {\parbox{6em}{\centering compilation multi-critères}} ;
	}
	\end{scope}

	\begin{scope}[alt=<3-4>{opacity=.3}]
	\draw [->, thick, DarkPlum] (skel.north east) -- (concr.south west) ;
  \draw [->, thick, DarkPlum] (skel) -- (abs) ;
	\draw [<->, double, thick, DarkPlum] (concr) -- (abs) ;
	\draw [<->, double, thick, DarkPlum, dashed] (abs) -- (cfa) ;
	\draw<2-> [<->, double, thick, DarkPlum, dashed] (concr) -- (ocaml) ;
	\draw<2-> [<->, double, thick, DarkPlum, dashed] (cost) to [out = 0, in = 90] (compmulti) ;
	\end{scope}

	\begin{scope}[alt=<4>{opacity=.3}]
  \draw<2-> [->, thick, DarkPlum, dashed] (skel) -- (cost) ;
	\draw<2-> [<->, double, thick, DarkPlum, dashed] (abs) -- (cost) ;
	\end{scope}

	\begin{scope}[alt=<3>{opacity=.3}]
  \draw [->, thick, DarkPlum, dashed] (skel.south east) -- (comp.north west) ;
	\draw<2-> [<->, double, thick, DarkPlum, dashed] (comp) -- (compmulti) ;
	\end{scope}

	\onslide<3>{
		\node[locnode plum, thick, bottom color = white, top color = white, left = 5mm of cost, yshift = -1cm] {
			\parbox{57mm}{
				\begin{itemize}
					\item Coûts temps/énergie,
					% \item Plusieurs manières de définir une interprétation de coûts,
					\item Composition d’interprétations.
				\end{itemize}
				}
			} ;
		}

\end{centertikz}
	\end{widemargin}

	\begin{tikzpicture}[overlay]
	\begin{scope}[xshift = 83.5mm, yshift = 76mm]
		\draw [->, thick, DarkPlum] (0, 0) -- ++ (1, 0) node [right, Aluminium6] {Interprétation} ;
		\draw [<->, thick, double, DarkPlum] (0, -.5) -- ++ (1, 0) node [right, Aluminium6] {Cohérence} ;
		\draw [Aluminium6, thick] (-.1, -.8) rectangle (3.4, .3) ;
	\end{scope}
	\end{tikzpicture}
}

\sectionframe**{Compilation multi-critères\\avec les squelettes}{
	\vfill

	\begin{centertikz}
		\node [locnode yellow] (start) {Squelette} ;
		\node [above right = 1cm of start] (term) {Programme} ;
		\node [right = 25mm of start, locnode yellow] (specialised) {\parbox{15mm}{\centering{}Squelette\\spécialisé}} ;
		\node [right = 25mm of specialised, locnode] (GIL) {\parbox{4em}{\centering{}Langage\\cible}} ;

		\draw [->, thick, DarkSkyBlue] (start) -- node [below, DarkSkyBlue] {Spécialisation} (specialised) ;
		\draw [->, thick, DarkSkyBlue] (term) to [out = -90, in = 180] (specialised) ;

		\onslide<1-2>{
		\draw [->, thick, DarkSkyBlue] (specialised) -- node [below, DarkSkyBlue] {Compilation} (GIL) ;
		}
		\onslide<3->{
			\draw [->, thick, DarkSkyBlue] (specialised) -- node [above, DarkSkyBlue] {\parbox{6em}{\centering{}Compilation\\multi-critères}} (GIL) ;
		}

		\onslide<2->{
			\node [locnode, below of = start, node distance = 3cm] (cost) {Coûts} ;
			\node [locnode, below of = specialised, node distance = 3cm] (cost2) {Coûts} ;
			\node [locnode, below of = GIL, node distance = 3cm] (cost3) {Coûts réels} ;

			\draw [->, thick, DarkPlum] (start) -- (cost) ;
			\draw [->, thick, DarkPlum] (specialised) -- (cost2) ;
			\draw [<->, thick, double, dashed, DarkPlum] (cost) -- node [below] {?} (cost2) ;
			\draw [->, thick, DarkPlum] (GIL) -- (cost3) ;
			\draw [<->, thick, double, dashed, DarkPlum] (cost2) -- node [below] {?} (cost3) ;
		}

		\onslide<3->{
			\draw [->, thick, DarkSkyBlue] (cost2.40) to [bend left = 40] node [right, pos = .3] {\parbox{3cm}{\centering{}Composition d’interprétations}} (GIL.west) ;
			}
	\end{centertikz}
	}

\begin{frame}
    \frametitle{Conclusion}

		\vfill
		\vfill

\begin{widemargin}
\begin{centertikz}
  \node [locnode yellow] (skel) {Squelettes} ;

  \node [locnode, above left = 2cm of skel, yshift = 9.5mm] (while) {While} ;
  \node [locnode, below = 5mm of while, dashed] (js) {JavaScript} ;
  \node [locnode, below = 5mm of js, dashed] (wasm) {WebAssembly} ;

	\node [locnode plum, below = 5mm of wasm, dashed] (lustre) {Lustre} ;
	\node [locnode plum, below = 5mm of lustre, dashed] (realsystems) {\parbox{4em}{\centering{}Systèmes réels}} ;
	\node [locnode plum, below = 5mm of realsystems, dashed] {R} ;

	\draw [draw = DarkPlum, thick, decorate, decoration = brace] ($(skel) + (-1.5, 3.2)$) -- ($(skel) + (-1.5, -3.2)$) ;

  \node [locnode, above right = 2cm of skel] (concr) {\parbox{6em}{\centering interprétation concrète}} ;
	\node [locnode, right = 7mm of concr] (ocaml) {OCaml, Coq} ;
  \node [locnode, below = 5mm of concr] (abs) {\parbox{6em}{\centering interprétation abstraite}} ;
	\node [locnode, right = 7mm of abs] (cfa) {\(k\)-CFA} ;
  \node [locnode plum, below = 5mm of abs, dashed] (cost) {\parbox{6em}{\centering analyses\\de coûts}} ;
  \node [locnode, below = 5mm of cost, dashed] (comp) {\parbox{6em}{\centering compilation}} ;
  \node [locnode plum, right = 7mm of comp, dashed] (compmulti) {\parbox{6em}{\centering compilation multi-critères}} ;

	\draw [->, thick, DarkPlum] (skel.north east) -- (concr.south west) ;
  \draw [->, thick, DarkPlum] (skel) -- (abs) ;
  \draw [->, thick, DarkPlum, dashed] (skel.south east) -- (comp.north west) ;
	\draw [<->, double, thick, DarkPlum] (concr) -- (abs) ;
	\draw [<->, double, thick, DarkPlum, dashed] (abs) -- (cfa) ;
	\draw [<->, double, thick, DarkPlum, dashed] (concr) -- (ocaml) ;
  \draw [->, thick, DarkPlum, dashed] (skel) -- (cost) ;
	\draw [<->, double, thick, DarkPlum, dashed] (abs) -- (cost) ;
	\draw [<->, double, thick, DarkPlum, dashed] (comp) -- (compmulti) ;
	\draw [<->, double, thick, DarkPlum, dashed] (cost) to [out = 0, in = 90] (compmulti) ;

\end{centertikz}
	\end{widemargin}

	\begin{tikzpicture}[overlay]
	\begin{scope}[xshift = 83.5mm, yshift = 77.5mm]
		\draw [->, thick, DarkPlum] (0, 0) -- ++ (1, 0) node [right, Aluminium6] {Interprétation} ;
		\draw [<->, thick, double, DarkPlum] (0, -.5) -- ++ (1, 0) node [right, Aluminium6] {Cohérence} ;
		\draw [Aluminium6, thick] (-.1, -.8) rectangle (3.4, .3) ;
	\end{scope}
	\end{tikzpicture}
\end{frame}

\renewcommand\applyToFrameNumbers[1]{}
\frame{\tableofcontents}
\sectionframe*{Bonus}

\newcommand\questiontoc{
    %\begin{multicols}{2}
    \begin{enumerate}
				\item \hyperlink{frame:Rintro}{Introduction à R},
				\item \hyperlink{frame:Rlazy}{R: Un langage de programmation paresseux},
				\item \hyperlink{frame:CoqR}{CoqR},
				\item \hyperlink{frame:line:by:line}{Correspondance ligne à ligne},
				\item \hyperlink{frame:jscert:one:plus:one}{Preuve dans JSCert},
				\item \hyperlink{frame:skeldef}{Définition formelle des squelettes},
				\item \hyperlink{frame:concrete:interpretation}{Interprétation concrète},
				\item \hyperlink{frame:abstract:interpretation}{Interprétation abstraite},
				\item \hyperlink{frame:cost:interpretation}{Interprétation de coûts},
				\item \hyperlink{frame:consistencies}{Cohérences d’interprétations},
				\item \hyperlink{frame:compose:interpretations}{Composer des interprétations},
				\item \hyperlink{frame:parallel}{Parallélisme et squelettes}.
    \end{enumerate}
    %\end{multicols}
}

\frame{\questiontoc}

\begin{frame}[fragile]
	\label{frame:Rintro}
  \frametitle{R: Un langage de vecteurs}

\begin{Rcode}
v <- c(10, 12, 14, 11, 13)
v[1]                         # Retourne 10@\pause@
indices <- c(3, 5, 1)
v[indices]                   # Retourne c(14, 13, 10)@\pause@
v[-2]                        # Retourne c(10, 14, 11, 13)@\pause@
v[-indices]                  # Retourne c(12, 11)@\pause@
v[c(FALSE, TRUE, FALSE)]     # Retourne c(12, 13)@\pause@
v[v > 11]                    # Retourne c(12, 14, 13)
\end{Rcode}

\end{frame}

\begin{frame}[fragile]
    \label{frame:Rlazy}
		\frametitle{R: Un langage de programmation paresseux}

\begin{Rcode}
f <- function (x, y = x) {
    x <- 1
    y
    x <- 2
    y
}
f (3)                               @\pause@# Retourne 1
\end{Rcode}

\begin{overlayarea}{\textwidth}{3cm}
\begin{onlyenv}<3->
\begin{Rcode}
f <- function (x, y) if (x == 1) y
f (1, a <- 1)
a                                   # Retourne 1
f (0, b <- 1)
b                                   # Erreur
\end{Rcode}
\end{onlyenv}
\end{overlayarea}

\end{frame}

\begin{frame}
	\label{frame:CoqR}
  \frametitle{CoqR~: faire confiance à R}

~\vspace{-7mm}

\begin{centertikz}[node distance = 1.5cm]

    \node (realworldleft) {};
    \node [right of = realworldleft, node distance = 11.5cm] (realworldright) {} ;

    \node [right of = realworldleft, node distance = 1.5cm] (semlim) {} ;
    \node [left of = realworldright, node distance = 4cm] (testlim) {} ;

    \draw [dashed] (realworldleft) to node [above, pos = 0.9] {Coq definitions} node [below, pos = 0.9] {Industrial world} (realworldright) ;

    \node [above of = testlim, locnode brown] (coqr) {CoqR} ;

    \node [locnode blue, below of = jsref, node distance = 45mm] (tests) {\includegraphics[width = 3cm]{images/unknown.png}} ;
    \node [below = 0pt of tests] {Test suites} ;

    \draw [<->, thick, Plum] (tests) --
        node [sloped, above, fill = white] {Running tests}
        (coqr) ;

    \node [locnode brown, below of = semlim, node distance = 27mm, xshift = 5mm] (gnuR) {GNU~R} ;
    \node [below = 0pt of gnuR] {Reference interpreter} ;

    \draw [<->, thick, Plum] (gnuR) --
        node [sloped, above, fill = white] {Line-by-line}
        node [sloped, below, fill = white] {correspondence} (coqr) ;

\end{centertikz}

  \centering\url{https://github.com/Mbodin/CoqR}

\end{frame}

\begin{frame}[fragile]
	\label{frame:line:by:line}
    \frametitle{Correspondance ligne à ligne}

    \begin{widemargin}\centering{}
\begin{minipage}{.53\textwidth}
  \centering{}GNU~R

\begin{ccode}[fontsize=\tiny]
SEXP do_attr@\anchorm{nameA}{}@
    (SEXP call, SEXP op, SEXP args, SEXP env){@\anchorm{argsA}{}@
  SEXP argList, car, ans;
  int nargs = R_length (args);@\anchorm{RlengthA}{}@
  argList =@\anchorm{argListA}{}@
    matchArgs (do_attr_formals, args, call);@\anchorm{matchArgsA}{}@
  PROTECT (argList);
  if (nargs < 2 || nargs > 3)@\anchorm{ifA}{}@
    error ("Wrong argument count.");@\anchorm{errorA}{}@
  car = CAR (argList);@\anchorm{carA}{}@
  /* ... */
  return ans;@\anchorm{ansA}{}@
}
\end{ccode}
\end{minipage}
\qquad
\begin{minipage}{.5\textwidth}
  \centering{}CoqR

\begin{coqcode}[fontsize=\tiny]
@\anchorm{nameB}{}@Definition do_attr globals runs
   @\anchorm{argsB}{}@(call op args env : SEXP) : result SEXP :=
  let%success nargs :=
    @\anchorm{RlengthB}{}@R_length globals runs args in
  @\anchorm{argListB}{}@let%success argList :=
    @\anchorm{matchArgsB}{}@matchArgs globals runs
      do_attr_formals args call in
  @\anchorm{ifB}{}@if nargs <? 2 || nargs >? 3 then
    @\anchorm{errorB}{}@result_error "Wrong argument count."
  else
    @\anchorm{carB}{}@read%list car, _, _ := argList in
    (* ... *)
    @\anchorm{ansB}{}@result_success ans.
\end{coqcode}
\end{minipage}
    \end{widemargin}

    \begin{tikzpicture}[overlay, remember picture]
        \def\localxshift{2.5mm} % WTF Tikz…
        \def\localyshift{3.5mm}%{18mm}
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]nameA.east) -- ([xshift = \localxshift, yshift = \localyshift]nameB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]argsA.east) -- ([xshift = \localxshift, yshift = \localyshift]argsB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]RlengthA.east) -- ([xshift = \localxshift, yshift = \localyshift]RlengthB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]argListA.east) -- ([xshift = \localxshift, yshift = \localyshift]argListB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]matchArgsA.east) -- ([xshift = \localxshift, yshift = \localyshift]matchArgsB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]ifA.east) -- ([xshift = \localxshift, yshift = \localyshift]ifB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]errorA.east) -- ([xshift = \localxshift, yshift = \localyshift]errorB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]carA.east) -- ([xshift = \localxshift, yshift = \localyshift]carB.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]ansA.east) -- ([xshift = \localxshift, yshift = \localyshift]ansB.west) ;
    \end{tikzpicture}

    \onslide<3->{
    \begin{widemargin}\centering{}
\begin{minipage}{.53\textwidth}
  \centering{}ECMAScript

  \vspace{-2mm}
  \tiny
    \begin{block}{“\jsinline|s1 ; s2|” is evaluated as follows.}
\begin{enumerate}
  \item Let~\(o_1\) be the result of evaluating~\jsinline|s1|.\anchor{step1ecma}{}
  \item If~\(o_1\) is an exception, return~\(o_1\).\anchor{step2ecma}{}
  \item Let~\(o_2\) be the result of evaluating~\jsinline|s2|.\anchor{step3ecma}{}
        \item If an exception~\(\mathit{V}\) was thrown, return \(\mpar{\mathtt{throw}, \mathit{V}, \mathit{empty}}\). % where \(\mathit{V}\)~is the exception.
            % (Execution now proceeds as if no exception were thrown.)
        \item If~\(\mathit{o_2}.\mathit{value}\) is empty, let~\(\mathit{V} = \mathit{o_1}.\mathit{value}\),
            otherwise let~\(\mathit{V} = \mathit{o_2}.\mathit{value}\).
        \item Return \(\mpar{\mathit{o_2}.\mathit{type}, \mathit{V}, \mathit{o_2}.\mathit{target}}\).
\end{enumerate}
    \end{block}
\end{minipage}
\qquad
\begin{minipage}{.5\textwidth}
  \centering{}JSCert

  \vspace{2mm}
  \anchorm{seq1rule}{
  \scalebox{0.5}{
\begin{mathpar}
    \inferrule[seq-1\(\fund{s_1}{s_2}\)]
    { S, C, s_1 \evalr o_1 \\ o_1, \seqx{s_2} \evalr o }
    { S, C, \seq{s_1}{s_2} \evalr o }
\end{mathpar}
  }
}
  \anchorm{seq2rule}{
  \scalebox{0.5}{
\begin{mathpar}
    \inferrule[seq-2\(\funu{s_2}\)]
    { }
    { o_1, \seqx{s_2} \evalr o_1 }
    \quad { \abort{o_1} }
\end{mathpar}
  }
}
  \anchorm{seq3rule}{
  \scalebox{0.5}{
\begin{mathpar}
    \inferrule[seq-3\(\funu{s_2}\)]
    { o_1, s_2 \evalr o_2 \\ o_1, o_2, \seqxx{} \evalr o }
    { o_1, \seqx{s_2} \evalr o }
    \quad { \neg\abort{o_1} }
\end{mathpar}
  }
}
\end{minipage}
    \end{widemargin}

    \begin{tikzpicture}[overlay, remember picture]
        \def\localxshift{0mm} % WTF Tikz…
        \def\localyshift{0mm}%{18mm}
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]step1ecma.east) -- ([xshift = \localxshift, yshift = \localyshift]seq1rule.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]step2ecma.east) -- ([xshift = \localxshift, yshift = \localyshift]seq2rule.west) ;
        \draw<2-> [DarkChocolate, thick, <->] ([xshift = \localxshift, yshift = \localyshift]step3ecma.east) -- ([xshift = \localxshift, yshift = \localyshift]seq3rule.west) ;
    \end{tikzpicture}
}

\end{frame}

\begin{frame}[fragile]
	\label{frame:jscert:one:plus:one}
    \frametitle{Preuve dans JSCert{}}

\begin{coqcode}[fontsize = \tiny]
Lemma one_plus_one_exec : forall S C,
  red_expr S C (expr_binary_op one binary_op_add one) (out_ter S (prim_number two)).
Proof.
  intros.
  eapply red_expr_binary_op.
   constructor.
   eapply red_spec_expr_get_value.
    eapply red_expr_literal. reflexivity.
   eapply red_spec_expr_get_value_1.
   eapply red_spec_ref_get_value_value.
  eapply red_expr_binary_op_1.
   eapply red_spec_expr_get_value.
    eapply red_expr_literal. reflexivity.
   eapply red_spec_expr_get_value_1.
   eapply red_spec_ref_get_value_value.
  eapply red_expr_binary_op_2.
  eapply red_expr_binary_op_add.
   eapply red_spec_convert_twice.
    eapply red_spec_to_primitive_pref_prim.
   eapply red_spec_convert_twice_1.
    eapply red_spec_to_primitive_pref_prim.
   eapply red_spec_convert_twice_2.
  eapply red_expr_binary_op_add_1_number.
   simpl. intros [A|A]; inversion A.
   eapply red_spec_convert_twice.
    eapply red_spec_to_number_prim. reflexivity.
   eapply red_spec_convert_twice_1.
    eapply red_spec_to_number_prim. reflexivity.
   eapply red_spec_convert_twice_2.
  eapply red_expr_puremath_op_1. reflexivity.
Qed.
\end{coqcode}

\end{frame}

\begin{frame}
	\label{frame:skeldef}
  \frametitle{Les squelettes, formellement}

  \begin{widemargin}
\begin{align*}
\textsc{Terms} \quad t & \Coloneqq b \mid \tvar \mid c\myvecp{\term}{n} \\[1em]
\textsc{Skeleton} \quad  & \Coloneqq \Rule{Name}{c\myvecp{\tvar}{n}}{\skel} \\[1em]
\textsc{Skeleton Body} \quad \skel & \Coloneqq
      \letinS{x}{\skel} \skel'
      \mid \filterb{F}{\myvec{\svar{x}}{n}}
      \mid \derivb{x}{t}
      \mid \branches[]{\begin{gathered}
                           \skel[1]\\
                           ..\\
                           \skel[n]
                         \end{gathered}}
\end{align*}
  \end{widemargin}

  \begin{widemargin}
\begin{itemize}
\item Un crochet $\derivb{x}{t}$ est un appel récursif du terme $t$ dans l’état $x$.
\item Les filtres sont à la fois des calculs atomiques et des prédicats.
\end{itemize}
  \end{widemargin}

\end{frame}

\begin{frame}
	\label{frame:concrete:interpretation}
  \frametitle{Interprétation concrète}

  \vspace{-5mm}
  \begin{mathpar}
    E : \mathit{variable} \to \mathit{value}
		\and
		\pinterpbi<3->{\skel}{T}\funu{E} : \powerset{\mathit{output}}
   %\and
   %\onslide<3->{
   %  T : \powerset{\mathit{input} \times \mathit{term} \times \mathit{output}}
   %}
  \end{mathpar}

  \begin{align*}
      \pinterpbi<3->{\letinS{x}{\skel} \skel'}{T}\funu{E}
      & =
				\onslide<2->{\bigcup_{v \in \pinterpbi<3->{\skel}{T}\funu{E}} \pinterpbi<2->{\skel'}{T}\funu{E + x \mapsto v}}
			\\[1mm]
      \pinterpbi<3->{\derivb{x}{t}}{T}\funu{E}
      & = \onslide<3->{\mset{v \st \mpar{E[x], t, v} \in T}}
      \\[1mm]
      \pinterpbi<3->{\filterb{F}{\myvec{\svar{x}}{n}}}{T}\funu{E}
			& = \onslide<2->{\anchorm{Fsymbolinterp}{\pinterp{F}}\funu{E[x_1]..E[x_n]}}
      \\[1mm]
      \pinterpbi<3->{\branches[]{\begin{gathered}
                         \skel[1]\\
                         ..\\
                         \skel[n]
               \end{gathered}}}{T}\funu{E}
			& = \onslide<2->{\bigcup_{0 < i \le n}\pinterpbi<2->{\skel[i]}{T}\funu{E}}
  \end{align*}

 %\onslide<3->{
 %  \begin{block}{}
 %		La sémantique concrète~\({\evalr}\) est le plus petit point fixe de~\(\pinterp{\cdot}\).
 %  \end{block}
 %}

    \onslide<4->{
      \begin{tikzpicture}[overlay, remember picture]
        \node [ellipse, thick, draw = \colorAtome, fit = (Fsymbolinterp)] (Fsymbolinterpe) {} ;
        \node [below right = 5pt of Fsymbolinterpe, \colorAtome, xshift = 2mm, yshift = 3mm] {Dépendent du langage} ;
      \end{tikzpicture}
    }

\end{frame}

\begin{frame}
	\label{frame:abstract:interpretation}
  \frametitle{Interprétation abstraite}

  \vspace{-6mm}
  \begin{mathpar}
    E^\sharp : \mathit{variable} \to \mathit{value}^\sharp
    \and
		\pinterpbi{\skel}{T}\funu{E^\sharp} : \powerset{\mathit{output^\sharp}}
  \end{mathpar}
 %\vspace{-3mm}
 %\begin{mathpar}
 %  T : \powerset{\mathit{input}^\sharp \times \mathit{term} \times \mathit{output}^\sharp}
 %\end{mathpar}
  \vspace{-4mm}
 %\pause

  \begin{align*}
      \pinterp{\letinS{x}{\skel} \skel'}_T\funu{E^\sharp}
      & =
        \bigcup_{v^\sharp \in \pinterp{\skel}_T\funu{E^\sharp}} \pinterp{\skel'}_T\funu{E^\sharp + x \mapsto v^\sharp}
      \\
      \pinterp{\derivb{x}{t}}_T\funu{E^\sharp}
      & = \mset{v^\sharp \st \mpar{E^\sharp[x], t, v^\sharp} \in T}
      \\
      \pinterp{\filterb{F}{\myvec{\svar{x}}{n}}}_T\funu{E^\sharp}
      & = \anchorm{Fsymbolinterpabs}{\pinterp{F}^\sharp}\funu{E^\sharp[x_1]..E^\sharp[x_n]}
      \\
      \pinterp{\branches[]{\begin{gathered}
                         \skel[1]\\
                         ..\\
                         \skel[n]
               \end{gathered}}}_T\funu{E^\sharp}
      & = \anchorm{bigcapabs}{\displaystyle\bigcap_{0 < i \le n}} \pinterp{\skel[i]}_T\funu{E^\sharp}
  \end{align*}

%   \begin{block}{}
%     La sémantique abstraite~\({\evalr^\sharp}\) est le plus\anchor{greatestabs}{grand}point fixe de~\(\pinterp{\cdot}\).
%   \end{block}

      \begin{tikzpicture}[overlay, remember picture]
    \onslide<2->{
        \node [ellipse, thick, draw = \colorAtome, fit = (Fsymbolinterpabs)] (Fsymbolinterpabse) {} ;
				\node [below right = 5pt of Fsymbolinterpabse, \colorAtome, xshift = 2mm, yshift = 3mm] {Dépendent du langage} ;
        }
%   \onslide<1->{
%       \node [ellipse, thick, draw = DarkScarletRed, fit = (bigcapabs)] {} ;
%       % \node [ellipse, thick, draw = DarkScarletRed, fit = (greatestabs)] {} ;
%       }
      \end{tikzpicture}

\end{frame}

\begin{frame}
	\label{frame:cost:interpretation}
  \frametitle{Interprétation de coûts}

  \vspace{-6mm}
  \begin{mathpar}
		\pinterpbi{\skel}{T} : \mathit{cost}
    %\and
		%\onslide<2->{T : \powerset{\mathit{term} \times \mathit{cost}}}
  \end{mathpar}
  \vspace{-6mm}

	\begin{changemargin}{-3cm}{0cm}
  \begin{align*}
      \pinterp{\letinS{x}{\skel} \skel'}_T
      & =
				\onslide<2->{\max_{\substack{c \in \pinterp{\skel}_T \\ c' \in \pinterp{\skel'}_T}} c + c'}
      \\
      \pinterp{\derivb{x}{t}}_T
			& = \onslide<2->{\max \mset{c \st \mpar{t, c} \in T}}
      \\
      \pinterp{\filterb{F}{\myvec{\svar{x}}{n}}}_T
			& = \anchorm{costF}{\pinterp{F}}
      \\
      \pinterp{\branches[]{\begin{gathered}
                         \skel[1]\\
                         ..\\
                         \skel[n]
               \end{gathered}}}_T
			& = \onslide<2->{\max_{0 < i \le n} \pinterp{\skel[i]}_T}
  \end{align*}

      \begin{tikzpicture}[overlay, remember picture]
				\onslide<3->{
        \node [ellipse, thick, draw = DarkPlum, fit = (costF)] (costFe) {} ;
				\node [right = 5pt of costFe, DarkPlum] (costFm) {Dépend des entrées de \(F\)} ;
					\node [below = 0pt of costFm, DarkPlum, yshift = 8pt, xshift = 1cm] {\parbox{6cm}{\flushright\textcolor{DarkPlum}{\(\Rightarrow\) composer avec les interprétations\\concrètes et abstraites}}} ;
				}
			\end{tikzpicture}
	\end{changemargin}

\end{frame}

\begin{frame}
	\label{frame:consistencies}
  \frametitle{Correction de la sémantique abstraite}

  \begin{block}{Théorème\provedincoq{}}
    \vspace{-4mm}
\begin{equation*}
  \forall \mpar{\sigma^\sharp,t,v^\sharp} \in {\evalr^\sharp}.\ 
  \forall \mpar{\sigma,t,v} \in {{\evalr}}.\ 
  \text{ Si } \sigma \in \gamma\funu{\sigma^\sharp} \text{ alors } v \in \gamma\funu{v^\sharp}
\end{equation*}
\end{block}

\begin{block}{Preuve}
	Grâce aux cohérences d’interprétation.
\end{block}

\begin{block}{Cohérence}
\begin{itemize}
\item un prédicat sur les entrées des deux interprétations $\OKst{\mpar{E, T}}{\mpar{E^\sharp, T^\sharp}}$
\item un prédicat sur les sorties des deux interprétations $\OKout{v}{v^\sharp}$
\end{itemize}
\end{block}
\end{frame}

\begin{frame}
  \frametitle{Cohérence}
	Si la cohérence des deux prédicats est préservée par l’action des quatres constructeurs des squelettes,
	alors elle est préservée de manière globale.

\onslide<2->{
\begin{block}{Cohérence entre les interprétations concrète et abstraite}
\begin{align*}
  \OKst{\mpar{E, T}}{\mpar{E^\sharp, T^\sharp}} \Coloneqq
  &~ \dom{E} = \dom{E^\sharp} \\
  & \land \forall x.\ E[x] \in \gamma\funu{E^\sharp[x]} \\
  & \land \forall (v_1, t, v_2) \in T, (v_1^\sharp, t, v_2^\sharp) \in T^\sharp.\ \\
			 &\qquad v_1 \in \gamma\funu{v_1^\sharp} \mathrel{\Rightarrow}
       v_2 \in \gamma\funu{v_2^\sharp}
\end{align*}
\end{block}
}

  \vspace{3mm}
\onslide<3->{
  \begin{block}{Théorème\provedincoq{}}
  Si les atomes sont cohérents, alors la sémantique abstraite est correcte.
\end{block}
}

\end{frame}

\newcommand\domaineinterpretation[2][]{
	\node<1> [locnode, #1] (#2) {\parbox{25mm}{\centering{}Domaine~#2}} ;
		\node<2-> [locnode, #1] (#2) {\parbox{25mm}{\centering{}Interprétation~#2}} ;
	}
\begin{frame}
	\label{frame:compose:interpretations}
	\frametitle{Composer des interprétations}

	Idée de l’interprétation abstraite, qui fonctionne avec les squelettes.
	\begin{widemargin}
	\begin{centertikz}
		\domaineinterpretation{A}
		\domaineinterpretation[right = 15mm of A]{B}
		\domaineinterpretation[right = 15mm of B]{C}

		\draw [->, thick, DarkOrange] (C) to [bend right = 50] node [below, yshift = -5pt] {Messages globaux} (A) ;
		\draw [->, thick, DarkOrange] (C) to [bend right = 50] (B) ;
		\draw [->, thick, DarkPlum] (A) -- node [above] {Message} (B) ;
		\draw [->, thick, DarkPlum] (B) -- node [above] {Message} (C) ;
		\draw [<->, thick, DarkSkyBlue] (B) to [bend right = 50] (C) ;
		\draw [<->, thick, DarkSkyBlue] (A) to [bend right = 50] (B) ;
		\draw [<->, thick, DarkSkyBlue] (A) to [bend right = 50] node [above] {Requêtes} (C) ;
	\end{centertikz}
	\end{widemargin}

	% \begin{center}
	% \includegraphics[width=\textwidth]{images/JHJourdan_domaines.png}
	% \end{center}

	Comment la généraliser à plusieurs interprétations~?

\end{frame}

\newcommand\varnameform[1]{\mbox{\jsinline|"#1"|}}
\begin{frame}[fragile]
	\label{frame:parallel}
	\frametitle{Parallélisme et squelettes}

	\begin{widemargin}
\begin{align*}
	\derivb{\sigma}{(x = 1 ; a = y) \parallel (y = 1 ; b = x)} &\coloneqq \left[
  \begin{aligned}
		&\letinS{t_0}{\filterb{\texttt{makeThread}}{\sigma}} \\
		&\letinS{t_1}{\filterb{\texttt{write}}{t_0, \varnameform{x}, 1}} \\
		&\letinS{t_2}{\filterb{\texttt{write}}{t_1, \varnameform{a}, \varnameform{y}}} \\
		&\letinS{t'_0}{\filterb{\texttt{makeThread}}{\sigma}} \\
		&\letinS{t'_1}{\filterb{\texttt{write}}{t'_0, \varnameform{y}, 1}} \\
		&\letinS{t'_2}{\filterb{\texttt{write}}{t'_1, \varnameform{b}, \varnameform{x}}} \\
		&\filterb{\texttt{parallel}}{t_2, t'_2}
  \end{aligned}
  \right]
\end{align*}
	\end{widemargin}

%   let t0 = make_thread in
%   let t1 = write t0 “x” 1 in
%   let t2 = write t1 “a” “y” in
%   let t0’ = make_thread in
%   let t1’ = write t0 “y” 1 in
%   let t2’ = write t1 “b” “x” in
%   parallel t2 t2’

\end{frame}

\frame{\questiontoc}
\frame{\tableofcontents}

\end{document}

