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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
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} |
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$}; |
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$}} () |