slides/slides03.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 08 Oct 2013 21:59:31 +0100
changeset 135 72b686e1c974
parent 134 e3a8cf96f570
child 136 cc19e6cbcb68
permissions -rw-r--r--
added slides
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
     2
\usepackage{beamerthemeplaincu}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
     3
%%\usepackage[T1]{fontenc}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage[latin1]{inputenc}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{mathpartir}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage[absolute,overlay]{textpos}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{ifthen}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
\usepackage{tikz}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\usepackage{pgf}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\usepackage{calc} 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\usepackage{ulem}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\usepackage{courier}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\usepackage{listings}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\renewcommand{\uline}[1]{#1}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\usetikzlibrary{arrows}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\usetikzlibrary{automata}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
\usetikzlibrary{shapes}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\usetikzlibrary{shadows}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
\usetikzlibrary{positioning}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
\usetikzlibrary{calc}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\usepackage{graphicx} 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
\definecolor{javared}{rgb}{0.6,0,0} % for strings
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    27
\makeatletter
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    28
\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    29
\@empty\z@\@empty
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    30
\makeatother
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
\lstset{language=Java,
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    33
	basicstyle=\consolas,
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
	keywordstyle=\color{javapurple}\bfseries,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
	stringstyle=\color{javagreen},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
	commentstyle=\color{javagreen},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
	morecomment=[s][\color{javadocblue}]{/**}{*/},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
	numbers=left,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
	numberstyle=\tiny\color{black},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
	stepnumber=1,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
	numbersep=10pt,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
	tabsize=2,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
	showspaces=false,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
	showstringspaces=false}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
\lstdefinelanguage{scala}{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  morekeywords={abstract,case,catch,class,def,%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
    do,else,extends,false,final,finally,%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
    for,if,implicit,import,match,mixin,%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
    new,null,object,override,package,%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
    private,protected,requires,return,sealed,%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
    super,this,throw,trait,true,try,%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
    type,val,var,while,with,yield},
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    54
  otherkeywords={=>,<-,<\%,<:,>:,\#,@,->},
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
  sensitive=true,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  morecomment=[l]{//},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
  morecomment=[n]{/*}{*/},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
  morestring=[b]",
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
  morestring=[b]',
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
  morestring=[b]"""
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
\lstset{language=Scala,
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    64
	basicstyle=\consolas,
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
	keywordstyle=\color{javapurple}\bfseries,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
	stringstyle=\color{javagreen},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
	commentstyle=\color{javagreen},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
	morecomment=[s][\color{javadocblue}]{/**}{*/},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
	numbers=left,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
	numberstyle=\tiny\color{black},
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
	stepnumber=1,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
	numbersep=10pt,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
	tabsize=2,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
	showspaces=false,
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
	showstringspaces=false}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    77
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
% beamer stuff 
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    79
\renewcommand{\slidecaption}{AFL 03, King's College London, 9.~October 2013}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
\begin{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
\begin{frame}<1>[t]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
\frametitle{%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
  \begin{tabular}{@ {}c@ {}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  \\[-3mm]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
  \LARGE Automata and \\[-2mm] 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
  \LARGE Formal Languages (3)\\[3mm] 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  \end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  %\begin{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  %\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  %\includegraphics[scale=0.31]{pics/ante2.jpg}\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
  %\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
  %\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
\normalsize
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  \begin{center}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   103
  \begin{tabular}{lp{8cm}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
  Email:  & christian.urban at kcl.ac.uk\\
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   105
  Office: & S1.27 (1st floor Strand Building)\\
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   106
  Slides: & KEATS (also home work and coursework is there)\\
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
  \end{tabular}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
  \end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
\begin{frame}[c]
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   117
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   119
In programming languages they are often used to recognise:\medskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
\begin{itemize}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   122
\item symbols, digits
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   123
\item identifiers
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   124
\item numbers (non-leading zeros)
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   125
\item keywords
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   126
\item comments
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   127
\end{itemize}\bigskip
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   128
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   129
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   130
\mbox{}\hfill\bl{\url{http://www.regexper.com}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   131
\end{frame}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   132
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   134
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   135
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   136
\mode<presentation>{
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   137
\begin{frame}[c]
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   138
\frametitle{\begin{tabular}{c}Last Week\end{tabular}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   139
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   140
Last week I showed you a regular expression matcher 
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   141
which works provably correctly in all cases.
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   144
\bl{$matcher\,r\,s$} \;\;if and only if \;\; \bl{$s \in L(r)$}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   145
\end{center}\bigskip\bigskip 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   146
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   147
\small
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   148
\textcolor{gray}{\mbox{}\hfill{}by Janusz Brzozowski (1964)}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   149
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
\frametitle{\begin{tabular}{c}The Derivative of a Rexp\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   161
  \bl{$der\, c\, (\varnothing)$}      & \bl{$\dn$} & \bl{$\varnothing$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   162
  \bl{$der\, c\, (\epsilon)$}           & \bl{$\dn$} & \bl{$\varnothing$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   163
  \bl{$der\, c\, (d)$}                     & \bl{$\dn$} & \bl{if $c = d$ then $\epsilon$ else $\varnothing$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   164
  \bl{$der\, c\, (r_1 + r_2)$}        & \bl{$\dn$} & \bl{$der\, c\, r_1 + der\, c\, r_2$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   165
  \bl{$der\, c\, (r_1 \cdot r_2)$}  & \bl{$\dn$}  & \bl{if $nullable (r_1)$}\\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   166
  & & \bl{then $(der\,c\,r_1) \cdot r_2 + der\, c\, r_2$}\\ 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   167
  & & \bl{else $(der\, c\, r_1) \cdot r_2$}\\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   168
  \bl{$der\, c\, (r^*)$}          & \bl{$\dn$} & \bl{$(der\,c\,r) \cdot (r^*)$} &\smallskip\\\pause
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   169
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   170
  \bl{$der\!s\, []\, r$}     & \bl{$\dn$} & \bl{$r$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   171
  \bl{$der\!s\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$der\!s\,s\,(der\,c\,r)$} & \\
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
  \end{tabular}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   183
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   184
To see what is going on, define
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   187
\bl{$Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   188
\end{center}\bigskip\bigskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   190
\small
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   191
For \bl{$A = \{"f\!oo", "bar", "f\!rak"\}$} then
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   194
\bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   195
$Der\,f\,A$ & $=$ & $\{"oo", "rak"\}$\\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   196
$Der\,b\,A$ & $=$ &  $\{"ar"\}$\\  
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   197
$Der\,a\,A$ & $=$ & $\varnothing$\\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   198
\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
\end{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   200
 
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
\frametitle{\begin{tabular}{c}The Idea of the Algorithm\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   211
If we want to recognise the string \bl{$"abc"$} with regular expression \bl{$r$}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
then\medskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
\begin{enumerate}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   215
\item \bl{$Der\,a\,(L(r))$}\pause
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   216
\item \bl{$Der\,b\,(Der\,a\,(L(r)))$}\pause
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   217
\item \bl{$Der\,c\,(Der\,b\,(Der\,a\,(L(r))))$}\pause
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   218
\item finally we test whether the empty string is in this set\pause\medskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   221
The matching algorithm works similarly, just over regular expression instead of sets.
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   230
Input: string \bl{$"abc"$} and regular expression \bl{$r$} 
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
\begin{enumerate}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   233
\item \bl{$der\,a\,r$}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   234
\item \bl{$der\,b\,(der\,a\,r)$}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   235
\item \bl{$der\,c\,(der\,b\,(der\,a\,r))$}\bigskip\pause
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   236
\item finally check whether the last regular expression can match the empty string
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   246
We proved already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   247
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   248
\begin{center}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   249
\bl{$nullable(r)$} \;if and only if\;  \bl{$"" \in L(r)$}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   250
\end{center}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   251
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   252
by induction on the regular expression.\bigskip\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   253
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   254
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   255
\huge\bf \alert{Any Questions?}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   256
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   257
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   258
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   259
\end{frame}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   260
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   261
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   262
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   263
\mode<presentation>{
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   264
\begin{frame}[c]
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   265
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
We need to prove
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   269
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
by induction on the regular expression.
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
\begin{frame}[c]
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   280
\frametitle{\begin{tabular}{c}Proofs about Rexps\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
\item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   284
\item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   285
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   286
\item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   287
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   288
\item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   289
holds for \bl{$r$}.
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
\begin{frame}[c]
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   298
\frametitle{\begin{tabular}{c}Proofs about Natural\\[-1mm] Numbers and Strings\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
\item \bl{$P$} holds for \bl{$0$} and
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
\item \bl{$P$} holds for \bl{$n + 1$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
holds for \bl{$n$}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
\end{itemize}\bigskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
\begin{itemize}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   307
\item \bl{$P$} holds for \bl{$""$} and
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
\item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
holds for \bl{$s$}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
\frametitle{\begin{tabular}{c}Languages\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
A \alert{language} is a set of strings.\bigskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   324
A \alert{regular expression} specifies a language.\bigskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
A language is \alert{regular} iff there exists
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
a regular expression that recognises all its strings.\bigskip\bigskip\pause
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   329
\textcolor{gray}{not all languages are regular, e.g.~\bl{$a^nb^n$}.}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
\begin{frame}[t]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
\begin{center}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   339
   \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   340
  \bl{$r$} & \bl{$::=$}  & \bl{$\varnothing$}  & null\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   341
         & \bl{$\mid$} & \bl{$\epsilon$}        & empty string / "" / $[]$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   342
         & \bl{$\mid$} & \bl{$c$}                         & character\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   343
         & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   344
         & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   345
         & \bl{$\mid$} & \bl{$r^*$}                   & star (zero or more)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   346
  \end{tabular}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
  \end{center}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   348
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   349
How about ranges \bl{$[a\mbox{-}z]$}, \bl{$r^+$} and \bl{$\sim{}r$}? Do they increase the
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   350
set of languages we can recognise?
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
\frametitle{\begin{tabular}{c}Negation of Regular Expr's\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
\begin{itemize}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   361
\item \bl{$\sim{}r$}  \hspace{6mm} (everything that \bl{r} cannot recognise)\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   362
\item \bl{$L(\sim{}r) \dn UNIV - L(r)$}\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   363
\item \bl{$nullable (r) \dn not (nullable(r))$}\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   364
\item \bl{$der\,c\,(\sim{}r) \dn \;\sim{}(der\,c\,r)$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   365
\end{itemize}\bigskip\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   366
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   367
Used often for comments:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   368
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   369
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   370
\bl{/ \cdot * \cdot (\sim{}([a\mbox{-}z]^* \cdot * \cdot / \cdot [a\mbox{-}z]^*)) \cdot * \cdot /}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   371
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   372
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   373
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   377
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   378
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   379
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   380
\frametitle{\begin{tabular}{c}Negation\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   381
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   382
Assume you have an alphabet consisting of the letters \bl{a}, \bl{b} and \bl{c} only.
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   383
Find a regular expression that matches all strings \emph{except} \bl{ab}, \bl{ac} and \bl{cba}.
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   384
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   385
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   386
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   387
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
\frametitle{\begin{tabular}{c}Regular Exp's for Lexing\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
Lexing separates strings into ``words'' / components.
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
\item Identifiers (non-empty strings of letters or digits, starting with a letter)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
\item Numbers (non-empty sequences of digits omitting leading zeros)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
\item Keywords (else, if, while, \ldots)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
\item White space (a non-empty sequence of blanks, newlines and tabs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
\item Comments
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   405
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
A deterministic finite automaton consists of:
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
\item a set of states
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
\item one of these states is the start state
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
\item some states are accepting states, and
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   419
\item there is transition function\medskip 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
\small
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
which takes a state as argument and a character and produces a new state\smallskip\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
this function might not always be defined
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   426
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   428
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   429
\mode<presentation>{
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   430
\begin{frame}[c]
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   431
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   432
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   433
A deterministic finite automaton consists of:
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   434
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   435
\begin{itemize}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   436
\item a set of states
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   437
\item one of these states is the start state
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   438
\item some states are accepting states, and
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   439
\item there is transition function\medskip 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   440
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   441
\small
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   442
which takes a state as argument and a character and produces a new state\smallskip\\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   443
this function might not always be defined
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   444
\end{itemize}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   445
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   446
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   447
\bl{$A(Q, q_0, F, \delta)$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   448
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   449
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   450
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   451
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   452
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   453
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   454
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   455
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   456
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   457
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   458
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   459
\includegraphics[scale=0.7]{pics/ch3.jpg}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   460
\end{center}\pause
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   461
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   462
\begin{itemize}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   463
\item start can be an accepting state
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   464
\item it is possible that there is no accepting state
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   465
\item all states might be accepting (but does not necessarily mean all strings are accepted)
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   466
\end{itemize}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   467
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   468
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   469
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   470
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   471
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   472
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   473
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   474
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   475
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   476
\includegraphics[scale=0.7]{pics/ch3.jpg}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   477
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   478
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   479
for this automaton \bl{$\delta$} is the function\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   480
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   481
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   482
\begin{tabular}{lll}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   483
\bl{(q$_0$, a) $\rightarrow$ q$_1$} & \bl{(q$_1$, a) $\rightarrow$ q$_4$} & \bl{(q$_4$, a) $\rightarrow$ q$_4$}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   484
\bl{(q$_0$, b) $\rightarrow$ q$_2$} & \bl{(q$_1$, b) $\rightarrow$ q$_2$} & \bl{(q$_4$, b) $\rightarrow$ q$_4$}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   485
\end{tabular}\ldots
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   486
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   487
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   488
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   489
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   490
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   491
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   492
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   493
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   494
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   495
\begin{frame}[t]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   496
\frametitle{\begin{tabular}{c}Accepting a String\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   497
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   498
Given
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   499
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   500
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   501
\bl{$A(Q, q_0, F, \delta)$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   502
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   503
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   504
you can define
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   505
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   506
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   507
\begin{tabular}{l}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   508
\bl{$\hat{\delta}(q, \texttt{""}) = q$}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   509
\bl{$\hat{\delta}(q, c::s) = \hat{\delta}(\delta(q, c), s)$}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   510
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   511
\end{center}\pause
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   512
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   513
Whether a string \bl{$s$} is accepted by \bl{$A$}?
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   514
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   515
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   516
\hspace{5mm}\bl{$\hat{\delta}(q_0, s) \in F$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   517
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   518
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   519
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   520
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   521
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   522
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   523
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   524
\frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   525
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   526
A non-deterministic finite automaton consists again of:
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   527
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   528
\begin{itemize}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   529
\item a finite set of states
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   530
\item one of these states is the start state
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   531
\item some states are accepting states, and
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   532
\item there is transition \alert{relation}\medskip 
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   533
\end{itemize}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   534
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   535
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   536
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   537
\begin{tabular}{c}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   538
\bl{(q$_1$, a) $\rightarrow$ q$_2$}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   539
\bl{(q$_1$, a) $\rightarrow$ q$_3$}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   540
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   541
\hspace{10mm}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   542
\begin{tabular}{c}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   543
\bl{(q$_1$, $\epsilon$) $\rightarrow$ q$_2$}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   544
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   545
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   546
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   547
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   548
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   549
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   550
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   551
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   552
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   553
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   554
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   555
\includegraphics[scale=0.7]{pics/ch5.jpg}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   556
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   557
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   558
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   559
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   560
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   561
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   562
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   563
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   564
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   565
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   566
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   567
\begin{tabular}[b]{ll}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   568
\bl{$\varnothing$} & \includegraphics[scale=0.7]{pics/NULL.jpg}\\\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   569
\bl{$\epsilon$} & \includegraphics[scale=0.7]{pics/epsilon.jpg}\\\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   570
\bl{c} & \includegraphics[scale=0.7]{pics/char.jpg}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   571
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   572
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   573
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   574
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   575
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   576
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   577
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   578
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   579
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   580
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   581
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   582
\begin{tabular}[t]{ll}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   583
\bl{r$_1$ $\cdot$ r$_2$} & \includegraphics[scale=0.6]{pics/seq.jpg}\\\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   584
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   585
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   586
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   587
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   588
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   589
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   590
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   591
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   592
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   593
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   594
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   595
\begin{tabular}[t]{ll}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   596
\bl{r$_1$ + r$_2$} & \includegraphics[scale=0.7]{pics/alt.jpg}\\\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   597
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   598
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   599
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   600
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   601
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   602
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   603
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   604
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   605
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   606
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   607
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   608
\begin{tabular}[b]{ll}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   609
\bl{r$^*$} & \includegraphics[scale=0.7]{pics/star.jpg}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   610
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   611
\end{center}\pause\bigskip
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   612
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   613
Why can't we just have an epsilon transition from the accepting states to the starting state?
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   614
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   615
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   616
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   617
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   618
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   619
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   620
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   621
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   622
\frametitle{\begin{tabular}{c}Subset Construction\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   623
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   624
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   625
\begin{textblock}{5}(1,2.5)
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   626
\includegraphics[scale=0.5]{pics/ch5.jpg}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   627
\end{textblock}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   628
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   629
\begin{textblock}{11}(6.5,4.5)
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   630
\begin{tabular}{r|cl}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   631
& a & b\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   632
\hline
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   633
$\varnothing$ \onslide<2>{\textcolor{white}{*}} & $\varnothing$ & $\varnothing$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   634
$\{0\}$ \onslide<2>{\textcolor{white}{*}} & $\{0,1,2\}$ & $\{2\}$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   635
$\{1\}$ \onslide<2>{\textcolor{white}{*}} &$\{1\}$ & $\varnothing$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   636
$\{2\}$ \onslide<2>{*} & $\varnothing$ &$\{2\}$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   637
$\{0,1\}$ \onslide<2>{\textcolor{white}{*}} &$\{0,1,2\}$ &$\{2\}$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   638
$\{0,2\}$ \onslide<2>{*}&$\{0,1,2\}$ &$\{2\}$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   639
$\{1,2\}$ \onslide<2>{*}& $\{1\}$ & $\{2\}$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   640
\onslide<2>{s:} $\{0,1,2\}$ \onslide<2>{*}&$\{0,1,2\}$ &$\{2\}$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   641
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   642
\end{textblock}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   643
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   644
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   645
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   646
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   647
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   648
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   649
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   650
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   651
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   652
\frametitle{\begin{tabular}{c}Regular Languages\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   653
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   654
A language is \alert{regular} iff there exists
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   655
a regular expression that recognises all its strings.\bigskip\medskip
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   656
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   657
or equivalently\bigskip\medskip
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   658
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   659
A language is \alert{regular} iff there exists
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   660
a deterministic finite automaton that recognises all its strings.\bigskip\pause
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   661
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   662
Why is every finite set of strings a regular language?
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   663
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   664
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   665
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   666
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   667
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   668
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   669
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   670
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   671
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   672
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   673
\includegraphics[scale=0.5]{pics/ch3.jpg}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   674
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   675
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   676
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   677
\includegraphics[scale=0.5]{pics/ch4.jpg}\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   678
minimal automaton
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   679
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   680
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   681
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   682
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   683
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   684
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   685
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   686
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   687
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   688
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   689
\begin{enumerate}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   690
\item Take all pairs \bl{(q, p)} with \bl{q $\not=$ p}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   691
\item Mark all pairs that accepting and non-accepting states
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   692
\item For  all unmarked pairs \bl{(q, p)} and all characters \bl{c} tests wether
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   693
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   694
\bl{($\delta$(q,c), $\delta$(p,c))}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   695
\end{center} 
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   696
are marked. If yes, then also mark \bl{(q, p)} 
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   697
\item Repeat last step until no chance.
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   698
\item All unmarked pairs can be merged.
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   699
\end{enumerate}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   700
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   701
\end{frame}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   702
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   703
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   704
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   705
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   706
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   707
\mode<presentation>{
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   708
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   709
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   710
Given the function 
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   711
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   712
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   713
\bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   714
$rev(\varnothing)$   & $\dn$ & $\varnothing$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   715
$rev(\epsilon)$         & $\dn$ & $\epsilon$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   716
$rev(c)$                      & $\dn$ & $c$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   717
$rev(r_1 + r_2)$        & $\dn$ & $rev(r_1) + rev(r_2)$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   718
$rev(r_1 \cdot r_2)$  & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   719
$rev(r^*)$                   & $\dn$ & $rev(r)^*$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   720
\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   721
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   722
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   723
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   724
and the set
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   725
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   726
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   727
\bl{$Rev\,A \dn \{s^{-1} \;|\; s \in A\}$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   728
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   729
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   730
prove whether
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   731
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   732
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   733
\bl{$L(rev(r)) = Rev (L(r))$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   734
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   735
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   736
\end{frame}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   737
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   738
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   739
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   740
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   741
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   742
%%% Local Variables:  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   743
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   744
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   745
%%% End: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   746