handouts/notation.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sun, 02 Oct 2016 15:07:21 +0100
changeset 434 8664ff87cd77
parent 404 245d302791c7
child 476 d922cc83b70c
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\documentclass{article}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
\usepackage{../style}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
\usepackage{../langs}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
\begin{document}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
\section*{A Crash-Course on Notation}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    11
There are innumerable books available about compilers,
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    12
automata theory and formal languages. Unfortunately, they
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    13
often use their own notational conventions and their own
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    14
symbols. This handout is meant to clarify some of the notation
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    15
I will use. I appologise in advance that sometimes I will be a
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    16
bit fuzzy\ldots the problem is that often we want to have
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    17
convenience in our mathematical definitions (to make them
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    18
readable and understandable), but sometimes we need precision
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    19
for actual programs.
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    20
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
\subsubsection*{Characters and Strings}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    23
The most important concept in this module are strings. Strings
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    24
are composed of \defn{characters}. While characters are surely
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    25
a familiar concept, we will make one subtle distinction in
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    26
this module. If we want to refer to concrete characters, like
332
4755ad4b457b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 266
diff changeset
    27
\code{a}, \code{b}, \code{c} and so on, we use a typewriter font.
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    28
Accordingly if we want to refer to the concrete characters of
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    29
my email address we shall write
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
\begin{center}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
\pcode{christian.urban@kcl.ac.uk}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
\end{center}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    35
\noindent If we also need to explicitly indicate the ``space''
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
character, we write \VS{}\hspace{1mm}. For example
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
\begin{center}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
\tt{}hello\VS\hspace{0.5mm}world
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
\end{center}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    43
\noindent But often we do not care which particular characters
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    44
we use. In such cases we use the italic font and write $a$,
332
4755ad4b457b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 266
diff changeset
    45
$b$, $c$ and so on for characters. Therefore if we need a
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
representative string, we might write
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    48
\[
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
abracadabra
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    50
\]
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    52
\noindent In this string, we do not really care what the
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    53
characters stand for, except we do care about the fact that
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    54
for example the character $a$ is not equal to $b$ and so on.
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    55
Why do I make this distinction? Because we often need to
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    56
define functions using variables ranging over characters. We
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    57
need to somehow say this is a variable, say $c$, ranging over
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    58
characters, while this is the atual character \pcode{c}.
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    60
An \defn{alphabet} is a (non-empty) finite set of characters.
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    61
Often the letter $\Sigma$ is used to refer to an alphabet. For
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    62
example the ASCII characters \pcode{a} to \pcode{z} form an
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    63
alphabet. The digits $0$ to $9$ are another alphabet. The
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    64
Greek letters $\alpha$ to $\omega$ also form an alphabet. If
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    65
nothing else is specified, we usually assume the alphabet
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    66
consists of just the lower-case letters $a$, $b$, \ldots, $z$.
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    67
Sometimes, however, we explicitly want to restrict strings to
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    68
contain only the letters $a$ and $b$, for example. In this
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
    69
case we will state that the alphabet is the set $\{a, b\}$. 
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
\defn{Strings} are lists of characters. Unfortunately, there
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
are many ways how we can write down strings. In programming
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
languages, they are usually written as \dq{$hello$} where the
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    74
double quotes indicate that we are dealing with a string. In
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    75
programming languages, such as Scala, strings have a special
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    76
type---namely \pcode{String} which is different from the type
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    77
for lists of chatacters. This is because strings can be
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    78
efficiently represented in memory, unlike general lists. Since
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    79
\code{String} and the type of lists of characters,
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    80
\code{List[Char]} are not the same, we need to explicitly
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    81
coerce elements between the two types, for example
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    82
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    83
\begin{lstlisting}[numbers=none]
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    84
scala> "abc".toList
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    85
res01: List[Char] = List(a, b, c)
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    86
\end{lstlisting}
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    87
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    88
\noindent Since in our (mathematical) definitions we regard
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    89
strings as lists of characters, we will also write
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    90
\dq{$hello$} as
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    92
\[
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
    93
[\text{\it h, e, l, l, o}] \qquad\text{or simply}\qquad \textit{hello}
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    94
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    95
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    96
\noindent The important point is that we can always decompose
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    97
such strings. For example, we will often consider the first
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    98
character of a string, say $h$, and the ``rest'' of a string
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    99
say \dq{\textit{ello}} when making definitions about strings.
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   100
There are also some subtleties with the empty string,
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   101
sometimes written as \dq{} but also as the empty list of
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   102
characters $[\,]$.\footnote{In the literature you can also
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   103
often find that $\varepsilon$ or $\lambda$ is used to
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   104
represent the empty string.} 
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   105
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   106
Two strings, say $s_1$ and $s_2$, can be \defn{concatenated},
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   107
which we write as $s_1 @ s_2$. If we regard $s_1$ and $s_2$ as
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   108
lists of characters, then $@$ is the list-append function.
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   109
Suppose we are given two strings \dq{\textit{foo}} and
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   110
\dq{\textit{bar}}, then their concatenation, writen
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   111
\dq{\textit{foo}} $@$ \dq{\textit{bar}}, gives
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   112
\dq{\textit{foobar}}. But as said above, we will often
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   113
simplify our life and just drop the double quotes whenever it
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   114
is clear we are talking about strings, So we will often just
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   115
write \textit{foo}, \textit{bar}, \textit{foobar} or
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   116
\textit{foo $@$ bar}.
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   117
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   118
Occasionally we will use the notation $a^n$ for strings, which 
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   119
stands for the string of $n$ repeated $a$s. So $a^{n}b^{n}$ is
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   120
a string that has as many $a$s by as many $b$s.
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   121
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   122
A simple property of string concatenation is 
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   123
\emph{associativity}, meaning
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   124
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   125
\[(s_1 @ s_2) @ s_3 = s_1 @ (s_2 @ s_3)\]  
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   126
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   127
\noindent are always equal strings. The empty string behaves
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   128
like a \emph{unit element}, therefore
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   129
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   130
\[s \,@\, [] = [] \,@\, s = s\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   131
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   132
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   133
\subsubsection*{Sets and Languages}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   134
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   135
We will use the familiar operations $\cup$, $\cap$, $\subset$
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   136
and $\subseteq$ for sets. For the empty set we will either
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   137
write $\varnothing$ or $\{\,\}$. The set containing the
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   138
natural numbers $1$, $2$ and $3$, for example, we will write
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   139
with curly braces as
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   140
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
\{1, 2, 3\}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   144
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   145
\noindent The notation $\in$ means \emph{element of}, so $1
266
ae039d6ae3f2 fixed typo
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 246
diff changeset
   146
\in \{1, 2, 3\}$ is true and $4 \in \{1, 2, 3\}$ is false.
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   147
Sets can potentially have infinitely many elements. For
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   148
example the set of all natural numbers $\{0, 1, 2, \ldots\}$
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   149
is infinite. This set is often also abbreviated as
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   150
$\mathbb{N}$. We can define sets by giving all elements, for
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   151
example $\{0, 1\}$ for the set containing just $0$ and $1$,
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   152
but also by \defn{set comprehensions}. For example the set of
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   153
all even natural numbers can be defined as
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   154
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   155
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   156
\{n\;|\;n\in\mathbb{N} \wedge n\;\text{is even}\}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   157
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   158
  
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   159
\noindent Though silly, but the set $\{0, 1, 2\}$ could also be
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   160
defined by the following set comprehension
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   161
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   162
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   163
\{n\;|\; n^2 < 9 \wedge n \in \mathbb{N}\}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   164
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   165
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   166
\noindent Notice that set comprehensions could be used
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   167
to define set union, intersection and difference:
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   168
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   169
\begin{eqnarray*}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   170
A \cup B & \dn & \{x\;|\; x \in A \vee x \in B\}\\
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   171
A \cap B & \dn & \{x\;|\; x \in A \wedge x \in B\}\\
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   172
A \backslash B & \dn & \{x\;|\; x \in A \wedge x \not\in B\} 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   173
\end{eqnarray*}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   174
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   175
\noindent In general set comprehensions are of the form
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   176
$\{a\;|\;P\}$ which stands for the set of all elements $a$
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   177
(from some set) for which some property $P$ holds.
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   178
 
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   179
For defining sets, we will also often use the notion of the
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   180
``big union''. An example is as follows:
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   181
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   182
\begin{equation}\label{bigunion}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   183
\bigcup_{0\le n}\; \{n^2, n^2 + 1\}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   184
\end{equation}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   185
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   186
\noindent which is the set of all squares and their immediate
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   187
successors, so
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   188
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   189
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   190
\{0, 1, 2, 4, 5, 9, 10, 16, 17, \ldots\}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   191
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   192
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   193
\noindent A big union is a sequence of unions which are 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   194
indexed typically by a natural number. So the big union in
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   195
\eqref{bigunion} could equally be written as
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   196
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   197
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   198
\{0, 1\} \cup \{1, 2\} \cup \{4, 5\} \cup \{9, 10\} \cup 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   199
\ldots
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   200
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   201
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   202
\noindent but using the big union notation is more concise.
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   203
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   204
While this stuff about sete might all look trivial or even
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   205
needlessly pedantic, \emph{Nature} is never simple. If you
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   206
want to be amazed how complicated sets can get, watch out for
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   207
the last lecture just before Christmas where I want you to
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   208
convince you of the fact that some sets are more infinite than
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   209
others. Actually that will be a fact that is very relevant to
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   210
the material of this module.
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   211
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   212
Another important notion in this module are \defn{languages}, which
398
c8ce95067c1a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   213
are sets of strings. One of the main goals for us will be how to
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   214
(formally) specify languages and to find out whether a string
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   215
is in a language or not.\footnote{You might wish to ponder
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   216
whether this is in general a hard or easy problem, where
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   217
hardness is meant in terms of Turing decidable, for example.}
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   218
Note that the language containing the empty string $\{\dq{}\}$
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   219
is not equal to $\varnothing$, the empty language (or empty
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   220
set): The former contains one element, namely \dq{} (also
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   221
written $[\,]$), but the latter does not contain any
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   222
element.
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   223
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   224
For languages we define the operation of \defn{language
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   225
concatenation}, written like in the string case as $A @ B$:
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   226
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   227
\begin{equation}\label{langconc}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   228
A @ B \dn \{s_1 @ s_2\;|\; s_1\in A \wedge s_2\in B\}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   229
\end{equation}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   230
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   231
\noindent Be careful to understand the difference: the $@$
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   232
in $s_1 @ s_2$ is string concatenation, while $A @ B$ refers 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   233
to the concatenation of two languages (or sets of strings).
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   234
As an example suppose $A=\{ab, ac\}$ and $B=\{zzz, qq, r\}$,
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   235
then $A \,@\, B$ is the language
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   236
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   237
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   238
\{abzzz, abqq, abr, aczzz, acqq, acr\}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   239
\] 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   240
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   241
\noindent Recall the properties for string concatenation. For
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   242
language concatenation we have the following properties
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   243
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   244
\begin{center}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   245
\begin{tabular}{ll}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   246
associativity: & $(A @ B) @ C = A @ (B @ C)$\\
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   247
unit element:  & $A \,@\, \{[]\} = \{[]\} \,@\, A = A$\\
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   248
zero element:  & $A \,@\, \varnothing = \varnothing \,@\, A = 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   249
\varnothing$
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   250
\end{tabular}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   251
\end{center}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   252
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   253
\noindent Note the difference in the last two lines: the empty
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   254
set behaves like $0$ for multiplication and the set $\{[]\}$
242
35104ee14f87 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 241
diff changeset
   255
like $1$ for multiplication ($n * 1 = n$ and $n * 0 = 0$).
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   256
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   257
Following the language concatenation, we can define a
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   258
\defn{language power} operation as follows:
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   259
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   260
\begin{eqnarray*}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   261
A^0     & \dn & \{[]\}\\
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   262
A^{n+1} & \dn & A \,@\, A^n
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   263
\end{eqnarray*}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   264
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   265
\noindent This definition is by recursion on natural numbers.
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   266
Note carefully that the zero-case is not defined as the empty
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   267
set, but the set containing the empty string. So no matter
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   268
what the set $A$ is, $A^0$ will always be $\{[]\}$. (There is
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   269
another hint about a connection between the $@$-operation and
242
35104ee14f87 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 241
diff changeset
   270
multiplication: How is $x^n$ defined recursively and what is
35104ee14f87 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 241
diff changeset
   271
$x^0$?)
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   272
242
35104ee14f87 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 241
diff changeset
   273
Next we can define the \defn{star operation} for languages:
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   274
$A\star$ is the union of all powers of $A$, or short
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   275
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   276
\begin{equation}\label{star}
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   277
A\star \dn \bigcup_{0\le n}\; A^n
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   278
\end{equation}
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   279
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   280
\noindent This star operation is often also called
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   281
\emph{Kleene-star}. Unfolding the definition in \eqref{star}
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   282
gives
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   283
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   284
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   285
A^0 \cup A^1 \cup A^2 \cup A^3 \cup \ldots
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   286
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   287
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   288
\noindent
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   289
which is equal to 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   290
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   291
\[
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   292
\{[]\} \,\cup\, A \,\cup\, A @ A \,\cup\, A @ A @ A \,\cup\, \ldots
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   293
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   294
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   295
\noindent We can see that the empty string is always in $A\star$,
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   296
no matter what $A$ is. This is because $[] \in A^0$. To make
241
10f02605a46a polished
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 239
diff changeset
   297
sure you understand these definitions, I leave you to answer
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   298
what $\{[]\}\star$ and $\varnothing\star$ are?
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   299
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   300
Recall that an alphabet is often referred to by the letter
404
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   301
$\Sigma$. We can now write for the set of \emph{all} strings
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   302
over this alphabet $\Sigma\star$. In doing so we also include the
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   303
empty string as a possible string over $\Sigma$. So if $\Sigma
245d302791c7 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 398
diff changeset
   304
= \{a, b\}$, then $\Sigma\star$ is
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   305
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   306
\[
246
baf41b05210f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 242
diff changeset
   307
\{[], a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bab, \ldots\}
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   308
\]
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   309
246
baf41b05210f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 242
diff changeset
   310
\noindent or in other words all strings containing $a$s and
baf41b05210f updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 242
diff changeset
   311
$b$s only, plus the empty string.
239
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   312
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   313
\end{document}
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   314
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   315
%%% Local Variables: 
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   316
%%% mode: latex
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   317
%%% TeX-master: t
68d98140b90b added notation handout
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   318
%%% End: