slides/slides03.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 07 Oct 2013 16:59:36 +0100
changeset 133 09efdf5cf07c
parent 93 4794759139ea
child 134 e3a8cf96f570
permissions -rw-r--r--
updated
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}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  \begin{tabular}{ll}
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)\\
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
  Slides: & KEATS (also home work is there)\\
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
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   119
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 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   141
which works provably 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
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
The matching algorithm works similarly, just over regular expression than sets.
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
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
\item finally check whether the latter regular expression can match the empty string
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
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   252
by induction on the regular expression.
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   253
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   254
\end{frame}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   255
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   256
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   257
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   258
\mode<presentation>{
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   259
\begin{frame}[c]
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   260
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
We need to prove
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   264
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
by induction on the regular expression.
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
\begin{frame}[c]
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   276
\frametitle{\begin{tabular}{c}Proofs about Rexps\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
\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
   280
\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
   281
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
   282
\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
   283
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
   284
\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
   285
holds for \bl{$r$}.
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
\begin{frame}[c]
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   294
\frametitle{\begin{tabular}{c}Proofs about Natural\\[-1mm] Numbers and Strings\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
\item \bl{$P$} holds for \bl{$0$} and
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
\item \bl{$P$} holds for \bl{$n + 1$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
holds for \bl{$n$}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
\end{itemize}\bigskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
\begin{itemize}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   303
\item \bl{$P$} holds for \bl{$""$} and
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
\item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
holds for \bl{$s$}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
\frametitle{\begin{tabular}{c}Languages\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
A \alert{language} is a set of strings.\bigskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   320
A \alert{regular expression} specifies a language.\bigskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
A language is \alert{regular} iff there exists
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
a regular expression that recognises all its strings.\bigskip\bigskip\pause
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
\textcolor{gray}{not all languages are regular, e.g.~\bl{a$^n$b$^n$}.}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
\begin{frame}[t]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
  \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
  \bl{r} & \bl{$::=$}  & \bl{$\varnothing$}  & null\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
         & \bl{$\mid$} & \bl{$\epsilon$}        & empty string / "" / []\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
         & \bl{$\mid$} & \bl{c}                         & character\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
         & \bl{$\mid$} & \bl{r$_1$ $\cdot$ r$_2$} & sequence\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
         & \bl{$\mid$} & \bl{r$_1$ + r$_2$}  & alternative / choice\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
         & \bl{$\mid$} & \bl{r$^*$}                   & star (zero or more)\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
  \end{tabular}\bigskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
  \end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
How about ranges \bl{[a-z]}, \bl{r$^\text{+}$} and \bl{!r}?
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
\frametitle{\begin{tabular}{c}Negation of Regular Expr's\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
\item \bl{!r}  \hspace{6mm} (everything that \bl{r} cannot recognise)\medskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
\item \bl{$L$(!r) $\dn$ UNIV - $L$(r)}\medskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
\item \bl{nullable (!r) $\dn$ not (nullable(r))}\medskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
\item \bl{der\,c\,(!r) $\dn$ !(der\,c\,r)}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   364
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   365
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   369
\begin{frame}[c]
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   370
\frametitle{\begin{tabular}{c}Regular Languages\end{tabular}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   371
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   372
A language (a set of strings) is \alert{regular} iff there exists
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   373
a regular expression that recognises all its strings.\bigskip\bigskip\pause
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   374
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   375
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   376
Do you think there are languages that are {\bf not} regular?
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   377
\end{frame}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   378
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   379
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   380
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   381
\mode<presentation>{
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   382
\begin{frame}[c]
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
\frametitle{\begin{tabular}{c}Regular Exp's for Lexing\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
Lexing separates strings into ``words'' / components.
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
\item Identifiers (non-empty strings of letters or digits, starting with a letter)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
\item Numbers (non-empty sequences of digits omitting leading zeros)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
\item Keywords (else, if, while, \ldots)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
\item White space (a non-empty sequence of blanks, newlines and tabs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
\item Comments
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
\end{frame}}
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
A deterministic finite automaton consists of:
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   405
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
\item a set of states
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
\item one of these states is the start state
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
\item some states are accepting states, and
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
\item there is transition function\medskip 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
\small
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
which takes a state as argument and a character and produces a new state\smallskip\\
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
this function might not always be defined
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   418
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   419
\mode<presentation>{
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   420
\begin{frame}[c]
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   421
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   422
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   423
A deterministic finite automaton consists of:
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   424
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   425
\begin{itemize}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   426
\item a set of states
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   427
\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
   428
\item some states are accepting states, and
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   429
\item there is transition function\medskip 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   430
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   431
\small
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   432
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
   433
this function might not always be defined
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   434
\end{itemize}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   435
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   436
\end{frame}}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   437
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
%%% Local Variables:  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   444
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445
%%% End: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   446