slides/slides03.tex
changeset 515 3566c8175e63
parent 500 c502933be072
child 517 edab48a5b37e
equal deleted inserted replaced
513:676e6484f29b 515:3566c8175e63
    27 \normalsize
    27 \normalsize
    28   \begin{center}
    28   \begin{center}
    29   \begin{tabular}{lp{8cm}}
    29   \begin{tabular}{lp{8cm}}
    30   Email:  & christian.urban at kcl.ac.uk\\
    30   Email:  & christian.urban at kcl.ac.uk\\
    31   Office: & N7.07 (North Wing, Bush House)\\
    31   Office: & N7.07 (North Wing, Bush House)\\
    32   Slides: & KEATS (also home work and coursework is there)\\
    32   Slides: & KEATS (also homework and coursework is there)\\
    33   \end{tabular}
    33   \end{tabular}
    34   \end{center}
    34   \end{center}
    35 
    35 
    36 \end{frame}
    36 \end{frame}
    37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    40 \begin{frame}[c]
    40 \begin{frame}[c]
    41 \frametitle{Scala Book, Exams}
    41 \frametitle{Scala Book, Exams}
    42 
    42 
    43 \begin{itemize}
    43 \begin{itemize}
    44 \item www.inf.kcl.ac.uk/~urbanc/ProgInScala2ed.pdf
    44 \item \small https://nms.kcl.ac.uk/christian.urban/ProgInScala2ed.pdf\normalsize
    45 \item homeworks (exam 80\%)
    45 \item homeworks (written exam 80\%)
    46 \item coursework (20\%)
    46 \item coursework (20\%)\bigskip
       
    47 \item short survey at KEATS; to be answered until Sunday    
    47 \end{itemize}
    48 \end{itemize}
    48 
    49 
    49 \end{frame}
    50 \end{frame}
    50 %%%%%%%%%%%
    51 %%%%%%%%%%%
    51 
    52 
   109 \end{frame}
   110 \end{frame}
   110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   111 
   112 
   112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   113 \begin{frame}[c]
   114 \begin{frame}[c]
       
   115 \frametitle{Example}
       
   116 
       
   117 Given \bl{$r \dn ((a \cdot b) + b)^*$} what is
       
   118 
       
   119 \begin{center}
       
   120 \def\arraystretch{1.5}  
       
   121 \begin{tabular}{@{}lcl}
       
   122   \bl{$\der\,a\,((a \cdot b) + b)^*$}
       
   123     & \bl{$\Rightarrow$}& \bl{$\der\,a\, \underline{((a \cdot b) + b)^*}$}\\
       
   124     & \bl{$=$} & \bl{$(der\,a\,(\underline{(a \cdot b) + b})) \cdot r$}\\
       
   125     & \bl{$=$} & \bl{$((der\,a\,(\underline{a \cdot b})) + (der\,a\,b)) \cdot r$}\\
       
   126     & \bl{$=$} & \bl{$(((der\,a\,\underline{a}) \cdot b) + (der\,a\,b)) \cdot r$}\\
       
   127     & \bl{$=$} & \bl{$((\ONE \cdot b) + (der\,a\,\underline{b})) \cdot r$}\\
       
   128     & \bl{$=$} & \bl{$((\ONE \cdot b) + \ZERO) \cdot r$}\\
       
   129 \end{tabular}
       
   130 \end{center}
       
   131 
       
   132 \end{frame}
       
   133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   134 
       
   135 
       
   136 
       
   137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   138 \begin{frame}[c]
   114 
   139 
   115 Input: string \bl{$abc$} and regular expression \bl{$r$} 
   140 Input: string \bl{$abc$} and regular expression \bl{$r$} 
   116 
   141 
   117 \begin{enumerate}
   142 \begin{enumerate}
   118 \item \bl{$der\,a\,r$}
   143 \item \bl{$der\,a\,r$}
   120 \item \bl{$der\,c\,(der\,b\,(der\,a\,r))$}\bigskip\pause
   145 \item \bl{$der\,c\,(der\,b\,(der\,a\,r))$}\bigskip\pause
   121 \item finally check whether the last regular expression can match the empty string
   146 \item finally check whether the last regular expression can match the empty string
   122 \end{enumerate}
   147 \end{enumerate}
   123 
   148 
   124 \end{frame}
   149 \end{frame}
   125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   126 
   151 
   127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   128 \begin{frame}[c]
   153 \begin{frame}[c]
   129 
   154 \frametitle{Simplification}
   130 We proved already
   155 
       
   156 Given \bl{$r \dn ((a \cdot b) + b)^*$} what is
       
   157 
       
   158 \begin{center}
       
   159 \def\arraystretch{2}  
       
   160 \begin{tabular}{@{}lcl}
       
   161   \bl{$((\ONE \cdot b) + \ZERO) \cdot r$}
       
   162     & \bl{$\Rightarrow$} & \bl{$((\underline{\ONE \cdot b}) + \ZERO) \cdot r$}\\
       
   163     & \bl{$=$} & \bl{$(\underline{b + \ZERO}) \cdot r$}\\
       
   164     & \bl{$=$} & \bl{$b \cdot r$}\\
       
   165 \end{tabular}
       
   166 \end{center}
       
   167 
       
   168 \end{frame}
       
   169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   170 
       
   171 
       
   172 
       
   173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   174 \begin{frame}[c]
       
   175 
       
   176 We proved partially
   131 
   177 
   132 \begin{center}
   178 \begin{center}
   133 \bl{$nullable(r)$} \;if and only if\;  \bl{$[] \in L(r)$}
   179 \bl{$nullable(r)$} \;if and only if\;  \bl{$[] \in L(r)$}
   134 \end{center}
   180 \end{center}
   135 
   181 
   195 \begin{frame}[t]
   241 \begin{frame}[t]
   196 \frametitle{Regular Expressions}
   242 \frametitle{Regular Expressions}
   197 
   243 
   198 \begin{center}
   244 \begin{center}
   199    \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
   245    \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
   200   \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}  & null\\
   246   \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}  & nothing\\
   201          & \bl{$\mid$} & \bl{$\ONE$}        & empty string / "" / $[]$\\
   247          & \bl{$\mid$} & \bl{$\ONE$}        & empty string / "" / $[]$\\
   202          & \bl{$\mid$} & \bl{$c$}                         & character\\
   248          & \bl{$\mid$} & \bl{$c$}                         & character\\
   203          & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
   249          & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
   204          & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
   250          & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
   205          & \bl{$\mid$} & \bl{$r^*$}                   & star (zero or more)\\
   251          & \bl{$\mid$} & \bl{$r^*$}                   & star (zero or more)\\
   241 \bl{$ab$} and \bl{$ac$}!
   287 \bl{$ab$} and \bl{$ac$}!
   242 
   288 
   243 \end{frame}
   289 \end{frame}
   244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   245 
   291 
   246 
       
   247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   248 %\mode<presentation>{
       
   249 %\begin{frame}[c]
       
   250 %\frametitle{\begin{tabular}{c}Regular Exp's for Lexing\end{tabular}}
       
   251 %
       
   252 %Lexing separates strings into ``words'' / components.
       
   253 %
       
   254 %\begin{itemize}
       
   255 %\item Identifiers (non-empty strings of letters or digits, starting with a letter)
       
   256 %\item Numbers (non-empty sequences of digits omitting leading zeros)
       
   257 %\item Keywords (else, if, while, \ldots)
       
   258 %\item White space (a non-empty sequence of blanks, newlines and tabs)
       
   259 %\item Comments
       
   260 %\end{itemize}
       
   261 %
       
   262 %\end{frame}}
       
   263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   264 
       
   265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   266 \begin{frame}[c]
   293 \begin{frame}[c]
   267 \frametitle{Automata}
   294 \frametitle{Automata}
   268 
   295 
   269 A \alert{\bf deterministic finite automaton}, DFA, consists of:
   296 A \alert{\bf deterministic finite automaton}, DFA, consists of:
   270 
   297 
   271 \begin{itemize}
   298 \begin{itemize}
       
   299 \item an alphabet \bl{$\varSigma$}  
   272 \item a set of states \bl{$Q$}
   300 \item a set of states \bl{$Q$}
   273 \item one of these states is the start state \bl{$q_0$}
   301 \item one of these states is the start state \bl{$\mbox{Q}_0$}
   274 \item some states are accepting states \bl{$F$}, and
   302 \item some states are accepting states \bl{$F$}, and
   275 \item there is transition function \bl{$\delta$}\bigskip 
   303 \item there is transition function \bl{$\delta$}\bigskip 
   276 
   304 
   277 \small
   305 \small
   278 which takes a state as argument and a character and produces a 
   306 which takes a state as argument and a character and produces a 
   279 new state; this function might not be everywhere defined
   307 new state; this function might not be everywhere defined $\Rightarrow$ partial function
   280 \end{itemize}
   308 \end{itemize}
   281 
   309 
   282 \begin{center}
   310 \begin{center}
   283 \bl{$A(Q, q_0, F, \delta)$}
   311 \bl{$A(\varSigma, \mbox{Q}, \mbox{Q}_0, F, \delta)$}
   284 \end{center}
   312 \end{center}
   285 
   313 
   286 \end{frame}
   314 \end{frame}
   287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   288 
   316 
   291 \begin{frame}[c]
   319 \begin{frame}[c]
   292 
   320 
   293 \begin{center}
   321 \begin{center}
   294 \begin{tikzpicture}[>=stealth',very thick,auto,
   322 \begin{tikzpicture}[>=stealth',very thick,auto,
   295                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   323                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   296 \node[state,initial]  (q_0)  {$q_0$};
   324 \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
   297 \node[state] (q_1) [right=of q_0] {$q_1$};
   325 \node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
   298 \node[state] (q_2) [below right=of q_0] {$q_2$};
   326 \node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};
   299 \node[state] (q_3) [right=of q_2] {$q_3$};
   327 \node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};
   300 \node[state, accepting] (q_4) [right=of q_1] {$q_4$};
   328 \node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};
   301 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
   329 \path[->] (Q_0) edge node [above]  {\alert{$a$}} (Q_1);
   302 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
   330 \path[->] (Q_1) edge node [above]  {\alert{$a$}} (Q_4);
   303 \path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
   331 \path[->] (Q_4) edge [loop right] node  {\alert{$a, b$}} ();
   304 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
   332 \path[->] (Q_3) edge node [right]  {\alert{$a$}} (Q_4);
   305 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
   333 \path[->] (Q_2) edge node [above]  {\alert{$a$}} (Q_3);
   306 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
   334 \path[->] (Q_1) edge node [right]  {\alert{$b$}} (Q_2);
   307 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
   335 \path[->] (Q_0) edge node [above]  {\alert{$b$}} (Q_2);
   308 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
   336 \path[->] (Q_2) edge [loop left] node  {\alert{$b$}} ();
   309 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
   337 \path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (Q_0);
   310 \end{tikzpicture}
   338 \end{tikzpicture}
   311 \end{center}
   339 \end{center}
   312 
   340 
   313 
   341 
   314 \begin{itemize}
   342 \begin{itemize}
   324 \begin{frame}[c]
   352 \begin{frame}[c]
   325 
   353 
   326 \begin{center}
   354 \begin{center}
   327 \begin{tikzpicture}[>=stealth',very thick,auto,
   355 \begin{tikzpicture}[>=stealth',very thick,auto,
   328                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   356                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   329 \node[state,initial]  (q_0)  {$q_0$};
   357 \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
   330 \node[state] (q_1) [right=of q_0] {$q_1$};
   358 \node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
   331 \node[state] (q_2) [below right=of q_0] {$q_2$};
   359 \node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};
   332 \node[state] (q_3) [right=of q_2] {$q_3$};
   360 \node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};
   333 \node[state, accepting] (q_4) [right=of q_1] {$q_4$};
   361 \node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};
   334 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
   362 \path[->] (Q_0) edge node [above]  {\alert{$a$}} (Q_1);
   335 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
   363 \path[->] (Q_1) edge node [above]  {\alert{$a$}} (Q_4);
   336 \path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
   364 \path[->] (Q_4) edge [loop right] node  {\alert{$a, b$}} ();
   337 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
   365 \path[->] (Q_3) edge node [right]  {\alert{$a$}} (Q_4);
   338 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
   366 \path[->] (Q_2) edge node [above]  {\alert{$a$}} (Q_3);
   339 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
   367 \path[->] (Q_1) edge node [right]  {\alert{$b$}} (Q_2);
   340 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
   368 \path[->] (Q_0) edge node [above]  {\alert{$b$}} (Q_2);
   341 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
   369 \path[->] (Q_2) edge [loop left] node  {\alert{$b$}} ();
   342 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
   370 \path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (Q_0);
   343 \end{tikzpicture}
   371 \end{tikzpicture}
   344 \end{center}
   372 \end{center}
   345 
   373 
   346 for this automaton \bl{$\delta$} is the function\\
   374 for this automaton \bl{$\delta$} is the function\\
   347 
   375 
   348 \begin{center}
   376 \begin{center}
   349 \begin{tabular}{lll}
   377 \begin{tabular}{lll}
   350 \bl{$(q_0, a) \rightarrow q_1$} & \bl{$(q_1, a) \rightarrow q_4$} & \bl{$(q_4, a) \rightarrow q_4$}\\
   378   \bl{$(\mbox{Q}_0, a) \rightarrow \mbox{Q}_1$} & \bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_4$}
   351 \bl{$(q_0, b) \rightarrow q_2$} & \bl{$(q_1, b) \rightarrow q_2$} & \bl{$(q_4, b) \rightarrow q_4$}\\
   379   & \bl{$(\mbox{Q}_4, a) \rightarrow \mbox{Q}_4$}\\
       
   380   \bl{$(\mbox{Q}_0, b) \rightarrow \mbox{Q}_2$} & \bl{$(\mbox{Q}_1, b) \rightarrow \mbox{Q}_2$} &
       
   381   \bl{$(\mbox{Q}_4, b) \rightarrow \mbox{Q}_4$}\\
   352 \end{tabular}\ldots
   382 \end{tabular}\ldots
   353 \end{center}
   383 \end{center}
   354 
   384 
   355 \end{frame}
   385 \end{frame}
   356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   360 \frametitle{Accepting a String}
   390 \frametitle{Accepting a String}
   361 
   391 
   362 Given
   392 Given
   363 
   393 
   364 \begin{center}
   394 \begin{center}
   365 \bl{$A(Q, q_0, F, \delta)$}
   395 \bl{$A(\varSigma, \mbox{Q}, \mbox{Q}_0, F, \delta)$}
   366 \end{center}
   396 \end{center}
   367 
   397 
   368 you can define
   398 you can define
   369 
   399 
   370 \begin{center}
   400 \begin{center}
   371 \begin{tabular}{l}
   401 \begin{tabular}{l}
   372 \bl{$\hat{\delta}(q, []) \dn q$}\\
   402 \bl{$\widehat{\delta}(q, []) \dn q$}\\
   373 \bl{$\hat{\delta}(q, c::s) \dn \hat{\delta}(\delta(q, c), s)$}\\
   403 \bl{$\widehat{\delta}(q, c::s) \dn \widehat{\delta}(\delta(q, c), s)$}\\
   374 \end{tabular}
   404 \end{tabular}
   375 \end{center}\pause
   405 \end{center}\pause
   376 
   406 
   377 Whether a string \bl{$s$} is accepted by \bl{$A$}?
   407 Whether a string \bl{$s$} is accepted by \bl{$A$}?
   378 
   408 
   379 \begin{center}
   409 \begin{center}
   380 \hspace{5mm}\bl{$\hat{\delta}(q_0, s) \in F$}
   410 \hspace{5mm}\bl{$\hat{\delta}(\mbox{Q}_0, s) \in F$}
   381 \end{center}
   411 \end{center}
   382 \end{frame}
   412 \end{frame}
   383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   384 
   414 
   385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   418 \begin{frame}[c]
   448 \begin{frame}[c]
   419 \frametitle{\begin{tabular}{c}
   449 \frametitle{\begin{tabular}{c}
   420               Non-Deterministic\\[-1mm] 
   450               Non-Deterministic\\[-1mm] 
   421               Finite Automata\end{tabular}}
   451               Finite Automata\end{tabular}}
   422 
   452 
   423 A non-deterministic finite automaton consists again of:
   453 A non-deterministic finite automaton (NFA) consists again of:
   424 
   454 
   425 \begin{itemize}
   455 \begin{itemize}
   426 \item a finite set of states
   456 \item a finite set of states
   427 \item one of these states is the start state
   457 \item \underline{some} these states are the start states
   428 \item some states are accepting states, and
   458 \item some states are accepting states, and
   429 \item there is transition \alert{relation}\medskip 
   459 \item there is transition \alert{relation}\medskip 
   430 \end{itemize}
   460 \end{itemize}
   431 
   461 
   432 
   462 
   433 \begin{center}
   463 \begin{center}
   434 \begin{tabular}{c}
   464 \begin{tabular}{c}
   435 \bl{$(q_1, a) \rightarrow q_2$}\\
   465 \bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_2$}\\
   436 \bl{$(q_1, a) \rightarrow q_3$}\\
   466 \bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_3$}\\
   437 \end{tabular}
   467 \end{tabular}
   438 \hspace{10mm}
   468 \bl{\ldots}
   439 \begin{tabular}{c}
   469 \hspace{10mm}\pause
   440 \bl{$(q_1, \epsilon) \rightarrow q_2$}\\
   470 \bl{$(\mbox{Q}_1, a) \rightarrow \{\mbox{Q}_2, \mbox{Q}_3\}$}
   441 \end{tabular}
   471 \end{center}
   442 \end{center}
   472 
   443 
   473 \end{frame}
   444 \end{frame}
   474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   475 
   446 
   476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   477 \begin{frame}[c]
   448 \begin{frame}[c]
   478 \frametitle{An NFA Example}
   449 \frametitle{Two NFA Examples}
   479 
       
   480 % A NFA for (ab* + b)*a
       
   481 \begin{center}
       
   482 \begin{tikzpicture}[>=stealth',very thick, auto,
       
   483     every state/.style={minimum size=0pt,inner sep=3pt,
       
   484       draw=blue!50,very thick,fill=blue!20},scale=2]
       
   485 \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
       
   486 \node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
       
   487 \node[state, accepting] (Q_2) [right=of Q_1] {$\mbox{Q}_2$};
       
   488 \path[->] (Q_0) edge [loop above] node  {\alert{$b$}} ();
       
   489 \path[<-] (Q_0) edge node [below]  {\alert{$b$}} (Q_1);
       
   490 \path[->] (Q_0) edge [bend left] node [above]  {\alert{$a$}} (Q_1);
       
   491 \path[->] (Q_0) edge [bend right] node [below]  {\alert{$a$}} (Q_2);
       
   492 \path[->] (Q_1) edge [loop above] node  {\alert{$a,b$}} ();
       
   493 \path[->] (Q_1) edge node  [above] {\alert{$a$}} (Q_2);
       
   494 \end{tikzpicture}
       
   495 \end{center}
       
   496 
       
   497 \end{frame}
       
   498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   499 
       
   500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   501 \begin{frame}[c]
       
   502 \frametitle{Two Epsilon NFA Examples}
   450 
   503 
   451 \small
   504 \small
   452 \begin{center}
   505 \begin{center}
   453 \begin{tabular}[t]{c@{\hspace{9mm}}c}
   506 \begin{tabular}[t]{c@{\hspace{9mm}}c}
   454 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   507 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   478 \end{center}
   531 \end{center}
   479 
   532 
   480 \end{frame}
   533 \end{frame}
   481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   482 
   535 
       
   536 
   483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   484 \begin{frame}[c]
   538 \begin{frame}[c]
   485 \frametitle{Rexp to NFA}
   539 \frametitle{Rexp to NFA}
   486 
   540 
   487 \begin{center}
   541 \begin{center}
   488 \begin{tabular}[t]{l@{\hspace{10mm}}l}
   542 \begin{tabular}[t]{l@{\hspace{10mm}}l}
   489 \raisebox{1mm}{\bl{$\ZERO$}} & 
   543 \raisebox{1mm}{\bl{$\ZERO$}} & 
   490 \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   544 \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   491 \node[state, initial]  (q_0)  {$\mbox{}$};
   545 \node[state, initial]  (Q_0)  {$\mbox{}$};
   492 \end{tikzpicture}\\\\
   546 \end{tikzpicture}\\\\
   493 \raisebox{1mm}{\bl{$\ONE$}} & 
   547 \raisebox{1mm}{\bl{$\ONE$}} & 
   494 \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   548 \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   495 \node[state, initial, accepting]  (q_0)  {$\mbox{}$};
   549 \node[state, initial, accepting]  (Q_0)  {$\mbox{}$};
   496 \end{tikzpicture}\\\\
   550 \end{tikzpicture}\\\\
   497 \raisebox{2mm}{\bl{$c$}} & 
   551 \raisebox{2mm}{\bl{$c$}} & 
   498 \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   552 \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   499 \node[state, initial]  (q_0)  {$\mbox{}$};
   553 \node[state, initial]  (Q_0)  {$\mbox{}$};
   500 \node[state, accepting]  (q_1)  [right=of q_0] {$\mbox{}$};
   554 \node[state, accepting]  (Q_1)  [right=of Q_0] {$\mbox{}$};
   501 \path[->] (q_0) edge node [below]  {\alert{$c$}} (q_1);
   555 \path[->] (Q_0) edge node [below]  {\alert{$c$}} (Q_1);
   502 \end{tikzpicture}\\\\
   556 \end{tikzpicture}\\\\
   503 \end{tabular}
   557 \end{tabular}
   504 \end{center}
   558 \end{center}
   505 
   559 
   506 \end{frame}
   560 \end{frame}
   509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   510 \begin{frame}[t]
   564 \begin{frame}[t]
   511 \frametitle{Case $r_1\cdot r_2$}
   565 \frametitle{Case $r_1\cdot r_2$}
   512 
   566 
   513 \mbox{}\bigskip
   567 \mbox{}\bigskip
   514 \onslide<1>{By recursion we are given two automata:\bigskip}
   568 \onslide<1->{By recursion we are given two automata:\bigskip}
   515 
   569 
   516 {\centering\begin{tikzpicture}[node distance=3mm,
   570 {\centering%
   517                              >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   571 \only<1>{%
   518 \node[state, initial]  (q_0)  {$\mbox{}$};
   572 \begin{tikzpicture}[node distance=3mm,
   519 \node (r_1)  [right=of q_0] {$\ldots$};
   573     >=stealth',very thick,
   520 \only<1>{
   574     every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}]
   521 \node[state, accepting]  (t_1)  [right=of r_1] {$\mbox{}$};
   575 \node[state, initial]  (Q_0)  {$\mbox{}$};
   522 \node[state, accepting]  (t_2)  [above=of t_1] {$\mbox{}$};
   576 \node[state, initial]  (Q_01) [below=1mm of Q_0] {$\mbox{}$};  
   523 \node[state, accepting]  (t_3)  [below=of t_1] {$\mbox{}$};}
   577 \node[state, initial]  (Q_02) [above=1mm of Q_0] {$\mbox{}$};  
   524 \only<2>{
   578 \node (R_1)  [right=of Q_0] {$\ldots$};
   525 \node[state]  (t_1)  [right=of r_1] {$\mbox{}$};
   579 \node[state, accepting]  (T_1)  [right=of R_1] {$\mbox{}$};
   526 \node[state]  (t_2)  [above=of t_1] {$\mbox{}$};
   580 \node[state, accepting]  (T_2)  [above=of T_1] {$\mbox{}$};
   527 \node[state]  (t_3)  [below=of t_1] {$\mbox{}$};}
   581 \node[state, accepting]  (T_3)  [below=of T_1] {$\mbox{}$};
   528 \only<1>{\node[state, initial]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
   582 
   529 \only<2>{\node[state]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
   583 \node (A_0)  [right=2.5cm of T_1] {$\mbox{}$};
   530 \node (b_1)  [right=of a_0] {$\ldots$};
   584 \node[state, initial]  (A_01)  [above=1mm of A_0] {$\mbox{}$};
       
   585 \node[state, initial]  (A_02)  [below=1mm of A_0] {$\mbox{}$};
       
   586 
       
   587 \node (b_1)  [right=of A_0] {$\ldots$};
   531 \node[state, accepting]  (c_1)  [right=of b_1] {$\mbox{}$};
   588 \node[state, accepting]  (c_1)  [right=of b_1] {$\mbox{}$};
   532 \node[state, accepting]  (c_2)  [above=of c_1] {$\mbox{}$};
   589 \node[state, accepting]  (c_2)  [above=of c_1] {$\mbox{}$};
   533 \node[state, accepting]  (c_3)  [below=of c_1] {$\mbox{}$};
   590 \node[state, accepting]  (c_3)  [below=of c_1] {$\mbox{}$};
   534 \only<2>{
       
   535 \path[->] (t_1) edge node [above, pos=0.3]  {\alert{$\epsilon$}} (a_0);
       
   536 \path[->] (t_2) edge node [above]  {\alert{$\epsilon$}} (a_0);
       
   537 \path[->] (t_3) edge node [below]  {\alert{$\epsilon$}} (a_0);
       
   538 }
       
   539 \begin{pgfonlayer}{background}
   591 \begin{pgfonlayer}{background}
   540 \only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (r_1) (t_1) (t_2) (t_3)] {};}
   592   \node (1) [rounded corners, inner sep=1mm, thick,
   541 \only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (a_0) (b_1) (c_1) (c_2) (c_3)] {};}
   593     draw=black!60, fill=black!20, fit= (Q_0) (R_1) (T_1) (T_2) (T_3)] {};
   542 \only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (c_1) (c_2) (c_3)] {};}
   594   \node (2) [rounded corners, inner sep=1mm, thick,
   543 \only<1>{\node [yshift=2mm] at (1.north) {\bl{$r_1$}};}
   595     draw=black!60, fill=black!20, fit= (A_0) (b_1) (c_1) (c_2) (c_3)] {};
   544 \only<1>{\node [yshift=2mm] at (2.north) {\bl{$r_2$}};}
   596 \node [yshift=2mm] at (1.north) {$r_1$};
   545 \only<2>{\node [yshift=2mm] at (3.north) {\bl{$r_1\cdot r_2$}};}
   597 \node [yshift=2mm] at (2.north) {$r_2$};
   546 \end{pgfonlayer}
   598 \end{pgfonlayer}
   547 \end{tikzpicture}}\bigskip\bigskip
   599 \end{tikzpicture}}
       
   600 \only<2>{%
       
   601 \begin{tikzpicture}[node distance=3mm,
       
   602     >=stealth',very thick,
       
   603     every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
       
   604 \node[state, initial]  (Q_0)  {$\mbox{}$};
       
   605 \node[state, initial]  (Q_01) [below=1mm of Q_0] {$\mbox{}$};  
       
   606 \node[state, initial]  (Q_02) [above=1mm of Q_0] {$\mbox{}$};  
       
   607 \node (r_1)  [right=of Q_0] {$\ldots$};
       
   608 \node[state]  (t_1)  [right=of r_1] {$\mbox{}$};
       
   609 \node[state]  (t_2)  [above=of t_1] {$\mbox{}$};
       
   610 \node[state]  (t_3)  [below=of t_1] {$\mbox{}$};
       
   611 
       
   612 \node  (A_0)  [right=2.5cm of t_1] {$\mbox{}$};
       
   613 \node[state]  (A_01)  [above=1mm of A_0] {$\mbox{}$};
       
   614 \node[state]  (A_02)  [below=1mm of A_0] {$\mbox{}$};
       
   615 
       
   616 \node (b_1)  [right=of A_0] {$\ldots$};
       
   617 \node[state, accepting]  (c_1)  [right=of b_1] {$\mbox{}$};
       
   618 \node[state, accepting]  (c_2)  [above=of c_1] {$\mbox{}$};
       
   619 \node[state, accepting]  (c_3)  [below=of c_1] {$\mbox{}$};
       
   620 \path[->] (t_1) edge (A_01);
       
   621 \path[->] (t_2) edge node [above]  {$\epsilon$s} (A_01);
       
   622 \path[->] (t_3) edge (A_01);
       
   623 \path[->] (t_1) edge (A_02);
       
   624 \path[->] (t_2) edge (A_02);
       
   625 \path[->] (t_3) edge node [below]  {$\epsilon$s} (A_02);
       
   626  
       
   627 \begin{pgfonlayer}{background}
       
   628   \node (3) [rounded corners, inner sep=1mm, thick,
       
   629     draw=black!60, fill=black!20, fit= (Q_0) (c_1) (c_2) (c_3)] {};
       
   630 \node [yshift=2mm] at (3.north) {$r_1\cdot r_2$};
       
   631 \end{pgfonlayer}
       
   632 \end{tikzpicture}}
       
   633 %
       
   634 }\bigskip\bigskip
   548 
   635 
   549 \small
   636 \small
   550 We need to (1) change the accepting nodes of the first automaton into non-accepting nodes, and (2) connect them
   637 We need to (1) change the accepting nodes of the first automaton into non-accepting nodes, and (2) connect them
   551 via $\epsilon$-transitions to the starting state of the second automaton. 
   638 via $\epsilon$-transitions to the starting state of the second automaton. 
   552 
   639 
   554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   555 
   642 
   556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   557 \begin{frame}[t]
   644 \begin{frame}[t]
   558 \frametitle{Case $r_1+ r_2$}
   645 \frametitle{Case $r_1+ r_2$}
   559 \mbox{}\\[-10mm]
   646 \mbox{}\\[-8mm]
   560 
   647 
   561 \onslide<1>{By recursion we are given two automata:\smallskip}
   648 \onslide<1->{By recursion we are given two automata:\smallskip}
   562 
   649 
   563 \hspace{2cm}\begin{tikzpicture}[node distance=3mm,
   650 \hspace{2cm}
   564                              >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
   651 \only<1>{%
   565 \onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
   652   \begin{tikzpicture}[node distance=3mm,
   566 \onslide<2>{\node at (0,0) [state, initial]  (1)  {$\mbox{}$};}
   653     >=stealth',very thick,
   567 \only<1>{
   654     every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},
   568 \node[state, initial]  (2)  [above right=16mm of 1] {$\mbox{}$};
   655     baseline=(current bounding box.center)]
   569 \node[state, initial]  (3)  [below right=16mm of 1] {$\mbox{}$};}
   656 \node at (0,0)  (1)  {$\mbox{}$};
   570 \only<2>{
   657 \node  (2)  [above=14mm of 1] {};
   571 \node[state]  (2)  [above right=16mm of 1] {$\mbox{}$};
   658 \node[state, initial]  (4)  [above=1mm of 2] {$\mbox{}$};
   572 \node[state]  (3)  [below right=16mm of 1] {$\mbox{}$};}
   659 \node[state, initial]  (5)  [below=1mm of 2] {$\mbox{}$};
   573 
   660 \node[state, initial]  (3)  [below=10mm of 1] {$\mbox{}$};
       
   661 
       
   662 \node (a)  [right=of 2] {$\ldots\,$};
       
   663 \node  (a1)  [right=of a] {$$};
       
   664 \node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
       
   665 \node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};
       
   666 
       
   667 \node (b)  [right=of 3] {$\ldots$};
       
   668 \node[state, accepting]  (b1)  [right=of b] {$\mbox{}$};
       
   669 \node[state, accepting]  (b2)  [above=of b1] {$\mbox{}$};
       
   670 \node[state, accepting]  (b3)  [below=of b1] {$\mbox{}$};
       
   671 \begin{pgfonlayer}{background}
       
   672 \node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};
       
   673 \node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {};
       
   674 \node [yshift=3mm] at (1.north) {$r_1$};
       
   675 \node [yshift=3mm] at (2.north) {$r_2$};
       
   676 \end{pgfonlayer}
       
   677 \end{tikzpicture}}
       
   678 \only<2>{%
       
   679 \begin{tikzpicture}[node distance=3mm,
       
   680     >=stealth',very thick,
       
   681     every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},
       
   682     baseline=(current bounding box.center)]
       
   683 \node at (0,0) (1)  {$\mbox{}$};
       
   684 \node (2)  [above=14mm of 1] {$$};
       
   685 \node[state, initial]  (4)  [above=1mm of 2] {$\mbox{}$};
       
   686 \node[state, initial]  (5)  [below=1mm of 2] {$\mbox{}$};
       
   687 \node[state, initial]  (3)  [below=10mm of 1] {$\mbox{}$};
       
   688 
       
   689 \node (a)  [right=of 2] {$\ldots\,$};
       
   690 \node (a1)  [right=of a] {$$};
       
   691 \node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
       
   692 \node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};
       
   693 
       
   694 \node (b)  [right=of 3] {$\ldots$};
       
   695 \node[state, accepting]  (b1)  [right=of b] {$\mbox{}$};
       
   696 \node[state, accepting]  (b2)  [above=of b1] {$\mbox{}$};
       
   697 \node[state, accepting]  (b3)  [below=of b1] {$\mbox{}$};
       
   698 
       
   699 %\path[->] (1) edge node [above]  {$\epsilon$} (2);
       
   700 %\path[->] (1) edge node [below]  {$\epsilon$} (3);
       
   701 
       
   702 \begin{pgfonlayer}{background}
       
   703 \node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {};
       
   704 \node [yshift=3mm] at (3.north) {$r_1+ r_2$};
       
   705 \end{pgfonlayer}
       
   706 \end{tikzpicture}}
       
   707 %
       
   708 
       
   709 \small
       
   710 \mbox{}\\\medskip
       
   711 We (1) need to introduce a new starting state and (2) connect it to the original two starting states.
       
   712 \end{frame}
       
   713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   714 
       
   715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   716 \begin{frame}[c]
       
   717 \frametitle{Case $r^*$}
       
   718 
       
   719 \onslide<1->{By recursion we are given an automaton for $r$:\smallskip}
       
   720 
       
   721 \hspace{2cm}
       
   722 \only<1>{\begin{tikzpicture}[node distance=3mm,
       
   723     >=stealth',very thick,
       
   724     every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},
       
   725     baseline=(current bounding box.north)]
       
   726 \node (2)  {$\mbox{}$};
       
   727 \node[state, initial]  (4)  [above=1mm of 2] {$\mbox{}$};
       
   728 \node[state, initial]  (5)  [below=1mm of 2] {$\mbox{}$};  
   574 \node (a)  [right=of 2] {$\ldots$};
   729 \node (a)  [right=of 2] {$\ldots$};
   575 \node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
   730 \node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
   576 \node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
   731 \node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
   577 \node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};
   732 \node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};
   578 
       
   579 \node (b)  [right=of 3] {$\ldots$};
       
   580 \node[state, accepting]  (b1)  [right=of b] {$\mbox{}$};
       
   581 \node[state, accepting]  (b2)  [above=of b1] {$\mbox{}$};
       
   582 \node[state, accepting]  (b3)  [below=of b1] {$\mbox{}$};
       
   583 \only<2>{
       
   584 \path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
       
   585 \path[->] (1) edge node [below]  {\alert{$\epsilon$}} (3);
       
   586 }
       
   587 \begin{pgfonlayer}{background}
   733 \begin{pgfonlayer}{background}
   588 \only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
   734 \node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};
   589 \only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {};}
   735 \node [yshift=3mm] at (1.north) {$r$};
   590 \only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {};}
       
   591 \only<1>{\node [yshift=3mm] at (1.north) {\bl{$r_1$}};}
       
   592 \only<1>{\node [yshift=3mm] at (2.north) {\bl{$r_2$}};}
       
   593 \only<2>{\node [yshift=3mm] at (3.north) {\bl{$r_1+ r_2$}};}
       
   594 \end{pgfonlayer}
   736 \end{pgfonlayer}
   595 \end{tikzpicture}
   737 \end{tikzpicture}}
   596 
   738 \only<2->{\begin{tikzpicture}[node distance=3mm,
   597 \small
   739     >=stealth',very thick,
   598 We (1) need to introduce a new starting state and (2) connect it to the original two starting states.
   740     every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},
   599 \end{frame}
   741     baseline=(current bounding box.north)]
   600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   742 \node at (0,0) [state, initial,accepting]  (1)  {$\mbox{}$};
   601 
   743 \node (2)  [right=16mm of 1] {$\mbox{}$};
   602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   744 \node[state]  (4)  [above=1mm of 2] {$\mbox{}$};
   603 \begin{frame}[c]
   745 \node[state]  (5)  [below=1mm of 2] {$\mbox{}$};  
   604 \frametitle{Case $r^*$}
       
   605 
       
   606 \onslide<1>{By recursion we are given an automaton for $r$:\smallskip}
       
   607 
       
   608 \hspace{2cm}\begin{tikzpicture}[node distance=3mm,
       
   609                              >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
       
   610 \onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
       
   611 \onslide<2->{\node at (0,0) [state, initial,accepting]  (1)  {$\mbox{}$};}
       
   612 \only<1>{\node[state, initial]  (2)  [right=16mm of 1] {$\mbox{}$};}
       
   613 \only<2->{\node[state]  (2)  [right=16mm of 1] {$\mbox{}$};}
       
   614 \node (a)  [right=of 2] {$\ldots$};
   746 \node (a)  [right=of 2] {$\ldots$};
   615 \only<1>{
       
   616 \node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
       
   617 \node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
       
   618 \node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};}
       
   619 \only<2->{
       
   620 \node[state]  (a1)  [right=of a] {$\mbox{}$};
   747 \node[state]  (a1)  [right=of a] {$\mbox{}$};
   621 \node[state]  (a2)  [above=of a1] {$\mbox{}$};
   748 \node[state]  (a2)  [above=of a1] {$\mbox{}$};
   622 \node[state]  (a3)  [below=of a1] {$\mbox{}$};}
   749 \node[state]  (a3)  [below=of a1] {$\mbox{}$};
   623 \only<2->{
   750 \path[->] (1) edge node [below]  {$\epsilon$} (4);
   624 \path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
   751 \path[->] (1) edge node [below]  {$\epsilon$} (5);
   625 \path[->] (a1) edge [bend left=45] node [above]  {\alert{$\epsilon$}} (1);
   752 \path[->] (a1) edge [bend left=45] node [below]  {$\epsilon$} (1);
   626 \path[->] (a2) edge [bend right] node [below]  {\alert{$\epsilon$}} (1);
   753 \path[->] (a2) edge [bend right] node [below]  {$\epsilon$} (1);
   627 \path[->] (a3) edge [bend left=45] node [below]  {\alert{$\epsilon$}} (1);
   754 \path[->] (a3) edge [bend left=45] node [below]  {$\epsilon$} (1);
   628 
       
   629 }
       
   630 \begin{pgfonlayer}{background}
   755 \begin{pgfonlayer}{background}
   631 \only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
   756 \node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {};
   632 \only<2->{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {};}
   757 \node [yshift=3mm] at (2.north) {$r^*$};
   633 \only<1>{\node [yshift=3mm] at (1.north) {\bl{$r$}};}
       
   634 \only<2->{\node [yshift=3mm] at (2.north) {\bl{$r^*$}};}
       
   635 \end{pgfonlayer}
   758 \end{pgfonlayer}
   636 \end{tikzpicture}\bigskip
   759 \end{tikzpicture}}
       
   760 \bigskip
   637 
   761 
   638 \onslide<3->{
   762 \onslide<3->{
   639 Why can't we just have an epsilon transition from the accepting states to the starting state?}
   763 Why can't we just have an epsilon transition from the accepting states to the starting state?}
   640 
   764 
   641 \end{frame}
   765 \end{frame}
   646 \frametitle{Subset Construction}
   770 \frametitle{Subset Construction}
   647 
   771 
   648 
   772 
   649 \begin{textblock}{5}(1,1)
   773 \begin{textblock}{5}(1,1)
   650 \begin{center}
   774 \begin{center}
   651 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   775 \begin{tikzpicture}[node distance=6mm,scale=0.7,>=stealth',very thick,
   652                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
   776                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
   653 \node[state,initial]  (q_0)  {$q_0$};
   777 \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
   654 \node[state] (q_1) [above=of q_0] {$q_1$};
   778 \node[state] (Q_1) [above=of Q_0] {$\mbox{Q}_1$};
   655 \node[state, accepting] (q_2) [below=of q_0] {$q_2$};
   779 \node[state, accepting] (Q_2) [below=of Q_0] {$\mbox{Q}_2$};
   656 \path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
   780 \path[->] (Q_0) edge node [left]  {\alert{$\epsilon$}} (Q_1);
   657 \path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
   781 \path[->] (Q_0) edge node [left]  {\alert{$\epsilon$}} (Q_2);
   658 \path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
   782 \path[->] (Q_0) edge [loop right] node  {\alert{$a$}} ();
   659 \path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
   783 \path[->] (Q_1) edge [loop above] node  {\alert{$a$}} ();
   660 \path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
   784 \path[->] (Q_2) edge [loop below] node  {\alert{$b$}} ();
   661 \end{tikzpicture}
   785 \end{tikzpicture}
   662 \end{center}
   786 \end{center}
   663 \end{textblock}
   787 \end{textblock}
   664 
   788 
   665 \begin{textblock}{11}(6.5,4.5)
   789 \begin{textblock}{11}(6.5,4.5)
   746 \end{tikzpicture}}
   870 \end{tikzpicture}}
   747 &
   871 &
   748 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   872 \begin{tikzpicture}[scale=0.7,>=stealth',very thick,
   749                     every state/.style={minimum size=0pt,
   873                     every state/.style={minimum size=0pt,
   750                     draw=blue!50,very thick,fill=blue!20},]
   874                     draw=blue!50,very thick,fill=blue!20},]
   751 \node[state,initial]  (q_0)  {$q_0$};
   875 \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
   752 \node[state] (q_1) [above=of q_0] {$q_1$};
   876 \node[state] (Q_1) [above=of Q_0] {$\mbox{Q}_1$};
   753 \node[state, accepting] (q_2) [below=of q_0] {$q_2$};
   877 \node[state, accepting] (Q_2) [below=of Q_0] {$\mbox{Q}_2$};
   754 \path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
   878 \path[->] (Q_0) edge node [left]  {\alert{$\epsilon$}} (Q_1);
   755 \path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
   879 \path[->] (Q_0) edge node [left]  {\alert{$\epsilon$}} (Q_2);
   756 \path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
   880 \path[->] (Q_0) edge [loop right] node  {\alert{$a$}} ();
   757 \path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
   881 \path[->] (Q_1) edge [loop above] node  {\alert{$a$}} ();
   758 \path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
   882 \path[->] (Q_2) edge [loop below] node  {\alert{$b$}} ();
   759 \end{tikzpicture}
   883 \end{tikzpicture}
   760 \end{tabular}
   884 \end{tabular}
   761 \end{center}
   885 \end{center}
   762 
   886 
   763 \end{frame}
   887 \end{frame}
   807 \begin{frame}[c]
   931 \begin{frame}[c]
   808 
   932 
   809 \begin{center}
   933 \begin{center}
   810 \begin{tikzpicture}[>=stealth',very thick,auto,
   934 \begin{tikzpicture}[>=stealth',very thick,auto,
   811                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   935                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   812 \node[state,initial]  (q_0)  {$q_0$};
   936 \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
   813 \node[state] (q_1) [right=of q_0] {$q_1$};
   937 \node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
   814 \node[state] (q_2) [below right=of q_0] {$q_2$};
   938 \node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};
   815 \node[state] (q_3) [right=of q_2] {$q_3$};
   939 \node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};
   816 \node[state, accepting] (q_4) [right=of q_1] {$q_4$};
   940 \node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};
   817 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
   941 \path[->] (Q_0) edge node [above]  {\alert{$a$}} (Q_1);
   818 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
   942 \path[->] (Q_1) edge node [above]  {\alert{$a$}} (Q_4);
   819 \path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
   943 \path[->] (Q_4) edge [loop right] node  {\alert{$a, b$}} ();
   820 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
   944 \path[->] (Q_3) edge node [right]  {\alert{$a$}} (Q_4);
   821 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
   945 \path[->] (Q_2) edge node [above]  {\alert{$a$}} (Q_3);
   822 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
   946 \path[->] (Q_1) edge node [right]  {\alert{$b$}} (Q_2);
   823 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
   947 \path[->] (Q_0) edge node [above]  {\alert{$b$}} (Q_2);
   824 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
   948 \path[->] (Q_2) edge [loop left] node  {\alert{$b$}} ();
   825 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
   949 \path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (Q_0);
   826 \end{tikzpicture}
   950 \end{tikzpicture}
   827 \end{center}
   951 \end{center}
   828 
   952 
   829 \mbox{}\\[-20mm]\mbox{}
   953 \mbox{}\\[-20mm]\mbox{}
   830 
   954 
   840 \draw (1,0) -- (1, 4);
   964 \draw (1,0) -- (1, 4);
   841 \draw (2,0) -- (2, 3);
   965 \draw (2,0) -- (2, 3);
   842 \draw (3,0) -- (3, 2);
   966 \draw (3,0) -- (3, 2);
   843 \draw (4,0) -- (4, 1);
   967 \draw (4,0) -- (4, 1);
   844 
   968 
   845 \draw (0.5,-0.5) node {$q_0$}; 
   969 \draw (0.5,-0.5) node {$\mbox{Q}_0$}; 
   846 \draw (1.5,-0.5) node {$q_1$}; 
   970 \draw (1.5,-0.5) node {$\mbox{Q}_1$}; 
   847 \draw (2.5,-0.5) node {$q_2$}; 
   971 \draw (2.5,-0.5) node {$\mbox{Q}_2$}; 
   848 \draw (3.5,-0.5) node {$q_3$};
   972 \draw (3.5,-0.5) node {$\mbox{Q}_3$};
   849  
   973  
   850 \draw (-0.5, 3.5) node {$q_1$}; 
   974 \draw (-0.5, 3.5) node {$\mbox{Q}_1$}; 
   851 \draw (-0.5, 2.5) node {$q_2$}; 
   975 \draw (-0.5, 2.5) node {$\mbox{Q}_2$}; 
   852 \draw (-0.5, 1.5) node {$q_3$}; 
   976 \draw (-0.5, 1.5) node {$\mbox{Q}_3$}; 
   853 \draw (-0.5, 0.5) node {$q_4$}; 
   977 \draw (-0.5, 0.5) node {$\mbox{Q}_4$}; 
   854 
   978 
   855 \draw (0.5,0.5) node {\large$\star$}; 
   979 \draw (0.5,0.5) node {\large$\star$}; 
   856 \draw (1.5,0.5) node {\large$\star$}; 
   980 \draw (1.5,0.5) node {\large$\star$}; 
   857 \draw (2.5,0.5) node {\large$\star$}; 
   981 \draw (2.5,0.5) node {\large$\star$}; 
   858 \draw (3.5,0.5) node {\large$\star$};
   982 \draw (3.5,0.5) node {\large$\star$};
   867 
   991 
   868 \begin{center}
   992 \begin{center}
   869 \begin{tabular}{@{\hspace{-8mm}}cc@{}}
   993 \begin{tabular}{@{\hspace{-8mm}}cc@{}}
   870 \begin{tikzpicture}[>=stealth',very thick,auto,
   994 \begin{tikzpicture}[>=stealth',very thick,auto,
   871                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   995                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   872 \node[state,initial]  (q_0)  {$q_0$};
   996 \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
   873 \node[state] (q_1) [right=of q_0] {$q_1$};
   997 \node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
   874 \node[state] (q_2) [below right=of q_0] {$q_2$};
   998 \node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};
   875 \node[state] (q_3) [right=of q_2] {$q_3$};
   999 \node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};
   876 \node[state, accepting] (q_4) [right=of q_1] {$q_4$};
  1000 \node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};
   877 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
  1001 \path[->] (Q_0) edge node [above]  {\alert{$a$}} (Q_1);
   878 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
  1002 \path[->] (Q_1) edge node [above]  {\alert{$a$}} (Q_4);
   879 \path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
  1003 \path[->] (Q_4) edge [loop right] node  {\alert{$a, b$}} ();
   880 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
  1004 \path[->] (Q_3) edge node [right]  {\alert{$a$}} (Q_4);
   881 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
  1005 \path[->] (Q_2) edge node [above]  {\alert{$a$}} (Q_3);
   882 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
  1006 \path[->] (Q_1) edge node [right]  {\alert{$b$}} (Q_2);
   883 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
  1007 \path[->] (Q_0) edge node [above]  {\alert{$b$}} (Q_2);
   884 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
  1008 \path[->] (Q_2) edge [loop left] node  {\alert{$b$}} ();
   885 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
  1009 \path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (Q_0);
   886 \end{tikzpicture}
  1010 \end{tikzpicture}
   887 &
  1011 &
   888 \raisebox{9mm}{\begin{tikzpicture}[scale=0.6,line width=0.8mm]
  1012 \raisebox{9mm}{\begin{tikzpicture}[scale=0.6,line width=0.8mm]
   889 \draw (0,0) -- (4,0);
  1013 \draw (0,0) -- (4,0);
   890 \draw (0,1) -- (4,1);
  1014 \draw (0,1) -- (4,1);
   896 \draw (1,0) -- (1, 4);
  1020 \draw (1,0) -- (1, 4);
   897 \draw (2,0) -- (2, 3);
  1021 \draw (2,0) -- (2, 3);
   898 \draw (3,0) -- (3, 2);
  1022 \draw (3,0) -- (3, 2);
   899 \draw (4,0) -- (4, 1);
  1023 \draw (4,0) -- (4, 1);
   900 
  1024 
   901 \draw (0.5,-0.5) node {$q_0$}; 
  1025 \draw (0.5,-0.5) node {$\mbox{Q}_0$}; 
   902 \draw (1.5,-0.5) node {$q_1$}; 
  1026 \draw (1.5,-0.5) node {$\mbox{Q}_1$}; 
   903 \draw (2.5,-0.5) node {$q_2$}; 
  1027 \draw (2.5,-0.5) node {$\mbox{Q}_2$}; 
   904 \draw (3.5,-0.5) node {$q_3$};
  1028 \draw (3.5,-0.5) node {$\mbox{Q}_3$};
   905  
  1029  
   906 \draw (-0.5, 3.5) node {$q_1$}; 
  1030 \draw (-0.5, 3.5) node {$\mbox{Q}_1$}; 
   907 \draw (-0.5, 2.5) node {$q_2$}; 
  1031 \draw (-0.5, 2.5) node {$\mbox{Q}_2$}; 
   908 \draw (-0.5, 1.5) node {$q_3$}; 
  1032 \draw (-0.5, 1.5) node {$\mbox{Q}_3$}; 
   909 \draw (-0.5, 0.5) node {$q_4$}; 
  1033 \draw (-0.5, 0.5) node {$\mbox{Q}_4$}; 
   910 
  1034 
   911 \draw (0.5,0.5) node {\large$\star$}; 
  1035 \draw (0.5,0.5) node {\large$\star$}; 
   912 \draw (1.5,0.5) node {\large$\star$}; 
  1036 \draw (1.5,0.5) node {\large$\star$}; 
   913 \draw (2.5,0.5) node {\large$\star$}; 
  1037 \draw (2.5,0.5) node {\large$\star$}; 
   914 \draw (3.5,0.5) node {\large$\star$};
  1038 \draw (3.5,0.5) node {\large$\star$};
   924 \mbox{}\\[-20mm]\mbox{}
  1048 \mbox{}\\[-20mm]\mbox{}
   925 
  1049 
   926 \begin{center}
  1050 \begin{center}
   927 \begin{tikzpicture}[>=stealth',very thick,auto,
  1051 \begin{tikzpicture}[>=stealth',very thick,auto,
   928                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
  1052                              every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
   929 \node[state,initial]  (q_02)  {$q_{0, 2}$};
  1053 \node[state,initial]  (Q_02)  {$\mbox{Q}_{0, 2}$};
   930 \node[state] (q_13) [right=of q_02] {$q_{1, 3}$};
  1054 \node[state] (Q_13) [right=of Q_02] {$\mbox{Q}_{1, 3}$};
   931 \node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$};
  1055 \node[state, accepting] (Q_4) [right=of Q_13] {$\mbox{Q}_{4\phantom{,0}}$};
   932 \path[->] (q_02) edge [bend left] node [above]  {\alert{$a$}} (q_13);
  1056 \path[->] (Q_02) edge [bend left] node [above]  {\alert{$a$}} (Q_13);
   933 \path[->] (q_13) edge [bend left] node [below]  {\alert{$b$}} (q_02);
  1057 \path[->] (Q_13) edge [bend left] node [below]  {\alert{$b$}} (Q_02);
   934 \path[->] (q_02) edge [loop below] node  {\alert{$b$}} ();
  1058 \path[->] (Q_02) edge [loop below] node  {\alert{$b$}} ();
   935 \path[->] (q_13) edge node [above]  {\alert{$a$}} (q_4);
  1059 \path[->] (Q_13) edge node [above]  {\alert{$a$}} (Q_4);
   936 \path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
  1060 \path[->] (Q_4) edge [loop above] node  {\alert{$a, b$}} ();
   937 \end{tikzpicture}\\
  1061 \end{tikzpicture}\\
   938 minimal automaton
  1062 minimal automaton
   939 \end{center}
  1063 \end{center}
   940 
  1064 
   941 \end{frame}
  1065 \end{frame}
   949 
  1073 
   950 \begin{center}
  1074 \begin{center}
   951 \begin{tikzpicture}[>=stealth',very thick,auto,
  1075 \begin{tikzpicture}[>=stealth',very thick,auto,
   952                     every state/.style={minimum size=0pt,
  1076                     every state/.style={minimum size=0pt,
   953                     inner sep=2pt,draw=blue!50,very thick,fill=blue!20}]
  1077                     inner sep=2pt,draw=blue!50,very thick,fill=blue!20}]
   954 \only<1>{\node[state,initial]  (q_0)  {$q_0$};}
  1078 \only<1>{\node[state,initial]  (Q_0)  {$\mbox{Q}_0$};}
   955 \only<2->{\node[state,accepting]  (q_0)  {$q_0$};}
  1079 \only<2->{\node[state,accepting]  (Q_0)  {$\mbox{Q}_0$};}
   956 \node[state] (q_1) [right=of q_0] {$q_1$};
  1080 \node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
   957 \node[state] (q_2) [below right=of q_0] {$q_2$};
  1081 \node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};
   958 \node[state] (q_3) [right=of q_2] {$q_3$};
  1082 \node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};
   959 \only<1>{\node[state, accepting] (q_4) [right=of q_1] {$q_4$};}
  1083 \only<1>{\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};}
   960 \only<2->{\node[state, initial right] (q_4) [right=of q_1] {$q_4$};}
  1084 \only<2->{\node[state, initial right] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};}
   961 \only<1-2>{
  1085 \only<1-2>{
   962 \path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
  1086 \path[->] (Q_0) edge node [above]  {\alert{$a$}} (Q_1);
   963 \path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
  1087 \path[->] (Q_1) edge node [above]  {\alert{$a$}} (Q_4);
   964 \path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
  1088 \path[->] (Q_4) edge [loop above] node  {\alert{$a, b$}} ();
   965 \path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
  1089 \path[->] (Q_3) edge node [right]  {\alert{$a$}} (Q_4);
   966 \path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
  1090 \path[->] (Q_2) edge node [above]  {\alert{$a$}} (Q_3);
   967 \path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
  1091 \path[->] (Q_1) edge node [right]  {\alert{$b$}} (Q_2);
   968 \path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
  1092 \path[->] (Q_0) edge node [above]  {\alert{$b$}} (Q_2);
   969 \path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
  1093 \path[->] (Q_2) edge [loop left] node  {\alert{$b$}} ();
   970 \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);}
  1094 \path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (Q_0);}
   971 \only<3->{
  1095 \only<3->{
   972 \path[<-] (q_0) edge node [above]  {\alert{$a$}} (q_1);
  1096 \path[<-] (Q_0) edge node [above]  {\alert{$a$}} (Q_1);
   973 \path[<-] (q_1) edge node [above]  {\alert{$a$}} (q_4);
  1097 \path[<-] (Q_1) edge node [above]  {\alert{$a$}} (Q_4);
   974 \path[<-] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
  1098 \path[<-] (Q_4) edge [loop above] node  {\alert{$a, b$}} ();
   975 \path[<-] (q_3) edge node [right]  {\alert{$a$}} (q_4);
  1099 \path[<-] (Q_3) edge node [right]  {\alert{$a$}} (Q_4);
   976 \path[<-] (q_2) edge node [above]  {\alert{$a$}} (q_3);
  1100 \path[<-] (Q_2) edge node [above]  {\alert{$a$}} (Q_3);
   977 \path[<-] (q_1) edge node [right]  {\alert{$b$}} (q_2);
  1101 \path[<-] (Q_1) edge node [right]  {\alert{$b$}} (Q_2);
   978 \path[<-] (q_0) edge node [above]  {\alert{$b$}} (q_2);
  1102 \path[<-] (Q_0) edge node [above]  {\alert{$b$}} (Q_2);
   979 \path[<-] (q_2) edge [loop left] node  {\alert{$b$}} ();
  1103 \path[<-] (Q_2) edge [loop left] node  {\alert{$b$}} ();
   980 \path[<-] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);}
  1104 \path[<-] (Q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (Q_0);}
   981 \end{tikzpicture}
  1105 \end{tikzpicture}
   982 \end{center}
  1106 \end{center}
   983 \mbox{}\\[-18mm]
  1107 \mbox{}\\[-18mm]
   984 
  1108 
   985 \small
  1109 \small
  1023 \frametitle{DFA to Rexp}
  1147 \frametitle{DFA to Rexp}
  1024 
  1148 
  1025 \begin{center}
  1149 \begin{center}
  1026 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1150 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1027                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1151                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1028   \only<1>{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
  1152   \only<1>{\node[state, initial]        (q0) at ( 0,1) {$\mbox{Q}_0$};}
  1029   \only<2->{\node[state, initial,accepting]        (q0) at ( 0,1) {$q_0$};}
  1153   \only<2->{\node[state, initial,accepting]        (q0) at ( 0,1) {$\mbox{Q}_0$};}
  1030   \only<1>{\node[state]                    (q1) at ( 1,1) {$q_1$};}
  1154   \only<1>{\node[state]                    (q1) at ( 1,1) {$\mbox{Q}_1$};}
  1031   \only<2->{\node[state,accepting]                    (q1) at ( 1,1) {$q_1$};}
  1155   \only<2->{\node[state,accepting]                    (q1) at ( 1,1) {$\mbox{Q}_1$};}
  1032   \only<1>{\node[state, accepting] (q2) at ( 2,1) {$q_2$};}
  1156   \only<1>{\node[state, accepting] (q2) at ( 2,1) {$\mbox{Q}_2$};}
  1033   \only<2->{\node[state] (q2) at ( 2,1) {$q_2$};}
  1157   \only<2->{\node[state] (q2) at ( 2,1) {$\mbox{Q}_2$};}
  1034   \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
  1158   \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
  1035                   (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
  1159                   (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
  1036                   (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
  1160                   (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
  1037                   (q1) edge node[above] {\alert{$a$}} (q2)
  1161                   (q1) edge node[above] {\alert{$a$}} (q2)
  1038                   (q2) edge [loop right] node {\alert{$a$}} ()
  1162                   (q2) edge [loop right] node {\alert{$a$}} ()
  1050 \begin{frame}[c]
  1174 \begin{frame}[c]
  1051 
  1175 
  1052 \begin{center}
  1176 \begin{center}
  1053 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1177 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1054                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1178                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1055   \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
  1179   \only<1->{\node[state, initial]        (q0) at ( 0,1) {$\mbox{Q}_0$};}
  1056   \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
  1180   \only<1->{\node[state]                    (q1) at ( 1,1) {$\mbox{Q}_1$};}
  1057   \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
  1181   \only<1->{\node[state] (q2) at ( 2,1) {$\mbox{Q}_2$};}
  1058   \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
  1182   \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
  1059                   (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
  1183                   (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
  1060                   (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
  1184                   (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
  1061                   (q1) edge node[above] {\alert{$a$}} (q2)
  1185                   (q1) edge node[above] {\alert{$a$}} (q2)
  1062                   (q2) edge [loop right] node {\alert{$a$}} ()
  1186                   (q2) edge [loop right] node {\alert{$a$}} ()
  1067 
  1191 
  1068 \onslide<2->{
  1192 \onslide<2->{
  1069 You know how to solve since school days, no?
  1193 You know how to solve since school days, no?
  1070 \begin{center}
  1194 \begin{center}
  1071 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1195 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1072 \bl{$q_0$} & \bl{$=$} & \bl{$2\, q_0 + 3 \,q_1 +  4\, q_2$}\\
  1196 \bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$2\, \mbox{Q}_0 + 3 \,\mbox{Q}_1 +  4\, \mbox{Q}_2$}\\
  1073 \bl{$q_1$} & \bl{$=$} & \bl{$2 \,q_0 + 3\, q_1 + 1\, q_2$}\\
  1197 \bl{$\mbox{Q}_1$} & \bl{$=$} & \bl{$2 \,\mbox{Q}_0 + 3\, \mbox{Q}_1 + 1\, \mbox{Q}_2$}\\
  1074 \bl{$q_2$} & \bl{$=$} & \bl{$1\, q_0 + 5\, q_1 + 2\, q_2$}\\
  1198 \bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$1\, \mbox{Q}_0 + 5\, \mbox{Q}_1 + 2\, \mbox{Q}_2$}\\
  1075 
  1199 
  1076 \end{tabular}
  1200 \end{tabular}
  1077 \end{center}
  1201 \end{center}
  1078 }
  1202 }
  1079 
  1203 
  1084 \begin{frame}[c]
  1208 \begin{frame}[c]
  1085 
  1209 
  1086 \begin{center}
  1210 \begin{center}
  1087 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1211 \begin{tikzpicture}[scale=2,>=stealth',very thick,
  1088                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1212                              every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
  1089   \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
  1213   \only<1->{\node[state, initial]        (q0) at ( 0,1) {$\mbox{Q}_0$};}
  1090   \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
  1214   \only<1->{\node[state]                    (q1) at ( 1,1) {$\mbox{Q}_1$};}
  1091   \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
  1215   \only<1->{\node[state] (q2) at ( 2,1) {$\mbox{Q}_2$};}
  1092   \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
  1216   \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
  1093                   (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
  1217                   (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
  1094                   (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
  1218                   (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
  1095                   (q1) edge node[above] {\alert{$a$}} (q2)
  1219                   (q1) edge node[above] {\alert{$a$}} (q2)
  1096                   (q2) edge [loop right] node {\alert{$a$}} ()
  1220                   (q2) edge [loop right] node {\alert{$a$}} ()
  1100 \end{center}\bigskip
  1224 \end{center}\bigskip
  1101 
  1225 
  1102 \onslide<2->{
  1226 \onslide<2->{
  1103 \begin{center}
  1227 \begin{center}
  1104 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1228 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1105 \bl{$q_0$} & \bl{$=$} & \bl{$\ONE + q_0\,b + q_1\,b +  q_2\,b$}\\
  1229 \bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$\ONE + \mbox{Q}_0\,b + \mbox{Q}_1\,b +  \mbox{Q}_2\,b$}\\
  1106 \bl{$q_1$} & \bl{$=$} & \bl{$q_0\,a$}\\
  1230 \bl{$\mbox{Q}_1$} & \bl{$=$} & \bl{$\mbox{Q}_0\,a$}\\
  1107 \bl{$q_2$} & \bl{$=$} & \bl{$q_1\,a + q_2\,a$}\\
  1231 \bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$\mbox{Q}_1\,a + \mbox{Q}_2\,a$}\\
  1108 
  1232 
  1109 \end{tabular}
  1233 \end{tabular}
  1110 \end{center}
  1234 \end{center}
  1111 }
  1235 }
  1112 
  1236