slides/slides04.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 15 Oct 2013 22:14:04 +0100
changeset 144 0cb61bed557d
parent 142 1aa28135a2da
child 145 920f675b4ed1
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
     2
\usepackage{beamerthemeplaincu}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
     3
%%%\usepackage[T1]{fontenc}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage[latin1]{inputenc}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{mathpartir}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage[absolute,overlay]{textpos}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{ifthen}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
\usepackage{tikz}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\usepackage{pgf}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\usepackage{calc} 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\usepackage{ulem}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\usepackage{courier}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\usepackage{listings}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\renewcommand{\uline}[1]{#1}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\usetikzlibrary{arrows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\usetikzlibrary{automata}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
\usetikzlibrary{shapes}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\usetikzlibrary{shadows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
\usetikzlibrary{positioning}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
\usetikzlibrary{calc}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\usepackage{graphicx} 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
\definecolor{javared}{rgb}{0.6,0,0} % for strings
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
\lstset{language=Java,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
	basicstyle=\ttfamily,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
	keywordstyle=\color{javapurple}\bfseries,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
	stringstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
	commentstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
	morecomment=[s][\color{javadocblue}]{/**}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
	numbers=left,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
	numberstyle=\tiny\color{black},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
	stepnumber=1,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
	numbersep=10pt,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
	tabsize=2,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
	showspaces=false,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
	showstringspaces=false}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
\lstdefinelanguage{scala}{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  morekeywords={abstract,case,catch,class,def,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
    do,else,extends,false,final,finally,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
    for,if,implicit,import,match,mixin,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
    new,null,object,override,package,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
    private,protected,requires,return,sealed,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
    super,this,throw,trait,true,try,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
    type,val,var,while,with,yield},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  sensitive=true,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  morecomment=[l]{//},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  morecomment=[n]{/*}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  morestring=[b]",
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
  morestring=[b]',
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  morestring=[b]"""
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
\lstset{language=Scala,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
	basicstyle=\ttfamily,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
	keywordstyle=\color{javapurple}\bfseries,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
	stringstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
	commentstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
	morecomment=[s][\color{javadocblue}]{/**}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
	numbers=left,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
	numberstyle=\tiny\color{black},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
	stepnumber=1,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
	numbersep=10pt,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
	tabsize=2,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
	showspaces=false,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
	showstringspaces=false}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
% beamer stuff 
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
    74
\renewcommand{\slidecaption}{AFL 04, King's College London, 16.~October 2013}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
\begin{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
\begin{frame}<1>[t]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
\frametitle{%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  \begin{tabular}{@ {}c@ {}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
  \\[-3mm]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
  \LARGE Automata and \\[-2mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
  \LARGE Formal Languages (4)\\[3mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
  \end{tabular}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  \normalsize
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
  \begin{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
  \begin{tabular}{ll}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  Email:  & christian.urban at kcl.ac.uk\\
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
    94
  Office: & S1.27 (1st floor Strand Building)\\
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  Slides: & KEATS (also home work is there)\\
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  \end{tabular}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  \end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   103
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   104
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   105
\mode<presentation>{
144
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   106
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   107
\frametitle{Regexps and Automata}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   109
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   110
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   111
\node (rexp)  {\bl{\bf Regexps}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   112
\node (nfa) [right=of rexp] {\bl{\bf NFAs}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   113
\node (dfa) [right=of nfa] {\bl{\bf DFAs}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   114
\onslide<3->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   115
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   116
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   117
\onslide<3->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   118
\onslide<2->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   119
\end{tikzpicture}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   120
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   121
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   122
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   123
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   124
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   125
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   126
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   127
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   128
\mode<presentation>{
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   129
\begin{frame}<1-2>[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   130
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   131
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   132
\begin{tikzpicture}[>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   133
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   134
\node[state,initial]  (q_0)  {$q_0$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   135
\node[state] (q_1) [right=of q_0] {$q_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   136
\node[state] (q_2) [below right=of q_0] {$q_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   137
\node[state] (q_3) [right=of q_2] {$q_3$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   138
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   139
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   140
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   141
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   142
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   143
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   144
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   145
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   146
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   147
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   148
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   149
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   150
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   151
\mbox{}\\[-20mm]\mbox{}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   152
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   153
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   154
\begin{tikzpicture}[>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   155
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   156
\node[state,initial]  (q_02)  {$q_{0, 2}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   157
\node[state] (q_13) [right=of q_02] {$q_{1, 3}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   158
\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   159
\path[->] (q_02) edge [bend left] node [above]  {\alert{$a$}} (q_13);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   160
\path[->] (q_13) edge [bend left] node [below]  {\alert{$b$}} (q_02);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   161
\path[->] (q_02) edge [loop below] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   162
\path[->] (q_13) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   163
\path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   164
\end{tikzpicture}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   165
minimal automaton
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   166
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   167
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   168
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   169
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   170
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   171
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   172
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   173
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   174
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   175
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   176
\begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   177
\item Take all pairs \bl{(q, p)} with \bl{q $\not=$ p}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   178
\item Mark all pairs that are accepting and non-accepting states
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   179
\item For  all unmarked pairs \bl{(q, p)} and all characters \bl{c} tests wether
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   180
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   181
\bl{($\delta$(q,c), $\delta$(p,c))}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   182
\end{center} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   183
are marked. If yes, then also mark \bl{(q, p)} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   184
\item Repeat last step until no chance.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   185
\item All unmarked pairs can be merged.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   186
\end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   187
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   188
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   189
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   190
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   191
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   192
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   193
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
\begin{frame}[c]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
\frametitle{\begin{tabular}{c}Last Week\end{tabular}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   199
Last week I showed you\bigskip
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
\begin{itemize}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   202
\item a tokenizer taking a list of regular expressions\bigskip
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
\item tokenization identifies lexeme in an input stream of characters (or string)
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   205
and cathegorizes  them into tokens
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   206
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   207
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   208
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   209
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   210
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   212
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   213
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   214
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   215
\frametitle{\begin{tabular}{c}Two Rules\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   216
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   217
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   218
\item Longest match rule (maximal munch rule): The 
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   219
longest initial substring matched by any regular expression is taken
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   220
as next token.\bigskip
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   221
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   222
\item Rule priority:
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   223
For a particular longest initial substring, the first regular
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   224
expression that can match determines the token.
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   225
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
\end{itemize}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   228
%\url{http://www.technologyreview.com/tr10/?year=2011}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
  
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   230
%finite deterministic automata/ nondeterministic automaton
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   231
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   232
%\item problem with infix operations, for example i-12
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   233
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   234
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   237
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   238
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   239
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   240
\begin{frame}[t]
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   241
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   242
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   243
\texttt{"if true then then 42 else +"}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   244
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   245
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   246
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   247
\begin{tabular}{@{}l}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   248
KEYWORD: \\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   249
\hspace{5mm}\texttt{"if"}, \texttt{"then"}, \texttt{"else"},\\ 
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   250
WHITESPACE:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   251
\hspace{5mm}\texttt{" "}, \texttt{"$\backslash$n"},\\ 
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   252
IDENT:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   253
\hspace{5mm}LETTER $\cdot$ (LETTER + DIGIT + \texttt{"\_"})$^*$\\ 
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   254
NUM:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   255
\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + \texttt{"0"}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   256
OP:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   257
\hspace{5mm}\texttt{"+"}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   258
COMMENT:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   259
\hspace{5mm}\texttt{"$\slash$*"} $\cdot$ (ALL$^*$ $\cdot$ \texttt{"*$\slash$"} $\cdot$ ALL$^*$) $\cdot$ \texttt{"*$\slash$"}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   260
\end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   261
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   262
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   263
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
\mode<presentation>{
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   267
\begin{frame}[t]
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
\begin{center}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   270
\texttt{"if true then then 42 else +"}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
\end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   273
\only<1>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   274
\small\begin{tabular}{l}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   275
KEYWORD(if),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   276
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   277
IDENT(true),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   278
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   279
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   280
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   281
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   282
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   283
NUM(42),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   284
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   285
KEYWORD(else),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   286
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   287
OP(+)
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   288
\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   289
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   290
\only<2>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   291
\small\begin{tabular}{l}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   292
KEYWORD(if),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   293
IDENT(true),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   294
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   295
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   296
NUM(42),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   297
KEYWORD(else),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   298
OP(+)
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   299
\end{tabular}}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
\begin{frame}[c]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   309
There is one small problem with the tokenizer. How should we 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   310
tokenize:
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
\begin{center}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   313
\texttt{"x - 3"}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
\end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   316
\begin{tabular}{@{}l}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   317
OP:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   318
\hspace{5mm}\texttt{"+"}, \texttt{"-"}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   319
NUM:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   320
\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + \texttt{"0"}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   321
NUMBER:\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   322
\hspace{5mm}NUM +  (\texttt{"-"} $\cdot$ NUM)\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   323
\end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   324
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   325
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   329
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   330
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   331
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   332
\frametitle{\begin{tabular}{c}Negation\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   333
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   334
Assume you have an alphabet consisting of the letters \bl{a}, \bl{b} and \bl{c} only.
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   335
Find a regular expression that matches all strings \emph{except} \bl{ab}, \bl{ac} and \bl{cba}.
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   336
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   337
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   338
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   339
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   340
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
\begin{frame}[c]
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   345
\frametitle{\begin{tabular}{c}Deterministic Finite Automata\end{tabular}}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   346
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   347
A deterministic finite automaton consists of:
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   348
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   349
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   350
\item a finite set of states
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   351
\item one of these states is the start state
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   352
\item some states are accepting states, and
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   353
\item there is transition function\medskip 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   354
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   355
\small
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   356
which takes a state and a character as arguments and produces a new state\smallskip\\
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   357
this function might not always be defined everywhere
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   358
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   359
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   360
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   361
\bl{$A(Q, q_0, F, \delta)$}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   362
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   363
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   364
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   365
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   366
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   367
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   368
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   369
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   370
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   371
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   372
\includegraphics[scale=0.7]{pics/ch3.jpg}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   373
\end{center}\pause
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   374
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   375
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   376
\item start can be an accepting state
39
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   377
\item it is possible that there is no accepting state
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   378
\item all states might be accepting (but does not necessarily mean all strings are accepted)
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   379
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   380
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   381
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   382
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   383
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   384
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   385
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   386
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   387
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   388
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   389
\includegraphics[scale=0.7]{pics/ch3.jpg}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   390
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   391
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   392
for this automaton \bl{$\delta$} is the function\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   393
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   394
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   395
\begin{tabular}{lll}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   396
\bl{(q$_0$, a) $\rightarrow$ q$_1$} & \bl{(q$_1$, a) $\rightarrow$ q$_4$} & \bl{(q$_4$, a) $\rightarrow$ q$_4$}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   397
\bl{(q$_0$, b) $\rightarrow$ q$_2$} & \bl{(q$_1$, b) $\rightarrow$ q$_2$} & \bl{(q$_4$, b) $\rightarrow$ q$_4$}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   398
\end{tabular}\ldots
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   399
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   400
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   401
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   402
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   403
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   404
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   405
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   406
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   407
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   408
\begin{frame}[t]
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   409
\frametitle{\begin{tabular}{c}Accepting a String\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   410
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   411
Given
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   412
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   413
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   414
\bl{$A(Q, q_0, F, \delta)$}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   415
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   416
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   417
you can define
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   418
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   419
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   420
\begin{tabular}{l}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   421
\bl{$\hat{\delta}(q, \texttt{""}) = q$}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   422
\bl{$\hat{\delta}(q, c::s) = \hat{\delta}(\delta(q, c), s)$}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   423
\end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   424
\end{center}\pause
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   425
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   426
Whether a string \bl{$s$} is accepted by \bl{$A$}?
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   427
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   428
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   429
\hspace{5mm}\bl{$\hat{\delta}(q_0, s) \in F$}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   430
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   431
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   432
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   433
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   434
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   435
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   436
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   437
\frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   438
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   439
A non-deterministic finite automaton consists again of:
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   440
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   441
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   442
\item a finite set of states
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   443
\item one of these states is the start state
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   444
\item some states are accepting states, and
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   445
\item there is transition \alert{relation}\medskip 
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   446
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   447
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   448
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   449
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   450
\begin{tabular}{c}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   451
\bl{(q$_1$, a) $\rightarrow$ q$_2$}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   452
\bl{(q$_1$, a) $\rightarrow$ q$_3$}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   453
\end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   454
\hspace{10mm}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   455
\begin{tabular}{c}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   456
\bl{(q$_1$, $\epsilon$) $\rightarrow$ q$_2$}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   457
\end{tabular}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   458
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   459
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   460
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   461
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   463
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   464
\mode<presentation>{
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   465
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   466
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   467
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   468
\includegraphics[scale=0.7]{pics/ch5.jpg}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   469
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   470
37
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   471
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   472
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   473
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   474
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   475
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   476
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   477
\begin{frame}[c]
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   478
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   479
\begin{center}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   480
\begin{tabular}[b]{ll}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   481
\bl{$\varnothing$} & \includegraphics[scale=0.7]{pics/NULL.jpg}\\\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   482
\bl{$\epsilon$} & \includegraphics[scale=0.7]{pics/epsilon.jpg}\\\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   483
\bl{c} & \includegraphics[scale=0.7]{pics/char.jpg}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   484
\end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   485
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   486
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   487
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   488
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   489
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   490
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   491
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   492
\begin{frame}[c]
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   493
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   494
\begin{center}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   495
\begin{tabular}[t]{ll}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   496
\bl{r$_1$ $\cdot$ r$_2$} & \includegraphics[scale=0.6]{pics/seq.jpg}\\\\
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   497
\end{tabular}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   498
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   499
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   500
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   501
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   502
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   503
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   504
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   505
\begin{frame}[c]
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   507
\begin{center}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   508
\begin{tabular}[t]{ll}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   509
\bl{r$_1$ + r$_2$} & \includegraphics[scale=0.7]{pics/alt.jpg}\\\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   510
\end{tabular}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   511
\end{center}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   512
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   513
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   514
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   515
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   516
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   517
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   518
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   519
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   520
\begin{center}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   521
\begin{tabular}[b]{ll}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   522
\bl{r$^*$} & \includegraphics[scale=0.7]{pics/star.jpg}\\
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   523
\end{tabular}
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   524
\end{center}\pause\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   525
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   526
Why can't we just have an epsilon transition from the accepting states to the starting state?
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   527
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   528
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   529
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   530
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   531
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   532
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   533
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   534
\begin{frame}[c]
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   535
\frametitle{\begin{tabular}{c}Subset Construction\end{tabular}}
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   536
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   537
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   538
\begin{textblock}{5}(1,2.5)
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   539
\includegraphics[scale=0.5]{pics/ch5.jpg}
37
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   540
\end{textblock}
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   541
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   542
\begin{textblock}{11}(6.5,4.5)
37
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   543
\begin{tabular}{r|cl}
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   544
& a & b\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   545
\hline
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   546
$\varnothing$ \onslide<2>{\textcolor{white}{*}} & $\varnothing$ & $\varnothing$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   547
$\{0\}$ \onslide<2>{\textcolor{white}{*}} & $\{0,1,2\}$ & $\{2\}$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   548
$\{1\}$ \onslide<2>{\textcolor{white}{*}} &$\{1\}$ & $\varnothing$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   549
$\{2\}$ \onslide<2>{*} & $\varnothing$ &$\{2\}$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   550
$\{0,1\}$ \onslide<2>{\textcolor{white}{*}} &$\{0,1,2\}$ &$\{2\}$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   551
$\{0,2\}$ \onslide<2>{*}&$\{0,1,2\}$ &$\{2\}$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   552
$\{1,2\}$ \onslide<2>{*}& $\{1\}$ & $\{2\}$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   553
\onslide<2>{s:} $\{0,1,2\}$ \onslide<2>{*}&$\{0,1,2\}$ &$\{2\}$\\
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   554
\end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   555
\end{textblock}
Christian Urban <urbanc@in.tum.de>
parents: 36
diff changeset
   556
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   557
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   558
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   559
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   560
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   561
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   562
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   563
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   564
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   565
\frametitle{\begin{tabular}{c}Regular Languages\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   566
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   567
A language is \alert{regular} iff there exists
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   568
a regular expression that recognises all its strings.\bigskip\medskip
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   569
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   570
or equivalently\bigskip\medskip
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   571
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   572
A language is \alert{regular} iff there exists
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   573
a deterministic finite automaton that recognises all its strings.\bigskip\pause
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   574
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   575
Why is every finite set of strings a regular language?
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   576
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   577
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   578
36
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   579
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   580
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   581
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   582
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   583
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   584
Christian Urban <urbanc@in.tum.de>
parents: 35
diff changeset
   585
\begin{center}
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   586
\includegraphics[scale=0.5]{pics/ch3.jpg}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   587
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   588
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   589
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   590
\includegraphics[scale=0.5]{pics/ch4.jpg}\\
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   591
minimal automaton
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   592
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   593
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   594
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   595
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   596
39
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   597
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   598
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   599
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   600
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   601
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   602
\begin{enumerate}
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   603
\item Take all pairs \bl{(q, p)} with \bl{q $\not=$ p}
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   604
\item Mark all pairs that accepting and non-accepting states
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   605
\item For  all unmarked pairs \bl{(q, p)} and all characters \bl{c} tests wether
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   606
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   607
\bl{($\delta$(q,c), $\delta$(p,c))}
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   608
\end{center} 
41
Christian Urban <urbanc@in.tum.de>
parents: 40
diff changeset
   609
are marked. If yes, then also mark \bl{(q, p)} 
39
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   610
\item Repeat last step until no chance.
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   611
\item All unmarked pairs can be merged.
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   612
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   613
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   614
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   615
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   616
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   617
Christian Urban <urbanc@in.tum.de>
parents: 38
diff changeset
   618
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   619
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   620
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   621
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   622
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   623
Given the function 
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   624
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   625
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   626
\bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   627
$rev(\varnothing)$   & $\dn$ & $\varnothing$\\
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   628
$rev(\epsilon)$         & $\dn$ & $\epsilon$\\
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   629
$rev(c)$                      & $\dn$ & $c$\\
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   630
$rev(r_1 + r_2)$        & $\dn$ & $rev(r_1) + rev(r_2)$\\
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   631
$rev(r_1 \cdot r_2)$  & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   632
$rev(r^*)$                   & $\dn$ & $rev(r)^*$\\
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   633
\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   634
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   635
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   636
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   637
and the set
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   638
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   639
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   640
\bl{$Rev\,A \dn \{s^{-1} \;|\; s \in A\}$}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   641
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   642
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   643
prove whether
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   644
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   645
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   646
\bl{$L(rev(r)) = Rev (L(r))$}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   647
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   648
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   649
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   650
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   651
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   652
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   653
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   654
\begin{frame}[c]
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   655
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   656
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   657
\item The star-case in our proof about the matcher needs the following lemma
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   658
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   659
\bl{Der\,c\,A$^*$ $=$ (Der c A)\,@\, A$^*$}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   660
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   661
\end{itemize}\bigskip\bigskip
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   662
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   663
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   664
\item If \bl{\texttt{""} $\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B $\cup$ (Der\,c\,B)}\medskip
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   665
\item If \bl{\texttt{""} $\not\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   666
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   667
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   668
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   669
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   670
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   671
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   672
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   673
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   674
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   675
\begin{frame}[c]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   676
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   677
\begin{itemize}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   678
\item Assuming you have the alphabet \bl{\{a, b, c\}}\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   679
\item Give a regular expression that can recognise all strings that have at least one \bl{b}.
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   680
\end{itemize}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   681
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   682
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   683
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   684
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   685
40
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   686
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   687
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   688
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   689
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   690
``I hate coding. I do not want to look at code.''
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   691
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   692
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   693
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 39
diff changeset
   694
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   695
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   696
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   697
\end{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   698
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   699
%%% Local Variables:  
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   700
%%% mode: latex
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   701
%%% TeX-master: t
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   702
%%% End: 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   703