slides/slides03.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 08 Oct 2013 21:37:13 +0100
changeset 134 e3a8cf96f570
parent 133 09efdf5cf07c
child 135 72b686e1c974
permissions -rw-r--r--
added
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
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   377
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   378
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   379
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
\frametitle{\begin{tabular}{c}Regular Exp's for Lexing\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
Lexing separates strings into ``words'' / components.
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
\item Identifiers (non-empty strings of letters or digits, starting with a letter)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
\item Numbers (non-empty sequences of digits omitting leading zeros)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
\item Keywords (else, if, while, \ldots)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
\item White space (a non-empty sequence of blanks, newlines and tabs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
\item Comments
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
A deterministic finite automaton consists of:
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   405
\item a set of states
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
\item one of these states is the start state
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
\item some states are accepting states, and
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
\item there is transition function\medskip 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
\small
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
which takes a state as argument and a character and produces a new state\smallskip\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
this function might not always be defined
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   417
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   418
\mode<presentation>{
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   419
\begin{frame}[c]
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   420
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   421
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   422
A deterministic finite automaton consists of:
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   423
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   424
\begin{itemize}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   425
\item a set of states
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   426
\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
   427
\item some states are accepting states, and
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   428
\item there is transition function\medskip 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   429
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   430
\small
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   431
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
   432
this function might not always be defined
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   433
\end{itemize}
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
\end{frame}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   436
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
%%% Local Variables:  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   444
%%% End: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445