slides/slides02.tex
author Christian Urban <christian.urban@kcl.ac.uk>
Sat, 09 Nov 2024 06:23:35 +0000
changeset 972 ebb4a40d9bae
parent 967 ce5de01b9632
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
     1
% !TEX program = xelatex
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
     2
\documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     3
\usepackage{../slides}
871
94b84d880c2b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 842
diff changeset
     4
\usepackage{../graphicss}
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
     5
\usepackage{../langs}
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
     6
\usepackage{../data}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
     8
\usepackage{tcolorbox}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
     9
\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
    10
\newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
    11
\newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
    12
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
    13
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
    14
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    15
\hfuzz=220pt 
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    16
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    17
\lstset{language=Scala,
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    18
        style=mystyle,
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    19
        numbersep=0pt,
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    20
        numbers=none,
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    21
        xleftmargin=0mm}
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    22
777
a10430cb797c updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 771
diff changeset
    23
\pgfplotsset{compat=1.17}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    24
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    25
\newcommand{\bl}[1]{\textcolor{blue}{#1}}     
117
25999de692b2 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    26
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
% beamer stuff 
429
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    28
\renewcommand{\slidecaption}{CFL 02, King's College London}
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    29
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
\begin{document}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
261
24531cfaa36a updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
    34
\begin{frame}[t]
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
\frametitle{%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  \begin{tabular}{@ {}c@ {}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  \\[-3mm]
429
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    38
  \LARGE Compilers and \\[-1mm] 
882
5fcad75ade92 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    39
  \LARGE Formal Languages\\[-5mm] 
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  \end{tabular}}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
261
24531cfaa36a updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
    42
  \normalsize
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  \begin{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  \begin{tabular}{ll}
882
5fcad75ade92 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    45
  Email:  & christian.urban at kcl.ac.uk\\
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    46
  Office Hour: & Friday 12 -- 14\\  
882
5fcad75ade92 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    47
  Location: & N7.07 (North Wing, Bush House)\\
5fcad75ade92 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    48
  Slides \& Progs: & KEATS\\
5fcad75ade92 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    49
  Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\  
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  \end{tabular}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  \end{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    53
  \begin{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    54
    \begin{tikzpicture}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    55
      \node[drop shadow,fill=white,inner sep=0pt] 
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    56
      {\footnotesize\rowcolors{1}{capri!10}{white}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    57
        \begin{tabular}{|p{4.8cm}|p{4.8cm}|}\hline
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    58
          1 Introduction, Languages          & 6 While-Language \\
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    59
          \cellcolor{blue!50}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    60
          2 Regular Expressions, Derivatives & 7 Compilation, JVM \\
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    61
          3 Automata, Regular Languages      & 8 Compiling Functional Languages \\
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    62
          4 Lexing, Tokenising               & 9 Optimisations \\
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    63
          5 Grammars, Parsing                & 10 LLVM \\ \hline
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    64
        \end{tabular}%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    65
      };
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    66
    \end{tikzpicture}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    67
  \end{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    68
261
24531cfaa36a updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
    69
\end{frame}
24531cfaa36a updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
    70
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    72
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    73
\begin{frame}[c]
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    74
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    75
\begin{mybox3}{From Pollev last week}\it    
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    76
Will C++ users be publicly shamed and humiliated in front of the class?
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    77
\end{mybox3}  
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    78
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
    79
\end{frame}
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    80
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    81
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
    82
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
    84
\begin{frame}[t]
630
9b1c15c3eb6f updated
Christian Urban <urbanc@in.tum.de>
parents: 573
diff changeset
    85
  \frametitle{
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
    86
    Let's Implement an Efficient\\[-2mm] 
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
    87
    Regular Expression Matcher}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    88
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    89
\footnotesize
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    90
\begin{center}
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    91
  {\normalsize Graphs: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$} and strings \bl{$\underbrace{\,a\ldots a\,}_{n}$}}\\[-2mm]
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    92
\begin{tabular}{@{}cc@{}}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    93
\begin{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    94
\begin{axis}[
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    95
    title={Graph: $\texttt{(a*)*\,b}$ and strings 
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
    96
           $\underbrace{\texttt{a}\ldots \texttt{a}}_{n}$},
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
    97
    xlabel={$n$},
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
    98
    x label style={at={(1.05,0.0)}},
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
    99
    ylabel={time in secs},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   100
    enlargelimits=false,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   101
    xtick={0,5,...,30},
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   102
    xmax=33,
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   103
    ymax=35,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   104
    ytick={0,5,...,30},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   105
    scaled ticks=false,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   106
    axis lines=left,
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   107
    width=5.5cm,
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   108
    height=4.5cm, 
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   109
    legend entries={Python, Java 8, JavaScript, Swift},  
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   110
    legend pos=north west,
514
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
   111
    legend cell align=left]
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   112
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   113
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   114
\addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   115
\addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   116
\end{axis}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   117
\end{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   118
&
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   119
\begin{tikzpicture}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   120
  \begin{axis}[
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   121
    xlabel={$n$},
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   122
    x label style={at={(1.1,0.05)}},
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   123
    ylabel={time in secs},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   124
    enlargelimits=false,
442
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
   125
    xtick={0,5000,...,10000},
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
   126
    xmax=11500,
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   127
    ymax=35,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   128
    ytick={0,5,...,30},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   129
    scaled ticks=false,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   130
    axis lines=left,
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   131
    width=5cm,
514
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
   132
    height=4.5cm,
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
   133
    legend entries={Scala V2,Scala V3},
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   134
    legend pos=north east,
514
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
   135
    legend cell align=left]
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   136
\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   137
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   138
\end{axis}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   139
\end{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   140
\end{tabular}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   141
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   142
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   143
\small
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   144
\begin{textblock}{14}(1,14.6)
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   145
In the handouts is a similar graph for \bl{$(a^*)^* \cdot b$} and Java, 
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   146
JavaScript, Python and more.
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   147
\end{textblock}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   148
\end{frame}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   149
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   150
967
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   151
{
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   152
\setbeamercolor{background canvas}{bg=cream}
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   153
\begin{frame}<1-4>[c]
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   154
\end{frame}
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   155
}
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   156
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   157
ce5de01b9632 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 941
diff changeset
   158
512
a6aa52ecc1c5 updated
cu
parents: 510
diff changeset
   159
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   160
%\begin{frame}[c]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   161
%\frametitle{Evil Regular Expressions}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   162
%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   163
%\begin{itemize}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   164
%\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\bigskip
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   165
%\item Evil regular expressions\medskip
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   166
%\begin{itemize}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   167
%\item \bl{$a^{?\{n\}} \cdot a^{\{n\}}$}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   168
%\item \bl{$(a^*)^*$}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   169
%\item \bl{$([a$\,-\,$z]^+)^*$}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   170
%\item \bl{$(a + a \cdot a)^*$}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   171
%\item \bl{$(a + a^?)^*$}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   172
%\end{itemize}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   173
%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   174
%\item sometimes also called \alert{catastrophic backtracking}\bigskip
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   175
%\item \small\ldots I hope you have watched the video by the
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   176
%  StackExchange engineer  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   177
%\end{itemize}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   178
%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   179
%\end{frame}
512
a6aa52ecc1c5 updated
cu
parents: 510
diff changeset
   180
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   181
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   182
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   183
\begin{frame}[c]
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   184
\frametitle{(Basic) Regular Expressions}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   185
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   186
Their inductive definition:
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   187
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   188
\begin{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   189
  \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   190
  \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}  & nothing\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   191
         & \bl{$\mid$} & \bl{$\ONE$}       & empty string / \pcode{""} / $[]$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   192
         & \bl{$\mid$} & \bl{$c$}                         & character\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   193
         & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   194
         & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   195
         & \bl{$\mid$} & \bl{$r^*$}            & star (zero or more)\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   196
  \end{tabular}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   197
\end{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   198
\vspace{\fill}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   199
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
   200
%%Q: \;What about \;\bl{$r \cdot 0$} \; ?
507
fdbc7d0ec04f updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   201
\end{frame}
fdbc7d0ec04f updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   202
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fdbc7d0ec04f updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   203
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   204
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   205
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   206
\begin{frame}[c]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   207
  \frametitle{
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   208
   When Are Two Regular\\[-1mm]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   209
   Expressions Equivalent?}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   210
  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   211
   \begin{bubble}[10cm]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   212
    \large
763
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   213
    Two regular expressions \bl{$r_1$} and \bl{$r_2$} are
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   214
    \alert{\bf{}equivalent} 
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   215
    provided:\medskip 
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   216
    \begin{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   217
      \bl{$r_1 \equiv r_2 \;\;\dn\;\; L(r_1) = L(r_2)$}  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   218
    \end{center}\medskip
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   219
    \end{bubble}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   220
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   221
\end{frame}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   222
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   223
  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   224
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   225
\begin{frame}[c]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   226
\frametitle{Some Concrete Equivalences}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   227
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   228
\begin{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   229
\bl{\begin{tabular}{rcl}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   230
$(a + b)  + c$ & $\equiv$ & $a + (b + c)$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   231
$a + a$        & $\equiv$ & $a$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   232
$a + b$        & $\equiv$ & $b + a$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   233
$(a \cdot b) \cdot c$ & $\equiv$ & $a \cdot (b \cdot c)$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   234
$c \cdot (a + b)$ & $\equiv$ & $(c \cdot a) + (c \cdot b)$\bigskip\bigskip\\\pause
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   235
$a \cdot a$       & $\not\equiv$ & $a$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   236
$a + (b \cdot c)$ & $\not\equiv$ & $(a + b) \cdot (a + c)$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   237
\end{tabular}}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   238
\end{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   239
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   240
\end{frame}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   241
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   242
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   243
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   244
\begin{frame}[c]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   245
\frametitle{Some Corner Cases}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   246
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   247
\begin{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   248
\bl{\begin{tabular}{rcl}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   249
$a \cdot \ZERO$ & $\not\equiv$ & $a$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   250
$a + \ONE$ & $\not\equiv$ & $a$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   251
$\ONE$ & $\equiv$ & $\ZERO^*$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   252
$\ONE^*$ & $\equiv$ & $\ONE$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   253
$\ZERO^*$ & $\not\equiv$ & $\ZERO$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   254
\end{tabular}}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   255
\end{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   256
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   257
\end{frame}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   258
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   259
  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   260
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   261
\begin{frame}[c]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   262
\frametitle{Some Simplification Rules}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   263
 
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   264
\begin{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   265
\bl{\begin{tabular}{rcl}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   266
$r + \ZERO$  & $\equiv$ & $r$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   267
$\ZERO + r$  & $\equiv$ & $r$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   268
$r \cdot \ONE$ & $\equiv$ & $r$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   269
$\ONE \cdot r$     & $\equiv$ & $r$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   270
$r \cdot \ZERO$ & $\equiv$ & $\ZERO$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   271
$\ZERO \cdot r$ & $\equiv$ & $\ZERO$\\
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   272
$r + r$ & $\equiv$ & $r$
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   273
\end{tabular}}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   274
\end{center}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   275
 
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   276
\end{frame}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   277
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   278
  
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   279
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   280
\begin{frame}[c]
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   281
\frametitle{Simplification Example}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   282
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   283
%%Given \bl{$r \dn ((a \cdot b) + b)^*$}, you can simplify as follows
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   284
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   285
\begin{center}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   286
\def\arraystretch{2}  
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   287
\begin{tabular}{@{}lcl}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   288
  \bl{$((\ONE \cdot b) + \ZERO) \cdot r$}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   289
    & \bl{$\Rightarrow$} & \bl{$((\underline{\ONE \cdot b}) + \ZERO) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   290
    & \bl{$=$} & \bl{$(\underline{b + \ZERO}) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   291
    & \bl{$=$} & \bl{$b \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   292
\end{tabular}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   293
\end{center}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   294
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   295
\end{frame}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   296
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   297
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   298
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   299
\begin{frame}[c]
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   300
\frametitle{Simplification Example}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   301
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   302
%%Given \bl{$r \dn ((a \cdot b) + b)^*$}, you can simplify as follows
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   303
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   304
\begin{center}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   305
\def\arraystretch{2}  
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   306
\begin{tabular}{@{}lcl}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   307
  \bl{$((\ZERO \cdot b) + \ZERO) \cdot r$}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   308
    & \bl{$\Rightarrow$} & \bl{$((\underline{\ZERO \cdot b}) + \ZERO) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   309
    & \bl{$=$} & \bl{$(\underline{\ZERO + \ZERO}) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   310
    & \bl{$=$} & \bl{$\ZERO \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   311
    & \bl{$=$} & \bl{$\ZERO$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   312
\end{tabular}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   313
\end{center}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   314
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   315
\end{frame}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   316
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
566
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
   317
507
fdbc7d0ec04f updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   318
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   319
\begin{frame}[t]
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   320
\frametitle{Semantic Derivative\\[5mm]}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   321
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   322
\begin{itemize}
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   323
\item The \alert{\bf Semantic Derivative} of a 
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   324
\underline{language}\\ w.r.t.~to a character \bl{$c$}:
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   325
\bigskip
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   326
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   327
\begin{center}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   328
\bl{$\Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   329
\end{center}\bigskip
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   330
630
9b1c15c3eb6f updated
Christian Urban <urbanc@in.tum.de>
parents: 573
diff changeset
   331
For \bl{$A = \{\mathit{foo}, \mathit{bar}, \mathit{frak}\}$} then
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   332
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   333
\begin{center}
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   334
\bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l}
630
9b1c15c3eb6f updated
Christian Urban <urbanc@in.tum.de>
parents: 573
diff changeset
   335
$\Der\,f\,A$ & $=$ & $\{\mathit{oo}, \mathit{rak}\}$\\
9b1c15c3eb6f updated
Christian Urban <urbanc@in.tum.de>
parents: 573
diff changeset
   336
$\Der\,b\,A$ & $=$ &  $\{\mathit{ar}\}$\\  
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   337
$\Der\,a\,A$ & $=$ & $\{\}$\pause
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   338
\end{tabular}}
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   339
\end{center}\medskip
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   340
630
9b1c15c3eb6f updated
Christian Urban <urbanc@in.tum.de>
parents: 573
diff changeset
   341
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
   342
We can extend this definition to strings
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
   343
\[
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   344
\bl{\Ders\,s\,A = \{s'\;|\;s\,@\,s' \in A\}}
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
   345
\]
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
   346
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   347
\end{itemize}
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   348
 
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   349
\end{frame}
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   350
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
117
25999de692b2 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   351
763
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   352
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   353
\begin{frame}[c]
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   354
\frametitle{The Specification for Matching}
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   355
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   356
\begin{bubble}[10cm]
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   357
\large
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   358
A regular expression \bl{$r$} matches a string~\bl{$s$} 
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   359
provided:
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   360
\begin{center}
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   361
\bl{$s \in L(r)$} 
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   362
\end{center}\medskip
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   363
\end{bubble}
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   364
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   365
\bigskip\bigskip
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   366
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   367
\ldots and the point of the this lecture is to decide this problem as
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   368
fast as possible (unlike Python, Ruby, Java etc)
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   369
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   370
\end{frame}
4e628958c01a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 743
diff changeset
   371
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
771
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
   372
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
   373
512
a6aa52ecc1c5 updated
cu
parents: 510
diff changeset
   374
a6aa52ecc1c5 updated
cu
parents: 510
diff changeset
   375
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a6aa52ecc1c5 updated
cu
parents: 510
diff changeset
   376
\begin{frame}[c]
573
711bbc480998 updated
Christian Urban <urbanc@in.tum.de>
parents: 569
diff changeset
   377
\frametitle{\mbox{Brzozowski's Algorithm (1)}}
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   378
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   379
117
25999de692b2 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   380
\ldots{}whether a regular expression can match the empty string:
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   381
\begin{center}
117
25999de692b2 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   382
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
429
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   383
\bl{$nullable(\ZERO)$}    & \bl{$\dn$} & \bl{\textit{false}}\\
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   384
\bl{$nullable(\ONE)$}       & \bl{$\dn$} & \bl{\textit{true}}\\
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   385
\bl{$nullable (c)$}             & \bl{$\dn$} & \bl{\textit{false}}\\
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   386
\bl{$nullable (r_1 + r_2)$}     & \bl{$\dn$} & \bl{$nullable(r_1) \vee nullable(r_2)$} \\ 
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   387
\bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \wedge nullable(r_2)$} \\
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   388
\bl{$nullable (r^*)$}           & \bl{$\dn$} & \bl{\textit{true}}\\
117
25999de692b2 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   389
\end{tabular}
16
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   390
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 15
diff changeset
   391
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   392
\end{frame}
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   393
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   394
972
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   395
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   396
\begin{frame}[c]
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   397
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   398
\bl{$r ::= \ZERO \,\;|\;\, \ONE \,\;|\;\, c \,\;|\;\, r_1 + r_2 \,\;|\;\, r_1 \cdot r_2 \,\;|\;\, r^{*} \,\;|\;\, r^{\{n\}}$}  
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   399
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   400
\end{frame}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   401
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   402
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   403
  
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   404
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   405
\begin{frame}[c]
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   406
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   407
\begin{center}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   408
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   409
\bl{$nullable(\ZERO)$}    & \bl{$\dn$} & \bl{\textit{false}}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   410
\bl{$nullable(\ONE)$}       & \bl{$\dn$} & \bl{\textit{true}}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   411
\bl{$nullable (c)$}             & \bl{$\dn$} & \bl{\textit{false}}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   412
\bl{$nullable (r_1 + r_2)$}     & \bl{$\dn$} & \bl{$nullable(r_1) \vee nullable(r_2)$} \\ 
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   413
\bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \wedge nullable(r_2)$} \\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   414
\bl{$nullable (r^*)$}           & \bl{$\dn$} & \bl{\textit{true}}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   415
\bl{$nullable (r^{\{n\}})$}      & \bl{$\dn$} & \bl{if $n = 0$ then \textit{true} else $nullable(r)$}\\  
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   416
\end{tabular}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   417
\end{center}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   418
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   419
\end{frame}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   420
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   421
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   422
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   423
\begin{frame}[c]
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   424
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   425
\begin{center}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   426
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   427
  \bl{$\der\, c\, (\ZERO)$}      & \bl{$\dn$} & \bl{$\ZERO$} & \\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   428
  \bl{$\der\, c\, (\ONE)$}           & \bl{$\dn$} & \bl{$\ZERO$} & \\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   429
  \bl{$\der\, c\, (d)$}                     & \bl{$\dn$} & \bl{if $c = d$ then $\ONE$ else $\ZERO$} & \\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   430
  \bl{$\der\, c\, (r_1 + r_2)$}        & \bl{$\dn$} & \bl{$\der\, c\, r_1 + \der\, c\, r_2$} & \\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   431
  \bl{$\der\, c\, (r_1 \cdot r_2)$}  & \bl{$\dn$}  & \bl{if $nullable (r_1)$}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   432
  & & \bl{then $(\der\,c\,r_1) \cdot r_2 + \der\, c\, r_2$}\\ 
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   433
  & & \bl{else $(\der\, c\, r_1) \cdot r_2$}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   434
  \bl{$\der\, c\, (r^*)$}  & \bl{$\dn$} & \bl{$(\der\,c\,r) \cdot (r^*)$}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   435
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   436
  \bl{$\der\, c\, (r^{\{n\}})$}  & \bl{$\dn$} & \bl{if $n = 0$ then $\ZERO$ else $(\der\,c\,r) \cdot r^{\{n-1\}}$}\\
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   437
                                                
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   438
  \end{tabular}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   439
\end{center}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   440
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   441
\end{frame}
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   442
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   443
ebb4a40d9bae updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 967
diff changeset
   444
11
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   445
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   446
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5353d405e4e6 added slides 2
Christian Urban <urbanc@in.tum.de>
parents: 7
diff changeset
   447
\begin{frame}[c]
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   448
\frametitle{The Derivative of a Rexp}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   449
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
\large
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   451
If \bl{$r$} matches the string \bl{$c\!::\!s$}, what is a regular 
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   452
expression that matches just \bl{$s$}?\bigskip\bigskip\bigskip\bigskip
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   453
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   454
\small
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   455
\bl{$\der\,c\,r$} gives the answer, Brzozowski 1964
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   456
\end{frame}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   457
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   458
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   459
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   460
\begin{frame}[c]
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   461
\frametitle{The Derivative of a Rexp}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
\begin{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   465
  \bl{$\der\, c\, (\ZERO)$}      & \bl{$\dn$} & \bl{$\ZERO$} & \\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   466
  \bl{$\der\, c\, (\ONE)$}           & \bl{$\dn$} & \bl{$\ZERO$} & \\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   467
  \bl{$\der\, c\, (d)$}                     & \bl{$\dn$} & \bl{if $c = d$ then $\ONE$ else $\ZERO$} & \\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   468
  \bl{$\der\, c\, (r_1 + r_2)$}        & \bl{$\dn$} & \bl{$\der\, c\, r_1 + \der\, c\, r_2$} & \\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   469
  \bl{$\der\, c\, (r_1 \cdot r_2)$}  & \bl{$\dn$}  & \bl{if $nullable (r_1)$}\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   470
  & & \bl{then $(\der\,c\,r_1) \cdot r_2 + \der\, c\, r_2$}\\ 
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   471
  & & \bl{else $(\der\, c\, r_1) \cdot r_2$}\\
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   472
  \bl{$\der\, c\, (r^*)$}  & \bl{$\dn$} & \bl{$(\der\,c\,r) \cdot (r^*)$} &\medskip\bigskip\\\pause
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   474
  \bl{$\ders\, []\, r$}     & \bl{$\dn$} & \bl{$r$} & \\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   475
  \bl{$\ders\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\ders\,s\,(\der\,c\,r)$} & \\
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   476
  \end{tabular}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   477
\end{center}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   479
\end{frame}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
941
66adcae6c762 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 940
diff changeset
   482
{
66adcae6c762 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 940
diff changeset
   483
\setbeamercolor{background canvas}{bg=cream}
66adcae6c762 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 940
diff changeset
   484
\begin{frame}<1-6>[c]
66adcae6c762 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 940
diff changeset
   485
\end{frame}
66adcae6c762 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 940
diff changeset
   486
}
66adcae6c762 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 940
diff changeset
   487
66adcae6c762 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 940
diff changeset
   488
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
\begin{frame}[c]
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   491
\frametitle{Examples}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   493
Given \bl{$r \dn ((a \cdot b) + b)^*$} what is
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   494
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   495
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   496
\begin{tabular}{l}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   497
\bl{$\der\,a\,r =\;?$}\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   498
\bl{$\der\,b\,r =\;?$}\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   499
\bl{$\der\,c\,r =\;?$}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   500
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   501
\end{center}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   502
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   503
\end{frame}
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   504
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   505
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   506
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
431
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   507
\begin{frame}[c]
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   508
\frametitle{Derivative Example}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   509
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   510
Given \bl{$r \dn ((a \cdot b) + b)^*$} what is
431
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   511
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   512
\begin{center}
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   513
\def\arraystretch{1.5}  
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   514
\begin{tabular}{@{}lcl}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   515
  \bl{$\der\,a\,((a \cdot b) + b)^*$}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   516
    & \bl{$\Rightarrow$}& \bl{$\der\,a\, \underline{((a \cdot b) + b)^*}$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   517
    & \bl{$=$} & \bl{$(der\,a\,(\underline{(a \cdot b) + b})) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   518
    & \bl{$=$} & \bl{$((der\,a\,(\underline{a \cdot b})) + (der\,a\,b)) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   519
    & \bl{$=$} & \bl{$(((der\,a\,\underline{a}) \cdot b) + (der\,a\,b)) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   520
    & \bl{$=$} & \bl{$((\ONE \cdot b) + (der\,a\,\underline{b})) \cdot r$}\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   521
    & \bl{$=$} & \bl{$((\ONE \cdot b) + \ZERO) \cdot r$}
431
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   522
\end{tabular}
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   523
\end{center}
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   524
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   525
\end{frame}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   526
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   527
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   528
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   529
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   530
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   531
\begin{frame}[c]
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   532
\frametitle{\mbox{The Brzozowski Algorithm}}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   533
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   534
%\begin{center}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   535
%\begin{tabular}{l} 
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   536
%\bl{$\textit{matcher}\,r\,s \dn \textit{nullable}(\ders\;s\;r)$}  
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   537
%\end{tabular}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   538
%\end{center}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   539
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   540
\begin{center}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   541
\begin{mybox3}{}
765
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   542
\centering    
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   543
\bl{$\textit{matcher}\,r\,s \dn \textit{nullable}(\ders\;s\;r)$}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   544
\end{mybox3}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   545
\end{center}
431
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   546
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   547
\end{frame}
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   548
%%%%%%%%%%%%%%%%%
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   549
c7d4ee344451 updated
Christian Urban <urbanc@in.tum.de>
parents: 429
diff changeset
   550
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
   551
\begin{frame}[t]
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   552
\frametitle{Brzozowski: An Example}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   553
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   554
Does \bl{$r_1$} match \bl{$abc$}?
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   555
\begin{center}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   556
\begin{tabular}{@{}rl@{}l@{}}
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   557
Step 1: & build derivative of \bl{$a$} and \bl{$r_1$} & \bl{$(r_2 = \der\,a\,r_1)$}\smallskip\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   558
Step 2: & build derivative of \bl{$b$} and \bl{$r_2$} & \bl{$(r_3 = \der\,b\,r_2)$}\smallskip\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   559
Step 3: & build derivative of \bl{$c$} and \bl{$r_3$} & \bl{$(r_4 = \der\,c\,r_3)$}\smallskip\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   560
Step 4: & the string is exhausted: & \bl{($nullable(r_4))$}\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   561
        & test whether \bl{$r_4$} can recognise\\
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   562
        & the empty string\medskip\\
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   563
Output: & result of the test\\
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   564
        & $\Rightarrow \bl{\textit{true}} \,\text{or}\, 
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   565
                       \bl{\textit{false}}$\\        
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   566
\end{tabular}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   567
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   568
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   569
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   570
\end{frame}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   571
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   572
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   573
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   574
\begin{frame}[c]
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   575
\frametitle{The Idea of the Algorithm}
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   576
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   577
If we want to recognise the string \bl{$abc$} with regular 
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   578
expression \bl{$r_1$} then\medskip
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   579
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   580
\begin{enumerate}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   581
\item \bl{$\Der\,a\,(L(r_1))$}\pause
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   582
\item \bl{$\Der\,b\,(\Der\,a\,(L(r_1)))$}\pause
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   583
\item \bl{$\Der\,c\,(\Der\,b\,(\Der\,a\,(L(r_1))))$}\bigskip
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
   584
\item finally we test whether the empty string is in this 
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   585
set; same for  \bl{$\Ders\,abc\,(L(r_1))$}.\medskip
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   586
\end{enumerate}
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   587
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   588
The matching algorithm works similarly, just over regular expressions instead of sets.
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   589
\end{frame}
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   590
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   591
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   592
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   593
\begin{frame}[c]
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   594
\frametitle{The Idea with Derivatives}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   595
  
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   596
Input: string \bl{$abc$} and regular expression \bl{$r$}\medskip 
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   597
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   598
\begin{enumerate}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   599
\item \bl{$der\,a\,r$}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   600
\item \bl{$der\,b\,(der\,a\,r)$}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   601
\item \bl{$der\,c\,(der\,b\,(der\,a\,r))$}\bigskip\pause
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   602
\item finally check whether the last regular expression can match the empty string
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   603
\end{enumerate}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   604
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   605
\end{frame}
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   606
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
   607
765
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   608
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   609
\begin{frame}[c]
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   610
\frametitle{\boldmath\;$a^{?\{n\}} \cdot a^{\{n\}}$}
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   611
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   612
\begin{center}
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   613
\begin{tikzpicture}
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   614
\begin{axis}[
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   615
    xlabel={$n$},
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   616
    x label style={at={(1.05,0.0)}},
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   617
    ylabel={time in secs},
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   618
    enlargelimits=false,
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   619
    xtick={0,5,...,30},
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   620
    xmax=31,
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   621
    ytick={0,5,...,30},
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   622
    scaled ticks=false,
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   623
    axis lines=left,
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   624
    width=7cm,
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   625
    height=7cm, 
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   626
    legend entries={Python,Ruby},  
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   627
    legend pos=outer north east,
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   628
    legend cell align=left  
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   629
]
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   630
\addplot[blue,mark=*, mark options={fill=white}] 
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   631
  table {re-python.data};
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   632
\addplot[brown,mark=pentagon*, mark options={fill=white}] 
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   633
  table {re-ruby.data};    
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   634
\end{axis}
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   635
\end{tikzpicture}
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   636
\end{center}
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   637
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   638
\end{frame}
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   639
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   640
b294cfbb5c01 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 764
diff changeset
   641
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   642
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   643
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   644
\begin{frame}[c]
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   645
\frametitle{Oops\ldots \boldmath\;$a^{?\{n\}} \cdot a^{\{n\}}$}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   646
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   647
\begin{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   648
\begin{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   649
\begin{axis}[
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   650
    xlabel={$n$},
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   651
    x label style={at={(1.05,0.0)}},
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   652
    ylabel={time in secs},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   653
    enlargelimits=false,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   654
    xtick={0,5,...,30},
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   655
    xmax=31,
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   656
    ytick={0,5,...,30},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   657
    scaled ticks=false,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   658
    axis lines=left,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   659
    width=7cm,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   660
    height=7cm, 
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   661
    legend entries={Python,Ruby,Scala V1},  
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   662
    legend pos=outer north east,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   663
    legend cell align=left  
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   664
]
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   665
\addplot[blue,mark=*, mark options={fill=white}] 
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   666
  table {re-python.data};
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   667
\addplot[brown,mark=pentagon*, mark options={fill=white}] 
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   668
  table {re-ruby.data};  
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   669
\addplot[red,mark=triangle*,mark options={fill=white}] 
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   670
  table {re1.data};  
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   671
\end{axis}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   672
\end{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   673
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   674
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   675
\end{frame}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   676
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   677
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   678
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   679
\begin{frame}[t]
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   680
\frametitle{A Problem\medskip}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   681
345
0922b3e01289 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 342
diff changeset
   682
We represented the ``n-times'' \bl{$a^{\{n\}}$} as a 
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   683
sequence regular expression:
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   684
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   685
\begin{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   686
\begin{tabular}{rl}
767
bdd12391d345 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 765
diff changeset
   687
0: & \bl{$\ONE$}\\    
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   688
1: & \bl{$a$}\\
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   689
2: & \bl{$a\cdot a$}\\
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   690
3: & \bl{$a\cdot a\cdot a$}\\
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   691
& \ldots\\
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   692
13: & \bl{$a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a$}\\
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   693
& \ldots\\
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   694
20:
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   695
\end{tabular}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   696
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   697
345
0922b3e01289 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 342
diff changeset
   698
This problem is aggravated with \bl{$a^?$} being represented 
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   699
as \bl{$a + \ONE$}.
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   700
\end{frame}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   701
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   702
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   703
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   704
\begin{frame}[c]
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   705
\frametitle{Solving the Problem}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   706
514
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
   707
What happens if we extend our regular expressions with explicit 
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
   708
constructors
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   709
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   710
\begin{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   711
\begin{tabular}{rcl}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   712
\bl{$r$} & \bl{$::=$} & \bl{\ldots}\\
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
   713
             & \bl{$\mid$} & \bl{$r^{\{n\}}$}\\
345
0922b3e01289 updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 342
diff changeset
   714
             & \bl{$\mid$} & \bl{$r^?$} 
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   715
\end{tabular}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   716
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   717
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   718
What is their meaning?\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   719
What are the cases for \bl{$nullable$} and \bl{$\der$}?
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   720
\end{frame}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   721
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   722
769
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   723
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   724
\begin{frame}[c]
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   725
  \frametitle{$der$ for $n$-times}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   726
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   727
Case \bl{$n = 2$} and \bl{$r \cdot r$}: 
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   728
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   729
\begin{center}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   730
  \begin{tabular}{lcl}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   731
    \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{if \; $nullable(r)$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   732
                              &   & \bl{then \; \alert<3>{$(der\,c\,r)\cdot r + der\,c\,r$}}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   733
                              &   & \bl{else \; $(der\,c\,r)\cdot r$}\bigskip\pause\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   734
    my claim                  &   & \bl{$\equiv\;$} \bl{$(der\,c\,r)\cdot r$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   735
    (in this case)                                
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   736
  \end{tabular} 
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   737
\end{center}  
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   738
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   739
\end{frame}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   740
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   741
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   742
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   743
\begin{frame}[t]
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   744
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   745
We know \bl{$nullable(r)$} holds!\pause 
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   746
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   747
\begin{center}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   748
  \begin{tabular}{@{}lcl}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   749
    \bl{$(der\,c\,r)\cdot r + der\,c\,r$}\pause
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   750
    & \bl{$\equiv$} & \bl{$(der\,c\,r)\cdot r + (der\,c\,r) \cdot \ONE$}\medskip\pause\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   751
    & \bl{$\equiv$} & \bl{$(der\,c\,r)\cdot (r + \ONE)$}\medskip\pause\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   752
    & \bl{$\equiv$} & \bl{$(der\,c\,r)\cdot r$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   753
    \multicolumn{3}{r}{\small(remember \bl{$r$} is nullable)}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   754
  \end{tabular} 
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   755
\end{center}\pause
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   756
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   757
\rule{13cm}{0.8mm}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   758
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   759
\begin{textblock}{13}(2,10)
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   760
\only<6>{%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   761
  \begin{tabular}{lcl}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   762
    \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{if \; $nullable(r)$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   763
                          &   & \bl{then \; $(der\,c\,r)\cdot r + der\,c\,r$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   764
                          &   & \bl{else \; $(der\,c\,r)\cdot r$}                                
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   765
  \end{tabular}}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   766
\only<7>{%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   767
  \begin{tabular}{lcl}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   768
    \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{if \; $nullable(r)$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   769
                          &   & \bl{then \; $(der\,c\,r)\cdot r$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   770
                          &   & \bl{else \; $(der\,c\,r)\cdot r$}                                
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   771
  \end{tabular}}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   772
\only<8>{%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   773
  \begin{tabular}{lcl}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   774
    \bl{$der\,c\,(r\cdot r)$} & \bl{$\dn$} & \bl{$(der\,c\,r)\cdot r$}                                
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   775
  \end{tabular}}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   776
\end{textblock}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   777
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   778
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   779
\end{frame}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   780
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   781
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   782
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   783
\begin{frame}[c]
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   784
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   785
\begin{center}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   786
\begin{tabular}{ll@{\hspace{10mm}}l}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   787
& \bl{$r\{n\}$} & \bl{$der$}\hspace{20mm}\mbox{}\\\hline\\[-4mm]    
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   788
\bl{$n = 0$} : & \bl{$\ONE$}           & \bl{$\ZERO$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   789
\bl{$n = 1$} : & \bl{$r$}              & \bl{$(der\,c\,r)$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   790
\bl{$n = 2$} : & \bl{$r\cdot r$}       & \bl{$(der\,c\,r)\cdot r$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   791
\bl{$n = 3$} : & \bl{$r\cdot r\cdot r$}& \only<1>{???}\only<2->{\bl{$(der\,c\,r)\cdot r\cdot r$}}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   792
\quad\vdots  
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   793
\end{tabular} 
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   794
\end{center}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   795
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   796
\begin{textblock}{13}(1,11)
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   797
\only<3->{%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   798
  \begin{tabular}{rcl}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   799
    \bl{$nullable(r\{n\})$} & \bl{$\dn$} &
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   800
                          \bl{if\; $n = 0$\; then\; $true$\; else\; $nullable(r)$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   801
    \bl{$der\,c\,(r\{n\})$} & \bl{$\dn$} &
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   802
                          \bl{if\; $n = 0$\; then\; $\ZERO$\; else\; $(der\,c\,r)\cdot r\{n - 1\}$}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   803
  \end{tabular}}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   804
\end{textblock}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   805
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   806
\end{frame}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   807
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   808
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   809
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   810
\begin{frame}[c]
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   811
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   812
\begin{textblock}{13}(1.5,4)
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   813
  \only<1-6>{%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   814
  \begin{tabular}{@{}lcl@{}}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   815
    \bl{$der\,c\,(r\cdot r\cdot r)$}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   816
    & \bl{$\dn$} & \bl{if $nullable(r)$}\medskip\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   817
    & & \only<1>{\bl{then\; $(der\,c\,r)\cdot r\cdot r + der\,c\,(r\cdot r)$}}%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   818
        \only<2>{\bl{then\; $(der\,c\,r)\cdot r\cdot r + (der\,c\,r)\cdot r$}}%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   819
        \only<3>{\bl{then\; $(der\,c\,r)\cdot (r\cdot r + r)$}}%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   820
        \only<4>{\bl{then\; $(der\,c\,r)\cdot (r\cdot (r + \ONE))$}}%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   821
        \only<5>{\bl{then\; $(der\,c\,r)\cdot (r\cdot r)$}}%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   822
        \only<6>{\bl{then\; $(der\,c\,r)\cdot r\cdot r$}}\medskip\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   823
    & & \bl{else\; $(der\,c\,r)\cdot r\cdot r$}\\
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   824
  \end{tabular}}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   825
  \only<7->{%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   826
  \begin{tabular}{@{}lcl@{}}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   827
    \bl{$der\,c\,(r\cdot r\cdot r)$}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   828
    & \bl{$\dn$} & \bl{$(der\,c\,r)\cdot r\cdot r$}%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   829
  \end{tabular}} 
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   830
\end{textblock}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   831
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   832
\end{frame}
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   833
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
   834
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   835
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   836
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   837
\begin{frame}[t]
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   838
\frametitle{Brzozowski: \boldmath$a^{?\{n\}} \cdot a^{\{n\}}$}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   839
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   840
\begin{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   841
\begin{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   842
\begin{axis}[
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   843
    xlabel={$n$},
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   844
    x label style={at={(1.05,0.0)}},   
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   845
    ylabel={time in secs},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   846
    enlargelimits=false,
434
8664ff87cd77 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 433
diff changeset
   847
    xtick={0,200,...,1100},
8664ff87cd77 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 433
diff changeset
   848
    xmax=1200,
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   849
    ytick={0,5,...,30},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   850
    scaled ticks=false,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   851
    axis lines=left,
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   852
    width=8cm,
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   853
    height=6.5cm, 
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   854
    legend entries={Python,Ruby,Scala V1,Scala V2},  
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   855
    legend pos=outer north east,
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   856
    legend cell align=left  
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   857
]
434
8664ff87cd77 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 433
diff changeset
   858
\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
8664ff87cd77 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 433
diff changeset
   859
\addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data};  
8664ff87cd77 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 433
diff changeset
   860
\addplot[red,mark=triangle*,mark options={fill=white}] table {re1.data};  
8664ff87cd77 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 433
diff changeset
   861
\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   862
\end{axis}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   863
\end{tikzpicture}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   864
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   865
335
2d112a7b29eb updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   866
\end{frame}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   867
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   868
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   869
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   870
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   871
\begin{frame}[c]
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   872
\frametitle{Examples}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   873
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   874
Recall the example of \bl{$r \dn ((a \cdot b) + b)^*$} with
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   875
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   876
\begin{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   877
\begin{tabular}{l}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   878
\bl{$\der\,a\,r = ((\ONE \cdot b) + \ZERO) \cdot r$}\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   879
\bl{$\der\,b\,r = ((\ZERO \cdot b) + \ONE)\cdot r$}\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   880
\bl{$\der\,c\,r = ((\ZERO \cdot b) + \ZERO)\cdot r$}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   881
\end{tabular}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   882
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   883
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   884
What are these regular expressions equivalent to?
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   885
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   886
\end{frame}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   887
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   888
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   889
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   890
\begin{frame}[c]
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   891
\frametitle{Simplification Rules}
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   892
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   893
\begin{center}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   894
\bl{\begin{tabular}{rcl}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   895
$r + \ZERO$       & $\Rightarrow$ & $r$\\
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   896
$\ZERO + r$       & $\Rightarrow$ & $r$\\
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   897
$r \cdot \ONE$    & $\Rightarrow$ & $r$\\
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   898
$\ONE \cdot r$    & $\Rightarrow$ & $r$\\
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   899
$r \cdot \ZERO$   & $\Rightarrow$ & $\ZERO$\\
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   900
$\ZERO \cdot r$   & $\Rightarrow$ & $\ZERO$\\
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   901
$r + r$           & $\Rightarrow$ & $r$
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   902
\end{tabular}}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   903
\end{center}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   904
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   905
\footnotesize
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   906
\lstinputlisting[firstline=22,lastline=26]{../progs/app6.scala}
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   907
\end{frame}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   908
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   909
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   910
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   911
\begin{frame}[c]
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   912
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   913
\footnotesize
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   914
\lstinputlisting[firstline=1,lastline=21]{../progs/app6.scala}
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   915
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   916
\end{frame}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   917
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   918
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   919
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   920
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   921
\begin{frame}[t]
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   922
\frametitle{Brzozowski: \boldmath$a^{?\{n\}} \cdot a^{\{n\}}$}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   923
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   924
\begin{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   925
\begin{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   926
\begin{axis}[
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   927
    xlabel={$n$},
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   928
    x label style={at={(1.05,0.0)}},     
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   929
    ylabel={time in secs},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   930
    enlargelimits=false,
442
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
   931
    xtick={0,5000,...,10000},
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
   932
    xmax=11000,
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   933
    ymax=35,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   934
    ytick={0,5,...,30},
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   935
    scaled ticks=false,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   936
    axis lines=left,
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   937
    width=9cm,
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   938
    height=7cm,
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   939
    legend entries={Scala V2,Scala V3},  
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   940
    legend pos=north east
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   941
]
434
8664ff87cd77 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 433
diff changeset
   942
\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   943
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   944
\end{axis}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   945
\end{tikzpicture}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
   946
\end{center}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   947
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   948
\end{frame}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   949
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
   950
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   951
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   952
\begin{frame}[t]
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   953
\frametitle{Brzozowski: \boldmath$a^{?\{n\}} \cdot a^{\{n\}}$}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   954
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   955
\begin{center}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   956
\begin{tikzpicture}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   957
\begin{axis}[
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   958
    xlabel={$n$},
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   959
    x label style={at={(1.05,0.0)}},     
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   960
    ylabel={time in secs},
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   961
    enlargelimits=false,
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   962
    xtick={0,5000,...,10000},
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   963
    xmax=11000,
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   964
    ymax=35,
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   965
    ytick={0,5,...,30},
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   966
    scaled ticks=false,
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   967
    axis lines=left,
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   968
    width=9cm,
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   969
    height=7cm,
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   970
    legend entries={Scala V2,Scala V3,Rust},  
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   971
    legend pos=north east
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   972
]
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   973
\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   974
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   975
\addplot[pink,mark=triangle,mark options={fill=pink}] table {re-rust.data};
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   976
\end{axis}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   977
\end{tikzpicture}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   978
\end{center}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   979
782
a26a20acd1c2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 778
diff changeset
   980
code by Archie Collard
a26a20acd1c2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 778
diff changeset
   981
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   982
\end{frame}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   983
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
   984
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   985
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   986
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
   987
\begin{frame}[c]
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
   988
  \frametitle{Another Example \boldmath$(a^*)^* \cdot b$}
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   989
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
   990
\bigskip    
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   991
\begin{center}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   992
\begin{tikzpicture}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   993
  \begin{axis}[
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   994
    xlabel={$n$},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   995
    x label style={at={(1.05,0.0)}},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   996
    ylabel={time in secs},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   997
    enlargelimits=false,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   998
    xtick={0,5,...,30},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
   999
    xmax=33,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1000
    ymax=35,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1001
    ytick={0,10,...,30},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1002
    scaled ticks=false,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1003
    axis lines=left,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1004
    width=9cm,
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1005
    height=5.5cm, 
777
a10430cb797c updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 771
diff changeset
  1006
    legend entries={Java 8,Python,JavaScript,Swift,Dart},  
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1007
    legend pos=outer north east,
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1008
    legend cell align=left]
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1009
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1010
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1011
\addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
767
bdd12391d345 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 765
diff changeset
  1012
\addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
777
a10430cb797c updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 771
diff changeset
  1013
\addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data};
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1014
\end{axis}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1015
\end{tikzpicture}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1016
\end{center}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1017
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1018
Regex: \bl{$(a^*)^* \cdot b$}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1019
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1020
Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1021
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1022
\end{frame}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1023
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1024
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1025
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1026
\begin{frame}[c]
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1027
\frametitle{Same Example in Java 9+}
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1028
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1029
\begin{center}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1030
\begin{tikzpicture}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1031
  \begin{axis}[
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1032
    xlabel={$n$},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1033
    x label style={at={(1.09,-0.15)}},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1034
    ylabel={time in secs},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1035
    scaled x ticks=false,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1036
    enlargelimits=false,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1037
    xtick distance=10000,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1038
    xmax=44000, 
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1039
    ytick={0,10,...,30}, 
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1040
    ymax=35, 
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1041
    axis lines=left,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1042
    width=9cm,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1043
    height=5cm, 
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1044
    legend entries={Java \liningnums{9}+},
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1045
    legend pos=north west,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1046
    legend cell align=left]
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1047
\addplot[blue,mark=square*,mark options={fill=white}] table {re-java9.data};
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1048
\end{axis}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1049
\end{tikzpicture}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1050
\end{center}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1051
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1052
Regex: \bl{$(a^*)^* \cdot b$}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1053
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1054
Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1055
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1056
\end{frame}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1057
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1058
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1059
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1060
\begin{frame}[c]
646
2abd285c66d1 updated
Christian Urban <urbanc@in.tum.de>
parents: 638
diff changeset
  1061
\frametitle{\ldots{}and with Brzozowski}
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1062
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1063
\begin{center}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1064
\begin{tikzpicture}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1065
  \begin{axis}[
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1066
    xlabel={$n$},
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1067
    x label style={at={(1.09,0.0)}},
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1068
    ylabel={time in secs},
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1069
    scaled x ticks=false,
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1070
    xtick distance=2000000,
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1071
    enlargelimits=false,
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1072
    xmax=6400000, 
514
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
  1073
    ytick={0,10,...,30},
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
  1074
    ymax=35,
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1075
    axis lines=left,
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1076
    width=9cm,
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1077
    height=5cm, 
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1078
    legend entries={Scala V3},
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1079
    legend pos=north west,
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1080
    legend cell align=left]
514
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
  1081
%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1082
\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1083
\end{axis}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1084
\end{tikzpicture}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1085
\end{center}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1086
565
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1087
Regex: \bl{$(a^*)^* \cdot b$}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1088
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1089
Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
2be8c4c77418 updated
Christian Urban <urbanc@in.tum.de>
parents: 564
diff changeset
  1090
435
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1091
\end{frame}
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1092
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e08431a78f66 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 434
diff changeset
  1093
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1094
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
573
711bbc480998 updated
Christian Urban <urbanc@in.tum.de>
parents: 569
diff changeset
  1095
\begin{frame}[c]
711bbc480998 updated
Christian Urban <urbanc@in.tum.de>
parents: 569
diff changeset
  1096
\frametitle{\mbox{What is good about this Alg.}}
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1097
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1098
\begin{itemize}
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1099
\item extends to most regular expressions, for example
573
711bbc480998 updated
Christian Urban <urbanc@in.tum.de>
parents: 569
diff changeset
  1100
\bl{$\sim r$} (next slide)
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1101
769
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
  1102
\item is easy to implement in a functional language
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1103
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1104
\item the algorithm is already quite old; there is still
514
bca9f8889a48 updated
Christian Urban <urbanc@in.tum.de>
parents: 512
diff changeset
  1105
  work to be done to use it as a tokenizer (that is relatively new work)
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1106
769
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
  1107
\item we can prove its correctness\ldots (another video)
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1108
\end{itemize}
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1109
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1110
\end{frame}
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1111
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1112
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1113
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
566
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1114
\begin{frame}[c]
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1115
\frametitle{Negation of Regular Expr's}
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1116
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1117
\begin{itemize}
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1118
\item \bl{$\sim{}r$}  \hspace{6mm} (everything that \bl{$r$} cannot recognise)\medskip
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1119
\item \bl{$L(\sim{}r) \dn UNIV - L(r)$}\medskip
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1120
\item \bl{$nullable (\sim{}r) \dn not\, (nullable(r))$}\medskip
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1121
\item \bl{$der\,c\,(\sim{}r) \dn \;\sim{}(der\,c\,r)$}
769
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 767
diff changeset
  1122
\end{itemize}\bigskip\bigskip\medskip\pause
566
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1123
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1124
Used often for recognising comments:
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1125
\[
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1126
\bl{/ \cdot * \cdot (\sim{}([a\mbox{-}z]^* \cdot * \cdot / \cdot [a\mbox{-}z]^*)) \cdot * \cdot /}
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1127
\]
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1128
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1129
\end{frame}
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1130
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1131
771
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1132
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1133
\begin{frame}[c]
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1134
\frametitle{The Specification for Matching}
566
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1135
771
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1136
\begin{bubble}[10cm]
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1137
\large
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1138
A regular expression \bl{$r$} matches a string~\bl{$s$} 
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1139
provided:
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1140
\begin{center}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1141
\bl{$s \in L(r)$} 
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1142
\end{center}\medskip
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1143
\end{bubble}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1144
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1145
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1146
\begin{center}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1147
\onslide<2>{\bl{\large$\forall\,r\,s.\;$}}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1148
\bl{$matcher\,s\,r$}  \;if and only if\  \bl{$s \in L(r)$} 
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1149
\end{center}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1150
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1151
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1152
\end{frame}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1153
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1154
  
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1155
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1156
\begin{frame}[c]
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1157
\frametitle{nullable and \boldmath$der$}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1158
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1159
The central properties:\bigskip\bigskip
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1160
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1161
\large
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1162
\begin{quote}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1163
  \onslide<3>{\bl{$\forall r.\phantom{\,c}\;$}}%
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1164
  \bl{$nullable(r)$} \;if and only if\; \bl{$[] \in L(r)$}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1165
\end{quote}\bigskip\bigskip\pause
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1166
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1167
\begin{quote}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1168
  \onslide<3>{\bl{$\forall r\,c.\;$}}%
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1169
  \bl{$L(der\,c\,r) \;=\; Der\,c\,(L(r))$}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1170
\end{quote}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1171
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1172
\end{frame}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1173
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
770
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1174
  
566
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1175
  
b153c04834eb updated
Christian Urban <urbanc@in.tum.de>
parents: 565
diff changeset
  1176
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1177
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
342
c235e0aeb8df updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 338
diff changeset
  1178
\begin{frame}[t]
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1179
\frametitle{Proofs about Rexps}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1180
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1181
Remember their inductive definition:\\[5cm]
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1182
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1183
\begin{textblock}{6}(5,5)
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1184
  \begin{tabular}{@ {}rrl}
429
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
  1185
  \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}\\
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
  1186
         & \bl{$\mid$} & \bl{$\ONE$}     \\
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1187
         & \bl{$\mid$} & \bl{$c$}            \\
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1188
         & \bl{$\mid$} & \bl{$r_1 \cdot r_2$}\\
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1189
         & \bl{$\mid$} & \bl{$r_1 + r_2$}    \\
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1190
         & \bl{$\mid$} & \bl{$r^*$}          \\
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1191
  \end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1192
  \end{textblock}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1193
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1194
If we want to prove something, say a property \bl{$P(r)$}, for all regular expressions \bl{$r$} then \ldots
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1195
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1196
\end{frame}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1197
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1198
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1199
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1200
\begin{frame}[c]
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1201
\frametitle{Proofs about Rexp (2)}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1202
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1203
\begin{itemize}
429
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
  1204
\item \bl{$P$} holds for \bl{$\ZERO$}, \bl{$\ONE$} and \bl{c}\bigskip
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1205
\item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1206
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1207
\item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1208
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1209
\item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1210
holds for \bl{$r$}.
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1211
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1212
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1213
\end{frame}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1214
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1215
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1216
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1217
\begin{frame}[c]
771
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1218
\frametitle{Proofs about Rexp}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1219
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1220
Assume \bl{$P(r)$} is the property:
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1221
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1222
\begin{center}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1223
\bl{$nullable(r)$} if and only if \bl{$[] \in L(r)$}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1224
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1225
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1226
\end{frame}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1227
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1228
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1229
% begin{frame}[c]
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1230
% \begin{mybox3}{}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1231
%   der c (r*) def = (der c r) $\cdot$ (r*)\smallskip\\
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1232
%   Why in the example (slide 19) the first step is:
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1233
%   der a ((a $\cdot$ b) + b)* = (der a ((a $\cdot$ b) + b)) $\cdot$ r\smallskip\\
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1234
%   and not\smallskip\\
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1235
%   der a ((a $\cdot$ b) + b) = (der a ((a $\cdot$ b) + b)) · (r*)
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1236
% \end{mybox3}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1237
% \end{frame}
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1238
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1239
% \begin{frame}[c]
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1240
% \begin{mybox3}{}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1241
%   Would it be possible to find and go over a few examples from the
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1242
%   Brzozowski Algorithm, as it doesn't seem to be as simple as it
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1243
%   sounds?
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1244
% \end{mybox3}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1245
% \end{frame}
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1246
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1247
% \begin{frame}[c]
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1248
% \begin{mybox3}{}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1249
%   Is it possible to make a visual example of how using simp() function
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1250
%   on a (a*)*.b regular expression reduces its runtime? If not it's
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1251
%   fine. I am just very surprised that it is so efficient.
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1252
% \end{mybox3}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1253
% \end{frame}
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1254
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1255
% \begin{frame}[c]
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1256
% \begin{mybox3}{}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1257
%   Do you think the algorithm can be still improved (made faster)?
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1258
% \end{mybox3}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1259
% \end{frame}
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1260
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1261
% \begin{frame}[c]
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1262
% \begin{mybox3}{}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1263
%   Do the regular expression matchers in Python and Java 8 have more
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1264
%   features than the one implemented in this module? Or is there
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1265
%   another reason for their inefficiency?
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1266
% \end{mybox3}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1267
% \end{frame}
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1268
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1269
% \begin{frame}[c]
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1270
% \begin{mybox3}{}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1271
%   Will we discuss the broader Chomsky hierarchy of languages at some
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1272
%   point?
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1273
% \end{mybox3}
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 930
diff changeset
  1274
% \end{frame}
778
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1275
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1276
\begin{frame}<1-8>[c]
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1277
\end{frame}
3e5f5d19f514 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 777
diff changeset
  1278
842
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1279
\begin{frame}[c]
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1280
\end{frame}
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1281
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1282
\begin{frame}[c]
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1283
\end{frame}
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1284
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1285
\begin{frame}[c]
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1286
\end{frame}
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1287
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1288
\begin{frame}<1-10>[c]
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1289
\end{frame}
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1290
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1291
b53ac1bb5f43 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 782
diff changeset
  1292
771
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1293
\end{document}
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1294
% below are slides for proving.
3a12e096f9a0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 770
diff changeset
  1295
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1296
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1297
\begin{frame}[c]
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1298
\frametitle{Proofs about Rexp (4)}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1299
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1300
\begin{center}
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1301
\bl{\begin{tabular}{r@{\hspace{2mm}}c@{\hspace{2mm}}l}
429
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
  1302
$rev(\ZERO)$   & $\dn$ & $\ZERO$\\
7e71c947ec69 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
  1303
$rev(\ONE)$      & $\dn$ & $\ONE$\\
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1304
$rev(c)$             & $\dn$ & $c$\\
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1305
$rev(r_1 + r_2)$     & $\dn$ & $rev(r_1) + rev(r_2)$\\
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1306
$rev(r_1 \cdot r_2)$ & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1307
$rev(r^*)$           & $\dn$ & $rev(r)^*$\\
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1308
\end{tabular}}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1309
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1310
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1311
We can prove
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1312
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1313
\begin{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1314
\bl{$L(rev(r)) = \{s^{-1} \;|\; s \in L(r)\}$}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1315
\end{center}
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1316
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1317
by induction on \bl{$r$}.
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1318
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1319
\end{frame}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1320
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1321
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1322
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1323
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1324
\begin{frame}[c]
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1325
\frametitle{Correctness Proof \\[-1mm]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1326
            for our Matcher}
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1327
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1328
\begin{itemize}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1329
\item We started from
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1330
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1331
\begin{center}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1332
\begin{tabular}{rp{4cm}}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1333
  & \bl{$s \in L(r)$}\medskip\\
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1334
\bl{$\Leftrightarrow$} & \bl{$[] \in \Ders\,s\,(L(r))$}\pause  
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1335
\end{tabular}
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1336
\end{center}\bigskip
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1337
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1338
\item if we can show \bl{$\Ders\, s\,(L(r)) = L(\ders\,s\,r)$} we 
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1339
have\bigskip
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1340
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1341
\begin{center}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1342
\begin{tabular}{rp{4cm}}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1343
\bl{$\Leftrightarrow$} & \bl{$[] \in L(\ders\,s\,r)$}\medskip\\
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1344
\bl{$\Leftrightarrow$} & \bl{$nullable(\ders\,s\,r)$}\medskip\\
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1345
\bl{$\dn$} & \bl{$matcher\,s\,r$}
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1346
\end{tabular}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1347
\end{center}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1348
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1349
\end{itemize}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1350
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1351
\end{frame}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1352
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1353
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1354
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1355
\begin{frame}[c]
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1356
\frametitle{Proofs about Rexp (5)}
263
92e6985018ae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 261
diff changeset
  1357
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1358
Let \bl{$Der\,c\,A$} be the set defined as
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1359
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1360
\begin{center}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1361
\bl{$\Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1362
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1363
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1364
We can prove
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1365
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1366
\begin{center}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1367
\bl{$L(\der\,c\,r) = \Der\,c\,(L(r))$}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1368
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1369
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1370
by induction on \bl{$r$}.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1371
337
885ac2b6c27d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1372
\end{frame}
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1373
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1374
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1375
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1376
\begin{frame}[c]
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1377
\frametitle{Proofs about Strings}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1378
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1379
If we want to prove something, say a property \bl{$P(s)$}, for all strings \bl{$s$} then \ldots\bigskip
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1380
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1381
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1382
\item \bl{$P$} holds for the empty string, and\medskip
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1383
\item \bl{$P$} holds for the string \bl{$c\!::\!s$} under the assumption that \bl{$P$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1384
already holds for \bl{$s$}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1385
\end{itemize}
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1386
\end{frame}
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1387
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1388
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1389
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1390
\begin{frame}[c]
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1391
\frametitle{Proofs about Strings (2)}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1392
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1393
We can then prove
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1394
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1395
\begin{center}
433
c08290ee4f1f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
  1396
\bl{$\Ders\,s\,(L(r)) = L(\ders\,s\,r)$}  
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1397
\end{center}
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1398
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1399
119
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 118
diff changeset
  1400
We can finally prove
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1401
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1402
\begin{center}
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1403
\bl{$matcher\,s\,r$}  if and only if  \bl{$s \in L(r)$} 
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1404
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1405
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1406
338
f16120cb4e19 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
  1407
\end{frame}
19
Christian Urban <urbanc@in.tum.de>
parents: 17
diff changeset
  1408
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
17
Christian Urban <urbanc@in.tum.de>
parents: 16
diff changeset
  1409
436
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1410
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1411
\begin{frame}[c]
770
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1412
\frametitle{Coursework 1}
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1413
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1414
%%\underline{Strand 1:}
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1415
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1416
\begin{itemize}
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1417
\item Submission on Friday 16 October @ 18:00\medskip
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1418
\item source code needs to be submitted as well\medskip
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1419
\item you can re-use my Scala code from KEATS \\
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1420
  and use any programming language you like\medskip
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1421
\item \small https://nms.kcl.ac.uk/christian.urban/ProgInScala2ed.pdf\normalsize
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1422
\end{itemize}  
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1423
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1424
\end{frame}
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1425
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1426
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1427
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c563cf946497 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 769
diff changeset
  1428
\begin{frame}[c]
436
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1429
\frametitle{Epilogue}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1430
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1431
\footnotesize
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1432
\begin{center}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1433
\begin{tabular}{cc}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1434
\begin{tikzpicture}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1435
\begin{axis}[
442
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
  1436
    title={\small{}Graph: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$}},
436
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1437
    xlabel={$n$},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1438
    x label style={at={(1.04,0.0)}},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1439
    ylabel={time in secs},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1440
    enlargelimits=false,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1441
    xmax=7100000,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1442
    ytick={0,5,...,30},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1443
    ymax=33,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1444
    %scaled ticks=false,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1445
    axis lines=left,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1446
    width=5cm,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1447
    height=5cm, 
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1448
    legend entries={Scala V3, Scala V4},
442
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
  1449
    legend style={at={(0.1,-0.2)},anchor=north}]
436
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1450
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1451
\addplot[purple,mark=square*,mark options={fill=white}] table {re4.data};
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1452
\end{axis}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1453
\end{tikzpicture}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1454
&
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1455
\begin{tikzpicture}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1456
\begin{axis}[
442
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
  1457
    title={\small{}Graph: \bl{$(a^*)^* \cdot b$}},
436
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1458
    xlabel={$n$},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1459
    x label style={at={(1.09,0.0)}},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1460
    ylabel={time in secs},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1461
    enlargelimits=false,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1462
    xmax=8100000,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1463
    ytick={0,5,...,30},
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1464
    ymax=33,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1465
    %scaled ticks=false,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1466
    axis lines=left,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1467
    width=5cm,
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1468
    height=5cm, 
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1469
    legend entries={Scala V3, Scala V4},
442
84d6714840c9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 436
diff changeset
  1470
    legend style={at={(0.1,-0.2)},anchor=north}]
436
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1471
\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1472
\addplot[purple,mark=square*,mark options={fill=white}] table {re4a.data};
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1473
\end{axis}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1474
\end{tikzpicture}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1475
\end{tabular}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1476
\end{center}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1477
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1478
\only<2->{\footnotesize
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1479
\begin{textblock}{9}(0.5,8)
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1480
\begin{bubble}[11.8cm]
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1481
\lstinputlisting[numbers=none]{../progs/app52.scala}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1482
\end{bubble}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1483
\end{textblock}} 
510
cu
parents: 507
diff changeset
  1484
 
436
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1485
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1486
\end{frame}
9213b8298ca9 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 435
diff changeset
  1487
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1488
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1489
\begin{frame}[c]
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1490
  \frametitle{Another Homework Question}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1491
  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1492
  \begin{itemize}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1493
  \item How many basic regular expressions are there to match
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1494
    the string \bl{$abcd$}\,?\pause
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1495
  \item How many if they cannot include
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1496
    \bl{$\ONE$} and \bl{$\ZERO$}\/?\pause
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1497
  \item How many if they are also not
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1498
    allowed to contain stars?\pause
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1499
  \item How many if they are also
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1500
        not allowed to contain \bl{$\_ + \_$}\/? 
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1501
  \end{itemize}  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1502
  
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1503
  \end{frame}
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1504
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1505
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1506
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1507
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1508
\begin{frame}[c]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1509
\frametitle{\begin{tabular}{c}\\[3cm]\huge\alert{Questions?}\end{tabular}}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1510
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1511
%\bigskip
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1512
%homework (written exam 80\%)\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1513
%coursework (20\%; first one today)\\
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1514
%submission Fridays @ 18:00 -- accepted until Mondays
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1515
\mbox{}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1516
\end{frame}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1517
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1518
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1519
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1520
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1521
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1522
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1523
\begin{frame}[c]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1524
\frametitle{Last Week}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1525
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1526
Last week I showed you a regular expression matcher 
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1527
that works provably correct in all cases (we only
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1528
started with the proving part though)
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1529
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1530
\begin{center}
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1531
\bl{$matcher\,s\,r$} \;\;if and only if \;\; \bl{$s \in L(r)$}
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1532
\end{center}\bigskip\bigskip 
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1533
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1534
\small
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1535
\textcolor{gray}{\mbox{}\hfill{}by Janusz Brzozowski (1964)}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1536
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1537
\end{frame}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1538
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1539
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1540
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1541
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1542
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1543
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1544
 
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1545
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1546
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1547
\begin{frame}[c]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1548
  \frametitle{Proofs about Rexp}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1549
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1550
  \begin{itemize}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1551
  \item \bl{$P$} holds for \bl{$\ZERO$}, \bl{$\ONE$} and \bl{c}\bigskip
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1552
  \item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1553
  holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1554
  \item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1555
  holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1556
  \item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1557
  holds for \bl{$r$}.
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1558
  \end{itemize}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1559
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1560
\end{frame}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1561
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1562
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1563
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1564
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1565
\begin{frame}[c]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1566
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1567
We proved
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1568
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1569
\begin{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1570
\bl{$nullable(r)$} \;if and only if\;  \bl{$[] \in L(r)$}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1571
\end{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1572
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1573
by induction on the regular expression \bl{$r$}.\bigskip\pause
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1574
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1575
\begin{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1576
{\huge\bf\alert{Any Questions?}}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1577
\end{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1578
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1579
\end{frame}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1580
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1581
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1582
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1583
\begin{frame}[c]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1584
\frametitle{\begin{tabular}{c}Proofs about Natural\\[-1mm] Numbers and Strings\end{tabular}}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1585
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1586
\begin{itemize}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1587
\item \bl{$P$} holds for \bl{$0$} and
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1588
\item \bl{$P$} holds for \bl{$n + 1$} under the assumption that \bl{$P$} already
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1589
holds for \bl{$n$}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1590
\end{itemize}\bigskip
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1591
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1592
\begin{itemize}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1593
\item \bl{$P$} holds for \bl{$[]$} and
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1594
\item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1595
holds for \bl{$s$}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1596
\end{itemize}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1597
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1598
\end{frame}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1599
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1600
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1601
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1602
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1603
\begin{frame}[c]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1604
  \frametitle{Correctness Proof \\[-1mm]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1605
              for our Matcher}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1606
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1607
  \begin{itemize}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1608
  \item We started from
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1609
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1610
  \begin{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1611
  \begin{tabular}{rp{4cm}}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1612
    & \bl{$s \in L(r)$}\medskip\\
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1613
  \bl{$\Leftrightarrow$} & \bl{$[] \in \Ders\,s\,(L(r))$}\pause  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1614
  \end{tabular}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1615
  \end{center}\bigskip
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1616
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1617
  \item \textbf{\alert{if}} we can show \bl{$\Ders\, s\,(L(r)) = L(\ders\,s\,r)$} we 
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1618
  have\bigskip
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1619
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1620
  \begin{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1621
  \begin{tabular}{rp{4cm}}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1622
  \bl{$\Leftrightarrow$} & \bl{$[] \in L(\ders\,s\,r)$}\medskip\\
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1623
  \bl{$\Leftrightarrow$} & \bl{$nullable(\ders\,s\,r)$}\medskip\\
764
6718ef6143b8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 763
diff changeset
  1624
  \bl{$\dn$} & \bl{$matcher\,s\,r$}
743
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1625
  \end{tabular}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1626
  \end{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1627
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1628
  \end{itemize}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1629
  
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1630
  \end{frame}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1631
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1632
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1633
\begin{frame}[c]
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1634
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1635
We need to prove
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1636
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1637
\begin{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1638
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1639
\end{center}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1640
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1641
also by induction on the regular expression \bl{$r$}.
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1642
\end{frame}
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1643
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1644
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1645
6acabeecdf75 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 646
diff changeset
  1646
638
0367aa7c764b updated
Christian Urban <urbanc@in.tum.de>
parents: 630
diff changeset
  1647
7
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1648
\end{document}
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1649
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1650
%%% Local Variables:  
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1651
%%% mode: latex
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1652
%%% TeX-master: t
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1653
%%% End: 
73cf4406b773 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1654