slides/slides03.tex
changeset 346 a98794b11ac4
parent 265 332fbe9c91ab
child 348 31e89128ccd2
equal deleted inserted replaced
345:0922b3e01289 346:a98794b11ac4
    36 \end{frame}
    36 \end{frame}
    37  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    37  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    38 
    38 
    39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    40 \begin{frame}[c]
    40 \begin{frame}[c]
    41 \frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
    41 \frametitle{Regular Expressions}
    42 
    42 
    43 In programming languages they are often used to recognise:\medskip
    43 In programming languages they are often used to recognise:\medskip
    44 
    44 
    45 \begin{itemize}
    45 \begin{itemize}
    46 \item symbols, digits
    46 \item symbols, digits
    58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    59 \begin{frame}[c]
    59 \begin{frame}[c]
    60 \frametitle{Last Week}
    60 \frametitle{Last Week}
    61 
    61 
    62 Last week I showed you a regular expression matcher 
    62 Last week I showed you a regular expression matcher 
    63 which works provably correct in all cases (we did not
    63 that works provably correct in all cases (we only
    64 do the proving part though)
    64 started with the proving part though)
    65 
    65 
    66 \begin{center}
    66 \begin{center}
    67 \bl{$matches\,r\,s$} \;\;if and only if \;\; \bl{$s \in L(r)$}
    67 \bl{$matches\,s\,r$} \;\;if and only if \;\; \bl{$s \in L(r)$}
    68 \end{center}\bigskip\bigskip 
    68 \end{center}\bigskip\bigskip 
    69 
    69 
    70 \small
    70 \small
    71 \textcolor{gray}{\mbox{}\hfill{}by Janusz Brzozowski (1964)}
    71 \textcolor{gray}{\mbox{}\hfill{}by Janusz Brzozowski (1964)}
    72 
    72 
   121 
   121 
   122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   123 \begin{frame}[c]
   123 \begin{frame}[c]
   124 \frametitle{The Idea of the Algorithm}
   124 \frametitle{The Idea of the Algorithm}
   125 
   125 
   126 If we want to recognise the string \bl{$abc$} with regular expression \bl{$r$}
   126 If we want to recognise the string \bl{$abc$} with regular
   127 then\medskip
   127 expression \bl{$r$} then\medskip
   128 
   128 
   129 \begin{enumerate}
   129 \begin{enumerate}
   130 \item \bl{$Der\,a\,(L(r))$}\pause
   130 \item \bl{$Der\,a\,(L(r))$}\pause
   131 \item \bl{$Der\,b\,(Der\,a\,(L(r)))$}\pause
   131 \item \bl{$Der\,b\,(Der\,a\,(L(r)))$}\pause
   132 \item \bl{$Der\,c\,(Der\,b\,(Der\,a\,(L(r))))$}\bigskip\pause
   132 \item \bl{$Der\,c\,(Der\,b\,(Der\,a\,(L(r))))$}\bigskip\pause
   181 \end{center}
   181 \end{center}
   182 
   182 
   183 by induction on the regular expression.
   183 by induction on the regular expression.
   184 \end{frame}
   184 \end{frame}
   185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   186 
       
   187 
   186 
   188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   189 \begin{frame}[c]
   188 \begin{frame}[c]
   190 \frametitle{Proofs about Rexps}
   189 \frametitle{Proofs about Rexps}
   191 
   190 
   216 \item \bl{$P$} holds for \bl{$[]$} and
   215 \item \bl{$P$} holds for \bl{$[]$} and
   217 \item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already
   216 \item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already
   218 holds for \bl{$s$}
   217 holds for \bl{$s$}
   219 \end{itemize}
   218 \end{itemize}
   220 
   219 
   221 \end{frame}
       
   222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   223 
       
   224 
       
   225 
       
   226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   227 \begin{frame}[c]
       
   228 \frametitle{Languages}
       
   229 
       
   230 A \alert{language} is a set of strings.\bigskip
       
   231 
       
   232 A \alert{regular expression} specifies a language.\bigskip
       
   233 
       
   234 A language is \alert{regular} iff there exists
       
   235 a regular expression that recognises all its strings.\bigskip\bigskip\pause
       
   236 
       
   237 \textcolor{gray}{not all languages are regular, e.g.~\bl{$a^nb^n$} is not}
       
   238 \end{frame}
   220 \end{frame}
   239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   240 
   222 
   241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   242 \begin{frame}[t]
   224 \begin{frame}[t]
   311 
   293 
   312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   313 \begin{frame}[c]
   295 \begin{frame}[c]
   314 \frametitle{Automata}
   296 \frametitle{Automata}
   315 
   297 
   316 A \alert{deterministic finite automaton} consists of:
   298 A \alert{\bf deterministic finite automaton}, DFA, consists of:
   317 
   299 
   318 \begin{itemize}
   300 \begin{itemize}
   319 \item a set of states
   301 \item a set of states \bl{$Q$}
   320 \item one of these states is the start state
   302 \item one of these states is the start state \bl{$q_0$}
   321 \item some states are accepting states, and
   303 \item some states are accepting states \bl{$F$}, and
   322 \item there is transition function\medskip 
   304 \item there is transition function \bl{$\delta$}\bigskip 
   323 
   305 
   324 \small
   306 \small
   325 which takes a state as argument and a character and produces a 
   307 which takes a state as argument and a character and produces a 
   326 new state\smallskip\\
   308 new state; this function might not be everywhere defined
   327 this function might not be everywhere defined
       
   328 \end{itemize}
   309 \end{itemize}
   329 
   310 
   330 \begin{center}
   311 \begin{center}
   331 \bl{$A(Q, q_0, F, \delta)$}
   312 \bl{$A(Q, q_0, F, \delta)$}
   332 \end{center}
   313 \end{center}
   354 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
   335 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
   355 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
   336 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
   356 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
   337 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
   357 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
   338 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
   358 \end{tikzpicture}
   339 \end{tikzpicture}
   359 \end{center}\pause
   340 \end{center}
   360 
   341 
   361 
   342 
   362 \begin{itemize}
   343 \begin{itemize}
   363 \item the start state can be an accepting state
   344 \item the start state can be an accepting state
   364 \item it is possible that there is no accepting state
   345 \item it is possible that there is no accepting state
   430 \end{frame}
   411 \end{frame}
   431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   432 
   413 
   433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   434 \begin{frame}[c]
   415 \begin{frame}[c]
       
   416 \frametitle{Regular Languages}
       
   417 
       
   418 A \alert{\bf language} is a set of strings.\bigskip
       
   419 
       
   420 A \alert{\bf regular expression} specifies a language.\bigskip
       
   421 
       
   422 A language is \alert{\bf regular} iff there exists
       
   423 a regular expression that recognises all its strings.\bigskip\bigskip\pause
       
   424 
       
   425 not all languages are regular, e.g.~\bl{$a^nb^n$} is not
       
   426 \end{frame}
       
   427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   428 
       
   429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   430 \begin{frame}[c]
       
   431 \frametitle{Regular Languages (2)}
       
   432 
       
   433 A language is \alert{\bf regular} iff there exists a regular
       
   434 expression that recognises all its strings.\bigskip\medskip
       
   435 
       
   436 or {\bf equivalently}\bigskip\medskip
       
   437 
       
   438 A language is \alert{\bf regular} iff there exists a
       
   439 deterministic finite automaton that recognises all its
       
   440 strings.
       
   441 
       
   442 \end{frame}
       
   443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   444 
       
   445 
       
   446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   447 \begin{frame}[c]
   435 \frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}}
   448 \frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}}
   436 
   449 
   437 A non-deterministic finite automaton consists again of:
   450 A non-deterministic finite automaton consists again of:
   438 
   451 
   439 \begin{itemize}
   452 \begin{itemize}
   460 
   473 
   461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   462 \begin{frame}[c]
   475 \begin{frame}[c]
   463 \frametitle{Two NFA Examples}
   476 \frametitle{Two NFA Examples}
   464 
   477 
       
   478 \small
   465 \begin{center}
   479 \begin{center}
   466 \begin{tabular}[t]{c@{\hspace{9mm}}c}
   480 \begin{tabular}[t]{c@{\hspace{9mm}}c}
   467 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   481 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   468                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
   482                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
   469 \node[state,initial]  (q_0)  {$q_0$};
   483 \node[state,initial]  (q_0)  {$q_0$};
   611 We (1) need to introduce a new starting state and (2) connect it to the original two starting states.
   625 We (1) need to introduce a new starting state and (2) connect it to the original two starting states.
   612 \end{frame}
   626 \end{frame}
   613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   614 
   628 
   615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   616 \mode<presentation>{
       
   617 \begin{frame}[c]
   630 \begin{frame}[c]
   618 \frametitle{Case $r^*$}
   631 \frametitle{Case $r^*$}
   619 
   632 
   620 \onslide<1>{By recursion we are given an automaton for $r$:\smallskip}
   633 \onslide<1>{By recursion we are given an automaton for $r$:\smallskip}
   621 
   634 
   650 \end{tikzpicture}\bigskip
   663 \end{tikzpicture}\bigskip
   651 
   664 
   652 \onslide<3->{
   665 \onslide<3->{
   653 Why can't we just have an epsilon transition from the accepting states to the starting state?}
   666 Why can't we just have an epsilon transition from the accepting states to the starting state?}
   654 
   667 
   655 \end{frame}}
   668 \end{frame}
   656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   657 
   670 
   658 
   671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   672 \begin{frame}[c]
   660 \mode<presentation>{
   673 \frametitle{Subset Construction}
   661 \begin{frame}[c]
       
   662 \frametitle{\begin{tabular}{c}Subset Construction\end{tabular}}
       
   663 
   674 
   664 
   675 
   665 \begin{textblock}{5}(1,1)
   676 \begin{textblock}{5}(1,1)
   666 \begin{center}
   677 \begin{center}
   667 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   678 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   680 
   691 
   681 \begin{textblock}{11}(6.5,4.5)
   692 \begin{textblock}{11}(6.5,4.5)
   682 \begin{tabular}{r|cl}
   693 \begin{tabular}{r|cl}
   683 nodes \textcolor{white}{*} & $a$ & $b$\\
   694 nodes \textcolor{white}{*} & $a$ & $b$\\
   684 \hline
   695 \hline
   685 $\varnothing$ \textcolor{white}{*} & \onslide<2->{$\varnothing$} & \onslide<2->{$\varnothing$}\\
   696 $\{\}$ \textcolor{white}{*} & \onslide<2->{$\{\}$} & \onslide<2->{$\{\}$}\\
   686 $\{0\}$ \textcolor{white}{*} & \onslide<3->{$\{0,1,2\}$} & \onslide<3->{$\{2\}$}\\
   697 $\{0\}$ \textcolor{white}{*} & \onslide<3->{$\{0,1,2\}$} & \onslide<3->{$\{2\}$}\\
   687 $\{1\}$ \textcolor{white}{*} & \onslide<3->{$\{1\}$} & \onslide<3->{$\varnothing$}\\
   698 $\{1\}$ \textcolor{white}{*} & \onslide<3->{$\{1\}$} & \onslide<3->{$\{\}$}\\
   688 $\{2\}$ \onslide<5->{*} & \onslide<3->{$\varnothing$} & \onslide<3->{$\{2\}$}\\
   699 $\{2\}$ \onslide<5->{*} & \onslide<3->{$\{\}$} & \onslide<3->{$\{2\}$}\\
   689 $\{0,1\}$ \textcolor{white}{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
   700 $\{0,1\}$ \textcolor{white}{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
   690 $\{0,2\}$ \onslide<5->{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
   701 $\{0,2\}$ \onslide<5->{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
   691 $\{1,2\}$ \onslide<5->{*} & \onslide<4->{$\{1\}$} & \onslide<4->{$\{2\}$}\\
   702 $\{1,2\}$ \onslide<5->{*} & \onslide<4->{$\{1\}$} & \onslide<4->{$\{2\}$}\\
   692 \onslide<5->{s:} $\{0,1,2\}$ \onslide<5->{*}& \onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
   703 \onslide<5->{s:} $\{0,1,2\}$ \onslide<5->{*}& \onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
   693 \end{tabular}
   704 \end{tabular}
   694 \end{textblock}
   705 \end{textblock}
   695 
   706 
   696 
   707 \end{frame}
   697 \end{frame}}
   708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   709 
       
   710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   711 \begin{frame}[c]
       
   712 \frametitle{The Result}
       
   713 
       
   714 \footnotesize
       
   715 \begin{center}
       
   716 \begin{tikzpicture}[scale=0.5,>=stealth',very thick,
       
   717                     every state/.style={minimum size=0pt,
       
   718                     draw=blue!50,very thick,fill=blue!20},
       
   719                     baseline=0mm]
       
   720 \node[state,initial,accepting]  (q012)  {$\{0,1,2\}$};
       
   721 \node[state,accepting] (q02) [right=of q012] {$\{0,2\}$};
       
   722 \node[state] (q01) [above=of q02] {$\{0,1\}$};
       
   723 \node[state,accepting] (q12) [below=of q02] {$\{1,2\}$};
       
   724 \node[state] (q0) [right=2cm of q01] {$\{0\}$};
       
   725 \node[state] (q1) [right=2.5cm of q02] {$\{1\}$};
       
   726 \node[state,accepting] (q2) [right=1.5cm of q12] {$\{2\}$};
       
   727 \node[state] (qn) [right=of q1] {$\{\}$};
       
   728 
       
   729 \path[->] (q012) edge [loop below] node  {$a$} ();
       
   730 \path[->] (q012) edge node [above]  {$b$} (q2);
       
   731 \path[->] (q12) edge [bend left] node [below,pos=0.4]  {$a$} (q1);
       
   732 \path[->] (q12) edge node [below]  {$b$} (q2);
       
   733 \path[->] (q02) edge node [above]  {$a$} (q012);
       
   734 \path[->] (q02) edge [bend left] node [above, pos=0.8]  {$b$} (q2);
       
   735 \path[->] (q01) edge node [below]  {$a$} (q012);
       
   736 \path[->] (q01) edge [bend left] node [above]  {$b$} (q2);
       
   737 \path[->] (q0) edge node [below]  {$a$} (q012);
       
   738 \path[->] (q0) edge node [right, pos=0.2]  {$b$} (q2);
       
   739 \path[->] (q1) edge [loop above] node  {$a$} ();
       
   740 \path[->] (q1) edge node [above]  {$b$} (qn);
       
   741 \path[->] (q2) edge [loop right] node  {$b$} ();
       
   742 \path[->] (q2) edge node [below]  {$a$} (qn);
       
   743 \path[->] (qn) edge [loop above] node  {$a,b$} ();
       
   744 \end{tikzpicture}
       
   745 \end{center}
       
   746 
       
   747 
       
   748 \end{frame}
       
   749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   750 
       
   751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   752 \begin{frame}[c]
       
   753 \frametitle{Removing Dead States}
       
   754 
       
   755 \footnotesize
       
   756 \begin{center}
       
   757 \begin{tabular}{ll}
       
   758 DFA: & NFA:\\
       
   759 \raisebox{10mm}{%
       
   760 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
       
   761                     every state/.style={minimum size=0pt,
       
   762                     draw=blue!50,very thick,fill=blue!20}]
       
   763 \node[state,initial,accepting]  (q012)  {$\{0,1,2\}$};
       
   764 \node[state,accepting] (q2) [right=of q012] {$\{2\}$};
       
   765 \node[state] (qn) [right=of q2] {$\{\}$};
       
   766 
       
   767 \path[->] (q012) edge [loop below] node  {\alert{$a$}} ();
       
   768 \path[->] (q012) edge node [above]  {\alert{$b$}} (q2);
       
   769 \path[->] (q2) edge [loop below] node  {\alert{$b$}} ();
       
   770 \path[->] (q2) edge node [below]  {\alert{$a$}} (qn);
       
   771 \path[->] (qn) edge [loop above] node 
       
   772    {$\alert{a},\alert{b}$} ();
       
   773 \end{tikzpicture}}
       
   774 &
       
   775 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
       
   776                     every state/.style={minimum size=0pt,
       
   777                     draw=blue!50,very thick,fill=blue!20},]
       
   778 \node[state,initial]  (q_0)  {$q_0$};
       
   779 \node[state] (q_1) [above=of q_0] {$q_1$};
       
   780 \node[state, accepting] (q_2) [below=of q_0] {$q_2$};
       
   781 \path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
       
   782 \path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
       
   783 \path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
       
   784 \path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
       
   785 \path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
       
   786 \end{tikzpicture}
       
   787 \end{tabular}
       
   788 \end{center}
       
   789 
       
   790 \end{frame}
       
   791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   792 
       
   793 
   699 
   794 
   700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   701 \begin{frame}[c]
   796 \begin{frame}[c]
   702 \frametitle{Regexps and Automata}
   797 \frametitle{Regexps and Automata}
   703 
   798 
   704 \begin{center}
   799 \begin{center}
   705 \begin{tikzpicture}
   800 \begin{tikzpicture}
   706 \node (rexp)  {\bl{\bf Regexps}};
   801 \node (rexp)  {\bl{\bf Regexps}};
   707 \node (nfa) [right=of rexp] {\bl{\bf NFAs}};
   802 \node (nfa) [right=of rexp] {\bl{\bf NFAs}};
   708 \node (dfa) [right=of nfa] {\bl{\bf DFAs}};
   803 \node (dfa) [right=of nfa] {\bl{\bf DFAs}};
   709 \onslide<3->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
   804 \onslide<2->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
   710 \path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
   805 \path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
   711 \path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
   806 \path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
   712 \onslide<3->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
   807 \onslide<2->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
       
   808 \end{tikzpicture}\\
       
   809 \end{center}
       
   810 
       
   811 \end{frame}
       
   812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   813 
       
   814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   815 \begin{frame}[c]
       
   816 \frametitle{DFA Minimisation}
       
   817 
       
   818 \begin{enumerate}
       
   819 \item Take all pairs \bl{$(q, p)$} with \bl{$q \not= p$}
       
   820 \item Mark all pairs that accepting and non-accepting states
       
   821 \item For  all unmarked pairs \bl{$(q, p)$} and all characters \bl{$c$} test whether
       
   822 \begin{center}
       
   823 \bl{$(\delta(q, c), \delta(p,c))$}
       
   824 \end{center} 
       
   825 are marked. If yes, then also mark \bl{$(q, p)$}.
       
   826 \item Repeat last step until no change.
       
   827 \item All unmarked pairs can be merged.
       
   828 \end{enumerate}
       
   829 
       
   830 \end{frame}
       
   831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   832 
       
   833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   834 \begin{frame}[c]
       
   835 
       
   836 \begin{center}
       
   837 \begin{tikzpicture}[>=stealth',very thick,auto,
       
   838                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
       
   839 \node[state,initial]  (q_0)  {$q_0$};
       
   840 \node[state] (q_1) [right=of q_0] {$q_1$};
       
   841 \node[state] (q_2) [below right=of q_0] {$q_2$};
       
   842 \node[state] (q_3) [right=of q_2] {$q_3$};
       
   843 \node[state, accepting] (q_4) [right=of q_1] {$q_4$};
       
   844 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
       
   845 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
       
   846 \path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
       
   847 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
       
   848 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
       
   849 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
       
   850 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
       
   851 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
       
   852 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
       
   853 \end{tikzpicture}
       
   854 \end{center}
       
   855 
       
   856 \mbox{}\\[-20mm]\mbox{}
       
   857 
       
   858 \begin{center}
       
   859 \begin{tikzpicture}[scale=0.8,line width=0.8mm]
       
   860 \draw (0,0) -- (4,0);
       
   861 \draw (0,1) -- (4,1);
       
   862 \draw (0,2) -- (3,2);
       
   863 \draw (0,3) -- (2,3);
       
   864 \draw (0,4) -- (1,4);
       
   865 
       
   866 \draw (0,0) -- (0, 4);
       
   867 \draw (1,0) -- (1, 4);
       
   868 \draw (2,0) -- (2, 3);
       
   869 \draw (3,0) -- (3, 2);
       
   870 \draw (4,0) -- (4, 1);
       
   871 
       
   872 \draw (0.5,-0.5) node {$q_0$}; 
       
   873 \draw (1.5,-0.5) node {$q_1$}; 
       
   874 \draw (2.5,-0.5) node {$q_2$}; 
       
   875 \draw (3.5,-0.5) node {$q_3$};
       
   876  
       
   877 \draw (-0.5, 3.5) node {$q_1$}; 
       
   878 \draw (-0.5, 2.5) node {$q_2$}; 
       
   879 \draw (-0.5, 1.5) node {$q_3$}; 
       
   880 \draw (-0.5, 0.5) node {$q_4$}; 
       
   881 
       
   882 \draw (0.5,0.5) node {\large$\star$}; 
       
   883 \draw (1.5,0.5) node {\large$\star$}; 
       
   884 \draw (2.5,0.5) node {\large$\star$}; 
       
   885 \draw (3.5,0.5) node {\large$\star$};
       
   886 \end{tikzpicture}
       
   887 \end{center}
       
   888 
       
   889 \end{frame}
       
   890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   891 
       
   892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   893 \begin{frame}[c]
       
   894 
       
   895 \begin{center}
       
   896 \begin{tabular}{@{\hspace{-8mm}}cc@{}}
       
   897 \begin{tikzpicture}[>=stealth',very thick,auto,
       
   898                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
       
   899 \node[state,initial]  (q_0)  {$q_0$};
       
   900 \node[state] (q_1) [right=of q_0] {$q_1$};
       
   901 \node[state] (q_2) [below right=of q_0] {$q_2$};
       
   902 \node[state] (q_3) [right=of q_2] {$q_3$};
       
   903 \node[state, accepting] (q_4) [right=of q_1] {$q_4$};
       
   904 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
       
   905 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
       
   906 \path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
       
   907 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
       
   908 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
       
   909 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
       
   910 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
       
   911 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
       
   912 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
       
   913 \end{tikzpicture}
       
   914 &
       
   915 \raisebox{9mm}{\begin{tikzpicture}[scale=0.6,line width=0.8mm]
       
   916 \draw (0,0) -- (4,0);
       
   917 \draw (0,1) -- (4,1);
       
   918 \draw (0,2) -- (3,2);
       
   919 \draw (0,3) -- (2,3);
       
   920 \draw (0,4) -- (1,4);
       
   921 
       
   922 \draw (0,0) -- (0, 4);
       
   923 \draw (1,0) -- (1, 4);
       
   924 \draw (2,0) -- (2, 3);
       
   925 \draw (3,0) -- (3, 2);
       
   926 \draw (4,0) -- (4, 1);
       
   927 
       
   928 \draw (0.5,-0.5) node {$q_0$}; 
       
   929 \draw (1.5,-0.5) node {$q_1$}; 
       
   930 \draw (2.5,-0.5) node {$q_2$}; 
       
   931 \draw (3.5,-0.5) node {$q_3$};
       
   932  
       
   933 \draw (-0.5, 3.5) node {$q_1$}; 
       
   934 \draw (-0.5, 2.5) node {$q_2$}; 
       
   935 \draw (-0.5, 1.5) node {$q_3$}; 
       
   936 \draw (-0.5, 0.5) node {$q_4$}; 
       
   937 
       
   938 \draw (0.5,0.5) node {\large$\star$}; 
       
   939 \draw (1.5,0.5) node {\large$\star$}; 
       
   940 \draw (2.5,0.5) node {\large$\star$}; 
       
   941 \draw (3.5,0.5) node {\large$\star$};
       
   942 \draw (0.5,1.5) node {\large$\star$}; 
       
   943 \draw (2.5,1.5) node {\large$\star$}; 
       
   944 \draw (0.5,3.5) node {\large$\star$}; 
       
   945 \draw (1.5,2.5) node {\large$\star$}; 
       
   946 \end{tikzpicture}}
       
   947 \end{tabular}
       
   948 \end{center}
       
   949 
       
   950 
       
   951 \mbox{}\\[-20mm]\mbox{}
       
   952 
       
   953 \begin{center}
       
   954 \begin{tikzpicture}[>=stealth',very thick,auto,
       
   955                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
       
   956 \node[state,initial]  (q_02)  {$q_{0, 2}$};
       
   957 \node[state] (q_13) [right=of q_02] {$q_{1, 3}$};
       
   958 \node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$};
       
   959 \path[->] (q_02) edge [bend left] node [above]  {\alert{$a$}} (q_13);
       
   960 \path[->] (q_13) edge [bend left] node [below]  {\alert{$b$}} (q_02);
       
   961 \path[->] (q_02) edge [loop below] node  {\alert{$b$}} ();
       
   962 \path[->] (q_13) edge node [above]  {\alert{$a$}} (q_4);
       
   963 \path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
       
   964 \end{tikzpicture}\\
       
   965 minimal automaton
       
   966 \end{center}
       
   967 
       
   968 \end{frame}
       
   969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   970 
       
   971 
       
   972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   973 \begin{frame}[c]
       
   974 \frametitle{Alternatives}
       
   975 \mbox{}\\[-17mm]\mbox{}
       
   976 
       
   977 \begin{center}
       
   978 \begin{tikzpicture}[>=stealth',very thick,auto,
       
   979                     every state/.style={minimum size=0pt,
       
   980                     inner sep=2pt,draw=blue!50,very thick,fill=blue!20}]
       
   981 \only<1>{\node[state,initial]  (q_0)  {$q_0$};}
       
   982 \only<2->{\node[state,accepting]  (q_0)  {$q_0$};}
       
   983 \node[state] (q_1) [right=of q_0] {$q_1$};
       
   984 \node[state] (q_2) [below right=of q_0] {$q_2$};
       
   985 \node[state] (q_3) [right=of q_2] {$q_3$};
       
   986 \only<1>{\node[state, accepting] (q_4) [right=of q_1] {$q_4$};}
       
   987 \only<2->{\node[state, initial right] (q_4) [right=of q_1] {$q_4$};}
       
   988 \only<1-2>{
       
   989 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
       
   990 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
       
   991 \path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
       
   992 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
       
   993 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
       
   994 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
       
   995 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
       
   996 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
       
   997 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);}
       
   998 \only<3->{
       
   999 \path[<-] (q_0) edge node [above]  {\alert{$a$}} (q_1);
       
  1000 \path[<-] (q_1) edge node [above]  {\alert{$a$}} (q_4);
       
  1001 \path[<-] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
       
  1002 \path[<-] (q_3) edge node [right]  {\alert{$a$}} (q_4);
       
  1003 \path[<-] (q_2) edge node [above]  {\alert{$a$}} (q_3);
       
  1004 \path[<-] (q_1) edge node [right]  {\alert{$b$}} (q_2);
       
  1005 \path[<-] (q_0) edge node [above]  {\alert{$b$}} (q_2);
       
  1006 \path[<-] (q_2) edge [loop left] node  {\alert{$b$}} ();
       
  1007 \path[<-] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);}
       
  1008 \end{tikzpicture}
       
  1009 \end{center}
       
  1010 \mbox{}\\[-18mm]
       
  1011 
       
  1012 \small
       
  1013 \begin{itemize}
       
  1014 \item<2-> exchange initial / accepting states\\[-2mm]
       
  1015 \item<3-> reverse all edges\\[-2mm]
       
  1016 \item<4-> subset construction $\Rightarrow$ DFA\\[-2mm]
       
  1017 \item<5-> remove dead states\\[-2mm]
       
  1018 \item<6-> repeat once more 
       
  1019           \onslide<6->{$\Rightarrow$ minimal DFA}
       
  1020 \end{itemize}
       
  1021 
       
  1022 \end{frame}
       
  1023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
  1024 
       
  1025 
       
  1026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1027 \begin{frame}[c]
       
  1028 \frametitle{Regexps and Automata}
       
  1029 
       
  1030 \begin{center}
       
  1031 \begin{tikzpicture}
       
  1032 \node (rexp)  {\bl{\bf Regexps}};
       
  1033 \node (nfa) [right=of rexp] {\bl{\bf NFAs}};
       
  1034 \node (dfa) [right=of nfa] {\bl{\bf DFAs}};
       
  1035 \onslide<1->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
       
  1036 \path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
       
  1037 \path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
       
  1038 \onslide<1->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
   713 \onslide<2->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
  1039 \onslide<2->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
   714 \end{tikzpicture}\\
  1040 \end{tikzpicture}\\
   715 \end{center}
  1041 \end{center}
   716 
  1042 
   717 \end{frame}
  1043 \end{frame}
   718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
  1044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   719 
  1045 
   720 
  1046 
   721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1047 
   722 \mode<presentation>{
  1048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   723 \begin{frame}[c]
       
   724 \frametitle{\begin{tabular}{c}Regular Languages\end{tabular}}
       
   725 
       
   726 A language is \alert{regular} iff there exists
       
   727 a regular expression that recognises all its strings.\bigskip\medskip
       
   728 
       
   729 or {\bf equivalently}\bigskip\medskip
       
   730 
       
   731 A language is \alert{regular} iff there exists
       
   732 a deterministic finite automaton that recognises all its strings.\bigskip\medskip\pause
       
   733 
       
   734 Why is every finite set of strings a regular language?
       
   735 \end{frame}}
       
   736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   737 
       
   738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   739 \mode<presentation>{
       
   740 \begin{frame}<2>[c]
  1049 \begin{frame}<2>[c]
   741 \frametitle{DFA to Rexp}
  1050 \frametitle{DFA to Rexp}
   742 
  1051 
   743 \begin{center}
  1052 \begin{center}
   744 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1053 \begin{tikzpicture}[scale=2,>=stealth',very thick,
   759 \end{tikzpicture}
  1068 \end{tikzpicture}
   760 \end{center}
  1069 \end{center}
   761 
  1070 
   762 \onslide<3>{How to get from a DFA to a regular expression?}
  1071 \onslide<3>{How to get from a DFA to a regular expression?}
   763 
  1072 
   764 \end{frame}}
  1073 \end{frame}
   765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
  1074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   766 
  1075 
   767 
  1076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   769 \mode<presentation>{
       
   770 \begin{frame}[c]
  1077 \begin{frame}[c]
   771 
  1078 
   772 \begin{center}
  1079 \begin{center}
   773 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1080 \begin{tikzpicture}[scale=2,>=stealth',very thick,
   774                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1081                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
   794 
  1101 
   795 \end{tabular}
  1102 \end{tabular}
   796 \end{center}
  1103 \end{center}
   797 }
  1104 }
   798 
  1105 
   799 \end{frame}}
  1106 \end{frame}
   800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
  1107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   801 
  1108 
   802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   803 \mode<presentation>{
       
   804 \begin{frame}[c]
  1110 \begin{frame}[c]
   805 
  1111 
   806 \begin{center}
  1112 \begin{center}
   807 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1113 \begin{tikzpicture}[scale=2,>=stealth',very thick,
   808                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1114                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
   835 \begin{center}
  1141 \begin{center}
   836 If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$}
  1142 If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$}
   837 \end{center}
  1143 \end{center}
   838 }
  1144 }
   839 
  1145 
   840 \end{frame}}
  1146 \end{frame}
   841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
  1147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   842 
  1148 
   843 
  1149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   844 
  1150 \begin{frame}[c]
   845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1151 \frametitle{Regexps and Automata}
   846 \mode<presentation>{
  1152 
       
  1153 \begin{center}
       
  1154 \begin{tikzpicture}
       
  1155 \node (rexp)  {\bl{\bf Regexps}};
       
  1156 \node (nfa) [right=of rexp] {\bl{\bf NFAs}};
       
  1157 \node (dfa) [right=of nfa] {\bl{\bf DFAs}};
       
  1158 \onslide<1->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
       
  1159 \path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
       
  1160 \path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
       
  1161 \onslide<1->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
       
  1162 \onslide<1->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
       
  1163 \end{tikzpicture}\\
       
  1164 \end{center}
       
  1165 
       
  1166 \end{frame}
       
  1167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
  1168 
       
  1169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1170 \begin{frame}[c]
       
  1171 \frametitle{Regular Languages (3)}
       
  1172 
       
  1173 A language is \alert{\bf regular} iff there exists a regular
       
  1174 expression that recognises all its strings.\bigskip\medskip
       
  1175 
       
  1176 or {\bf equivalently}\bigskip\medskip
       
  1177 
       
  1178 A language is \alert{\bf regular} iff there exists a
       
  1179 deterministic finite automaton that recognises all its
       
  1180 strings.\bigskip\medskip\pause
       
  1181 
       
  1182 Why is every finite set of strings a regular language?
       
  1183 \end{frame}
       
  1184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
  1185 
       
  1186 
       
  1187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   847 \begin{frame}[c]
  1188 \begin{frame}[c]
   848 
  1189 
   849 Given the function 
  1190 Given the function 
   850 
  1191 
   851 \begin{center}
  1192 \begin{center}
   870 
  1211 
   871 \begin{center}
  1212 \begin{center}
   872 \bl{$L(rev(r)) = Rev (L(r))$}
  1213 \bl{$L(rev(r)) = Rev (L(r))$}
   873 \end{center}
  1214 \end{center}
   874 
  1215 
   875 \end{frame}}
  1216 \end{frame}
   876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
  1217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   877 
  1218 
   878 
  1219 
   879 \end{document}
  1220 \end{document}
   880 
  1221