slides/slides02.tex
changeset 337 885ac2b6c27d
parent 336 7c80b9b6f713
child 338 f16120cb4e19
equal deleted inserted replaced
336:7c80b9b6f713 337:885ac2b6c27d
   261          & \bl{$\mid$} & \bl{$r_1 + r_2$}      & alternative / choice\\
   261          & \bl{$\mid$} & \bl{$r_1 + r_2$}      & alternative / choice\\
   262          & \bl{$\mid$} & \bl{$r^*$}            & star (zero or more)\\
   262          & \bl{$\mid$} & \bl{$r^*$}            & star (zero or more)\\
   263   \end{tabular}
   263   \end{tabular}
   264 \end{textblock}
   264 \end{textblock}
   265   
   265   
       
   266 \only<2->{\footnotesize
       
   267 \begin{textblock}{9}(2,0.5)
       
   268 \begin{bubble}[9.8cm]
       
   269 \lstinputlisting{../progs/app01.scala}
       
   270 \end{bubble}
       
   271 \end{textblock}}  
       
   272   
   266 \end{frame}
   273 \end{frame}
   267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   268 
   275 
   269 
   276 
   270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   473 \bl{$der\,c\,r$} gives the answer, Brzozowski 1964
   480 \bl{$der\,c\,r$} gives the answer, Brzozowski 1964
   474 \end{frame}
   481 \end{frame}
   475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   476 
   483 
   477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   478 \mode<presentation>{
       
   479 \begin{frame}[c]
   485 \begin{frame}[c]
   480 \frametitle{The Derivative of a Rexp}
   486 \frametitle{The Derivative of a Rexp}
   481 
   487 
   482 \begin{center}
   488 \begin{center}
   483 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
   489 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
   493   \bl{$\textit{ders}\, []\, r$}     & \bl{$\dn$} & \bl{$r$} & \\
   499   \bl{$\textit{ders}\, []\, r$}     & \bl{$\dn$} & \bl{$r$} & \\
   494   \bl{$\textit{ders}\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\textit{ders}\,s\,(der\,c\,r)$} & \\
   500   \bl{$\textit{ders}\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\textit{ders}\,s\,(der\,c\,r)$} & \\
   495   \end{tabular}
   501   \end{tabular}
   496 \end{center}
   502 \end{center}
   497 
   503 
   498 \end{frame}}
   504 \end{frame}
   499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   500 
   506 
   501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   502 \begin{frame}[c]
   508 \begin{frame}[c]
   503 \frametitle{Examples}
   509 \frametitle{Examples}
   514 
   520 
   515 \end{frame}
   521 \end{frame}
   516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   517 
   523 
   518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   519 \mode<presentation>{
       
   520 \begin{frame}[t]
   525 \begin{frame}[t]
   521 \frametitle{The Algorithm}
   526 \frametitle{The Algorithm}
   522 
   527 
   523 \begin{center}
   528 \begin{center}
   524 \begin{tabular}{@{}rll@{}}
   529 \begin{tabular}{@{}rll@{}}
   534                        \bl{\textit{false}}$\\        
   539                        \bl{\textit{false}}$\\        
   535 \end{tabular}
   540 \end{tabular}
   536 \end{center}
   541 \end{center}
   537 
   542 
   538 
   543 
   539 \end{frame}}
   544 \end{frame}
   540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   541 
   546 
   542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   543 \begin{frame}[c]
   548 \begin{frame}[c]
   544 \frametitle{The Idea of the Algorithm}
   549 \frametitle{The Idea of the Algorithm}
   558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   559 
   564 
   560 
   565 
   561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   562 \begin{frame}[c]
   567 \begin{frame}[c]
   563 \frametitle{\begin{tabular}{c}\bl{$(a?\{n\}) \cdot a\{n\}$}\end{tabular}}
   568 \frametitle{\bl{$(a?\{n\}) \cdot a\{n\}$}}
   564 
   569 
   565 \begin{center}
   570 \begin{center}
   566 \begin{tikzpicture}
   571 \begin{tikzpicture}
   567 \begin{axis}[
   572 \begin{axis}[
   568     xlabel={\pcode{a}s},
   573     xlabel={\pcode{a}s},
   671 \end{frame}
   676 \end{frame}
   672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   673 
   678 
   674 
   679 
   675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   676 \mode<presentation>{
   681 \begin{frame}[c]
   677 \begin{frame}[c]
   682 \frametitle{Examples}
   678 \frametitle{\begin{tabular}{c}Examples\end{tabular}}
       
   679 
   683 
   680 Recall the example of \bl{$r \dn ((a \cdot b) + b)^*$} with
   684 Recall the example of \bl{$r \dn ((a \cdot b) + b)^*$} with
   681 
   685 
   682 \begin{center}
   686 \begin{center}
   683 \begin{tabular}{l}
   687 \begin{tabular}{l}
   687 \end{tabular}
   691 \end{tabular}
   688 \end{center}
   692 \end{center}
   689 
   693 
   690 What are these regular expressions equivalent to?
   694 What are these regular expressions equivalent to?
   691 
   695 
   692 \end{frame}}
   696 \end{frame}
   693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   694 
   698 
   695 
   699 
   696 
   700 
   697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   698 \mode<presentation>{
   702 \begin{frame}[t]
   699 \begin{frame}[t]
   703 \frametitle{\bl{$(a?\{n\}) \cdot a\{n\}$}}
   700 \frametitle{\begin{tabular}{c}\bl{$(a?\{n\}) \cdot a\{n\}$}\end{tabular}}
       
   701 
   704 
   702 \begin{center}
   705 \begin{center}
   703 \begin{tikzpicture}
   706 \begin{tikzpicture}
   704 \begin{axis}[
   707 \begin{axis}[
   705     xlabel={\pcode{a}s},
   708     xlabel={\pcode{a}s},
   718 \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
   721 \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
   719 \end{axis}
   722 \end{axis}
   720 \end{tikzpicture}
   723 \end{tikzpicture}
   721 \end{center}
   724 \end{center}
   722 
   725 
   723 \end{frame}}
   726 \end{frame}
   724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   725 
   728 
   726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   727 \mode<presentation>{
   730 \begin{frame}[t]
   728 \begin{frame}[t]
   731 \frametitle{Proofs about Rexps}
   729 \frametitle{\begin{tabular}{c}Proofs about Rexps\end{tabular}}
       
   730 
   732 
   731 Remember their inductive definition:\\[5cm]
   733 Remember their inductive definition:\\[5cm]
   732 
   734 
   733 \begin{textblock}{6}(5,5)
   735 \begin{textblock}{6}(5,5)
   734   \begin{tabular}{@ {}rrl}
   736   \begin{tabular}{@ {}rrl}
   735   \bl{$r$} & \bl{$::=$}  & \bl{$\varnothing$}\\
   737   \bl{$r$} & \bl{$::=$}  & \bl{$\varnothing$}\\
   736          & \bl{$\mid$} & \bl{$\epsilon$}       \\
   738          & \bl{$\mid$} & \bl{$\epsilon$}     \\
   737          & \bl{$\mid$} & \bl{$c$}                        \\
   739          & \bl{$\mid$} & \bl{$c$}            \\
   738          & \bl{$\mid$} & \bl{$r_1 \cdot r_2$}\\
   740          & \bl{$\mid$} & \bl{$r_1 \cdot r_2$}\\
   739          & \bl{$\mid$} & \bl{$r_1 + r_2$}  \\
   741          & \bl{$\mid$} & \bl{$r_1 + r_2$}    \\
   740          & \bl{$\mid$} & \bl{$r^*$}                  \\
   742          & \bl{$\mid$} & \bl{$r^*$}          \\
   741   \end{tabular}
   743   \end{tabular}
   742   \end{textblock}
   744   \end{textblock}
   743 
   745 
   744 If we want to prove something, say a property \bl{$P(r)$}, for all regular expressions \bl{$r$} then \ldots
   746 If we want to prove something, say a property \bl{$P(r)$}, for all regular expressions \bl{$r$} then \ldots
   745 
   747 
   746 \end{frame}}
   748 \end{frame}
   747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   748 
   750 
   749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   750 \mode<presentation>{
   752 \begin{frame}[c]
   751 \begin{frame}[c]
   753 \frametitle{Proofs about Rexp (2)}
   752 \frametitle{\begin{tabular}{c}Proofs about Rexp (2)\end{tabular}}
       
   753 
   754 
   754 \begin{itemize}
   755 \begin{itemize}
   755 \item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip
   756 \item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip
   756 \item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already
   757 \item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already
   757 holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
   758 holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
   759 holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
   760 holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
   760 \item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already
   761 \item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already
   761 holds for \bl{$r$}.
   762 holds for \bl{$r$}.
   762 \end{itemize}
   763 \end{itemize}
   763 
   764 
   764 \end{frame}}
   765 \end{frame}
   765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   766 
   767 
   767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   768 \mode<presentation>{
   769 \begin{frame}[c]
   769 \begin{frame}[c]
   770 \frametitle{Proofs about Rexp (3)}
   770 \frametitle{\begin{tabular}{c}Proofs about Rexp (3)\end{tabular}}
       
   771 
   771 
   772 Assume \bl{$P(r)$} is the property:
   772 Assume \bl{$P(r)$} is the property:
   773 
   773 
   774 \begin{center}
   774 \begin{center}
   775 \bl{$nullable(r)$} if and only if \bl{$[] \in L(r)$}
   775 \bl{$nullable(r)$} if and only if \bl{$[] \in L(r)$}
   776 \end{center}
   776 \end{center}
   777 
   777 
   778 \end{frame}}
   778 \end{frame}
   779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   780 
   780 
   781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   782 \mode<presentation>{
   782 \begin{frame}[c]
   783 \begin{frame}[c]
   783 \frametitle{Proofs about Rexp (4)}
   784 \frametitle{\begin{tabular}{c}Proofs about Rexp (4)\end{tabular}}
       
   785 
       
   786 
   784 
   787 \begin{center}
   785 \begin{center}
   788 \bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
   786 \bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
   789 $rev(\varnothing)$   & $\dn$ & $\varnothing$\\
   787 $rev(\varnothing)$   & $\dn$ & $\varnothing$\\
   790 $rev(\epsilon)$         & $\dn$ & $\epsilon$\\
   788 $rev(\epsilon)$         & $\dn$ & $\epsilon$\\
   802 \bl{$L(rev(r)) = \{s^{-1} \;|\; s \in L(r)\}$}
   800 \bl{$L(rev(r)) = \{s^{-1} \;|\; s \in L(r)\}$}
   803 \end{center}
   801 \end{center}
   804 
   802 
   805 by induction on \bl{$r$}.
   803 by induction on \bl{$r$}.
   806 
   804 
   807 \end{frame}}
   805 \end{frame}
   808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   806 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   809 
   807 
   810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   811 \mode<presentation>{
   809 \begin{frame}[c]
   812 \begin{frame}[c]
   810 \frametitle{Proofs about Rexp (5)}
   813 \frametitle{\begin{tabular}{c}Proofs about Rexp (5)\end{tabular}}
       
   814 
   811 
   815 Let \bl{$Der\,c\,A$} be the set defined as
   812 Let \bl{$Der\,c\,A$} be the set defined as
   816 
   813 
   817 \begin{center}
   814 \begin{center}
   818 \bl{$Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
   815 \bl{$Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
   824 \bl{$L(der\,c\,r) = Der\,c\,(L(r))$}
   821 \bl{$L(der\,c\,r) = Der\,c\,(L(r))$}
   825 \end{center}
   822 \end{center}
   826 
   823 
   827 by induction on \bl{$r$}.
   824 by induction on \bl{$r$}.
   828 
   825 
   829 \end{frame}}
   826 \end{frame}
   830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   831 
   828 
   832 
   829 
   833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   834 \mode<presentation>{
   831 \mode<presentation>{