videos/02-prelims.srt
author Christian Urban <christian.urban@kcl.ac.uk>
Wed, 27 Sep 2023 22:42:19 +0100
changeset 930 0fe0937e049d
parent 766 e8402d8ec8e6
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
766
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
1
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
00:00:09,990 --> 00:00:13,465
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
Welcome back to this
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
week's lecture.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
2
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
00:00:13,465 --> 00:00:16,450
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
The task this week is to actually
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
3
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
00:00:16,450 --> 00:00:20,320
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
implement a regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
expression matcher.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
4
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
00:00:20,320 --> 00:00:22,510
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
And we want to be a bit
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
5
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
00:00:22,510 --> 00:00:25,315
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
faster than the regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
expression matcher
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
6
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
00:00:25,315 --> 00:00:29,380
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    26
in Python, Ruby,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    27
Javascript, and Java.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    28
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    29
7
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    30
00:00:29,380 --> 00:00:31,960
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    31
Remember this regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    32
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    33
8
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    34
00:00:31,960 --> 00:00:35,785
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    35
and strings which are
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    36
just a number of a's,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    37
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    38
9
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    39
00:00:35,785 --> 00:00:39,670
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    40
these regular expression matchers
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    41
where abysmally slow.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    42
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    43
10
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    44
00:00:39,670 --> 00:00:43,170
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    45
They could only match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    46
approximately 30 a's in
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    47
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    48
11
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    49
00:00:43,170 --> 00:00:45,665
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    50
something like half a minute.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    51
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    52
12
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    53
00:00:45,665 --> 00:00:49,460
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    54
What we like to do with
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    55
our regular expression matcher.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    56
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    57
13
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    58
00:00:49,460 --> 00:00:51,890
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    59
We will try a few times,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    60
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    61
14
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    62
00:00:51,890 --> 00:00:55,505
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    63
but our second trial will already
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    64
be much, much better.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    65
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    66
15
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    67
00:00:55,505 --> 00:00:58,400
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    68
It will probably
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    69
match around maybe
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    70
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    71
16
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    72
00:00:58,400 --> 00:01:02,030
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    73
thousand a's in something
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    74
in half a minute.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    75
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    76
17
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    77
00:01:02,030 --> 00:01:03,920
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    78
But our third version in
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    79
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    80
18
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    81
00:01:03,920 --> 00:01:06,230
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    82
comparison will be
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    83
blindingly fast.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    84
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    85
19
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    86
00:01:06,230 --> 00:01:08,180
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    87
And we'll be able to match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    88
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    89
20
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    90
00:01:08,180 --> 00:01:10,145
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    91
strings of length 10,000 a's
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    92
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    93
21
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    94
00:01:10,145 --> 00:01:12,230
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    95
and will not require
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    96
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    97
22
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    98
00:01:12,230 --> 00:01:14,975
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    99
more than five seconds.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   100
So let's go ahead with that.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   101
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   102
23
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   103
00:01:14,975 --> 00:01:18,095
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   104
We will first implement
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   105
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   106
24
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   107
00:01:18,095 --> 00:01:19,880
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   108
our regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   109
matcher only
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   110
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   111
25
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   112
00:01:19,880 --> 00:01:22,069
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   113
for the basic
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   114
regular expressions.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   115
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   116
26
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   117
00:01:22,069 --> 00:01:25,430
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   118
So we will have only six
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   119
cases to think about.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   120
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   121
27
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   122
00:01:25,430 --> 00:01:27,620
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   123
This will simplify matters at first.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   124
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   125
28
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   126
00:01:27,620 --> 00:01:30,350
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   127
Later we can
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   128
think about how to
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   129
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   130
29
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   131
00:01:30,350 --> 00:01:34,100
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   132
extend that to the extended
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   133
regular expressions.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   134
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   135
30
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   136
00:01:34,100 --> 00:01:37,625
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   137
Unfortunately, before we can
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   138
start our implementation,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   139
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   140
31
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   141
00:01:37,625 --> 00:01:39,290
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   142
we have to discuss
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   143
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   144
32
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   145
00:01:39,290 --> 00:01:42,470
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   146
when two regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   147
expressions are equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   148
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   149
33
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   150
00:01:42,470 --> 00:01:46,595
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   151
And we use here this notation
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   152
of the triple equals.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   153
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   154
34
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   155
00:01:46,595 --> 00:01:48,215
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   156
We say a regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   157
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   158
35
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   159
00:01:48,215 --> 00:01:50,180
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   160
r1 and r2 are
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   161
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   162
36
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   163
00:01:50,180 --> 00:01:56,059
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   164
equivalent if and only
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   165
if the language of r1 is
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   166
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   167
37
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   168
00:01:56,059 --> 00:01:59,360
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   169
equal to the language of r2.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   170
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   171
38
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   172
00:01:59,360 --> 00:02:02,915
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   173
Sounds complicated,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   174
but essentially means
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   175
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   176
39
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   177
00:02:02,915 --> 00:02:04,700
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   178
if the two regular expressions can
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   179
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   180
40
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   181
00:02:04,700 --> 00:02:06,950
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   182
match exactly the same strings,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   183
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   184
41
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   185
00:02:06,950 --> 00:02:09,800
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   186
then we want to regard
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   187
them as equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   188
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   189
42
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   190
00:02:09,800 --> 00:02:14,300
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   191
This equivalence justifies
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   192
why we can be sloppy
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   193
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   194
43
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   195
00:02:14,300 --> 00:02:16,040
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   196
with parentheses.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   197
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   198
44
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   199
00:02:16,040 --> 00:02:23,870
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   200
For example, if we have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   201
(r1 + r2) + r3,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   202
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   203
45
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   204
00:02:23,870 --> 00:02:32,270
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   205
then this will be equivalent
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   206
to r1 + (r2 + r3).
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   207
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   208
46
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   209
00:02:32,270 --> 00:02:34,910
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   210
Remember, regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   211
expressions are trees,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   212
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   213
47
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   214
00:02:34,910 --> 00:02:37,940
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   215
so these are two different
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   216
regular expressions,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   217
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   218
48
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   219
00:02:37,940 --> 00:02:41,540
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   220
but they can match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   221
the same strings.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   222
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   223
49
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   224
00:02:41,540 --> 00:02:45,695
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   225
Because, well, if we take
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   226
here the meaning of that,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   227
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   228
50
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   229
00:02:45,695 --> 00:02:54,350
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   230
that would be just L(r1 + r2 + r3),
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   231
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   232
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   233
51
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   234
00:02:54,350 --> 00:03:04,100
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   235
which is equal to L(r1 + r2) u L(r3).
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   236
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   237
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   238
52
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   239
00:03:04,100 --> 00:03:10,595
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   240
And that is equal to of 
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   241
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   242
53
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   243
00:03:10,595 --> 00:03:15,710
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   244
L(r1) u L(r2) u L(r3).
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   245
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   246
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   247
54
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   248
00:03:15,710 --> 00:03:17,930
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   249
And if you do the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   250
same calculation
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   251
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   252
55
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   253
00:03:17,930 --> 00:03:19,445
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   254
for that regular expression,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   255
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   256
56
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   257
00:03:19,445 --> 00:03:22,940
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   258
you will find out the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   259
two sets are the same.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   260
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   261
57
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   262
00:03:22,940 --> 00:03:26,195
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   263
So both regular expressions
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   264
can match the same strings.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   265
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   266
58
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   267
00:03:26,195 --> 00:03:28,805
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   268
So even if they're different
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   269
regular expressions,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   270
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   271
59
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   272
00:03:28,805 --> 00:03:31,220
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   273
we can regard them as eqivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   274
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   275
60
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   276
00:03:31,220 --> 00:03:33,290
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   277
And so that's why we can forget
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   278
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   279
61
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   280
00:03:33,290 --> 00:03:35,270
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   281
about writing these parentheses.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   282
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   283
62
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   284
00:03:35,270 --> 00:03:40,205
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   285
Let's have a look
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   286
at some more examples.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   287
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   288
63
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   289
00:03:40,205 --> 00:03:41,870
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   290
So the first one here,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   291
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   292
64
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   293
00:03:41,870 --> 00:03:43,205
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   294
that is now clear.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   295
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   296
65
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   297
00:03:43,205 --> 00:03:45,200
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   298
We did this calculation already
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   299
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   300
66
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   301
00:03:45,200 --> 00:03:47,480
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   302
for arbitrary regular expressions.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   303
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   304
67
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   305
00:03:47,480 --> 00:03:49,520
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   306
Here it is for
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   307
concrete ones a, b and c.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   308
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   309
68
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   310
00:03:49,520 --> 00:03:52,690
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   311
Here on the left-hand side,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   312
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   313
69
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   314
00:03:52,690 --> 00:03:54,895
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   315
the regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   316
has the same meaning
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   317
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   318
70
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   319
00:03:54,895 --> 00:03:56,620
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   320
as on the right-hand side.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   321
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   322
71
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   323
00:03:56,620 --> 00:03:58,420
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   324
So they are equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   325
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   326
72
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   327
00:03:58,420 --> 00:04:01,375
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   328
We can ignore the parentheses.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   329
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   330
73
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   331
00:04:01,375 --> 00:04:03,220
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   332
If I have a choice,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   333
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   334
74
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   335
00:04:03,220 --> 00:04:06,610
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   336
but the choice is
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   337
the same a or a,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   338
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   339
75
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   340
00:04:06,610 --> 00:04:09,265
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   341
then this is
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   342
equivalent to just a.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   343
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   344
76
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   345
00:04:09,265 --> 00:04:13,075
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   346
So the same choice doesn't
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   347
introduce anything more.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   348
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   349
77
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   350
00:04:13,075 --> 00:04:15,370
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   351
In the next case, if I have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   352
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   353
78
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   354
00:04:15,370 --> 00:04:19,450
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   355
a regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   356
which can match a or b,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   357
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   358
79
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   359
00:04:19,450 --> 00:04:23,860
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   360
that can match the same
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   361
strings as b or a.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   362
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   363
80
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   364
00:04:23,860 --> 00:04:27,325
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   365
So you have a kind of
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   366
commutativity for the plus,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   367
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   368
81
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   369
00:04:27,325 --> 00:04:29,485
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   370
which is like on natural numbers.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   371
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   372
82
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   373
00:04:29,485 --> 00:04:32,880
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   374
But you would not have a
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   375
communitivity for the sequence:
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   376
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   377
83
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   378
00:04:32,880 --> 00:04:37,070
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   379
if you have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   380
first a and then b,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   381
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   382
84
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   383
00:04:37,070 --> 00:04:40,850
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   384
that's not the same as
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   385
matching first b and then a.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   386
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   387
85
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   388
00:04:40,850 --> 00:04:42,800
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   389
So for the sequence ...
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   390
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   391
86
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   392
00:04:42,800 --> 00:04:44,615
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   393
they are not equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   394
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   395
87
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   396
00:04:44,615 --> 00:04:49,475
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   397
However, for the sequence I
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   398
can, like for the plus, ignore
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   399
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   400
88
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   401
00:04:49,475 --> 00:04:51,245
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   402
prarentheses.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   403
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   404
89
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   405
00:04:51,245 --> 00:04:55,070
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   406
If I have the parentheses
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   407
and this way,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   408
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   409
90
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   410
00:04:55,070 --> 00:04:57,785
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   411
or I have it in this way.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   412
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   413
91
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   414
00:04:57,785 --> 00:05:00,605
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   415
These are two different
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   416
regular expressions,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   417
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   418
92
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   419
00:05:00,605 --> 00:05:02,120
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   420
but they have the same meaning.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   421
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   422
93
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   423
00:05:02,120 --> 00:05:03,815
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   424
So they are equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   425
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   426
94
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   427
00:05:03,815 --> 00:05:05,780
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   428
And so I can leave out parentheses
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   429
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   430
95
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   431
00:05:05,780 --> 00:05:09,170
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   432
for times as well.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   433
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   434
96
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   435
00:05:09,170 --> 00:05:12,185
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   436
The next one is a slightly
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   437
more interesting one.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   438
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   439
97
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   440
00:05:12,185 --> 00:05:15,020
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   441
If I have a regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   442
expression which can match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   443
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   444
98
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   445
00:05:15,020 --> 00:05:19,655
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   446
c first followed by (a + b),
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   447
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   448
99
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   449
00:05:19,655 --> 00:05:25,355
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   450
then this is the same as
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   451
first c followed by a,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   452
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   453
100
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   454
00:05:25,355 --> 00:05:28,640
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   455
or c followed by b.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   456
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   457
101
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   458
00:05:28,640 --> 00:05:31,265
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   459
So that's the kind of
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   460
distributivity law
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   461
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   462
102
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   463
00:05:31,265 --> 00:05:33,545
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   464
on regular expressions.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   465
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   466
103
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   467
00:05:33,545 --> 00:05:36,350
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   468
But they're also regular expressions
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   469
which are not equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   470
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   471
104
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   472
00:05:36,350 --> 00:05:38,990
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   473
If I have the regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   474
expression which can
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   475
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   476
105
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   477
00:05:38,990 --> 00:05:42,800
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   478
match the string containing
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   479
exactly two a's.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   480
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   481
106
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   482
00:05:42,800 --> 00:05:44,240
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   483
That is not equivalent
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   484
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   485
107
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   486
00:05:44,240 --> 00:05:46,730
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   487
to the regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   488
expression which can just match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   489
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   490
108
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   491
00:05:46,730 --> 00:05:49,250
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   492
a single a. And similarly
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   493
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   494
109
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   495
00:05:49,250 --> 00:05:51,680
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   496
in this case, if I can match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   497
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   498
110
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   499
00:05:51,680 --> 00:05:56,075
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   500
a or the string b followed by c,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   501
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   502
111
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   503
00:05:56,075 --> 00:05:59,825
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   504
that is not the same as a or b,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   505
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   506
112
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   507
00:05:59,825 --> 00:06:02,000
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   508
followed by a or c.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   509
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   510
113
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   511
00:06:02,000 --> 00:06:05,990
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   512
I'll let you think about
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   513
why is that not equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   514
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   515
114
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   516
00:06:05,990 --> 00:06:08,060
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   517
Essentially you
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   518
have to find out what's
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   519
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   520
115
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   521
00:06:08,060 --> 00:06:10,475
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   522
the meaning of both
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   523
regular expressions.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   524
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   525
116
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   526
00:06:10,475 --> 00:06:14,090
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   527
And are they the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   528
same sets or not?
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   529
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   530
117
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   531
00:06:14,090 --> 00:06:17,435
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   532
There are again some
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   533
interesting corner cases.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   534
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   535
118
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   536
00:06:17,435 --> 00:06:20,540
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   537
If I have a regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   538
that can match a,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   539
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   540
119
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   541
00:06:20,540 --> 00:06:23,450
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   542
but followed by the regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   543
expression which cannot match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   544
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   545
120
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   546
00:06:23,450 --> 00:06:25,670
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   547
anything, that is not equivalent
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   548
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   549
121
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   550
00:06:25,670 --> 00:06:29,255
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   551
to the regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   552
expression which can match a.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   553
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   554
122
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   555
00:06:29,255 --> 00:06:31,340
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   556
Again here you have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   557
to do the calculation
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   558
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   559
123
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   560
00:06:31,340 --> 00:06:32,915
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   561
to convince you of that.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   562
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   563
124
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   564
00:06:32,915 --> 00:06:35,840
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   565
Similarly, if I have a regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   566
expression which can
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   567
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   568
125
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   569
00:06:35,840 --> 00:06:38,750
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   570
match a or the empty string,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   571
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   572
126
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   573
00:06:38,750 --> 00:06:40,640
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   574
this is not equivalent to
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   575
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   576
127
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   577
00:06:40,640 --> 00:06:43,355
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   578
the regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   579
which can just match a.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   580
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   581
128
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   582
00:06:43,355 --> 00:06:46,925
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   583
Here are some interesting
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   584
ones with zeros and ones.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   585
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   586
129
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   587
00:06:46,925 --> 00:06:48,860
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   588
So if I have the regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   589
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   590
130
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   591
00:06:48,860 --> 00:06:50,975
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   592
that can match the empty string,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   593
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   594
131
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   595
00:06:50,975 --> 00:06:53,540
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   596
this will be actually equivalent to
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   597
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   598
132
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   599
00:06:53,540 --> 00:06:56,435
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   600
the regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   601
which can match nothing,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   602
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   603
133
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   604
00:06:56,435 --> 00:06:59,405
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   605
but star of that.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   606
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   607
134
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   608
00:06:59,405 --> 00:07:01,970
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   609
Remember the star
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   610
always introduces,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   611
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   612
135
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   613
00:07:01,970 --> 00:07:04,370
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   614
no matter what, the empty string.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   615
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   616
136
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   617
00:07:04,370 --> 00:07:06,170
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   618
So this regular expression can match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   619
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   620
137
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   621
00:07:06,170 --> 00:07:08,930
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   622
the empty string,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   623
just like the 1.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   624
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   625
138
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   626
00:07:08,930 --> 00:07:12,125
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   627
So these two expressions
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   628
are not the same,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   629
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   630
139
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   631
00:07:12,125 --> 00:07:14,210
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   632
but they are equivalent.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   633
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   634
140
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   635
00:07:14,210 --> 00:07:16,700
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   636
And it doesn't matter
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   637
whether you take
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   638
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   639
141
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   640
00:07:16,700 --> 00:07:20,090
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   641
the empty string to  the star,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   642
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   643
142
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   644
00:07:20,090 --> 00:07:23,855
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   645
because if I can match 0 or
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   646
more times the empty string,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   647
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   648
143
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   649
00:07:23,855 --> 00:07:27,450
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   650
that will be equivalent to 
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   651
just the empty string.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   652
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   653
144
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   654
00:07:27,520 --> 00:07:32,510
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   655
Slightly similar to the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   656
third case is this one.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   657
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   658
145
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   659
00:07:32,510 --> 00:07:35,720
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   660
Zero star is not equivalent to 0
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   661
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   662
146
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   663
00:07:35,720 --> 00:07:40,025
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   664
because that can match
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   665
exactly the empty string.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   666
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   667
147
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   668
00:07:40,025 --> 00:07:42,740
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   669
This cannot match anything.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   670
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   671
148
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   672
00:07:42,740 --> 00:07:44,839
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   673
While the previous
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   674
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   675
149
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   676
00:07:44,839 --> 00:07:47,540
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   677
equivalences are all very
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   678
instructive to look at,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   679
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   680
150
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   681
00:07:47,540 --> 00:07:49,910
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   682
these are the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   683
equivalences we need
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   684
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   685
151
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   686
00:07:49,910 --> 00:07:52,685
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   687
in our regular expression matchers.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   688
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   689
152
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   690
00:07:52,685 --> 00:07:54,350
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   691
And they are defined for
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   692
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   693
153
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   694
00:07:54,350 --> 00:07:58,160
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   695
all regular expressions r.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   696
So r plus 0,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   697
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   698
154
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   699
00:07:58,160 --> 00:08:00,470
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   700
no matter what r looks
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   701
like is equivalent
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   702
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   703
155
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   704
00:08:00,470 --> 00:08:02,945
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   705
to just r. Similarly
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   706
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   707
156
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   708
00:08:02,945 --> 00:08:05,930
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   709
0 plus r is also
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   710
equivalent to r.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   711
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   712
157
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   713
00:08:05,930 --> 00:08:08,525
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   714
The order of this
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   715
choice doesn't matter;
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   716
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   717
158
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   718
00:08:08,525 --> 00:08:11,495
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   719
r followed by 1,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   720
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   721
159
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   722
00:08:11,495 --> 00:08:14,030
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   723
that's the sequence
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   724
regular expression, is
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   725
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   726
160
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   727
00:08:14,030 --> 00:08:16,760
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   728
equivalent to r. The
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   729
sam, r followed by
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   730
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   731
161
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   732
00:08:16,760 --> 00:08:19,010
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   733
r is equivalent to r.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   734
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   735
162
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   736
00:08:19,010 --> 00:08:20,990
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   737
And r followed by
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   738
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   739
163
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   740
00:08:20,990 --> 00:08:23,390
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   741
the regular expression which
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   742
cannot match anything,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   743
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   744
164
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   745
00:08:23,390 --> 00:08:27,455
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   746
is equivalent to just 0.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   747
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   748
165
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   749
00:08:27,455 --> 00:08:30,740
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   750
And 0 followed by r is also equivalent to 0.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   751
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   752
166
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   753
00:08:30,740 --> 00:08:33,615
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   754
And if you have the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   755
choice of r plus r,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   756
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   757
167
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   758
00:08:33,615 --> 00:08:37,210
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   759
that is also
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   760
equivalent to just r.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   761
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   762
168
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   763
00:08:37,210 --> 00:08:40,270
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   764
What we're going to do
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   765
with these equivalences is
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   766
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   767
169
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   768
00:08:40,270 --> 00:08:42,820
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   769
that we regard them as
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   770
simplification rules.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   771
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   772
170
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   773
00:08:42,820 --> 00:08:43,930
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   774
So whenever we see
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   775
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   776
171
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   777
00:08:43,930 --> 00:08:46,465
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   778
this regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   779
in our algorithm,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   780
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   781
172
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   782
00:08:46,465 --> 00:08:48,580
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   783
we will replace it by
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   784
the right-hand side.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   785
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   786
173
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   787
00:08:48,580 --> 00:08:51,715
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   788
So we will orient
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   789
these equivalences.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   790
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   791
174
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   792
00:08:51,715 --> 00:08:53,650
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   793
If we see, this regular expression,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   794
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   795
175
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   796
00:08:53,650 --> 00:08:55,225
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   797
we will replace it by that one.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   798
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   799
176
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   800
00:08:55,225 --> 00:08:58,945
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   801
And it will not matter
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   802
because the left-hand sides
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   803
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   804
177
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   805
00:08:58,945 --> 00:09:01,255
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   806
can match exactly
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   807
the same strings
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   808
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   809
178
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   810
00:09:01,255 --> 00:09:03,475
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   811
as the right-hand sides.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   812
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   813
179
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   814
00:09:03,475 --> 00:09:06,370
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   815
Here two quick examples.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   816
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   817
180
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   818
00:09:06,370 --> 00:09:08,680
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   819
The first one, let's
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   820
assume you have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   821
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   822
181
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   823
00:09:08,680 --> 00:09:10,270
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   824
a regular expression r and
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   825
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   826
182
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   827
00:09:10,270 --> 00:09:11,905
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   828
there is something
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   829
in front of it.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   830
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   831
183
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   832
00:09:11,905 --> 00:09:13,720
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   833
This "something in front of it"
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   834
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   835
184
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   836
00:09:13,720 --> 00:09:15,870
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   837
can be simplified as follows.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   838
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   839
185
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   840
00:09:15,870 --> 00:09:20,000
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   841
This 1 times b
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   842
can be simplified to b.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   843
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   844
186
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   845
00:09:20,000 --> 00:09:23,555
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   846
Then this b plus 0 can
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   847
be simplified to b.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   848
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   849
187
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   850
00:09:23,555 --> 00:09:25,490
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   851
And assuming that nothing can
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   852
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   853
188
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   854
00:09:25,490 --> 00:09:27,470
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   855
be simplified inside this r,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   856
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   857
189
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   858
00:09:27,470 --> 00:09:28,700
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   859
then this would be
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   860
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   861
190
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   862
00:09:28,700 --> 00:09:33,050
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   863
the simplified version
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   864
of this regular expression.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   865
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   866
191
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   867
00:09:33,050 --> 00:09:34,820
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   868
And because the simplification
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   869
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   870
192
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   871
00:09:34,820 --> 00:09:36,965
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   872
rules preserve what can be matched,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   873
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   874
193
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   875
00:09:36,965 --> 00:09:39,080
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   876
we can be sure that
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   877
this regular expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   878
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   879
194
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   880
00:09:39,080 --> 00:09:41,255
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   881
can match exactly the strings
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   882
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   883
195
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   884
00:09:41,255 --> 00:09:43,940
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   885
this regular expression can match.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   886
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   887
196
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   888
00:09:43,940 --> 00:09:45,740
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   889
Here is the other example.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   890
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   891
197
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   892
00:09:45,740 --> 00:09:49,550
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   893
This has just a tiny change
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   894
that this becomes here as 0.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   895
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   896
198
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   897
00:09:49,550 --> 00:09:54,485
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   898
Then 0 times b can be
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   899
replaced by just 0.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   900
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   901
199
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   902
00:09:54,485 --> 00:09:56,705
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   903
Then they are actually two
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   904
rules which could apply
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   905
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   906
200
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   907
00:09:56,705 --> 00:09:59,014
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   908
either that we have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   909
the same choice
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   910
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   911
201
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   912
00:09:59,014 --> 00:10:01,160
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   913
or we can just say something plus
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   914
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   915
202
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   916
00:10:01,160 --> 00:10:04,100
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   917
0 will always go to something.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   918
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   919
203
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   920
00:10:04,100 --> 00:10:06,245
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   921
So we can simplify it to that.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   922
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   923
204
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   924
00:10:06,245 --> 00:10:08,510
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   925
And then we have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   926
0 times r again,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   927
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   928
205
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   929
00:10:08,510 --> 00:10:10,460
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   930
and that can be simplified to 0.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   931
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   932
206
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   933
00:10:10,460 --> 00:10:12,080
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   934
So actually what we find out with
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   935
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   936
207
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   937
00:10:12,080 --> 00:10:14,645
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   938
this calculation is that
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   939
this regular expression,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   940
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   941
208
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   942
00:10:14,645 --> 00:10:16,835
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   943
even if it looks
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   944
quite complicated,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   945
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   946
209
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   947
00:10:16,835 --> 00:10:19,295
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   948
actually doesn't
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   949
match any string.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   950
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   951
210
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   952
00:10:19,295 --> 00:10:21,290
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   953
Because it matches exactly
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   954
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   955
211
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   956
00:10:21,290 --> 00:10:23,420
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   957
those string this regular
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   958
expression can match.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   959
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   960
212
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   961
00:10:23,420 --> 00:10:26,285
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   962
And this reg expression
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   963
cannot match any.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   964
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   965
213
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   966
00:10:26,285 --> 00:10:29,930
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   967
We need one more
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   968
operation on languages.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   969
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   970
214
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   971
00:10:29,930 --> 00:10:31,700
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   972
I call this operation
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   973
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   974
215
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   975
00:10:31,700 --> 00:10:35,165
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   976
the semantic derivative
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   977
of a language.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   978
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   979
216
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   980
00:10:35,165 --> 00:10:37,775
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   981
This operation takes
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   982
two arguments.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   983
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   984
217
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   985
00:10:37,775 --> 00:10:40,670
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   986
It takes a character
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   987
which we take
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   988
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   989
218
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   990
00:10:40,670 --> 00:10:43,925
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   991
the semantic derivative
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   992
according to,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   993
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   994
219
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   995
00:10:43,925 --> 00:10:45,980
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   996
and it takes a language.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   997
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   998
220
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   999
00:10:45,980 --> 00:10:49,579
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1000
And what it does is it
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1001
looks into this language
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1002
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1003
221
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1004
00:10:49,579 --> 00:10:51,365
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1005
and looks for all the strings
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1006
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1007
222
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1008
00:10:51,365 --> 00:10:53,735
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1009
that start with this character,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1010
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1011
223
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1012
00:10:53,735 --> 00:10:56,405
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1013
let's say c, and then
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1014
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1015
224
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1016
00:10:56,405 --> 00:11:00,920
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1017
just strips off that c.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1018
So here's an example.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1019
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1020
225
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1021
00:11:00,920 --> 00:11:02,975
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1022
Suppose you have a language A,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1023
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1024
226
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1025
00:11:02,975 --> 00:11:04,460
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1026
with the strings
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1027
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1028
227
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1029
00:11:04,460 --> 00:11:06,965
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1030
foo, bar and frak.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1031
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1032
228
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1033
00:11:06,965 --> 00:11:10,835
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1034
And you take the semantic
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1035
derivative according to f,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1036
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1037
229
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1038
00:11:10,835 --> 00:11:14,450
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1039
then we discard all the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1040
strings which do not
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1041
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1042
230
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1043
00:11:14,450 --> 00:11:18,320
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1044
start with an f. So
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1045
bar will be discarded.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1046
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1047
231
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1048
00:11:18,320 --> 00:11:22,850
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1049
Foo and frac start with
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1050
an f. So we keep them
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1051
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1052
232
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1053
00:11:22,850 --> 00:11:25,265
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1054
but we strip off the first f.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1055
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1056
233
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1057
00:11:25,265 --> 00:11:29,045
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1058
So here we have only oo and rak.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1059
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1060
234
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1061
00:11:29,045 --> 00:11:31,609
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1062
If you take the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1063
semantic derivative
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1064
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1065
235
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1066
00:11:31,609 --> 00:11:33,830
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1067
of that language according to b,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1068
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1069
236
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1070
00:11:33,830 --> 00:11:37,190
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1071
then we will discard foo and
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1072
frak because they don't
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1073
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1074
237
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1075
00:11:37,190 --> 00:11:40,940
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1076
start with b, and just keep bar.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1077
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1078
238
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1079
00:11:40,940 --> 00:11:44,585
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1080
But again, we have to
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1081
strip off this first b.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1082
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1083
239
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1084
00:11:44,585 --> 00:11:49,305
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1085
And if you take the semantic
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1086
derivative according to a,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1087
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1088
240
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1089
00:11:49,305 --> 00:11:52,585
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1090
then none of these
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1091
strings start with a.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1092
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1093
241
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1094
00:11:52,585 --> 00:11:56,800
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1095
So this will be defined
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1096
as just the empty set.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1097
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1098
242
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1099
00:11:56,800 --> 00:11:59,695
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1100
You can slightly 
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1101
generalized this
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1102
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1103
243
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1104
00:11:59,695 --> 00:12:02,560
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1105
semantic derivative
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1106
to also strings.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1107
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1108
244
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1109
00:12:02,560 --> 00:12:05,170
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1110
So imagine you have
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1111
a language A and you
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1112
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1113
245
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1114
00:12:05,170 --> 00:12:08,274
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1115
build the semantic derivative
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1116
according to a string s.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1117
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1118
246
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1119
00:12:08,274 --> 00:12:10,990
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1120
Then you look in
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1121
this language and
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1122
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1123
247
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1124
00:12:10,990 --> 00:12:13,420
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1125
you look for all the
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1126
strings that start with
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1127
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1128
248
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1129
00:12:13,420 --> 00:12:19,555
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1130
this s. But you strip
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1131
off that s. Ok?
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1132
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1133
249
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1134
00:12:19,555 --> 00:12:23,830
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1135
So if you have a string
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1136
starting with the s,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1137
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1138
250
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1139
00:12:23,830 --> 00:12:26,065
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1140
then you keep that string,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1141
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1142
251
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1143
00:12:26,065 --> 00:12:27,490
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1144
but you keep only the rest...
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1145
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1146
252
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1147
00:12:27,490 --> 00:12:28,810
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1148
what's coming after this s.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1149
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1150
253
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1151
00:12:28,810 --> 00:12:32,010
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1152
That is here indicated
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1153
with this s'.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1154
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1155
254
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1156
00:12:32,010 --> 00:12:35,330
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1157
I also have this convention,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1158
this personal convention
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1159
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1160
255
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1161
00:12:35,330 --> 00:12:40,055
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1162
I have to say, that everything
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1163
which works on lists,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1164
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1165
256
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1166
00:12:40,055 --> 00:12:42,185
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1167
remember strings are
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1168
lists of characters.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1169
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1170
257
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1171
00:12:42,185 --> 00:12:46,655
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1172
I just put there an 's'. So
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1173
here's the one for characters.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1174
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1175
258
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1176
00:12:46,655 --> 00:12:48,680
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1177
I just call it Der with a capital
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1178
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1179
259
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1180
00:12:48,680 --> 00:12:51,740
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1181
D. And I call that Ders,
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1182
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1183
260
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1184
00:12:51,740 --> 00:12:54,350
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1185
because that works over strings.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1186
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1187
261
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1188
00:12:54,350 --> 00:12:55,865
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1189
And you can see how it would
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1190
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1191
262
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1192
00:12:55,865 --> 00:12:59,750
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1193
be defined if you only take this
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1194
as a primitive operation.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1195
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1196
263
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1197
00:12:59,750 --> 00:13:01,340
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1198
We would just need to iterate
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1199
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1200
264
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1201
00:13:01,340 --> 00:13:04,050
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1202
that essentially for this Ders.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1203
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1204
265
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1205
00:13:04,060 --> 00:13:07,970
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1206
Ok, we now have all
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1207
the theory in place.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1208
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1209
266
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1210
00:13:07,970 --> 00:13:11,345
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1211
And we can finally start
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1212
implementing our algorithm.
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1213
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1214
267
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1215
00:13:11,345 --> 00:13:14,580
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1216
That's when we'll do
e8402d8ec8e6 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1217
in the next video.