slides/slides02.tex
changeset 565 2be8c4c77418
parent 564 b5d57d7064bb
child 566 b153c04834eb
equal deleted inserted replaced
564:b5d57d7064bb 565:2be8c4c77418
    42 
    42 
    43 \end{frame}
    43 \end{frame}
    44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    45 
    45 
    46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    47 \begin{frame}[c]
    47 \begin{frame}[t]
    48 \frametitle{\begin{tabular}{@ {}c@ {}}
    48   \frametitle{\Large
    49     An Efficient Regular\\[-1mm] 
    49     Lets Implement an Efficient\\[-2mm] 
    50     Expression Matcher\end{tabular}}
    50     Regular Expression Matcher}
    51 
    51 
    52 \footnotesize
    52 \footnotesize
    53 \begin{center}
    53 \begin{center}
    54   {\normalsize Graphs: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$} and strings \bl{$\underbrace{\,a\ldots a\,}_{n}$}}\smallskip\\
    54   {\normalsize Graphs: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$} and strings \bl{$\underbrace{\,a\ldots a\,}_{n}$}}\medskip\\
    55 \begin{tabular}{@{}cc@{}}
    55 \begin{tabular}{@{}cc@{}}
    56 \begin{tikzpicture}
    56 \begin{tikzpicture}
    57 \begin{axis}[
    57 \begin{axis}[
    58     xlabel={$n$},
    58     xlabel={$n$},
    59     x label style={at={(1.05,0.0)}},
    59     x label style={at={(1.05,0.0)}},
    88     scaled ticks=false,
    88     scaled ticks=false,
    89     axis lines=left,
    89     axis lines=left,
    90     width=5cm,
    90     width=5cm,
    91     height=4.5cm,
    91     height=4.5cm,
    92     legend entries={Scala V2,Scala V3},
    92     legend entries={Scala V2,Scala V3},
    93     legend pos=north west,
    93     legend pos=north east,
    94     legend cell align=left]
    94     legend cell align=left]
    95 \addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
    95 \addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
    96 \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
    96 \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
    97 \end{axis}
    97 \end{axis}
    98 \end{tikzpicture}
    98 \end{tikzpicture}
    99 \end{tabular}
    99 \end{tabular}
   100 \end{center}
   100 \end{center}
   101 
   101 
   102 \small
   102 \small
   103 In the handouts is a similar graph for \bl{$(a^*)^* \cdot b$} and Java.
   103 In the handouts is a similar graph for \bl{$(a^*)^* \cdot b$} and Java 8.
   104 
   104 
   105 \end{frame}
   105 \end{frame}
   106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   107 
   107 
   108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   111 
   111 
   112 \begin{itemize}
   112 \begin{itemize}
   113 \item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\bigskip
   113 \item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\bigskip
   114 \item Evil regular expressions\medskip
   114 \item Evil regular expressions\medskip
   115 \begin{itemize}
   115 \begin{itemize}
   116 \item \bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}
   116 \item \bl{$a^{?\{n\}} \cdot a^{\{n\}}$}
   117 \item \bl{$(a^*)^*$}
   117 \item \bl{$(a^*)^*$}
   118 \item \bl{$([a$\,-\,$z]^+)^*$}
   118 \item \bl{$([a$\,-\,$z]^+)^*$}
   119 \item \bl{$(a + a \cdot a)^*$}
   119 \item \bl{$(a + a \cdot a)^*$}
   120 \item \bl{$(a + a?)^*$}
   120 \item \bl{$(a + a^?)^*$}
   121 \end{itemize}
   121 \end{itemize}
   122 
   122 
   123 \item sometimes also called \alert{catastrophic backtracking}
   123 \item sometimes also called \alert{catastrophic backtracking}
   124 \end{itemize}
   124 \end{itemize}
   125 
   125 
   228 \item[] This expands to 
   228 \item[] This expands to 
   229 
   229 
   230 \[
   230 \[
   231 \bl{A^0 \cup A^1 \cup A^2 \cup A^3 \cup A^4 \cup \ldots}
   231 \bl{A^0 \cup A^1 \cup A^2 \cup A^3 \cup A^4 \cup \ldots}
   232 \]
   232 \]
       
   233 
       
   234 or
   233 
   235 
   234 \small
   236 \small
   235 \[
   237 \[
   236 \bl{\{[]\} \;\cup\; A \;\cup\; A\,@\,A \;\cup\; 
   238 \bl{\{[]\} \;\cup\; A \;\cup\; A\,@\,A \;\cup\; 
   237   A\,@\,A\,@\,A \;\cup\; A\,@\,A\,@\,A\,@\,A \cup \ldots}
   239   A\,@\,A\,@\,A \;\cup\; A\,@\,A\,@\,A\,@\,A \cup \ldots}
   242 \end{frame}
   244 \end{frame}
   243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   244 
   246 
   245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   246 \begin{frame}[c]
   248 \begin{frame}[c]
   247 \frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] 
   249 \frametitle{
   248   Regular Expression\end{tabular}}
   250     The Meaning of a\\[-2mm] 
       
   251     Regular Expression}
   249 
   252 
   250 \begin{textblock}{15}(1,4)
   253 \begin{textblock}{15}(1,4)
   251  \begin{tabular}{rcl}
   254  \begin{tabular}{rcl}
   252  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
   255  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
   253  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
   256  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
   266 
   269 
   267 \end{frame}
   270 \end{frame}
   268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   269 
   272 
   270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   271 \begin{frame}[c]
   274 \begin{frame}[t]
   272 \frametitle{Semantic Derivative}
   275 \frametitle{Semantic Derivative\\[5mm]}
       
   276 
       
   277   
   273 
   278 
   274 \begin{itemize}
   279 \begin{itemize}
   275 \item The \alert{\bf Semantic Derivative} of a 
   280 \item The \alert{\bf Semantic Derivative} of a 
   276 \underline{language}\\ wrt to a character \bl{$c$}:
   281 \underline{language}\\ w.r.t.~to a character \bl{$c$}:
   277 \bigskip
   282 \bigskip
   278 
   283 
   279 \begin{center}
   284 \begin{center}
   280 \bl{$\Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
   285 \bl{$\Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
   281 \end{center}\bigskip\bigskip\bigskip
   286 \end{center}\bigskip
   282 
   287 
   283 For \bl{$A = \{\textit{foo}, \textit{bar}, \textit{frak}\}$} then
   288 For \bl{$A = \{\textit{foo}, \textit{bar}, \textit{frak}\}$} then
   284 
   289 
   285 \begin{center}
   290 \begin{center}
   286 \bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l}
   291 \bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l}
   287 $\Der\,f\,A$ & $=$ & $\{\textit{oo}, \textit{rak}\}$\\
   292 $\Der\,f\,A$ & $=$ & $\{\textit{oo}, \textit{rak}\}$\\
   288 $\Der\,b\,A$ & $=$ &  $\{\textit{ar}\}$\\  
   293 $\Der\,b\,A$ & $=$ &  $\{\textit{ar}\}$\\  
   289 $\Der\,a\,A$ & $=$ & $\{\}$\\\pause
   294 $\Der\,a\,A$ & $=$ & $\{\}$\pause
   290 \end{tabular}}
   295 \end{tabular}}
   291 \end{center}
   296 \end{center}
   292 
   297 
   293 \small
   298 \small
   294 We can extend this definition to strings
   299 We can extend this definition to strings
   302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   303 
   308 
   304 
   309 
   305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   306 \begin{frame}[c]
   311 \begin{frame}[c]
   307 \frametitle{\begin{tabular}{c}The Specification\\ of Matching\end{tabular}}
   312 \frametitle{The Specification\\ for Matching}
   308 
   313 
   309 \begin{bubble}[10cm]
   314 \begin{bubble}[10cm]
   310 \large
   315 \large
   311 A regular expression \bl{$r$} matches a string~\bl{$s$} 
   316 A regular expression \bl{$r$} matches a string~\bl{$s$} 
   312 provided
   317 provided
   352 \end{frame}
   357 \end{frame}
   353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   354 
   359 
   355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   356 \begin{frame}[c]
   361 \begin{frame}[c]
   357 \frametitle{\begin{tabular}{c}
   362 \frametitle{
   358  When Are Two Regular\\[-1mm]
   363  When Are Two Regular\\[-1mm]
   359  Expressions Equivalent?\end{tabular}}
   364  Expressions Equivalent?}
       
   365 
   360 \large
   366 \large
   361 \begin{center}
   367 \begin{center}
   362 \bl{$r_1 \equiv r_2 \;\;\dn\;\; L(r_1) = L(r_2)$}
   368 \bl{$r_1 \equiv r_2 \;\;\dn\;\; L(r_1) = L(r_2)$}
   363 \end{center}  
   369 \end{center}  
   364   
   370   
   402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
   408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
   403 
   409 
   404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   405 \begin{frame}[t]
   411 \begin{frame}[t]
   406 \frametitle{Simplification Rules}
   412 \frametitle{Simplification Rules}
   407 
   413  
   408 \begin{center}
   414 \begin{center}
   409 \bl{\begin{tabular}{rcl}
   415 \bl{\begin{tabular}{rcl}
   410 $r + \ZERO$  & $\equiv$ & $r$\\
   416 $r + \ZERO$  & $\equiv$ & $r$\\
   411 $\ZERO + r$  & $\equiv$ & $r$\\
   417 $\ZERO + r$  & $\equiv$ & $r$\\
   412 $r \cdot \ONE$ & $\equiv$ & $r$\\
   418 $r \cdot \ONE$ & $\equiv$ & $r$\\
   421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   422 
   428 
   423 
   429 
   424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   425 \begin{frame}[t]
   431 \begin{frame}[t]
   426 \frametitle{A Matching Algorithm}
   432 \frametitle{A Matching Algorithm (1)}
   427 
   433 
   428 
   434 
   429 \ldots{}whether a regular expression can match the empty string:
   435 \ldots{}whether a regular expression can match the empty string:
   430 \begin{center}
   436 \begin{center}
   431 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
   437 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
   495 \end{frame}
   501 \end{frame}
   496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   497 
   503 
   498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   499 \begin{frame}[c]
   505 \begin{frame}[c]
   500 \frametitle{The Algorithm}
   506 \frametitle{\mbox{The Brzozowski Algorithm}}
   501 
   507 
   502 \begin{center}
   508 \begin{center}
   503 \begin{tabular}{l} 
   509 \begin{tabular}{l} 
   504 \bl{$\textit{matches}\,r\,s \dn \textit{nullable}(\ders\,r\,s)$}  
   510 \bl{$\textit{matches}\,r\,s \dn \textit{nullable}(\ders\;s\;r)$}  
   505 \end{tabular}
   511 \end{tabular}
   506 \end{center}
   512 \end{center}
   507 
   513 
   508 
   514 
   509 \end{frame}
   515 \end{frame}
   510 %%%%%%%%%%%%%%%%%
   516 %%%%%%%%%%%%%%%%%
   511 
   517 
   512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   513 \begin{frame}[t]
   519 \begin{frame}[t]
   514 \frametitle{An Example}
   520 \frametitle{Brzozowski: An Example}
   515 
   521 
   516 Does \bl{$r_1$} match \bl{$abc$}?
   522 Does \bl{$r_1$} match \bl{$abc$}?
   517 \begin{center}
   523 \begin{center}
   518 \begin{tabular}{@{}rl@{}l@{}}
   524 \begin{tabular}{@{}rl@{}l@{}}
   519 Step 1: & build derivative of \bl{$a$} and \bl{$r_1$} & \bl{$(r_2 = \der\,a\,r_1)$}\smallskip\\
   525 Step 1: & build derivative of \bl{$a$} and \bl{$r_1$} & \bl{$(r_2 = \der\,a\,r_1)$}\smallskip\\
   520 Step 2: & build derivative of \bl{$b$} and \bl{$r_2$} & \bl{$(r_3 = \der\,b\,r_2)$}\smallskip\\
   526 Step 2: & build derivative of \bl{$b$} and \bl{$r_2$} & \bl{$(r_3 = \der\,b\,r_2)$}\smallskip\\
   521 Step 3: & build derivative of \bl{$c$} and \bl{$r_3$} & \bl{$(r_4 = \der\,c\,r_3)$}\smallskip\\
   527 Step 3: & build derivative of \bl{$c$} and \bl{$r_3$} & \bl{$(r_4 = \der\,c\,r_3)$}\smallskip\\
   522 Step 4: & the string is exhausted: & \bl{($nullable(r_4))$}\\
   528 Step 4: & the string is exhausted: & \bl{($nullable(r_4))$}\\
   523         & test whether \bl{$r_4$} can recognise\\
   529         & test whether \bl{$r_4$} can recognise\\
   524         & the empty string\smallskip\\
   530         & the empty string\medskip\\
   525 Output: & result of the test\\
   531 Output: & result of the test\\
   526         & $\Rightarrow \bl{\textit{true}} \,\text{or}\, 
   532         & $\Rightarrow \bl{\textit{true}} \,\text{or}\, 
   527                        \bl{\textit{false}}$\\        
   533                        \bl{\textit{false}}$\\        
   528 \end{tabular}
   534 \end{tabular}
   529 \end{center}
   535 \end{center}
   552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   553 
   559 
   554 
   560 
   555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   556 \begin{frame}[c]
   562 \begin{frame}[c]
   557 \frametitle{Oops\ldots\bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}}
   563 \frametitle{Oops\ldots \;\bl{$a^{?\{n\}} \cdot a^{\{n\}}$}}
   558 
   564 
   559 \begin{center}
   565 \begin{center}
   560 \begin{tikzpicture}
   566 \begin{tikzpicture}
   561 \begin{axis}[
   567 \begin{axis}[
   562     xlabel={$n$},
   568     xlabel={$n$},
   586 
   592 
   587 \end{frame}
   593 \end{frame}
   588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   589 
   595 
   590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   591 \begin{frame}[c]
   597 \begin{frame}[t]
   592 \frametitle{A Problem}
   598 \frametitle{A Problem\medskip}
   593 
   599 
   594 We represented the ``n-times'' \bl{$a^{\{n\}}$} as a 
   600 We represented the ``n-times'' \bl{$a^{\{n\}}$} as a 
   595 sequence regular expression:
   601 sequence regular expression:
   596 
   602 
   597 \begin{center}
   603 \begin{center}
   632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   633 
   639 
   634 
   640 
   635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   636 \begin{frame}[t]
   642 \begin{frame}[t]
   637 \frametitle{\bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}}
   643 \frametitle{Brzozowski: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$}}
   638 
   644 
   639 \begin{center}
   645 \begin{center}
   640 \begin{tikzpicture}
   646 \begin{tikzpicture}
   641 \begin{axis}[
   647 \begin{axis}[
   642     xlabel={$n$},
   648     xlabel={$n$},
   685 \end{frame}
   691 \end{frame}
   686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   687 
   693 
   688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   689 \begin{frame}[c]
   695 \begin{frame}[c]
   690 \frametitle{Simplifiaction}
   696 \frametitle{Simplification Rules}
   691 
   697 
   692 \begin{center}
   698 \begin{center}
   693 \bl{\begin{tabular}{rcl}
   699 \bl{\begin{tabular}{rcl}
   694 $r + \ZERO$       & $\Rightarrow$ & $r$\\
   700 $r + \ZERO$       & $\Rightarrow$ & $r$\\
   695 $\ZERO + r$       & $\Rightarrow$ & $r$\\
   701 $\ZERO + r$       & $\Rightarrow$ & $r$\\
   700 $r + r$           & $\Rightarrow$ & $r$
   706 $r + r$           & $\Rightarrow$ & $r$
   701 \end{tabular}}
   707 \end{tabular}}
   702 \end{center}
   708 \end{center}
   703 
   709 
   704 \footnotesize
   710 \footnotesize
   705 \lstinputlisting{../progs/app60.scala}
   711 \lstinputlisting[firstline=22,lastline=26]{../progs/app6.scala}
   706 \end{frame}
   712 \end{frame}
   707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   708 
   714 
   709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   710 \begin{frame}[c]
   716 \begin{frame}[c]
   711 
   717 
   712 \footnotesize
   718 \footnotesize
   713 \lstinputlisting{../progs/app6.scala}
   719 \lstinputlisting[firstline=1,lastline=21]{../progs/app6.scala}
   714 
   720 
   715 \end{frame}
   721 \end{frame}
   716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   717 
   723 
   718 
   724 
   719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   720 \begin{frame}[t]
   726 \begin{frame}[t]
   721 \frametitle{\bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}}
   727 \frametitle{Brzozowski: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$}}
   722 
   728 
   723 \begin{center}
   729 \begin{center}
   724 \begin{tikzpicture}
   730 \begin{tikzpicture}
   725 \begin{axis}[
   731 \begin{axis}[
   726     xlabel={$n$},
   732     xlabel={$n$},
   745 \end{center}
   751 \end{center}
   746 
   752 
   747 \end{frame}
   753 \end{frame}
   748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   749 
   755 
   750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   756 
   751 %\begin{frame}[c]
   757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   752 %\frametitle{\bl{$(a^*)^* \cdot b$}}
   758 \begin{frame}[c]
   753 %
   759   \frametitle{
   754 %\begin{center}
   760     Another Example\\[-1mm]
   755 %\begin{tikzpicture}
   761     in Java \liningnums{8} and Python}
   756 %  \begin{axis}[
   762 
   757 %    xlabel={$n$},
   763 \begin{center}
   758 %    x label style={at={(1.09,0.0)}},
   764 \begin{tikzpicture}
   759 %    ylabel={time in secs},
   765   \begin{axis}[
   760 %    enlargelimits=false,
   766     xlabel={$n$},
   761 %    xmax=27,
   767     x label style={at={(1.05,0.0)}},
   762 %    xtick={0,5,...,20},
   768     ylabel={time in secs},
   763 %    ytick={0,5,...,25},
   769     enlargelimits=false,
   764 %    ymax=13,
   770     xtick={0,5,...,30},
   765 %    scaled ticks=false,
   771     xmax=33,
   766 %    axis lines=left,
   772     ymax=35,
   767 %    width=9cm,
   773     ytick={0,10,...,30},
   768 %    height=5cm, 
   774     scaled ticks=false,
   769 %    legend entries={Scala V2},
   775     axis lines=left,
   770 %    legend pos=north west,
   776     width=9cm,
   771 %    legend cell align=left]
   777     height=5cm, 
   772 %\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
   778     legend entries={Java 8, Python},  
   773 %% still needs to be done
   779     legend pos=north west,
   774 %%\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
   780     legend cell align=left]
   775 %\end{axis}
   781 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
   776 %\end{tikzpicture}
   782 \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
   777 %\end{center}
   783 \end{axis}
   778 %
   784 \end{tikzpicture}
   779 %\end{frame}
   785 \end{center}
   780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   786 
   781 
   787 Regex: \bl{$(a^*)^* \cdot b$}
   782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   788 
   783 \begin{frame}[c]
   789 Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
   784 \frametitle{\bl{$(a^*)^* \cdot b$}}
   790 
       
   791 \end{frame}
       
   792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   793 
       
   794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   795 \begin{frame}[c]
       
   796 \frametitle{Same Example in Java \liningnums{9}+}
       
   797 
       
   798 \begin{center}
       
   799 \begin{tikzpicture}
       
   800   \begin{axis}[
       
   801     xlabel={$n$},
       
   802     x label style={at={(1.09,-0.15)}},
       
   803     ylabel={time in secs},
       
   804     scaled x ticks=false,
       
   805     enlargelimits=false,
       
   806     xtick distance=10000,
       
   807     xmax=44000, 
       
   808     ytick={0,10,...,30}, 
       
   809     ymax=35, 
       
   810     axis lines=left,
       
   811     width=9cm,
       
   812     height=5cm, 
       
   813     legend entries={Java \liningnums{9}+},
       
   814     legend pos=north west,
       
   815     legend cell align=left]
       
   816 \addplot[blue,mark=square*,mark options={fill=white}] table {re-java9.data};
       
   817 \end{axis}
       
   818 \end{tikzpicture}
       
   819 \end{center}
       
   820 
       
   821 Regex: \bl{$(a^*)^* \cdot b$}
       
   822 
       
   823 Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
       
   824 
       
   825 \end{frame}
       
   826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   827 
       
   828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   829 \begin{frame}[c]
       
   830 \frametitle{and with Brzozowski}
   785 
   831 
   786 \begin{center}
   832 \begin{center}
   787 \begin{tikzpicture}
   833 \begin{tikzpicture}
   788   \begin{axis}[
   834   \begin{axis}[
   789     xlabel={$n$},
   835     xlabel={$n$},
   790     x label style={at={(1.09,0.0)}},
   836     x label style={at={(1.09,0.0)}},
   791     ylabel={time in secs},
   837     ylabel={time in secs},
       
   838     scaled x ticks=false,
       
   839     xtick distance=2000000,
   792     enlargelimits=false,
   840     enlargelimits=false,
       
   841     xmax=6400000, 
   793     ytick={0,10,...,30},
   842     ytick={0,10,...,30},
   794     ymax=35,
   843     ymax=35,
   795     axis lines=left,
   844     axis lines=left,
   796     width=9cm,
   845     width=9cm,
   797     height=5cm, 
   846     height=5cm, 
   798     legend entries={Scala V3},
   847     legend entries={Scala V3},
   799     legend pos=north east,
   848     legend pos=north west,
   800     legend cell align=left]
   849     legend cell align=left]
   801 %\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
   850 %\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
   802 \addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
   851 \addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
   803 \end{axis}
   852 \end{axis}
   804 \end{tikzpicture}
   853 \end{tikzpicture}
   805 \end{center}
   854 \end{center}
   806 
   855 
   807 \end{frame}
   856 Regex: \bl{$(a^*)^* \cdot b$}
   808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   857 
   809 
   858 Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
   810 
   859 
       
   860 \end{frame}
       
   861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   811 
   862 
   812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   813 \begin{frame}[t]
   864 \begin{frame}[t]
   814 \frametitle{What is good about this Alg.}
   865 \frametitle{What is good about this Alg.}
   815 
   866