slides02.tex
author Christian Urban <urbanc@in.tum.de>
Thu, 11 Oct 2012 11:07:36 +0100
changeset 30 0e971bd4403d
parent 20 32af6d4de262
permissions -rw-r--r--
typ
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\usepackage{beamerthemeplainculight}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage[T1]{fontenc}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage[latin1]{inputenc}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{mathpartir}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage[absolute,overlay]{textpos}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{ifthen}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
\usepackage{tikz}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\usepackage{pgf}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\usepackage{calc} 
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\usepackage{ulem}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\usepackage{courier}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\usepackage{listings}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\renewcommand{\uline}[1]{#1}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\usetikzlibrary{arrows}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\usetikzlibrary{automata}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
\usetikzlibrary{shapes}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\usetikzlibrary{shadows}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
\usetikzlibrary{positioning}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
\usetikzlibrary{calc}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\usepackage{graphicx} 
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
\definecolor{javared}{rgb}{0.6,0,0} % for strings
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
\lstset{language=Java,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
	basicstyle=\ttfamily,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
	keywordstyle=\color{javapurple}\bfseries,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
	stringstyle=\color{javagreen},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
	commentstyle=\color{javagreen},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
	morecomment=[s][\color{javadocblue}]{/**}{*/},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
	numbers=left,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
	numberstyle=\tiny\color{black},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
	stepnumber=1,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
	numbersep=10pt,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
	tabsize=2,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
	showspaces=false,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
	showstringspaces=false}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
\lstdefinelanguage{scala}{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  morekeywords={abstract,case,catch,class,def,%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
    do,else,extends,false,final,finally,%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
    for,if,implicit,import,match,mixin,%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
    new,null,object,override,package,%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
    private,protected,requires,return,sealed,%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
    super,this,throw,trait,true,try,%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
    type,val,var,while,with,yield},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  sensitive=true,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  morecomment=[l]{//},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  morecomment=[n]{/*}{*/},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  morestring=[b]",
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
  morestring=[b]',
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  morestring=[b]"""
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
\lstset{language=Scala,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
	basicstyle=\ttfamily,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
	keywordstyle=\color{javapurple}\bfseries,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
	stringstyle=\color{javagreen},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
	commentstyle=\color{javagreen},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
	morecomment=[s][\color{javadocblue}]{/**}{*/},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
	numbers=left,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
	numberstyle=\tiny\color{black},
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
	stepnumber=1,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
	numbersep=10pt,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
	tabsize=2,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
	showspaces=false,
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
	showstringspaces=false}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
% beamer stuff 
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
    74
\renewcommand{\slidecaption}{AFL 02, King's College London, 3.~October 2012}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
    75
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
    76
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
\begin{document}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\mode<presentation>{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
\begin{frame}<1>[t]
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
\frametitle{%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  \begin{tabular}{@ {}c@ {}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
  \\[-3mm]
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
  \LARGE Automata and \\[-2mm] 
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
    87
  \LARGE Formal Languages (2)\\[3mm] 
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
  \end{tabular}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
    90
  %\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
    91
  %\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
    92
  %\includegraphics[scale=0.31]{pics/ante2.jpg}\\
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
    93
  %\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
    94
  %\end{center}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
\normalsize
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  \begin{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
  \begin{tabular}{ll}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
  Email:  & christian.urban at kcl.ac.uk\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  Of$\!$fice: & S1.27 (1st floor Strand Building)\\
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   101
  Slides: & KEATS 
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  \end{tabular}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  \end{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
\mode<presentation>{
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   111
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   112
\frametitle{\begin{tabular}{c}Languages\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   113
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   114
A \alert{language} is a set of strings.\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   115
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   116
A \alert{regular expression} specifies a set of strings or language.
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   117
  
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   118
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   119
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   120
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   121
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   122
\mode<presentation>{
15
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
   123
\begin{frame}[t]
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
15
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
   126
Their inductive definition:
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
   127
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
   128
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
   129
\begin{textblock}{6}(2,5)
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
  \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
  \bl{r} & \bl{$::=$}  & \bl{$\varnothing$}  & null\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
         & \bl{$\mid$} & \bl{$\epsilon$}        & empty string / "" / []\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
         & \bl{$\mid$} & \bl{c}                         & character\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
         & \bl{$\mid$} & \bl{r$_1$ $\cdot$ r$_2$} & sequence\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
         & \bl{$\mid$} & \bl{r$_1$ + r$_2$}  & alternative / choice\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
         & \bl{$\mid$} & \bl{r$^*$}                   & star (zero or more)\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
  \end{tabular}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
  \end{textblock}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
  
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
\mode<presentation>{
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   145
\begin{frame}[t]
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   146
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   147
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   148
Their implementation in Scala:
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   149
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   150
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   151
\texttt{\lstinputlisting{app51.scala}}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   152
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   153
  
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   154
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   155
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   156
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   157
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   158
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   159
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   160
\mode<presentation>{
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
\begin{frame}[c]
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
\frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] Regular Expression\end{tabular}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
\begin{textblock}{15}(1,4)
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
 \begin{tabular}{@ {}rcl}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
 \bl{$L$($\varnothing$)}  & \bl{$\dn$} & \bl{$\varnothing$}\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
 \bl{$L$($\epsilon$)}        & \bl{$\dn$} & \bl{$\{$""$\}$}\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
 \bl{$L$(c)}                         & \bl{$\dn$} & \bl{$\{$"c"$\}$}\\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
 \bl{$L$(r$_1$ + r$_2$)} & \bl{$\dn$} & \bl{$L$(r$_1$) $\cup$ $L$(r$_2$)}\\
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   170
 \bl{$L$(r$_1$ $\cdot$ r$_2$)}  & \bl{$\dn$} & \bl{$L$(r$_1$) @ $L$(r$_2$)}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   171
 \bl{$L$(r$^*$)}                   & \bl{$\dn$} & \bl{$\bigcup_{n \ge 0}$ $L$(r)$^n$}\\
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
  \end{tabular}\bigskip
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
  
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   174
\hspace{5mm}\textcolor{gray}{$L$(r)$^0$ $\;\dn\;$ $\{$""$\}$}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   175
\textcolor{gray}{$L$(r)$^{n+1}$ $\;\dn\;$ $L$(r) @ $L$(r)$^n$}  
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   176
\end{textblock}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   178
\only<2->{
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   179
\begin{textblock}{5}(11,5)
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   180
\textcolor{gray}{\small
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   181
A @ B\\
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   182
\ldots you take out every string from A and
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   183
concatenate it with every string in B 
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   184
}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   185
\end{textblock}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   186
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   187
\only<3->{
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   188
\begin{textblock}{6}(9,12)\small
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   189
\bl{$L$} is a function from regular expressions to sets of strings\\
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   190
\bl{$L$ : Rexp $\Rightarrow$ Set[String]}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   191
\end{textblock}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   192
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   193
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   197
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   198
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   199
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   200
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   201
\large
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   202
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   203
What is \bl{$L$(a$^*$)}?
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   204
\end{center}  
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   205
  
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   206
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   207
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   208
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   209
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   210
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   211
\newcommand{\YES}{\textcolor{gray}{yes}}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   212
\newcommand{\NO}{\textcolor{gray}{no}}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   213
\newcommand{\FORALLR}{\textcolor{gray}{$\forall$ r.}}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
\mode<presentation>{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
\begin{frame}[c]
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   217
\frametitle{\begin{tabular}{c}Reg Exp Equivalences\end{tabular}}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
\begin{center}
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   220
\begin{tabular}{l@ {\hspace{7mm}}rcl@ {\hspace{7mm}}l}
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   221
&\bl{(a + b)  + c} & \bl{$\equiv^?$} & \bl{a + (b + c)} & \onslide<2->{\YES}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   222
&\bl{a + a} & \bl{$\equiv^?$} & \bl{a} & \onslide<3->{\YES}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   223
&\bl{(a $\cdot$ b)  $\cdot$ c} & \bl{$\equiv^?$} & \bl{a $\cdot$ (b $\cdot$ c)} & \onslide<4->{\YES}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   224
&\bl{a $\cdot$ a} & \bl{$\equiv^?$} & \bl{a} & \onslide<5->{\NO}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   225
&\bl{$\epsilon^*$} & \bl{$\equiv^?$} & \bl{$\epsilon$} & \onslide<6->{\YES}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   226
&\bl{$\varnothing^*$} & \bl{$\equiv^?$} & \bl{$\varnothing$} & \onslide<7->{\NO}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   227
\FORALLR &\bl{r $\cdot$ $\epsilon$} & \bl{$\equiv^?$} & \bl{r} & \onslide<8->{\YES}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   228
\FORALLR &\bl{r + $\epsilon$} & \bl{$\equiv^?$} & \bl{r} & \onslide<9->{\NO}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   229
\FORALLR &\bl{r + $\varnothing$} & \bl{$\equiv^?$} & \bl{r} & \onslide<10->{\YES}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   230
\FORALLR &\bl{r $\cdot$ $\varnothing$} & \bl{$\equiv^?$} & \bl{r} & \onslide<11->{\NO}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   231
&\bl{c $\cdot$ (a + b)} & \bl{$\equiv^?$} & \bl{(c $\cdot$ a) + (c $\cdot$ b)} & \onslide<12->{\YES}\\
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   232
&\bl{a$^*$} & \bl{$\equiv^?$} & \bl{$\epsilon$ + (a $\cdot$ a$^*$)} & \onslide<13->{\YES}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   233
\end{tabular}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
\end{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
\mode<presentation>{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
\begin{frame}[c]
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   242
\frametitle{\begin{tabular}{c}The Meaning of Matching\end{tabular}}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   243
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   244
\large
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   245
a regular expression \bl{r} matches a string \bl{s} is defined as
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   246
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   247
\begin{center}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   248
\bl{s $\in$ $L$(r)}\\ 
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   249
\end{center}\bigskip\bigskip\pause
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   250
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   251
\small
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   252
if \bl{r$_1$ $\equiv$ r$_2$}, then \bl{$s$ $\in$ $L$(r$_1$)} iff \bl{$s$ $\in$ $L$(r$_2$)}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   253
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   254
\end{frame}}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   255
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   256
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   257
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   258
\mode<presentation>{
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   259
\begin{frame}[t]
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   260
\frametitle{\begin{tabular}{c}A Matching Algorithm\end{tabular}}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   261
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   262
\begin{itemize}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   263
\item given a regular expression \bl{r} and a string \bl{s}, say yes or no for whether
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   264
\begin{center}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   265
\bl{s $\in$ $L$(r)}
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   266
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   267
or not.\bigskip\bigskip\pause
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   268
\end{itemize}\pause
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   269
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   270
\small
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   271
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   272
\item Identifiers (strings of letters or digits, starting with a letter)
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   273
\item Integers (a non-empty sequence of digits)
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   274
\item Keywords (else, if, while, \ldots)
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   275
\item White space (a non-empty sequence of blanks, newlines and tabs)
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   276
\end{itemize}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   277
\end{frame}}
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   278
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   279
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   280
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   281
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   282
\mode<presentation>{
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   283
\begin{frame}[c]
15
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
   284
\frametitle{\begin{tabular}{c}A Matching Algorithm\end{tabular}}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
\small
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
whether a regular expression matches the empty string:\medskip
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
\texttt{\lstinputlisting{app5.scala}}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
\mode<presentation>{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
\begin{frame}[c]
15
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
   301
\frametitle{\begin{tabular}{c}The Derivative of a Rexp\end{tabular}}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
\large
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
If \bl{r} matches the string \bl{c::s}, what is a regular expression that matches \bl{s}?\bigskip\bigskip\bigskip\bigskip
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
\small
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
\bl{der c r} gives the answer
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
\mode<presentation>{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
\begin{frame}[c]
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   314
\frametitle{\begin{tabular}{c}The Derivative of a Rexp (2)\end{tabular}}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
\begin{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
  \bl{der c ($\varnothing$)}            & \bl{$\dn$} & \bl{$\varnothing$} & \\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
  \bl{der c ($\epsilon$)}           & \bl{$\dn$} & \bl{$\varnothing$} & \\
20
Christian Urban <urbanc@in.tum.de>
parents: 19
diff changeset
   320
  \bl{der c (d)}           & \bl{$\dn$} & \bl{if c $=$ d then $\epsilon$ else $\varnothing$} & \\
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
  \bl{der c (r$_1$ + r$_2$)} & \bl{$\dn$} & \bl{(der c r$_1$) + (der c r$_2$)} & \\
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   322
  \bl{der c (r$_1$ $\cdot$ r$_2$)} & \bl{$\dn$}  & \bl{if nullable r$_1$}\\
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   323
  & & \bl{then ((der c r$_1$) $\cdot$ r$_2$) + (der c r$_2$)}\\ 
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   324
  & & \bl{else (der c r$_1$) $\cdot$ r$_2$}\\
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
  \bl{der c (r$^*$)}          & \bl{$\dn$} & \bl{(der c r) $\cdot$ (r$^*$)} &\smallskip\\\pause
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
  \bl{ders [] r}     & \bl{$\dn$} & \bl{r} & \\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
  \bl{ders (c::s) r} & \bl{$\dn$} & \bl{ders s (der c r)} & \\
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
  \end{tabular}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
\end{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
\mode<presentation>{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
\begin{frame}[c]
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
\frametitle{\begin{tabular}{c}The Derivative\end{tabular}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
\texttt{\lstinputlisting{app6.scala}}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
\mode<presentation>{
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
\begin{frame}[c]
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
\frametitle{\begin{tabular}{c}The Rexp Matcher\end{tabular}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
\texttt{\lstinputlisting{app7.scala}}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
\end{frame}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   364
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   365
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   366
\begin{frame}[t]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   367
\frametitle{\begin{tabular}{c}Proofs about Rexp\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   368
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   369
Remember their inductive definition:\\[5cm]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   370
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   371
\begin{textblock}{6}(5,5)
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   372
  \begin{tabular}{@ {}rrl}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   373
  \bl{r} & \bl{$::=$}  & \bl{$\varnothing$}\\
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   374
         & \bl{$\mid$} & \bl{$\epsilon$}       \\
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   375
         & \bl{$\mid$} & \bl{c}                        \\
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   376
         & \bl{$\mid$} & \bl{r$_1$ $\cdot$ r$_2$}\\
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   377
         & \bl{$\mid$} & \bl{r$_1$ + r$_2$}  \\
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   378
         & \bl{$\mid$} & \bl{r$^*$}                  \\
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   379
  \end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   380
  \end{textblock}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   381
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   382
If we want to prove something, say a property \bl{$P$(r)}, for all regular expressions \bl{r} then \ldots
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   383
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   384
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   385
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   386
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   387
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   388
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   389
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   390
\frametitle{\begin{tabular}{c}Proofs about Rexp (2)\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   391
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   392
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   393
\item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   394
\item \bl{$P$} holds for \bl{r$_1$ + r$_2$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   395
holds for \bl{r$_1$} and \bl{r$_2$}.\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   396
\item \bl{$P$} holds for \bl{r$_1$ $\cdot$ r$_2$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   397
holds for \bl{r$_1$} and \bl{r$_2$}.
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   398
\item \bl{$P$} holds for \bl{r$^*$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   399
holds for \bl{r}.
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   400
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   401
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   402
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   403
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   404
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   405
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   406
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   407
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   408
\frametitle{\begin{tabular}{c}Proofs about Rexp (3)\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   409
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   410
Assume \bl{$P(r)$} is the property:
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   411
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   412
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   413
\bl{nullable(r)} if and only if \bl{"" $\in$ $L$(r)}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   414
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   415
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   416
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   417
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   418
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   419
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   420
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   421
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   422
\frametitle{\begin{tabular}{c}Proofs about Strings\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   423
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   424
If we want to prove something, say a property \bl{$P$(s)}, for all strings \bl{s} then \ldots\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   425
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   426
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   427
\item \bl{$P$} holds for the empty string, and\medskip
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   428
\item \bl{$P$} holds for the string \bl{c::s} under the assumption that \bl{$P$}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   429
already holds for \bl{s}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   430
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   431
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   432
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   433
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   434
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   435
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   436
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   437
\frametitle{\begin{tabular}{c}Proofs about Strings (2)\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   438
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   439
Let \bl{Der c A} be the set defined as
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   440
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   441
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   442
\bl{Der c A $\dn$ $\{$ s $|$  c::s $\in$ A$\}$ } 
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   443
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   444
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   445
Assume that \bl{$L$(der c r) = Der c ($L$(r))}. Prove that
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   446
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   447
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   448
\bl{matcher(r, s)  if and only if  s $\in$ $L$(r)} 
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   449
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   450
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   451
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   452
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
   453
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   454
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   455
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   456
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   457
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   458
\frametitle{\begin{tabular}{c}Regular Languages\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   459
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   460
A language (set of strings) is \alert{regular} iff there exists
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   461
a regular expression that recognises all its strings.
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   462
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   463
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   464
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   465
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   466
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   467
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   468
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   469
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   470
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   471
A deterministic finite automaton consists of:
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   472
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   473
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   474
\item a set of states
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   475
\item one of these states is the start state
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   476
\item some states are accepting states, and
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   477
\item there is transition function\medskip 
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   478
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   479
\small
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   480
which takes a state as argument and a character and produces a new state\smallskip\\
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   481
this function might not always be defined
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   482
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   483
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   484
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   485
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   486
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   488
\end{document}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
%%% Local Variables:  
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
%%% mode: latex
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
%%% TeX-master: t
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
%%% End: 
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   494