slides04.tex
changeset 38 cad34315db1b
parent 37 a83143293943
child 39 e5fb17c02508
equal deleted inserted replaced
37:a83143293943 38:cad34315db1b
   233 
   233 
   234 
   234 
   235 \end{frame}}
   235 \end{frame}}
   236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   237 
   237 
       
   238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   239 \mode<presentation>{
       
   240 \begin{frame}[c]
       
   241 \frametitle{\begin{tabular}{c}Negation\end{tabular}}
       
   242 
       
   243 Assume you have an alphabet consisting of the letters \bl{a}, \bl{b} and \bl{c} only.
       
   244 Find a regular expression that matches all strings \emph{except} \bl{ab}, \bl{ac} and \bl{cba}.
       
   245 
       
   246 \end{frame}}
       
   247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   248 
       
   249 
   238 
   250 
   239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   240 \mode<presentation>{
   252 \mode<presentation>{
   241 \begin{frame}[c]
   253 \begin{frame}[c]
   242 \frametitle{\begin{tabular}{c}Deterministic Finite Automata\end{tabular}}
   254 \frametitle{\begin{tabular}{c}Deterministic Finite Automata\end{tabular}}
   416 
   428 
   417 \begin{center}
   429 \begin{center}
   418 \begin{tabular}[b]{ll}
   430 \begin{tabular}[b]{ll}
   419 \bl{r$^*$} & \includegraphics[scale=0.7]{pics/star.jpg}\\
   431 \bl{r$^*$} & \includegraphics[scale=0.7]{pics/star.jpg}\\
   420 \end{tabular}
   432 \end{tabular}
   421 \end{center}
   433 \end{center}\pause\bigskip
   422 
   434 
   423 \end{frame}}
   435 Why can't we just have an epsilon transition from the accepting states to the starting state?
   424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   436 
   425 
   437 \end{frame}}
   426 
   438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   439 
   428 \mode<presentation>{
   440 
   429 \begin{frame}[c]
   441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   430 
   442 \mode<presentation>{
   431 \begin{textblock}{5}(1,1)
   443 \begin{frame}[c]
       
   444 \frametitle{\begin{tabular}{c}Subset Construction\end{tabular}}
       
   445 
       
   446 
       
   447 \begin{textblock}{5}(1,2.5)
   432 \includegraphics[scale=0.5]{pics/ch5.jpg}
   448 \includegraphics[scale=0.5]{pics/ch5.jpg}
   433 \end{textblock}
   449 \end{textblock}
   434 
   450 
   435 \begin{textblock}{11}(6.5,3)
   451 \begin{textblock}{11}(6.5,4.5)
   436 \begin{tabular}{r|cl}
   452 \begin{tabular}{r|cl}
   437 & a & b\\
   453 & a & b\\
   438 \hline
   454 \hline
   439 $\varnothing$ \onslide<2>{\textcolor{white}{*}} & $\varnothing$ & $\varnothing$\\
   455 $\varnothing$ \onslide<2>{\textcolor{white}{*}} & $\varnothing$ & $\varnothing$\\
   440 $\{0\}$ \onslide<2>{\textcolor{white}{*}} & $\{0,1,2\}$ & $\{2\}$\\
   456 $\{0\}$ \onslide<2>{\textcolor{white}{*}} & $\{0,1,2\}$ & $\{2\}$\\
   450 
   466 
   451 \end{frame}}
   467 \end{frame}}
   452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   453 
   469 
   454 
   470 
   455 
   471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   456 
   472 \mode<presentation>{
   457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   473 \begin{frame}[c]
   458 \mode<presentation>{
   474 \frametitle{\begin{tabular}{c}Regular Languages\end{tabular}}
   459 \begin{frame}[c]
       
   460 
       
   461 \begin{center}
       
   462 \includegraphics[scale=0.7]{pics/ch4.jpg}
       
   463 \end{center}
       
   464 
       
   465 \end{frame}}
       
   466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   467 
       
   468 
       
   469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   470 \mode<presentation>{
       
   471 \begin{frame}[c]
       
   472 \frametitle{\begin{tabular}{c}Languages\end{tabular}}
       
   473 
   475 
   474 A language is \alert{regular} iff there exists
   476 A language is \alert{regular} iff there exists
   475 a regular expression that recognises all its strings.\bigskip\bigskip\pause
   477 a regular expression that recognises all its strings.\bigskip\medskip
   476 
   478 
   477 \textcolor{gray}{not all languages are regular, e.g.~\bl{a$^n$b$^n$}.}
   479 or equivalently\bigskip\medskip
       
   480 
       
   481 A language is \alert{regular} iff there exists
       
   482 a deterministic finite automaton that recognises all its strings.\bigskip\pause
       
   483 
       
   484 Why is every finite set of strings a regular language?
       
   485 \end{frame}}
       
   486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   487 
       
   488 
       
   489 
       
   490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   491 \mode<presentation>{
       
   492 \begin{frame}[c]
       
   493 
       
   494 \begin{center}
       
   495 \includegraphics[scale=0.5]{pics/ch3.jpg}
       
   496 \end{center}
       
   497 
       
   498 \begin{center}
       
   499 \includegraphics[scale=0.5]{pics/ch4.jpg}\\
       
   500 minimal automaton
       
   501 \end{center}
       
   502 
       
   503 \end{frame}}
       
   504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   505 
       
   506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   507 \mode<presentation>{
       
   508 \begin{frame}[c]
       
   509 
       
   510 Given the function 
       
   511 
       
   512 \begin{center}
       
   513 \bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
       
   514 $rev(\varnothing)$   & $\dn$ & $\varnothing$\\
       
   515 $rev(\epsilon)$         & $\dn$ & $\epsilon$\\
       
   516 $rev(c)$                      & $\dn$ & $c$\\
       
   517 $rev(r_1 + r_2)$        & $\dn$ & $rev(r_1) + rev(r_2)$\\
       
   518 $rev(r_1 \cdot r_2)$  & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\
       
   519 $rev(r^*)$                   & $\dn$ & $rev(r)^*$\\
       
   520 \end{tabular}}
       
   521 \end{center}
       
   522 
       
   523 
       
   524 and the set
       
   525 
       
   526 \begin{center}
       
   527 \bl{$Rev\,A \dn \{s^{-1} \;|\; s \in A\}$}
       
   528 \end{center}
       
   529 
       
   530 prove whether
       
   531 
       
   532 \begin{center}
       
   533 \bl{$L(rev(r)) = Rev (L(r))$}
       
   534 \end{center}
       
   535 
       
   536 \end{frame}}
       
   537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   538 
       
   539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   540 \mode<presentation>{
       
   541 \begin{frame}[c]
       
   542 
       
   543 \begin{itemize}
       
   544 \item The star-case in our proof about the matcher needs the following lemma
       
   545 \begin{center}
       
   546 \bl{Der\,c\,A$^*$ $=$ (Der c A)\,@\, A$^*$}
       
   547 \end{center}
       
   548 \end{itemize}\bigskip\bigskip
       
   549 
       
   550 \begin{itemize}
       
   551 \item If \bl{\texttt{""} $\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B $\cup$ (Der\,c\,B)}\medskip
       
   552 \item If \bl{\texttt{""} $\not\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B}
       
   553 
       
   554 \end{itemize}
       
   555 
   478 \end{frame}}
   556 \end{frame}}
   479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   480 
   558 
   481 
   559 
   482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   493 
   571 
   494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   495 \mode<presentation>{
   573 \mode<presentation>{
   496 \begin{frame}[c]
   574 \begin{frame}[c]
   497 
   575 
   498 
   576 Assume you have an alphabet consisting of the letters \bl{$a$}, \bl{$b$} and \bl{$c$} only.
   499 
   577 (a) Find a regular expression that recognises the two strings \bl{$ab$} and \bl{$ac$}. (b)
   500 \begin{itemize}
   578 Find a regular expression that matches all strings \emph{except} these two strings.
   501 \item The star-case in our proof needs the following lemma
   579 Note, you can only use regular expressions of the form 
   502 \begin{center}
   580 \begin{center}
   503 \bl{Der\,c\,A$^*$ $=$ (Der c A)\,@\, A$^*$}
   581 \bl{$r ::= \varnothing \;|\; \epsilon \;|\; c  \;|\; r_1 + r_2  \;|\; r_1 \cdot r_2 \;|\; r^*$}
   504 \end{center}
   582 \end{center}
   505 \end{itemize}\bigskip\bigskip
       
   506 
       
   507 
       
   508 
       
   509 \begin{itemize}
       
   510 \item If \bl{\texttt{""} $\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B $\cup$ (Der\,c\,B)}\medskip
       
   511 \item If \bl{\texttt{""} $\not\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B}
       
   512 
       
   513 \end{itemize}
       
   514 
   583 
   515 \end{frame}}
   584 \end{frame}}
   516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   517 
   586 
   518 
   587