| 33 |      1 | \documentclass[dvipsnames,14pt,t]{beamer}
 | 
|  |      2 | \usepackage{beamerthemeplainculight}
 | 
|  |      3 | \usepackage[T1]{fontenc}
 | 
|  |      4 | \usepackage[latin1]{inputenc}
 | 
|  |      5 | \usepackage{mathpartir}
 | 
|  |      6 | \usepackage[absolute,overlay]{textpos}
 | 
|  |      7 | \usepackage{ifthen}
 | 
|  |      8 | \usepackage{tikz}
 | 
|  |      9 | \usepackage{pgf}
 | 
|  |     10 | \usepackage{calc} 
 | 
|  |     11 | \usepackage{ulem}
 | 
|  |     12 | \usepackage{courier}
 | 
|  |     13 | \usepackage{listings}
 | 
|  |     14 | \renewcommand{\uline}[1]{#1}
 | 
|  |     15 | \usetikzlibrary{arrows}
 | 
|  |     16 | \usetikzlibrary{automata}
 | 
|  |     17 | \usetikzlibrary{shapes}
 | 
|  |     18 | \usetikzlibrary{shadows}
 | 
|  |     19 | \usetikzlibrary{positioning}
 | 
|  |     20 | \usetikzlibrary{calc}
 | 
|  |     21 | \usepackage{graphicx} 
 | 
|  |     22 | 
 | 
|  |     23 | \definecolor{javared}{rgb}{0.6,0,0} % for strings
 | 
|  |     24 | \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
 | 
|  |     25 | \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
 | 
|  |     26 | \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
 | 
|  |     27 | 
 | 
|  |     28 | \lstset{language=Java,
 | 
|  |     29 | 	basicstyle=\ttfamily,
 | 
|  |     30 | 	keywordstyle=\color{javapurple}\bfseries,
 | 
|  |     31 | 	stringstyle=\color{javagreen},
 | 
|  |     32 | 	commentstyle=\color{javagreen},
 | 
|  |     33 | 	morecomment=[s][\color{javadocblue}]{/**}{*/},
 | 
|  |     34 | 	numbers=left,
 | 
|  |     35 | 	numberstyle=\tiny\color{black},
 | 
|  |     36 | 	stepnumber=1,
 | 
|  |     37 | 	numbersep=10pt,
 | 
|  |     38 | 	tabsize=2,
 | 
|  |     39 | 	showspaces=false,
 | 
|  |     40 | 	showstringspaces=false}
 | 
|  |     41 | 
 | 
|  |     42 | \lstdefinelanguage{scala}{
 | 
|  |     43 |   morekeywords={abstract,case,catch,class,def,%
 | 
|  |     44 |     do,else,extends,false,final,finally,%
 | 
|  |     45 |     for,if,implicit,import,match,mixin,%
 | 
|  |     46 |     new,null,object,override,package,%
 | 
|  |     47 |     private,protected,requires,return,sealed,%
 | 
|  |     48 |     super,this,throw,trait,true,try,%
 | 
|  |     49 |     type,val,var,while,with,yield},
 | 
|  |     50 |   otherkeywords={=>,<-,<\%,<:,>:,\#,@},
 | 
|  |     51 |   sensitive=true,
 | 
|  |     52 |   morecomment=[l]{//},
 | 
|  |     53 |   morecomment=[n]{/*}{*/},
 | 
|  |     54 |   morestring=[b]",
 | 
|  |     55 |   morestring=[b]',
 | 
|  |     56 |   morestring=[b]"""
 | 
|  |     57 | }
 | 
|  |     58 | 
 | 
|  |     59 | \lstset{language=Scala,
 | 
|  |     60 | 	basicstyle=\ttfamily,
 | 
|  |     61 | 	keywordstyle=\color{javapurple}\bfseries,
 | 
|  |     62 | 	stringstyle=\color{javagreen},
 | 
|  |     63 | 	commentstyle=\color{javagreen},
 | 
|  |     64 | 	morecomment=[s][\color{javadocblue}]{/**}{*/},
 | 
|  |     65 | 	numbers=left,
 | 
|  |     66 | 	numberstyle=\tiny\color{black},
 | 
|  |     67 | 	stepnumber=1,
 | 
|  |     68 | 	numbersep=10pt,
 | 
|  |     69 | 	tabsize=2,
 | 
|  |     70 | 	showspaces=false,
 | 
|  |     71 | 	showstringspaces=false}
 | 
|  |     72 | 
 | 
|  |     73 | % beamer stuff 
 | 
|  |     74 | \renewcommand{\slidecaption}{AFL 04, King's College London, 17.~October 2012}
 | 
|  |     75 | \newcommand{\bl}[1]{\textcolor{blue}{#1}}       
 | 
|  |     76 | \newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
 | 
|  |     77 | 
 | 
|  |     78 | \begin{document}
 | 
|  |     79 | 
 | 
|  |     80 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |     81 | \mode<presentation>{
 | 
|  |     82 | \begin{frame}<1>[t]
 | 
|  |     83 | \frametitle{%
 | 
|  |     84 |   \begin{tabular}{@ {}c@ {}}
 | 
|  |     85 |   \\[-3mm]
 | 
|  |     86 |   \LARGE Automata and \\[-2mm] 
 | 
|  |     87 |   \LARGE Formal Languages (4)\\[3mm] 
 | 
|  |     88 |   \end{tabular}}
 | 
|  |     89 | 
 | 
|  |     90 |   \normalsize
 | 
|  |     91 |   \begin{center}
 | 
|  |     92 |   \begin{tabular}{ll}
 | 
|  |     93 |   Email:  & christian.urban at kcl.ac.uk\\
 | 
|  |     94 |   Of$\!$fice: & S1.27 (1st floor Strand Building)\\
 | 
|  |     95 |   Slides: & KEATS (also home work is there)\\
 | 
|  |     96 |   \end{tabular}
 | 
|  |     97 |   \end{center}
 | 
|  |     98 | 
 | 
|  |     99 | 
 | 
|  |    100 | \end{frame}}
 | 
|  |    101 |  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    102 | 
 | 
|  |    103 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    104 | \mode<presentation>{
 | 
|  |    105 | \begin{frame}[c]
 | 
|  |    106 | \frametitle{\begin{tabular}{c}Last Week\end{tabular}}
 | 
|  |    107 | 
 | 
| 35 |    108 | Last week I showed you\bigskip
 | 
| 33 |    109 | 
 | 
|  |    110 | \begin{itemize}
 | 
| 35 |    111 | \item a tokenizer taking a list of regular expressions\bigskip
 | 
| 33 |    112 | 
 | 
|  |    113 | \item tokenization identifies lexeme in an input stream of characters (or string)
 | 
| 35 |    114 | and cathegorizes  them into tokens
 | 
|  |    115 | 
 | 
|  |    116 | \end{itemize}
 | 
|  |    117 | 
 | 
|  |    118 | \end{frame}}
 | 
|  |    119 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
| 33 |    120 | 
 | 
| 35 |    121 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    122 | \mode<presentation>{
 | 
|  |    123 | \begin{frame}[c]
 | 
|  |    124 | \frametitle{\begin{tabular}{c}Two Rules\end{tabular}}
 | 
|  |    125 | 
 | 
|  |    126 | \begin{itemize}
 | 
|  |    127 | \item Longest match rule (maximal munch rule): The 
 | 
| 34 |    128 | longest initial substring matched by any regular expression is taken
 | 
| 35 |    129 | as next token.\bigskip
 | 
| 34 |    130 | 
 | 
|  |    131 | \item Rule priority:
 | 
|  |    132 | For a particular longest initial substring, the first regular
 | 
|  |    133 | expression that can match determines the token.
 | 
|  |    134 | 
 | 
| 33 |    135 | \end{itemize}
 | 
|  |    136 | 
 | 
| 35 |    137 | %\url{http://www.technologyreview.com/tr10/?year=2011}
 | 
| 33 |    138 |   
 | 
| 35 |    139 | %finite deterministic automata/ nondeterministic automaton
 | 
| 34 |    140 | 
 | 
| 35 |    141 | %\item problem with infix operations, for example i-12
 | 
| 34 |    142 | 
 | 
|  |    143 | 
 | 
| 33 |    144 | \end{frame}}
 | 
|  |    145 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
| 36 |    146 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    147 | 
 | 
|  |    148 | \mode<presentation>{
 | 
|  |    149 | \begin{frame}[t]
 | 
|  |    150 | 
 | 
|  |    151 | \begin{center}
 | 
|  |    152 | \texttt{"if true then then 42 else +"}
 | 
|  |    153 | \end{center}
 | 
|  |    154 | 
 | 
|  |    155 | 
 | 
|  |    156 | \begin{tabular}{@{}l}
 | 
|  |    157 | KEYWORD: \\
 | 
|  |    158 | \hspace{5mm}\texttt{"if"}, \texttt{"then"}, \texttt{"else"},\\ 
 | 
|  |    159 | WHITESPACE:\\
 | 
|  |    160 | \hspace{5mm}\texttt{" "}, \texttt{"$\backslash$n"},\\ 
 | 
|  |    161 | IDENT:\\
 | 
|  |    162 | \hspace{5mm}LETTER $\cdot$ (LETTER + DIGIT + \texttt{"\_"})$^*$\\ 
 | 
|  |    163 | NUM:\\
 | 
|  |    164 | \hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + \texttt{"0"}\\
 | 
|  |    165 | OP:\\
 | 
|  |    166 | \hspace{5mm}\texttt{"+"}\\
 | 
|  |    167 | COMMENT:\\
 | 
|  |    168 | \hspace{5mm}\texttt{"$\slash$*"} $\cdot$ (ALL$^*$ $\cdot$ \texttt{"*$\slash$"} $\cdot$ ALL$^*$) $\cdot$ \texttt{"*$\slash$"}
 | 
|  |    169 | \end{tabular}
 | 
|  |    170 | 
 | 
|  |    171 | \end{frame}}
 | 
|  |    172 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
| 33 |    173 | 
 | 
|  |    174 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    175 | \mode<presentation>{
 | 
| 35 |    176 | \begin{frame}[t]
 | 
| 33 |    177 | 
 | 
|  |    178 | \begin{center}
 | 
| 35 |    179 | \texttt{"if true then then 42 else +"}
 | 
| 33 |    180 | \end{center}
 | 
|  |    181 | 
 | 
| 35 |    182 | \only<1>{
 | 
|  |    183 | \small\begin{tabular}{l}
 | 
|  |    184 | KEYWORD(if),\\ 
 | 
|  |    185 | WHITESPACE,\\ 
 | 
|  |    186 | IDENT(true),\\ 
 | 
|  |    187 | WHITESPACE,\\ 
 | 
|  |    188 | KEYWORD(then),\\ 
 | 
|  |    189 | WHITESPACE,\\ 
 | 
|  |    190 | KEYWORD(then),\\ 
 | 
|  |    191 | WHITESPACE,\\ 
 | 
|  |    192 | NUM(42),\\ 
 | 
|  |    193 | WHITESPACE,\\ 
 | 
|  |    194 | KEYWORD(else),\\ 
 | 
|  |    195 | WHITESPACE,\\ 
 | 
|  |    196 | OP(+)
 | 
|  |    197 | \end{tabular}}
 | 
|  |    198 | 
 | 
|  |    199 | \only<2>{
 | 
|  |    200 | \small\begin{tabular}{l}
 | 
|  |    201 | KEYWORD(if),\\ 
 | 
|  |    202 | IDENT(true),\\ 
 | 
|  |    203 | KEYWORD(then),\\ 
 | 
|  |    204 | KEYWORD(then),\\ 
 | 
|  |    205 | NUM(42),\\ 
 | 
|  |    206 | KEYWORD(else),\\ 
 | 
|  |    207 | OP(+)
 | 
|  |    208 | \end{tabular}}
 | 
| 33 |    209 | 
 | 
|  |    210 | \end{frame}}
 | 
|  |    211 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    212 | 
 | 
|  |    213 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    214 | \mode<presentation>{
 | 
|  |    215 | \begin{frame}[c]
 | 
|  |    216 | 
 | 
|  |    217 | 
 | 
| 35 |    218 | There is one small problem with the tokenizer. How should we 
 | 
|  |    219 | tokenize:
 | 
| 33 |    220 | 
 | 
|  |    221 | \begin{center}
 | 
| 35 |    222 | \texttt{"x - 3"}
 | 
| 33 |    223 | \end{center}
 | 
|  |    224 | 
 | 
| 36 |    225 | \begin{tabular}{@{}l}
 | 
|  |    226 | OP:\\
 | 
|  |    227 | \hspace{5mm}\texttt{"+"}, \texttt{"-"}\\
 | 
|  |    228 | NUM:\\
 | 
|  |    229 | \hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + \texttt{"0"}\\
 | 
|  |    230 | NUMBER:\\
 | 
|  |    231 | \hspace{5mm}NUM +  (\texttt{"-"} $\cdot$ NUM)\\
 | 
|  |    232 | \end{tabular}
 | 
|  |    233 | 
 | 
|  |    234 | 
 | 
| 33 |    235 | \end{frame}}
 | 
|  |    236 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    237 | 
 | 
|  |    238 | 
 | 
|  |    239 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    240 | \mode<presentation>{
 | 
|  |    241 | \begin{frame}[c]
 | 
| 36 |    242 | \frametitle{\begin{tabular}{c}Deterministic Finite Automata\end{tabular}}
 | 
| 35 |    243 | 
 | 
|  |    244 | A deterministic finite automaton consists of:
 | 
|  |    245 | 
 | 
|  |    246 | \begin{itemize}
 | 
|  |    247 | \item a finite set of states
 | 
|  |    248 | \item one of these states is the start state
 | 
|  |    249 | \item some states are accepting states, and
 | 
|  |    250 | \item there is transition function\medskip 
 | 
|  |    251 | 
 | 
|  |    252 | \small
 | 
|  |    253 | which takes a state and a character as arguments and produces a new state\smallskip\\
 | 
|  |    254 | this function might not always be defined everywhere
 | 
|  |    255 | \end{itemize}
 | 
|  |    256 | 
 | 
|  |    257 | \begin{center}
 | 
|  |    258 | \bl{$A(Q, q_0, F, \delta)$}
 | 
|  |    259 | \end{center}
 | 
|  |    260 | \end{frame}}
 | 
|  |    261 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    262 | 
 | 
|  |    263 | 
 | 
|  |    264 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    265 | \mode<presentation>{
 | 
|  |    266 | \begin{frame}[c]
 | 
|  |    267 | 
 | 
|  |    268 | \begin{center}
 | 
|  |    269 | \includegraphics[scale=0.7]{pics/ch3.jpg}
 | 
| 36 |    270 | \end{center}\pause
 | 
|  |    271 | 
 | 
|  |    272 | \begin{itemize}
 | 
|  |    273 | \item start can be an accepting state
 | 
|  |    274 | \item there is no accepting state
 | 
|  |    275 | \item all states are accepting
 | 
|  |    276 | \end{itemize}
 | 
|  |    277 | 
 | 
|  |    278 | \end{frame}}
 | 
|  |    279 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    280 | 
 | 
|  |    281 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    282 | \mode<presentation>{
 | 
|  |    283 | \begin{frame}[c]
 | 
|  |    284 | 
 | 
|  |    285 | \begin{center}
 | 
|  |    286 | \includegraphics[scale=0.7]{pics/ch3.jpg}
 | 
|  |    287 | \end{center}
 | 
|  |    288 | 
 | 
|  |    289 | for this automaton \bl{$\delta$} is the function\\
 | 
|  |    290 | 
 | 
|  |    291 | \begin{center}
 | 
|  |    292 | \begin{tabular}{lll}
 | 
|  |    293 | \bl{(q$_0$, a) $\rightarrow$ q$_1$} & \bl{(q$_1$, a) $\rightarrow$ q$_4$} & \bl{(q$_4$, a) $\rightarrow$ q$_4$}\\
 | 
|  |    294 | \bl{(q$_0$, b) $\rightarrow$ q$_2$} & \bl{(q$_1$, b) $\rightarrow$ q$_2$} & \bl{(q$_4$, b) $\rightarrow$ q$_4$}\\
 | 
|  |    295 | \end{tabular}\ldots
 | 
|  |    296 | \end{center}
 | 
|  |    297 | 
 | 
|  |    298 | \end{frame}}
 | 
|  |    299 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    300 | 
 | 
|  |    301 | 
 | 
|  |    302 | 
 | 
|  |    303 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    304 | \mode<presentation>{
 | 
|  |    305 | \begin{frame}[t]
 | 
|  |    306 | \frametitle{\begin{tabular}{c}Accepting a String\end{tabular}}
 | 
|  |    307 | 
 | 
|  |    308 | Given
 | 
|  |    309 | 
 | 
|  |    310 | \begin{center}
 | 
|  |    311 | \bl{$A(Q, q_0, F, \delta)$}
 | 
|  |    312 | \end{center}
 | 
|  |    313 | 
 | 
|  |    314 | you can define
 | 
|  |    315 | 
 | 
|  |    316 | \begin{center}
 | 
|  |    317 | \begin{tabular}{l}
 | 
|  |    318 | \bl{$\hat{\delta}(q, \texttt{""}) = q$}\\
 | 
|  |    319 | \bl{$\hat{\delta}(q, c::s) = \hat{\delta}(\delta(q, c), s)$}\\
 | 
|  |    320 | \end{tabular}
 | 
|  |    321 | \end{center}\pause
 | 
|  |    322 | 
 | 
|  |    323 | Whether a string \bl{$s$} is accepted by \bl{$A$}?
 | 
|  |    324 | 
 | 
|  |    325 | \begin{center}
 | 
|  |    326 | \hspace{5mm}\bl{$\hat{\delta}(q_0, s) \in F$}
 | 
|  |    327 | \end{center}
 | 
|  |    328 | \end{frame}}
 | 
|  |    329 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    330 | 
 | 
|  |    331 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    332 | \mode<presentation>{
 | 
|  |    333 | \begin{frame}[c]
 | 
|  |    334 | \frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}}
 | 
|  |    335 | 
 | 
|  |    336 | A non-deterministic finite automaton consists again of:
 | 
|  |    337 | 
 | 
|  |    338 | \begin{itemize}
 | 
|  |    339 | \item a finite set of states
 | 
|  |    340 | \item one of these states is the start state
 | 
|  |    341 | \item some states are accepting states, and
 | 
|  |    342 | \item there is transition \alert{relation}\medskip 
 | 
|  |    343 | \end{itemize}
 | 
|  |    344 | 
 | 
|  |    345 | 
 | 
|  |    346 | \begin{center}
 | 
|  |    347 | \begin{tabular}{c}
 | 
|  |    348 | \bl{(q$_1$, a) $\rightarrow$ q$_2$}\\
 | 
|  |    349 | \bl{(q$_1$, a) $\rightarrow$ q$_3$}\\
 | 
|  |    350 | \end{tabular}
 | 
|  |    351 | \hspace{10mm}
 | 
|  |    352 | \begin{tabular}{c}
 | 
|  |    353 | \bl{(q$_1$, $\epsilon$) $\rightarrow$ q$_2$}\\
 | 
|  |    354 | \end{tabular}
 | 
| 35 |    355 | \end{center}
 | 
|  |    356 | 
 | 
|  |    357 | \end{frame}}
 | 
|  |    358 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
| 33 |    359 | 
 | 
| 35 |    360 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    361 | \mode<presentation>{
 | 
| 36 |    362 | \begin{frame}[c]
 | 
|  |    363 | 
 | 
|  |    364 | \begin{center}
 | 
|  |    365 | \includegraphics[scale=0.7]{pics/ch5.jpg}
 | 
|  |    366 | \end{center}
 | 
|  |    367 | 
 | 
|  |    368 | \end{frame}}
 | 
|  |    369 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    370 | 
 | 
|  |    371 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    372 | \mode<presentation>{
 | 
|  |    373 | \begin{frame}[c]
 | 
| 35 |    374 | 
 | 
|  |    375 | \begin{center}
 | 
| 36 |    376 | \begin{tabular}[b]{ll}
 | 
|  |    377 | \bl{$\varnothing$} & \includegraphics[scale=0.7]{pics/NULL.jpg}\\\\
 | 
|  |    378 | \bl{$\epsilon$} & \includegraphics[scale=0.7]{pics/epsilon.jpg}\\\\
 | 
|  |    379 | \bl{c} & \includegraphics[scale=0.7]{pics/char.jpg}\\
 | 
|  |    380 | \end{tabular}
 | 
|  |    381 | \end{center}
 | 
|  |    382 | 
 | 
|  |    383 | \end{frame}}
 | 
|  |    384 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    385 | 
 | 
|  |    386 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    387 | \mode<presentation>{
 | 
|  |    388 | \begin{frame}[c]
 | 
| 35 |    389 | 
 | 
|  |    390 | \begin{center}
 | 
| 36 |    391 | \begin{tabular}[t]{ll}
 | 
|  |    392 | \bl{r$_1$ $\cdot$ r$_2$} & \includegraphics[scale=0.6]{pics/seq.jpg}\\\\
 | 
| 35 |    393 | \end{tabular}
 | 
| 36 |    394 | \end{center}
 | 
|  |    395 | 
 | 
|  |    396 | \end{frame}}
 | 
|  |    397 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    398 | 
 | 
|  |    399 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    400 | \mode<presentation>{
 | 
|  |    401 | \begin{frame}[c]
 | 
| 33 |    402 | 
 | 
| 35 |    403 | \begin{center}
 | 
| 36 |    404 | \begin{tabular}[t]{ll}
 | 
|  |    405 | \bl{r$_1$ + r$_2$} & \includegraphics[scale=0.7]{pics/alt.jpg}\\\\
 | 
|  |    406 | \end{tabular}
 | 
| 35 |    407 | \end{center}
 | 
| 36 |    408 | 
 | 
| 35 |    409 | \end{frame}}
 | 
|  |    410 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    411 | 
 | 
|  |    412 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    413 | \mode<presentation>{
 | 
|  |    414 | \begin{frame}[c]
 | 
|  |    415 | 
 | 
|  |    416 | \begin{center}
 | 
| 36 |    417 | \begin{tabular}[b]{ll}
 | 
|  |    418 | \bl{r$^*$} & \includegraphics[scale=0.7]{pics/star.jpg}\\
 | 
|  |    419 | \end{tabular}
 | 
|  |    420 | \end{center}
 | 
|  |    421 | 
 | 
|  |    422 | \end{frame}}
 | 
|  |    423 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    424 | 
 | 
|  |    425 | 
 | 
|  |    426 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    427 | \mode<presentation>{
 | 
|  |    428 | \begin{frame}[c]
 | 
|  |    429 | 
 | 
|  |    430 | \begin{center}
 | 
|  |    431 | \includegraphics[scale=0.5]{pics/ch5.jpg}
 | 
|  |    432 | \end{center}
 | 
|  |    433 | 
 | 
|  |    434 | \end{frame}}
 | 
|  |    435 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    436 | 
 | 
|  |    437 | 
 | 
|  |    438 | 
 | 
|  |    439 | 
 | 
|  |    440 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    441 | \mode<presentation>{
 | 
|  |    442 | \begin{frame}[c]
 | 
|  |    443 | 
 | 
|  |    444 | \begin{center}
 | 
| 35 |    445 | \includegraphics[scale=0.7]{pics/ch4.jpg}
 | 
|  |    446 | \end{center}
 | 
|  |    447 | 
 | 
|  |    448 | \end{frame}}
 | 
|  |    449 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    450 | 
 | 
|  |    451 | 
 | 
|  |    452 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    453 | \mode<presentation>{
 | 
|  |    454 | \begin{frame}[c]
 | 
|  |    455 | \frametitle{\begin{tabular}{c}Languages\end{tabular}}
 | 
| 33 |    456 | 
 | 
|  |    457 | A language is \alert{regular} iff there exists
 | 
|  |    458 | a regular expression that recognises all its strings.\bigskip\bigskip\pause
 | 
|  |    459 | 
 | 
|  |    460 | \textcolor{gray}{not all languages are regular, e.g.~\bl{a$^n$b$^n$}.}
 | 
|  |    461 | \end{frame}}
 | 
|  |    462 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    463 | 
 | 
|  |    464 | 
 | 
|  |    465 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    466 | \mode<presentation>{
 | 
|  |    467 | \begin{frame}[c]
 | 
|  |    468 | 
 | 
|  |    469 | \begin{itemize}
 | 
| 35 |    470 | \item Assuming you have the alphabet \bl{\{a, b, c\}}\bigskip
 | 
|  |    471 | \item Give a regular expression that can recognise all strings that have at least one \bl{b}.
 | 
| 33 |    472 | \end{itemize}
 | 
|  |    473 | 
 | 
|  |    474 | \end{frame}}
 | 
|  |    475 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    476 | 
 | 
|  |    477 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    478 | \mode<presentation>{
 | 
|  |    479 | \begin{frame}[c]
 | 
|  |    480 | 
 | 
| 35 |    481 | 
 | 
| 33 |    482 | 
 | 
|  |    483 | \begin{itemize}
 | 
| 35 |    484 | \item The star-case in our proof needs the following lemma
 | 
|  |    485 | \begin{center}
 | 
|  |    486 | \bl{Der\,c\,A$^*$ $=$ (Der c A)\,@\, A$^*$}
 | 
|  |    487 | \end{center}
 | 
|  |    488 | \end{itemize}\bigskip\bigskip
 | 
| 33 |    489 | 
 | 
| 35 |    490 | 
 | 
|  |    491 | 
 | 
|  |    492 | \begin{itemize}
 | 
|  |    493 | \item If \bl{\texttt{""} $\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B $\cup$ (Der\,c\,B)}\medskip
 | 
|  |    494 | \item If \bl{\texttt{""} $\not\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B}
 | 
|  |    495 | 
 | 
| 33 |    496 | \end{itemize}
 | 
|  |    497 | 
 | 
|  |    498 | \end{frame}}
 | 
|  |    499 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    500 | 
 | 
|  |    501 | 
 | 
|  |    502 | \end{document}
 | 
|  |    503 | 
 | 
|  |    504 | %%% Local Variables:  
 | 
|  |    505 | %%% mode: latex
 | 
|  |    506 | %%% TeX-master: t
 | 
|  |    507 | %%% End: 
 | 
|  |    508 | 
 |