Slides/Slides3.thy
changeset 286 b49ff5328a66
parent 285 447b433b67fa
child 287 d5a0e25c4742
equal deleted inserted replaced
285:447b433b67fa 286:b49ff5328a66
   118 (*>*)
   118 (*>*)
   119 
   119 
   120 
   120 
   121 
   121 
   122 text_raw {*
   122 text_raw {*
   123   \renewcommand{\slidecaption}{ITP, 24 July 2013}
   123   \renewcommand{\slidecaption}{Imperial College, 24 November 2013}
   124   \newcommand{\bl}[1]{#1}                        
   124   \newcommand{\bl}[1]{#1}                        
   125   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   125   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   126   \mode<presentation>{
   126   \mode<presentation>{
   127   \begin{frame}
   127   \begin{frame}
   128   \frametitle{%
   128   \frametitle{%
   129   \begin{tabular}{@ {}c@ {}}
   129   \begin{tabular}{@ {}c@ {}}
   130   \\[-3mm]
   130   \\[-3mm]
   131   {\fontsize{20}{20}\selectfont{}Mechanising Turing Machines and}\\[-2mm] 
   131   {\fontsize{30}{30}\selectfont{}Turing Machines and}\\[-1mm]  
   132   {\fontsize{20}{20}\selectfont{}Computability Theory in Isabelle}\\[-3mm] 
   132   {\fontsize{30}{30}\selectfont{}Separation Logic}\\[0mm]
       
   133   {\fontsize{22}{22}\selectfont{}(Work in Progress)}\\[-3mm] 
   133   \end{tabular}}
   134   \end{tabular}}
   134   
   135   
   135   \bigskip\medskip\medskip
   136   \bigskip\medskip\medskip
   136  
   137  
   137   \begin{center}
   138   \begin{center}
   157   \mode<presentation>{
   158   \mode<presentation>{
   158   \begin{frame}[c]
   159   \begin{frame}[c]
   159   \frametitle{Why Turing Machines?}%
   160   \frametitle{Why Turing Machines?}%
   160 
   161 
   161   \begin{itemize}
   162   \begin{itemize}
   162   \item At the beginning, it was just a student project
   163   \item we wanted to formalise computability theory
   163   about computability.\smallskip
   164   \item at the beginning, it was just a student project\smallskip
   164 
   165 
   165   \begin{center}
   166   \begin{center}
   166   \begin{tabular}{c}
   167   \begin{tabular}{c}
   167   \includegraphics[scale=0.3]{boolos.jpg}\\[-2mm]
   168   \includegraphics[scale=0.3]{boolos.jpg}\\[-2mm]
   168   \footnotesize Computability and Logic (5th.~ed)\\[-2mm]
   169   \footnotesize Computability and Logic (5th.~ed)\\[-2mm]
   172 
   173 
   173   \item found an inconsistency in the definition of halting computations
   174   \item found an inconsistency in the definition of halting computations
   174   (Chap.~3 vs Chap.~8)
   175   (Chap.~3 vs Chap.~8)
   175   \end{itemize}
   176   \end{itemize}
   176 
   177 
   177   \end{frame}}
   178   \only<2->{
   178   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
   179   \begin{textblock}{1}(0.7,4)
   179 *}
   180   \begin{tikzpicture}
   180 
   181   \draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
   181 text_raw {*
   182   {\normalsize
   182   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   183   \begin{minipage}{11cm}
   183   \mode<presentation>{
   184   \begin{quote}\rm
   184   \begin{frame}[c]
   185   \begin{itemize}
   185   \frametitle{Some Previous Works}%
   186   \item is a fantastic model of low-level code
       
   187   \item completely unstructured\makebox[0mm][10mm]{\mbox{}}\;\; 
       
   188   \only<2>{\textcolor{cream}{\fontspec{Chalkduster}Spaghetti Code}}%
       
   189   \only<3->{\textcolor{red}{\fontspec{Chalkduster}Spaghetti Code}}
       
   190   \bigskip
       
   191   \item good testbed for verification techniques
       
   192   \item Can we verify a program with 38 Mio instructions?
       
   193   \item we can delay implementing a concrete machine model (for OS/low-level code verification)
       
   194   \end{itemize}
       
   195   \end{quote}
       
   196   \end{minipage}};
       
   197   \end{tikzpicture}
       
   198   \end{textblock}}
       
   199 
       
   200   \end{frame}}
       
   201   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
   202 *}
       
   203 
       
   204 text_raw {*
       
   205   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   206   \mode<presentation>{
       
   207   \begin{frame}[c]
       
   208   \frametitle{
       
   209   \begin{tabular}{c}Some Previous Works\\[-5mm]
       
   210   \hspace{3.5cm}\small (but not interested in low-level code)
       
   211   \end{tabular}}%
   186 
   212 
   187   \begin{itemize}
   213   \begin{itemize}
   188   \item Norrish formalised computability theory in HOL starting
   214   \item Norrish formalised computability theory in HOL starting
   189   from the lambda-calculus\smallskip 
   215   from the lambda-calculus\smallskip 
   190   \begin{itemize}
   216   \begin{itemize}
   197   \begin{itemize}
   223   \begin{itemize}
   198   \item \textcolor{gray}{no undecidability result $\Rightarrow$ interest in complexity}
   224   \item \textcolor{gray}{no undecidability result $\Rightarrow$ interest in complexity}
   199   \item \textcolor{gray}{their UTM operates on a different alphabet than the TMs it simulates}
   225   \item \textcolor{gray}{their UTM operates on a different alphabet than the TMs it simulates}
   200   \begin{quote}
   226   \begin{quote}
   201   \textcolor{gray}{"In particular, the fact that the universal machine operates with a different 
   227   \textcolor{gray}{"In particular, the fact that the universal machine operates with a different 
   202   alphabet with respect to the machines it simulates is annoying." [Asperti and Ricciotti]}
   228   alphabet with respect to the machines it simulates is annoying." (Asperti and Ricciotti)}
   203   \end{quote}
   229   \end{quote}
   204   \end{itemize}
   230   \end{itemize}
   205   \end{itemize}
   231   \end{itemize}
   206 
   232 
   207   \end{frame}}
   233   \end{frame}}
   214                      draw=black!50, top color=white, bottom color=black!20]
   240                      draw=black!50, top color=white, bottom color=black!20]
   215   \tikzstyle{node2}=[rectangle, minimum size=12mm, rounded corners=3mm, very thick, 
   241   \tikzstyle{node2}=[rectangle, minimum size=12mm, rounded corners=3mm, very thick, 
   216                      draw=red!70, top color=white, bottom color=red!50!black!20]
   242                      draw=red!70, top color=white, bottom color=red!50!black!20]
   217   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   243   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   218   \mode<presentation>{
   244   \mode<presentation>{
   219   \begin{frame}[c]
   245   \begin{frame}[t]
   220   \frametitle{The Big Picture}%
   246   \frametitle{The Big Picture}%
   221 
   247 
       
   248   \mbox{}\\[19mm]
   222   \begin{center}
   249   \begin{center}
   223   \begin{tikzpicture}
   250   \begin{tikzpicture}
   224   \matrix[ampersand replacement=\&,column sep=13mm, row sep=5mm]
   251   \matrix[ampersand replacement=\&,column sep=13mm, row sep=5mm]
   225   { \node (def1)   [node1] {\large\hspace{1mm}TMs\hspace{1mm}\mbox{}}; \&
   252   { \node (tm)   [node1] {\large\hspace{1mm}TMs\hspace{1mm}\mbox{}}; \&
   226     \node (proof1) [node1] {\begin{tabular}{c}Register\\Machines\end{tabular}}; \&
   253     \node (reg) [node1] {\begin{tabular}{c}Register\\Machines\end{tabular}}; \&
   227     \node (alg1)   [node1] {\begin{tabular}{c}Recursive\\ Functions\end{tabular}}; \\    
   254     \node (rf)   [node1] {\begin{tabular}{c}Recursive\\ Functions\end{tabular}}; \\    
   228   };
   255   };
   229 
   256 
   230   \draw[->,black!50,line width=2mm] (proof1) -- (def1);
   257   \only<2->{\draw[->,black!50,line width=2mm] (reg) -- (tm);}
   231   \draw[<-,black!50,line width=2mm] (proof1) -- (alg1);
   258   \only<2->{\draw[<-,black!50,line width=2mm] (reg) -- (rf);}
   232   
   259 
   233   \end{tikzpicture}
   260   \only<4->{
   234   \end{center}
   261    \draw [<-, black!50,line width=2mm, rounded corners]
       
   262      %  start right of digit.east, that is, at the point that is the
       
   263      %  linear combination of digit.east and the vector (2mm,0pt). We
       
   264      %  use the ($ ... $) notation for computing linear combinations
       
   265      ($ (rf.south) + (0mm,0) $)
       
   266      %  Now go down
       
   267      -- ++(0,-2.5)
       
   268      %  And back to the left of digit.west
       
   269      -| ($ (tm.south) - (0mm,0) $);}
       
   270   
       
   271   \end{tikzpicture}
       
   272   \end{center}
       
   273 
       
   274   \only<1->{
       
   275   \begin{textblock}{3}(1,4.9)
       
   276   \begin{tikzpicture}
       
   277   \draw (0,0) node {\small\begin{tabular}{l}undecidability\\of the halting\\ problem\end{tabular}};
       
   278   \end{tikzpicture}
       
   279   \end{textblock}}
   235 
   280 
   236   \only<2->{
   281   \only<2->{
   237   \begin{textblock}{3}(8.3,4.0)
   282   \begin{textblock}{3}(8.3,8.4)
   238   \begin{tikzpicture}
   283   \begin{tikzpicture}
   239   \node at (0,0) [single arrow, shape border rotate=270, fill=black!50,text=white]{};
   284   \node at (0,0) [single arrow, shape border rotate=90, fill=black!50,text=white]{};
   240   \draw (0,1) node {\begin{tabular}{l}verified\\[-1mm] translator\end{tabular}};
   285   \draw (0,-1) node {\begin{tabular}{l}verified\\[-1mm] translator\end{tabular}};
   241   \end{tikzpicture}
   286   \end{tikzpicture}
   242   \end{textblock}
   287   \end{textblock}
   243 
   288 
   244   \begin{textblock}{3}(3.1,4.0)
   289   \begin{textblock}{3}(3.1,8.4)
   245   \begin{tikzpicture}
   290   \begin{tikzpicture}
   246   \node at (0,0) [single arrow, shape border rotate=270, fill=black!50,text=white]{};
   291   \node at (0,0) [single arrow, shape border rotate=90, fill=black!50,text=white]{};
   247   \draw (0,1) node {\begin{tabular}{l}verified\\[-1mm] translator\end{tabular}};
   292   \draw (0,-1) node {\begin{tabular}{l}verified\\[-1mm] translator\end{tabular}};
   248   \end{tikzpicture}
   293   \end{tikzpicture}
   249   \end{textblock}}
   294   \end{textblock}}
   250 
   295 
   251   \only<3->{
   296   \only<3->{
   252   \begin{textblock}{4}(10.9,9.4)
   297   \begin{textblock}{4}(12.5,5.8)
   253   \begin{tikzpicture}
   298   \begin{tikzpicture}
   254   \draw (0,0) node {\begin{tabular}{l}UF\end{tabular}};
   299   \draw (0,0) node {\begin{tabular}{l}UF\end{tabular}};
   255   \end{tikzpicture}
   300   \end{tikzpicture}
   256   \end{textblock}
       
   257 
       
   258   \begin{textblock}{3}(1,10.0)
       
   259   \begin{tikzpicture}
       
   260   \draw (0,0) node {\small\begin{tabular}{l}undecidability\\of the halting\\ problem\end{tabular}};
       
   261   \end{tikzpicture}
       
   262   \end{textblock}}
   301   \end{textblock}}
   263 
   302 
   264   \only<4->{
   303   \only<4->{
   265   \begin{textblock}{4}(4.2,12.4)
   304   \begin{textblock}{4}(3.3,13.3)
   266   \begin{tikzpicture}
   305   \begin{tikzpicture}
   267   \draw (0,0) node {\begin{tabular}{l}a correct UTM by translation\end{tabular}};
   306   \draw (0,0) node {\begin{tabular}{l}a correct UTM by translation\end{tabular}};
   268   \end{tikzpicture}
   307   \end{tikzpicture}
   269   \end{textblock}}
   308   \end{textblock}}
   270 
   309 
   377   & $\mid$ & @{term "Mn n f"} & \textcolor{black!60}{minimisation}
   416   & $\mid$ & @{term "Mn n f"} & \textcolor{black!60}{minimisation}
   378   \end{tabular}
   417   \end{tabular}
   379   \end{center}\bigskip
   418   \end{center}\bigskip
   380 
   419 
   381   \item @{text "eval :: rec \<Rightarrow> nat list \<Rightarrow> nat"}\\ 
   420   \item @{text "eval :: rec \<Rightarrow> nat list \<Rightarrow> nat"}\\ 
   382   can be defined by simple recursion\\ (HOL has @{term "Least"})
   421   \hspace{3mm}can be defined by recursion (HOL has @{term "Least"})
   383   
   422   
   384   \item \small you define
   423   \item \small you define
   385   \begin{itemize}
   424   \begin{itemize}
   386   \item addition, multiplication, logical operations, quantifiers\ldots
   425   \item addition, multiplication, logical operations, quantifiers\ldots
   387   \item coding of numbers (Cantor encoding), UF
   426   \item coding of numbers (Cantor encoding), UF
   522   \end{frame}}
   561   \end{frame}}
   523   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
   562   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
   524 *}
   563 *}
   525 
   564 
   526 text_raw {*
   565 text_raw {*
       
   566   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   567   \mode<presentation>{
       
   568   \begin{frame}[c]
       
   569   \frametitle{Dither Machine}%
       
   570 
       
   571   \begin{itemize}
       
   572   \item TM that is the identity with @{text "1"} and loops with @{text "0"}
       
   573   \smallskip
       
   574 
       
   575 \begin{center}
       
   576   \begin{tabular}{l@ {\hspace{3mm}}lcl}
       
   577   & \multicolumn{1}{c}{start tape}\\[1mm]
       
   578   \raisebox{2mm}{halting case:} &
       
   579   \begin{tikzpicture}[scale=0.8]
       
   580   \draw[very thick] (-2,0)   -- ( 0.75,0);
       
   581   \draw[very thick] (-2,0.5) -- ( 0.75,0.5);
       
   582   \draw[very thick] (-0.25,0)   -- (-0.25,0.5);
       
   583   \draw[very thick] ( 0.25,0)   -- ( 0.25,0.5);
       
   584   \draw[very thick] (-0.75,0)   -- (-0.75,0.5);
       
   585   \draw[very thick] ( 0.75,0)   -- ( 0.75,0.5);
       
   586   \draw[very thick] (-1.25,0)   -- (-1.25,0.5);
       
   587   \draw[rounded corners=1mm] (-0.35,-0.1) rectangle (0.35,0.6);
       
   588   \draw[fill]     (-0.15,0.1) rectangle (0.15,0.4);
       
   589   \draw[fill]     ( 0.35,0.1) rectangle (0.65,0.4);
       
   590   \node [anchor=base] at (-1.7,0.2) {\ldots};
       
   591   \end{tikzpicture} 
       
   592   & \raisebox{2mm}{$\;\;\large\Rightarrow\;\;$} &
       
   593   \begin{tikzpicture}[scale=0.8]
       
   594   \draw[very thick] (-2,0)   -- ( 0.75,0);
       
   595   \draw[very thick] (-2,0.5) -- ( 0.75,0.5);
       
   596   \draw[very thick] (-0.25,0)   -- (-0.25,0.5);
       
   597   \draw[very thick] ( 0.25,0)   -- ( 0.25,0.5);
       
   598   \draw[very thick] (-0.75,0)   -- (-0.75,0.5);
       
   599   \draw[very thick] ( 0.75,0)   -- ( 0.75,0.5);
       
   600   \draw[very thick] (-1.25,0)   -- (-1.25,0.5);
       
   601   \draw[rounded corners=1mm] (-0.35,-0.1) rectangle (0.35,0.6);
       
   602   \draw[fill]     (-0.15,0.1) rectangle (0.15,0.4);
       
   603   \draw[fill]     ( 0.35,0.1) rectangle (0.65,0.4);
       
   604   \node [anchor=base] at (-1.7,0.2) {\ldots};
       
   605   \end{tikzpicture}\\
       
   606 
       
   607   \raisebox{2mm}{non-halting case:} &
       
   608   \begin{tikzpicture}[scale=0.8]
       
   609   \draw[very thick] (-2,0)   -- ( 0.25,0);
       
   610   \draw[very thick] (-2,0.5) -- ( 0.25,0.5);
       
   611   \draw[very thick] (-0.25,0)   -- (-0.25,0.5);
       
   612   \draw[very thick] ( 0.25,0)   -- ( 0.25,0.5);
       
   613   \draw[very thick] (-0.75,0)   -- (-0.75,0.5);
       
   614   \draw[very thick] (-1.25,0)   -- (-1.25,0.5);
       
   615   \draw[rounded corners=1mm] (-0.35,-0.1) rectangle (0.35,0.6);
       
   616   \draw[fill]     (-0.15,0.1) rectangle (0.15,0.4);
       
   617   \node [anchor=base] at (-1.7,0.2) {\ldots};
       
   618   \end{tikzpicture} 
       
   619   & \raisebox{2mm}{$\;\;\large\Rightarrow\;\;$} &
       
   620   \raisebox{2mm}{loops}
       
   621   \end{tabular}
       
   622   \end{center}\bigskip
       
   623 
       
   624   \small
       
   625   \begin{center}
       
   626   \begin{tabular}[t]{@ {}l@ {}}
       
   627   @{text dither} @{text "\<equiv>"} @{text "["}@{text "(W\<^bsub>0\<^esub>, 1), (R, 2), (L, 1), (L, 0)"}@{text "]"}
       
   628   \end{tabular}
       
   629   \end{center}
       
   630 
       
   631 
       
   632   \end{itemize}
       
   633 
       
   634 
       
   635   \end{frame}}
       
   636   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
   637 *}
       
   638 
       
   639 text_raw {*
   527   \definecolor{mygrey}{rgb}{.80,.80,.80}
   640   \definecolor{mygrey}{rgb}{.80,.80,.80}
   528   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   641   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   529   \mode<presentation>{
   642   \mode<presentation>{
   530   \begin{frame}[c]
   643   \begin{frame}[c]
   531   \frametitle{Hoare Logic for TMs}%
   644   \frametitle{Hoare Logic for TMs}%
   607   @{thm tcontra_def}
   720   @{thm tcontra_def}
   608   \end{textblock}
   721   \end{textblock}
   609   
   722   
   610   \only<2>{
   723   \only<2>{
   611   \begin{itemize}
   724   \begin{itemize}
   612   \item Suppose @{text H} decides @{text contra} called with the code 
   725   \item Suppose @{text H} decides whether @{text contra} called with the code 
   613   of @{text contra} halts, then\smallskip
   726   of @{text contra} halts, then\smallskip
   614 
   727 
   615   \begin{center}\small
   728   \begin{center}\small
   616   \begin{tabular}{@ {}l@ {}}
   729   \begin{tabular}{@ {}l@ {}}
   617   \begin{tabular}[t]{@ {\hspace{-5mm}}l@ {}}
   730   \begin{tabular}[t]{@ {\hspace{-5mm}}l@ {}}
   632   \end{tabular}
   745   \end{tabular}
   633   \end{center}
   746   \end{center}
   634   \end{itemize}}
   747   \end{itemize}}
   635   \only<3>{
   748   \only<3>{
   636   \begin{itemize}
   749   \begin{itemize}
   637   \item Suppose @{text H} decides @{text contra} called with the code 
   750   \item Suppose @{text H} decides wether @{text contra} called with the code 
   638   of @{text contra} does \emph{not} halt, then\\[-8mm]\mbox{}
   751   of @{text contra} does \alert{not} halt, then\\[-8mm]\mbox{}
   639 
   752 
   640   \begin{center}\small
   753   \begin{center}\small
   641   \begin{tabular}{@ {}l@ {}}
   754   \begin{tabular}{@ {}l@ {}}
   642   \begin{tabular}[t]{@ {\hspace{-1mm}}l@ {}}
   755   \begin{tabular}[t]{@ {\hspace{-1mm}}l@ {}}
   643   @{term "Q\<^sub>1 \<equiv> \<lambda>tp. tp = ([]::cell list, <code_tcontra>)"}\\
   756   @{term "Q\<^sub>1 \<equiv> \<lambda>tp. tp = ([]::cell list, <code_tcontra>)"}\\
   721   & sizes:\smallskip\\
   834   & sizes:\smallskip\\
   722   UF       & @{text 140843} constructors\\
   835   UF       & @{text 140843} constructors\\
   723   URM      & @{text 2} Mio instructions\\
   836   URM      & @{text 2} Mio instructions\\
   724   UTM      & @{text 38} Mio states\\
   837   UTM      & @{text 38} Mio states\\
   725   \end{tabular}
   838   \end{tabular}
   726   \end{center}\smallskip\pause
   839   \end{center}\smallskip
   727 
   840 
   728   \item an observation: our treatment of recursive functions is a mini-version
       
   729   of the work by\\ Myreen \& Owens about deeply embedding HOL
       
   730   \end{itemize}
   841   \end{itemize}
   731  
   842  
   732   \only<1>{
   843   \only<1>{
   733   \begin{textblock}{4}(2,13.9)
   844   \begin{textblock}{4}(2,13.9)
   734   \begin{tikzpicture}
   845   \begin{tikzpicture}
   743 
   854 
   744 text_raw {*
   855 text_raw {*
   745   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   856   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   746   \mode<presentation>{
   857   \mode<presentation>{
   747   \begin{frame}[c]
   858   \begin{frame}[c]
       
   859   \frametitle{{\fontsize{20}{20}\selectfont{}The Trouble With Hoare-Triples}}%
       
   860 
       
   861   \begin{itemize}
       
   862   \item Whenever we wanted to prove 
       
   863 
       
   864   \begin{center}
       
   865   \large @{text "{P} p {Q}"}
       
   866   \end{center}\bigskip\medskip
       
   867  
       
   868   \item[@{text "(1)"}] we had to find invariants for each state\\ \textcolor{gray}{(not easy)}
       
   869 
       
   870   
       
   871   
       
   872   \item[@{text "(2)"}] we had to find a termination order proving that @{text p} terminates
       
   873   \textcolor{gray}{(not easy either)}
       
   874   \end{itemize}\pause
       
   875   
       
   876   \begin{center}
       
   877   \alert{very little opportunity for automation}
       
   878   \end{center}
       
   879 
       
   880   \end{frame}}
       
   881   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
   882 *} 
       
   883 
       
   884 text_raw {*
       
   885   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   886   \mode<presentation>{
       
   887   \begin{frame}[c]
   748   \frametitle{\begin{tabular}{@ {}c@ {}}\Large Inspiration from other Works\end{tabular}}%
   888   \frametitle{\begin{tabular}{@ {}c@ {}}\Large Inspiration from other Works\end{tabular}}%
   749 
   889 
   750   \onslide<3->{
   890   \onslide<3->{
   751   \begin{itemize}
   891   \begin{itemize}
   752   \item Jensen, Benton, Kennedy ({\bf 2013}),
   892   \item Jensen, Benton, Kennedy ({\bf 2013}),
   775   \begin{frame}[c]
   915   \begin{frame}[c]
   776   \frametitle{Better Composability}%
   916   \frametitle{Better Composability}%
   777 
   917 
   778   \begin{itemize}
   918   \begin{itemize}
   779   \item an idea from Jensen, Benton \& Kennedy who looked at X86 
   919   \item an idea from Jensen, Benton \& Kennedy who looked at X86 
   780   assembly programs and macros\bigskip
   920   assembler programs and macros\bigskip
   781   
   921   
   782   \item assembly for TMs:\medskip
   922   \item assembler for TMs:\medskip
   783   \begin{center}
   923   \begin{center}
   784   \begin{tabular}{l}
   924   \begin{tabular}{l}
   785   @{text "move_one_left"} @{text "\<equiv>"}\\ 
   925   @{text "move_one_left"} @{text "\<equiv>"}\\ 
   786   \hspace{13mm} @{text "\<Lambda> exit."}\\
   926   \hspace{13mm} @{text "\<Lambda> exit."}\\
   787   \hspace{16mm} @{text "Inst (L, exit) (L, exit)"} @{text ";"}\\
   927   \hspace{16mm} @{text "Inst (L, exit) (L, exit)"} @{text ";"}\\
   827 *}
   967 *}
   828 
   968 
   829 text_raw {*
   969 text_raw {*
   830   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   970   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   831   \mode<presentation>{
   971   \mode<presentation>{
   832   \begin{frame}[c]
   972   \begin{frame}[t]
   833   \frametitle{{\large The Trouble With Hoare-Triples}}%
   973   \frametitle{An RM-API with TMs}%
   834 
   974 
   835   \begin{itemize}
   975   \begin{center}
   836   \item Whenever we wanted to prove 
   976   \begin{tikzpicture}
   837 
   977   \matrix[ampersand replacement=\&,column sep=13mm, row sep=5mm]
   838   \begin{center}
   978   { \node (tm)   [node1, minimum size=44mm] {\mbox{}}; \&
   839   \large @{text "{P} p {Q}"}
   979     \node (rf)   [node1] {\begin{tabular}{c}Recursive\\ Functions\end{tabular}}; \\    
   840   \end{center}\bigskip\medskip
   980   };
   841  
   981 
   842   \item[@{text "(1)"}] we had to find invariants for each state\\ \textcolor{gray}{(not easy)}
   982   \draw[->,black!50,line width=2mm] (rf) -- (tm);
   843 
   983   
   844   
   984   \node [above, rotate=90] at (tm.east) {\textcolor{gray}{Reg.Mach. API}};
   845   
   985   \node [below right] at (tm.north west) {\textcolor{gray}{Macros}};
   846   \item[@{text "(2)"}] we had to find a termination order proving that @{text p} terminates
   986   \node [node1] at (tm) {\large\hspace{1mm}TMs\hspace{1mm}\mbox{}}; 
   847   \textcolor{gray}{(not easy either)}
   987   
   848   \end{itemize}\pause
   988 
   849   
   989   \end{tikzpicture}
   850   \begin{center}
   990   \end{center}
   851   \alert{very little opportunity for automation}
   991 
       
   992   \begin{itemize}
       
   993   \item Suppose the first four registers of an RM contain 1,2,0 and 3, then the encoding is
       
   994 
       
   995   \begin{center}
       
   996   \begin{tikzpicture}[scale=1]
       
   997 
       
   998   \draw[very thick] (-0.25,0)   -- ( 8.25,0);
       
   999   \draw[very thick] (-0.25,0.5) -- ( 8.25,0.5);
       
  1000 
       
  1001   \draw[very thick] (-0.25,0)   -- (-0.25,0.5);
       
  1002   \draw[very thick] ( 0.25,0)   -- ( 0.25,0.5);
       
  1003   \draw[very thick] ( 0.75,0)   -- ( 0.75,0.5);
       
  1004   \draw[very thick] ( 1.25,0)   -- ( 1.25,0.5);
       
  1005   \draw[very thick] ( 1.75,0)   -- ( 1.75,0.5);  
       
  1006   \draw[very thick] ( 2.25,0)   -- ( 2.25,0.5); 
       
  1007   \draw[very thick] ( 2.75,0)   -- ( 2.75,0.5);  
       
  1008   \draw[very thick] ( 3.25,0)   -- ( 3.25,0.5); 
       
  1009   \draw[very thick] ( 3.75,0)   -- ( 3.75,0.5); 
       
  1010   \draw[very thick] ( 4.25,0)   -- ( 4.25,0.5); 
       
  1011   \draw[very thick] ( 4.75,0)   -- ( 4.75,0.5); 
       
  1012   \draw[very thick] ( 5.25,0)   -- ( 5.25,0.5); 
       
  1013   \draw[very thick] ( 5.75,0)   -- ( 5.75,0.5); 
       
  1014   \draw[very thick] ( 6.25,0)   -- ( 6.25,0.5); 
       
  1015   \draw[very thick] ( 6.75,0)   -- ( 6.75,0.5); 
       
  1016 
       
  1017   \draw[fill]     (-0.15,0.1) rectangle (0.15,0.4);
       
  1018   \draw[fill]     ( 0.35,0.1) rectangle (0.65,0.4);
       
  1019   \draw[fill]     ( 1.35,0.1) rectangle (1.65,0.4);
       
  1020   \draw[fill]     ( 1.85,0.1) rectangle (2.15,0.4);
       
  1021   \draw[fill]     ( 2.35,0.1) rectangle (2.65,0.4);
       
  1022   \draw[fill]     ( 3.35,0.1) rectangle (3.65,0.4);
       
  1023   \draw[fill]     ( 4.35,0.1) rectangle (4.65,0.4);
       
  1024   \draw[fill]     ( 4.85,0.1) rectangle (5.15,0.4);
       
  1025   \draw[fill]     ( 5.35,0.1) rectangle (5.65,0.4);
       
  1026   \draw[fill]     ( 5.85,0.1) rectangle (6.15,0.4);
       
  1027   \end{tikzpicture}
       
  1028 
       
  1029   \end{center}
       
  1030   \end{itemize}
       
  1031 
       
  1032   \end{frame}}
       
  1033   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
  1034 *}
       
  1035 
       
  1036 text_raw {*
       
  1037   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1038   \mode<presentation>{
       
  1039   \begin{frame}[c]
       
  1040   \frametitle{Inc a}%
       
  1041 
       
  1042   \begin{center}
       
  1043   \begin{tabular}{@ {\hspace{-10mm}}l}
       
  1044   @{text "Inc a"} @{text "\<equiv>"} \\
       
  1045   \hspace{16mm} @{text "locate a"} @{text ";"}\\
       
  1046   \hspace{16mm} @{text "right_until_zero"} @{text ";"}\\
       
  1047   \hspace{16mm} @{text "move_right"} @{text ";"}\\
       
  1048   \hspace{16mm} @{text "shift_right"} @{text ";"}\\
       
  1049   \hspace{16mm} @{text "move_left"} @{text ";"}\\
       
  1050   \hspace{16mm} @{text "left_until_double_zero"} @{text ";"}\\
       
  1051   \hspace{16mm} @{text "write_one"} @{text ";"}\\
       
  1052   \hspace{16mm} @{text "left_until_double_zero"} @{text ";"}\\
       
  1053   \hspace{16mm} @{text "move_right"} @{text ";"}\\
       
  1054   \hspace{16mm} @{text "move_right"}\\
       
  1055   \end{tabular}
   852   \end{center}
  1056   \end{center}
   853 
  1057 
   854   \end{frame}}
  1058   \end{frame}}
   855   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
  1059   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
   856 *}
  1060 *}
   894   & \hspace{3mm} @{text "\<exists> k. "} @{text "(q \<star> c \<star> r) (steps k cf)"} 
  1098   & \hspace{3mm} @{text "\<exists> k. "} @{text "(q \<star> c \<star> r) (steps k cf)"} 
   895   \end{tabular}
  1099   \end{tabular}
   896   \end{center}\bigskip\bigskip
  1100   \end{center}\bigskip\bigskip
   897 
  1101 
   898   \normalsize
  1102   \normalsize
   899   @{text "c"} can be\;\;\; @{text "i:[move_left_until_zero]:j"}
  1103   \begin{center}
   900   
  1104   @{text "\<lbrace> st i \<star> hd v \<star> zero u \<star> ones (u + 1) v \<rbrace>"}\\
       
  1105   @{text "i:[left_until_zero]:j"}\\
       
  1106   @{text "\<lbrace> st j \<star> hd u \<star> zero u \<star> ones (u + 1) v \<rbrace>"}\\
       
  1107   \end{center}
       
  1108 
       
  1109   \end{frame}}
       
  1110   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
  1111 *}
       
  1112 
       
  1113 text_raw {*
       
  1114   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1115   \mode<presentation>{
       
  1116   \begin{frame}[c]
       
  1117   \frametitle{Inductions over \textit{ones}}%
       
  1118 
       
  1119   \begin{itemize}
       
  1120   \item What most simplifies the work is that we can do inductions over
       
  1121   the ''input'' (inductively defined assertions)\pause\medskip
       
  1122 
       
  1123   \item Suppose @{text "right_until_zero"}:\bigskip
       
  1124 
       
  1125     \begin{center}
       
  1126   \begin{tikzpicture}[scale=1]
       
  1127 
       
  1128   \draw[very thick] (-0.25,0)   -- ( 8.25,0);
       
  1129   \draw[very thick] (-0.25,0.5) -- ( 8.25,0.5);
       
  1130 
       
  1131   \draw[very thick] (-0.25,0)   -- (-0.25,0.5);
       
  1132   \draw[very thick] ( 0.25,0)   -- ( 0.25,0.5);
       
  1133   \draw[very thick] ( 0.75,0)   -- ( 0.75,0.5);
       
  1134   \draw[very thick] ( 1.25,0)   -- ( 1.25,0.5);
       
  1135   \draw[very thick] ( 1.75,0)   -- ( 1.75,0.5);  
       
  1136   \draw[very thick] ( 2.25,0)   -- ( 2.25,0.5); 
       
  1137   \draw[very thick] ( 2.75,0)   -- ( 2.75,0.5);  
       
  1138   \draw[very thick] ( 3.25,0)   -- ( 3.25,0.5); 
       
  1139   \draw[very thick] ( 3.75,0)   -- ( 3.75,0.5); 
       
  1140   \draw[very thick] ( 4.25,0)   -- ( 4.25,0.5); 
       
  1141   \draw[very thick] ( 4.75,0)   -- ( 4.75,0.5); 
       
  1142   \draw[very thick] ( 5.25,0)   -- ( 5.25,0.5); 
       
  1143   \draw[very thick] ( 5.75,0)   -- ( 5.75,0.5); 
       
  1144   \draw[very thick] ( 6.25,0)   -- ( 6.25,0.5); 
       
  1145   \draw[very thick] ( 6.75,0)   -- ( 6.75,0.5); 
       
  1146   \draw[rounded corners=1mm] (-0.35,-0.1) rectangle (0.35,0.6);
       
  1147   \draw[fill]     (-0.15,0.1) rectangle (0.15,0.4);
       
  1148   \draw[fill]     ( 0.35,0.1) rectangle (0.65,0.4);
       
  1149   \draw[fill]     ( 0.85,0.1) rectangle (1.15,0.4);
       
  1150   \draw[fill]     ( 1.35,0.1) rectangle (1.65,0.4);
       
  1151   \draw[fill]     ( 1.85,0.1) rectangle (2.15,0.4);
       
  1152   \draw[fill]     ( 2.35,0.1) rectangle (2.65,0.4);
       
  1153   \draw[fill]     ( 3.35,0.1) rectangle (3.65,0.4);
       
  1154   \draw[fill]     ( 3.85,0.1) rectangle (4.15,0.4);
       
  1155   \draw[fill]     ( 4.35,0.1) rectangle (4.65,0.4);
       
  1156   \draw[fill]     ( 4.85,0.1) rectangle (5.15,0.4);
       
  1157   \draw[fill]     ( 5.35,0.1) rectangle (5.65,0.4);
       
  1158   \draw[fill]     ( 5.85,0.1) rectangle (6.15,0.4);
       
  1159 
       
  1160   \path (2.75,0) edge [decorate,decoration={brace,amplitude=14pt}, thick] node[below=8pt] 
       
  1161   {\small\textcolor{gray}{@{text "ones u v"}}} (-0.25,0);
       
  1162 
       
  1163   \end{tikzpicture}
       
  1164   \end{center}
       
  1165 
       
  1166   \begin{center}
       
  1167   @{text "\<lbrace> st i \<star> hd u \<star> zero (v + 1) \<star> ones u v \<rbrace>"}\\
       
  1168   @{text "i:[right_until_zero]:j"}\\
       
  1169   @{text "\<lbrace> st j \<star> hd (v + 1) \<star> zero (v + 1) \<star> ones u v \<rbrace>"}\\
       
  1170   \end{center}
       
  1171   \end{itemize}
       
  1172 
       
  1173   \begin{textblock}{3}(11,10)
       
  1174   \begin{tikzpicture}
       
  1175   \only<2>{\node at (0,0) [single arrow, shape border rotate=270, fill=red,text=white]{\mbox{\alert{a}}};}
       
  1176   \end{tikzpicture}
       
  1177   \end{textblock}
   901 
  1178 
   902   \end{frame}}
  1179   \end{frame}}
   903   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
  1180   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
   904 *}
  1181 *}
   905 
  1182 
   915   \begin{center}
  1192   \begin{center}
   916   @{text "\<lbrace>p\<rbrace> i:[c\<^sub>1 ; ... ; c\<^sub>n]:j \<lbrace>q\<rbrace>"}
  1193   @{text "\<lbrace>p\<rbrace> i:[c\<^sub>1 ; ... ; c\<^sub>n]:j \<lbrace>q\<rbrace>"}
   917   \end{center}\bigskip\bigskip
  1194   \end{center}\bigskip\bigskip
   918 
  1195 
   919   \item for loops we often only have to do inductions on the length 
  1196   \item for loops we often only have to do inductions on the length 
   920   of the input (e.g.~how many @{text "1"}s are on the tape)\pause
  1197   of the input (e.g.~how many @{text "0"}s/@{text "1"}s are on the tape)
   921   
  1198   
   922   \item these macros allow us to completely get rid of register machines
  1199   \item no termination measures are needed
   923   \end{itemize}
  1200 
   924   
  1201   \end{itemize}
   925 
  1202   
   926   \end{frame}}
  1203 
   927   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
  1204   \end{frame}}
   928 *}
  1205   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
  1206 *}
       
  1207 
       
  1208 text_raw {*
       
  1209   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1210   \mode<presentation>{
       
  1211   \begin{frame}[c]
       
  1212   \frametitle{Register Machines}%
       
  1213 
       
  1214   \begin{itemize}
       
  1215   \item We could also use Jensen's et al work to give
       
  1216   a more appropriate \alert{view}  on register machines
       
  1217 
       
  1218   \begin{center}
       
  1219   @{text "\<lbrace>p\<rbrace> i:[rm_c]:j \<lbrace>q\<rbrace>"}
       
  1220   \end{center}\bigskip
       
  1221   \end{itemize}
       
  1222   
       
  1223   \small
       
  1224   \begin{itemize}
       
  1225       \item Rule for @{text "Inc"}
       
  1226 
       
  1227              \begin{tabular}{rl}
       
  1228                @{text "RM."} & @{text "\<lbrace> pc i \<star> m a v \<rbrace>"} \\
       
  1229                & @{text "i:[ Inc a ]:j"} \\
       
  1230                & @{text "\<lbrace> pc j \<star> m a (Suc v)\<rbrace>"}
       
  1231              \end{tabular}
       
  1232      \item Rules for @{text "Dec"}
       
  1233      \begin{tabular}{c c}
       
  1234        \begin{tabular}{r l}
       
  1235             @{text "RM."} & @{text "\<lbrace>(pc i \<star> m a (Suc v))\<rbrace>"} \\
       
  1236           & @{text "i :[ Dec a e ]: j"} \\
       
  1237           & @{text "\<lbrace>pc j \<star> m a v\<rbrace>"}
       
  1238        \end{tabular} &
       
  1239        \begin{tabular}{r l}
       
  1240          @{text "RM."} & @{text "\<lbrace> pc i \<star> m a 0 \<rbrace>"} \\
       
  1241          & @{text "i:[ Dec a e ]:j"} \\
       
  1242          & @{text "\<lbrace> pc e \<star> m a 0 \<rbrace>"}
       
  1243        \end{tabular}
       
  1244      \end{tabular}
       
  1245     %\item Rule for @{text "Goto"}
       
  1246     %
       
  1247     %   \begin{tabular}{r l}
       
  1248     %     @{text "RM."} & @{text "\<lbrace> pc i \<rbrace>"} \\
       
  1249     %    &@{text "i:[ (Goto e) ]:j"} \\
       
  1250     %    &@{text "\<lbrace> pc e \<rbrace>"}
       
  1251     %   \end{tabular} 
       
  1252   \end{itemize}
       
  1253 
       
  1254 
       
  1255   \end{frame}}
       
  1256   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
  1257 *}
       
  1258 
   929 
  1259 
   930 text_raw {*
  1260 text_raw {*
   931   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1261   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   932   \mode<presentation>{
  1262   \mode<presentation>{
   933   \begin{frame}[c]
  1263   \begin{frame}[c]