handouts/ho01.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 12 Nov 2013 21:51:57 +0000
changeset 186 fab34204d08e
parent 123 a75f9c9d8f94
child 217 cd6066f1056a
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\documentclass{article}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
\usepackage{charter}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
\usepackage{hyperref}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
\usepackage{amssymb}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
\usepackage{amsmath}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
\usepackage[T1]{fontenc}
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
     7
\usepackage{listings}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
     8
\usepackage{xcolor}
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
    10
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
    11
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    12
\definecolor{javared}{rgb}{0.6,0,0} % for strings
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    13
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    14
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    15
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    16
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    17
\lstdefinelanguage{scala}{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    18
  morekeywords={abstract,case,catch,class,def,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    19
    do,else,extends,false,final,finally,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    20
    for,if,implicit,import,match,mixin,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    21
    new,null,object,override,package,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    22
    private,protected,requires,return,sealed,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    23
    super,this,throw,trait,true,try,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    24
    type,val,var,while,with,yield},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    25
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    26
  sensitive=true,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    27
  morecomment=[l]{//},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    28
  morecomment=[n]{/*}{*/},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    29
  morestring=[b]",
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    30
  morestring=[b]',
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    31
  morestring=[b]"""
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    32
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    33
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    34
\lstset{language=Scala,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    35
	basicstyle=\ttfamily,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    36
	keywordstyle=\color{javapurple}\bfseries,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    37
	stringstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    38
	commentstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    39
	morecomment=[s][\color{javadocblue}]{/**}{*/},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    40
	numbers=left,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    41
	numberstyle=\tiny\color{black},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    42
	stepnumber=1,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    43
	numbersep=10pt,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    44
	tabsize=2,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    45
	showspaces=false,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    46
	showstringspaces=false}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
    47
	
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
\begin{document}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
\section*{Handout 1}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    52
This course is about the processing of strings. Lets start with what we mean by \emph{strings}. Strings
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    53
(they are also sometimes referred to as \emph{words}) are lists of characters drawn from an \emph{alphabet}. 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    54
If nothing else is specified, we usually assume 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    55
the alphabet consists of just the lower-case letters $a$, $b$, \ldots, $z$. Sometimes, however, we explicitly
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    56
restrict strings to contain, for example, only the letters $a$ and $b$. In this case we say the alphabet is the set $\{a, b\}$.
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    58
There are many ways how we can write down strings. In programming languages, they are usually 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    59
written as {\it "hello"} where the double quotes indicate that we dealing with a string. 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    60
Essentially, strings are lists of characters which can be written for example as follows
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    62
\[
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
[\text{\it h, e, l, l, o}]
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
\]
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
\noindent
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    67
The important point is that we can always decompose strings. For example, we will often consider the
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    68
first character of a string, say $h$, and the ``rest''  of a string say {\it "ello"} when making definitions 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    69
about strings. There are some subtleties with the empty string, sometimes written as {\it ""} but also as 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    70
the empty list of characters $[\,]$. Two strings, for example $s_1$ and $s_2$, can be \emph{concatenated}, 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    71
which we write as $s_1 @ s_2$. Suppose we are given two strings {\it "foo"} and {\it "bar"}, then their concatenation
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
    72
gives {\it "foobar"}.
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    74
We often need to talk about sets of strings. For example the set of all strings over the alphabet $\{a, \ldots\, z\}$
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    75
is
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    77
\[
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    78
\{\text{\it "", "a", "b", "c",\ldots,"z", "aa", "ab", "ac", \ldots, "aaa", \ldots}\}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    79
\]
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    80
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    81
\noindent
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    82
Any set of strings, not just the set-of-all-strings, is often called a \emph{language}. The idea behind
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    83
this choice of terminology is that if we enumerate, say, all words/strings from a dictionary, like 
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    84
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    85
\[
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    86
\{\text{\it "the", "of", "milk", "name", "antidisestablishmentarianism", \ldots}\}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
\]
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    88
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    89
\noindent
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    90
then we have essentially described the English language, or more precisely all
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
strings that can be used in a sentence of the English language. French would be a
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    92
different set of strings, and so on. In the context of this course, a language might 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    93
not necessarily make sense from a natural language point of view. For example
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    94
the set of all strings shown above is a language, as is the empty set (of strings). The
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    95
empty set of strings is often written as $\varnothing$ or $\{\,\}$. Note that there is a 
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    96
difference between the empty set, or empty language, and the set that 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    97
contains only the empty string $\{\text{""}\}$: the former has no elements, whereas 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
    98
the latter has one element.
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
    99
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   100
As seen, there are languages which contain infinitely many strings, like the set of all strings.
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   101
The ``natural'' languages like English, French and so on contain many but only finitely many 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   102
strings (namely the ones listed in a good dictionary). It might be therefore be surprising that the
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   103
language consisting of all email addresses is infinite provided we assume it is defined by the
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   104
regular expression\footnote{See \url{http://goo.gl/5LoVX7}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   106
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   107
([\text{\it{}a-z0-9\_.-}]^+)@([\text{\it a-z0-9.-}]^+).([\text{\it a-z.}]^{\{2,6\}})
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   108
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   109
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   110
\noindent
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   111
One reason is that before the $@$-sign there can be any string you want assuming it 
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   112
is made up from letters, digits, underscores, dots and hyphens---clearly there are infinitely many
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   113
of those. Similarly the string after the $@$-sign can be any string. However, this does not mean 
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   114
that every string is an email address. For example
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   115
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   116
\[
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   117
"\text{\it foo}@\text{\it bar}.\text{\it c}"
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   118
\]
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   120
\noindent
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   121
is not, because the top-level-domains must be of length of at least two. (Note that there is
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   122
the convention that uppercase letters are treated in email-addresses as if they were
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   123
lower-case.)
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   124
\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   125
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   126
Before we expand on the topic of regular expressions, let us review some operations on
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   127
sets. We will use capital letters $A$, $B$, $\ldots$ to stand for sets of strings. 
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   128
The union of two sets is written as usual as $A \cup B$. We also need to define the
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   129
operation of \emph{concatenating} two sets of strings. This can be defined as
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   130
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   131
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   132
A @ B \dn \{s_1@ s_2 | s_1 \in A \wedge s_2 \in B \}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   133
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   135
\noindent
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   136
which essentially means take the first string from the set $A$ and concatenate it with every
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   137
string in the set $B$, then take the second string from $A$ do the same and so on. You might
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   138
like to think about what this definition means in case $A$ or $B$ is the empty set.
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   139
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   140
We also need to define
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   141
the power of a set of strings, written as $A^n$ with $n$ being a natural number. This is defined inductively as follows
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   143
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   144
\begin{tabular}{rcl}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   145
$A^0$ & $\dn$ & $\{[\,]\}$ \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   146
$A^{n+1}$ & $\dn$ & $A @ A^n$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   147
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   148
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   149
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   150
\noindent
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   151
Finally we need the \emph{star} of a set of strings, written $A^*$. This is defined as the union
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   152
of every power of $A^n$ with $n\ge 0$. The mathematical notation for this operation is
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   153
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   154
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   155
A^* \dn \bigcup_{0\le n} A^n
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   156
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   157
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   158
\noindent
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   159
This definition implies that the star of a set $A$ contains always the empty string (that is $A^0$), one 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   160
copy of every string in $A$ (that is $A^1$), two copies in $A$ (that is $A^2$) and so on. In case $A=\{"a"\}$ we therefore 
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   161
have 
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   162
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   163
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   164
A^* = \{"", "a", "aa", "aaa", \ldots\}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   165
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   166
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   167
\noindent
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   168
Be aware that these operations sometimes have quite non-intuitive properties, for example
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   169
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   170
\begin{center}
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   171
\begin{tabular}{@{}ccc@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   172
\begin{tabular}{@{}r@{\hspace{1mm}}c@{\hspace{1mm}}l}
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   173
$A \cup \varnothing$ & $=$ & $A$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   174
$A \cup A$ & $=$ & $A$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   175
$A \cup B$ & $=$ & $B \cup A$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   176
\end{tabular} &
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   177
\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   178
$A @ B$ & $\not =$ & $B @ A$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   179
$A  @ \varnothing$ & $=$ & $\varnothing @ A = \varnothing$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   180
$A  @ \{""\}$ & $=$ & $\{""\} @ A = A$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   181
\end{tabular} &
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   182
\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l@{}}
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   183
$\varnothing^*$ & $=$ & $\{""\}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   184
$\{""\}^*$ & $=$ & $\{""\}$\\
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   185
$A^\star$ & $=$ & $\{""\} \cup A\cdot A^*$\\
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   186
\end{tabular} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   187
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   188
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   189
\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   190
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   191
\noindent
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   192
\emph{Regular expressions} are meant to conveniently describe languages...at least languages
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   193
we are interested in in Computer Science.  For example there is no convenient regular expression
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   194
for describing the English language short of enumerating all English words. 
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   195
But they seem useful for describing all permitted email addresses, as seen above. 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   197
Regular expressions are given by the following grammar:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   198
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   199
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   200
\begin{tabular}{r@{\hspace{1mm}}r@{\hspace{1mm}}l@{\hspace{13mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   201
  $r$ & $::=$ &   $\varnothing$         & null\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   202
        & $\mid$ & $\epsilon$              & empty string / "" / []\\
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   203
        & $\mid$ & $c$                         & single character\\
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   204
        & $\mid$ & $r_1 \cdot r_2$      & sequence\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   205
        & $\mid$ & $r_1 + r_2$            & alternative / choice\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   206
        & $\mid$ & $r^*$                      & star (zero or more)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   207
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   208
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   209
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   210
\noindent
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   211
Because we overload our notation, there are some subtleties you should be aware of. First, the letter 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   212
$c$ stands for any character from the
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   213
alphabet at hand. Second, we will use parentheses to disambiguate
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   214
regular expressions. For example we will write $(r_1 + r_2)^*$, which is different from, say $r_1 + (r_2)^*$.
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   215
The former means roughly zero or more times $r_1$ or $r_2$, while the latter means $r_1$ or zero or more times
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   216
$r_2$. We should also write $(r_1 + r_2) + r_3$, which is different from the regular expression $r_1 + (r_2 + r_3)$,
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   217
but in case of $+$ and $\cdot$ we actually do not care about the order and just write $r_1 + r_2 + r_3$, or $r_1 \cdot r_2 \cdot r_3$,
106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
   218
respectively. The reasons for this will become clear shortly. In the literature you will often find that the choice
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   219
$r_1 + r_2$  is written as $r_1\mid{}r_2$ or $r_1\mid\mid{}r_2$. Also following the convention in the literature, we will in case of $\cdot$ even 
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   220
often omit it all together. For example the regular expression for email addresses shown above is meant to be of the form
107
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   221
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   222
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   223
([\ldots])^+ \cdot @ \cdot ([\ldots])^+ \cdot . \cdot \ldots
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   224
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   225
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   226
\noindent
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   227
meaning first comes a name (specified by the regular expression $([\ldots])^+$), then an $@$-sign, then
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   228
a domain name (specified by the regular expression $([\ldots])^+$), then a dot and then a top-level domain. Similarly if
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   229
we want to specify the regular expression for the string {\it "hello"} we should write
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   230
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   231
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   232
{\it h} \cdot {\it e} \cdot {\it l} \cdot {\it l} \cdot {\it o}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   233
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   234
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   235
\noindent
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   236
but often just write {\it hello}.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   237
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   238
Another source of confusion might arise from the fact that we use the term \emph{regular expression} for the regular expressions used in ``theory''
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   239
and also the ones used in ``practice''. In this course we refer by default to the regular expressions defined by the grammar above. 
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   240
In ``practice'' we often use $r^+$ to stand for one or more times, $\backslash{}d$ to stand for a digit, $r^?$ to stand for an optional regular
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   241
expression, or ranges such as $[\text{\it a - z}]$ to stand for any lower case letter from $a$ to $z$. They are however mere convenience 
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   242
as they can be seen as shorthand for
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   243
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   244
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   245
\begin{tabular}{rcl}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   246
$r^+$ & $\mapsto$ & $r\cdot r^*$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   247
$r^?$ & $\mapsto$ & $\epsilon + r$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   248
$\backslash d$ & $\mapsto$ & $0 + 1 + 2 + \ldots + 9$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   249
$[\text{\it a - z}]$ & $\mapsto$ & $a + b + \ldots + z$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   250
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   251
\end{center}
107
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   252
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   253
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   254
We will see later that the \emph{not}-regular-expression can also be seen as convenience. This regular
110
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   255
expression is supposed to stand for every string \emph{not} matched by a regular expression. We will write
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   256
such not-regular-expressions as $\sim{}r$. While being ``convenience'' it is often not so clear what the shorthand for
9353308f1c6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 108
diff changeset
   257
these kind of not-regular-expressions is. Try to write down the regular expression which can match any
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   258
string except the two strings {\it "hello"} and {\it "world"}. It is possible in principle, but often it is easier to just include
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   259
$\sim{}r$ in the definition of regular expressions. Whenever we do so, we will state it explicitly.
107
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 106
diff changeset
   260
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   261
So far we have only considered informally what the \emph{meaning} of a regular expression is.  
111
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 110
diff changeset
   262
To do so more formally we will associate with every regular expression a set of strings 
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   263
that is supposed to be matched by this
111
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 110
diff changeset
   264
regular expression. This can be defined recursively  as follows
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   265
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   266
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   267
\begin{tabular}{rcl}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   268
$L(\varnothing)$  & $\dn$ & $\{\,\}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   269
$L(\epsilon)$       & $\dn$ & $\{""\}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   270
$L(c)$                  & $\dn$ & $\{"c"\}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   271
$L(r_1+ r_2)$      & $\dn$ & $L(r_1) \cup L(r_2)$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   272
$L(r_1 \cdot r_2)$  & $\dn$ & $\{s_1@ s_2 | s_1 \in L(r_1) \wedge s_2 \in L(r_2) \}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   273
$L(r^*)$                   & $\dn$ & $\bigcup_{n \ge 0} L(r)^n$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   274
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   275
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   276
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   277
\noindent
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   278
As a result we can now precisely state what the meaning, for example, of the regular expression 
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   279
${\it h} \cdot {\it e} \cdot {\it l} \cdot {\it l} \cdot {\it o}$ is, namely 
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   280
$L({\it h} \cdot {\it e} \cdot {\it l} \cdot {\it l} \cdot {\it o}) = \{\text{\it"hello"}\}$...as expected. Similarly if we have the 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   281
choice-regular-expression $a + b$, its meaning is $L(a + b) = \{\text{\it"a"}, \text{\it"b"}\}$, namely the only two strings which can possibly
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   282
be matched by this choice. You can now also see why we do not make a difference
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   283
between the different regular expressions $(r_1 + r_2) + r_3$ and $r_1 + (r_2 + r_3)$....they 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   284
are not the same regular expression, but have the same meaning. 
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   285
123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 113
diff changeset
   286
The point of the definition of $L$ is that we can use it to precisely specify when a string $s$ is matched by a
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   287
regular expression $r$, namely only when $s \in L(r)$. In fact we will write a program {\it match} that takes any string $s$ and
108
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   288
any regular expression $r$ as argument and returns \emph{yes}, if $s \in L(r)$ and \emph{no},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 107
diff changeset
   289
if $s \not\in L(r)$. We leave this for the next lecture.
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   290
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   291
\begin{figure}[p]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   292
{\lstset{language=Scala}\texttt{\lstinputlisting{../progs/crawler1.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   293
\caption{Scala code for a web-crawler that can detect broken links in a web-page. It uses
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   294
the regular expression {\tt http\_pattern} in Line~15 for recognising URL-addresses. It finds
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   295
all links using the library function {\tt findAllIn} in Line~21.}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   296
\end{figure}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   297
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   298
\begin{figure}[p]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   299
{\lstset{language=Scala}\texttt{\lstinputlisting{../progs/crawler2.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   300
\caption{A version of the web-crawler which only follows links in ``my'' domain---since these are the
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   301
ones I am interested in to fix. It uses the regular expression {\tt my\_urls} in Line~16.
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   302
The main change is in Line~26 where there is a test whether URL is in ``my'' domain or not.}
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   303
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   304
\end{figure}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   305
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   306
\begin{figure}[p]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   307
{\lstset{language=Scala}\texttt{\lstinputlisting{../progs/crawler3.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   308
\caption{A small email harvester---whenever we download a web-page, we also check whether
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   309
it contains any email addresses. For this we use the regular expression {\tt email\_pattern} in
113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
   310
Line~17.  The main change is in Lines 33 and 34 where all email addresses that can be found in a page are printed.}
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   311
\end{figure}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 111
diff changeset
   312
105
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   313
\end{document}
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   314
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   315
%%% Local Variables: 
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   316
%%% mode: latex
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   317
%%% TeX-master: t
397ecdafefd8 added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   318
%%% End: