slides/slides02.tex
changeset 769 f9686b22db7e
parent 767 bdd12391d345
child 770 c563cf946497
equal deleted inserted replaced
768:34f77b976b88 769:f9686b22db7e
   635 What is their meaning?\\
   635 What is their meaning?\\
   636 What are the cases for \bl{$nullable$} and \bl{$\der$}?
   636 What are the cases for \bl{$nullable$} and \bl{$\der$}?
   637 \end{frame}
   637 \end{frame}
   638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   639 
   639 
       
   640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   641 \begin{frame}[c]
       
   642   \frametitle{$der$ for $n$-times}
       
   643 
       
   644 Case \bl{$n = 2$} and \bl{$r \cdot r$}: 
       
   645 
       
   646 \begin{center}
       
   647   \begin{tabular}{lcl}
       
   648     \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{if \; $nullable(r)$}\\
       
   649                               &   & \bl{then \; \alert<3>{$(der\,c\,r)\cdot r + der\,c\,r$}}\\
       
   650                               &   & \bl{else \; $(der\,c\,r)\cdot r$}\bigskip\pause\\
       
   651     my claim                  &   & \bl{$\equiv\;$} \bl{$(der\,c\,r)\cdot r$}\\
       
   652     (in this case)                                
       
   653   \end{tabular} 
       
   654 \end{center}  
       
   655 
       
   656 \end{frame}
       
   657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   658 
       
   659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   660 \begin{frame}[t]
       
   661 
       
   662 We know \bl{$nullable(r)$} holds!\pause 
       
   663 
       
   664 \begin{center}
       
   665   \begin{tabular}{@{}lcl}
       
   666     \bl{$(der\,c\,r)\cdot r + der\,c\,r$}\pause
       
   667     & \bl{$\equiv$} & \bl{$(der\,c\,r)\cdot r + (der\,c\,r) \cdot \ONE$}\medskip\pause\\
       
   668     & \bl{$\equiv$} & \bl{$(der\,c\,r)\cdot (r + \ONE)$}\medskip\pause\\
       
   669     & \bl{$\equiv$} & \bl{$(der\,c\,r)\cdot r$}\\
       
   670     \multicolumn{3}{r}{\small(remember \bl{$r$} is nullable)}
       
   671   \end{tabular} 
       
   672 \end{center}\pause
       
   673 
       
   674 \rule{13cm}{0.8mm}
       
   675 
       
   676 \begin{textblock}{13}(2,10)
       
   677 \only<6>{%
       
   678   \begin{tabular}{lcl}
       
   679     \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{if \; $nullable(r)$}\\
       
   680                           &   & \bl{then \; $(der\,c\,r)\cdot r + der\,c\,r$}\\
       
   681                           &   & \bl{else \; $(der\,c\,r)\cdot r$}                                
       
   682   \end{tabular}}
       
   683 \only<7>{%
       
   684   \begin{tabular}{lcl}
       
   685     \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{if \; $nullable(r)$}\\
       
   686                           &   & \bl{then \; $(der\,c\,r)\cdot r$}\\
       
   687                           &   & \bl{else \; $(der\,c\,r)\cdot r$}                                
       
   688   \end{tabular}}
       
   689 \only<8>{%
       
   690   \begin{tabular}{lcl}
       
   691     \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{$(der\,c\,r)\cdot r$}                                
       
   692   \end{tabular}}
       
   693 \end{textblock}
       
   694 
       
   695 
       
   696 \end{frame}
       
   697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   698 
       
   699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   700 \begin{frame}[c]
       
   701 
       
   702 \begin{center}
       
   703 \begin{tabular}{ll@{\hspace{10mm}}l}
       
   704 & \bl{$r\{n\}$} & \bl{$der$}\hspace{20mm}\mbox{}\\\hline\\[-4mm]    
       
   705 \bl{$n = 0$} : & \bl{$\ONE$}           & \bl{$\ZERO$}\\
       
   706 \bl{$n = 1$} : & \bl{$r$}              & \bl{$(der\,c\,r)$}\\
       
   707 \bl{$n = 2$} : & \bl{$r\cdot r$}       & \bl{$(der\,c\,r)\cdot r$}\\
       
   708 \bl{$n = 3$} : & \bl{$r\cdot r\cdot r$}& \only<1>{???}\only<2->{\bl{$(der\,c\,r)\cdot r\cdot r$}}\\
       
   709 \quad\vdots  
       
   710 \end{tabular} 
       
   711 \end{center}
       
   712 
       
   713 \begin{textblock}{13}(1,11)
       
   714 \only<3->{%
       
   715   \begin{tabular}{rcl}
       
   716     \bl{$nullable(r\{n\})$} & \bl{$\dn$} &
       
   717                           \bl{if\; $n = 0$\; then\; $true$\; else\; $nullable(r)$}\\
       
   718     \bl{$der\,c\,(r\{n\})$} & \bl{$\dn$} &
       
   719                           \bl{if\; $n = 0$\; then\; $\ZERO$\; else\; $(der\,c\,r)\cdot r\{n - 1\}$}
       
   720   \end{tabular}}
       
   721 \end{textblock}
       
   722 
       
   723 \end{frame}
       
   724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   725 
       
   726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   727 \begin{frame}[c]
       
   728 
       
   729 \begin{textblock}{13}(1.5,4)
       
   730   \only<1-6>{%
       
   731   \begin{tabular}{@{}lcl@{}}
       
   732     \bl{$der\,c\,(r\cdot r\cdot r)$}
       
   733     & \bl{$\dn$} & \bl{if $nullable(r)$}\medskip\\
       
   734     & & \only<1>{\bl{then\; $(der\,c\,r)\cdot r\cdot r + der\,c\,(r\cdot r)$}}%
       
   735         \only<2>{\bl{then\; $(der\,c\,r)\cdot r\cdot r + (der\,c\,r)\cdot r$}}%
       
   736         \only<3>{\bl{then\; $(der\,c\,r)\cdot (r\cdot r + r)$}}%
       
   737         \only<4>{\bl{then\; $(der\,c\,r)\cdot (r\cdot (r + \ONE))$}}%
       
   738         \only<5>{\bl{then\; $(der\,c\,r)\cdot (r\cdot r)$}}%
       
   739         \only<6>{\bl{then\; $(der\,c\,r)\cdot r\cdot r$}}\medskip\\
       
   740     & & \bl{else\; $(der\,c\,r)\cdot r\cdot r$}\\
       
   741   \end{tabular}}
       
   742   \only<7->{%
       
   743   \begin{tabular}{@{}lcl@{}}
       
   744     \bl{$der\,c\,(r\cdot r\cdot r)$}
       
   745     & \bl{$\dn$} & \bl{$(der\,c\,r)\cdot r\cdot r$}%
       
   746   \end{tabular}} 
       
   747 \end{textblock}
       
   748 
       
   749 \end{frame}
       
   750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   751 
   640 
   752 
   641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   642 \begin{frame}[t]
   754 \begin{frame}[t]
   643 \frametitle{Brzozowski: \boldmath$a^{?\{n\}} \cdot a^{\{n\}}$}
   755 \frametitle{Brzozowski: \boldmath$a^{?\{n\}} \cdot a^{\{n\}}$}
   644 
   756 
   867 
   979 
   868 \begin{itemize}
   980 \begin{itemize}
   869 \item extends to most regular expressions, for example
   981 \item extends to most regular expressions, for example
   870 \bl{$\sim r$} (next slide)
   982 \bl{$\sim r$} (next slide)
   871 
   983 
   872 \item is easy to implement in a functional language (slide after)
   984 \item is easy to implement in a functional language
   873 
   985 
   874 \item the algorithm is already quite old; there is still
   986 \item the algorithm is already quite old; there is still
   875   work to be done to use it as a tokenizer (that is relatively new work)
   987   work to be done to use it as a tokenizer (that is relatively new work)
   876 
   988 
   877 \item we can prove its correctness\ldots (several slides later)
   989 \item we can prove its correctness\ldots (another video)
   878 \end{itemize}
   990 \end{itemize}
   879 
   991 
   880 \end{frame}
   992 \end{frame}
   881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   882 
   994 
   887 \begin{itemize}
   999 \begin{itemize}
   888 \item \bl{$\sim{}r$}  \hspace{6mm} (everything that \bl{$r$} cannot recognise)\medskip
  1000 \item \bl{$\sim{}r$}  \hspace{6mm} (everything that \bl{$r$} cannot recognise)\medskip
   889 \item \bl{$L(\sim{}r) \dn UNIV - L(r)$}\medskip
  1001 \item \bl{$L(\sim{}r) \dn UNIV - L(r)$}\medskip
   890 \item \bl{$nullable (\sim{}r) \dn not\, (nullable(r))$}\medskip
  1002 \item \bl{$nullable (\sim{}r) \dn not\, (nullable(r))$}\medskip
   891 \item \bl{$der\,c\,(\sim{}r) \dn \;\sim{}(der\,c\,r)$}
  1003 \item \bl{$der\,c\,(\sim{}r) \dn \;\sim{}(der\,c\,r)$}
   892 \end{itemize}\bigskip\pause
  1004 \end{itemize}\bigskip\bigskip\medskip\pause
   893 
  1005 
   894 Used often for recognising comments:
  1006 Used often for recognising comments:
   895 
       
   896 \[
  1007 \[
   897 \bl{/ \cdot * \cdot (\sim{}([a\mbox{-}z]^* \cdot * \cdot / \cdot [a\mbox{-}z]^*)) \cdot * \cdot /}
  1008 \bl{/ \cdot * \cdot (\sim{}([a\mbox{-}z]^* \cdot * \cdot / \cdot [a\mbox{-}z]^*)) \cdot * \cdot /}
   898 \]
  1009 \]
   899 
  1010 
   900 \end{frame}
  1011 \end{frame}