videos/02-algo2.srt
author Christian Urban <christian.urban@kcl.ac.uk>
Sat, 03 Oct 2020 00:51:47 +0100
changeset 769 f9686b22db7e
child 772 3bf3f5bb067e
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
769
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
1
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
00:00:06,020 --> 00:00:09,945
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
They come back after
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
this disappointment
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
2
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
00:00:09,945 --> 00:00:14,115
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
and case of over promising
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
and under achieving.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
3
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
00:00:14,115 --> 00:00:17,295
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
Let's have a look whether
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
we can recover from that.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
4
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
00:00:17,295 --> 00:00:20,535
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
So here's one problem.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
5
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
00:00:20,535 --> 00:00:23,790
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
Then we looked at this end
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
times vk expression and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
6
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    26
00:00:23,790 --> 00:00:27,330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    27
be able to represent
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    28
that directly.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    29
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    30
7
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    31
00:00:27,330 --> 00:00:31,275
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    32
We had two represented as a
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    33
sequence record expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    34
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    35
8
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    36
00:00:31,275 --> 00:00:32,850
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    37
So we expanded it.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    38
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    39
9
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    40
00:00:32,850 --> 00:00:36,510
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    41
So times one would be just a,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    42
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    43
10
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    44
00:00:36,510 --> 00:00:40,595
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    45
t, times two would
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    46
be a, and so on.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    47
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    48
11
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    49
00:00:40,595 --> 00:00:43,535
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    50
And so you can see if
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    51
you go already to 13,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    52
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    53
12
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    54
00:00:43,535 --> 00:00:47,960
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    55
N equals 13, the record
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    56
expression becomes quite large.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    57
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    58
13
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    59
00:00:47,960 --> 00:00:52,865
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    60
And now the functions
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    61
nullable and also derivative.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    62
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    63
14
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    64
00:00:52,865 --> 00:00:56,360
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    65
They need to traverse
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    66
this reg expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    67
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    68
15
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    69
00:00:56,360 --> 00:00:59,060
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    70
Remember this tree in sometimes
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    71
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    72
16
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    73
00:00:59,060 --> 00:01:01,820
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    74
they have to traverse
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    75
that even several times.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    76
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    77
17
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    78
00:01:01,820 --> 00:01:04,535
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    79
So that will slow
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    80
down the algorithm.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    81
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    82
18
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    83
00:01:04,535 --> 00:01:08,150
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    84
And in particular, because
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    85
our first reg expression was
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    86
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    87
19
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    88
00:01:08,150 --> 00:01:11,840
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    89
actually not just a bot
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    90
a plus one. So b hat.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    91
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    92
20
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    93
00:01:11,840 --> 00:01:14,330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    94
In the case of 13,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    95
we had a plus one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    96
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    97
21
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    98
00:01:14,330 --> 00:01:17,330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    99
a plus one a plus born 13 times.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   101
22
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   102
00:01:17,330 --> 00:01:20,150
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   103
And this reg
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   104
expression just grows,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   105
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   106
23
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   107
00:01:20,150 --> 00:01:25,475
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   108
stay in number n. Just to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   109
show you this also encode,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   110
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   111
24
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   112
00:01:25,475 --> 00:01:28,115
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   113
I'm Stern, This File rewarm
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   114
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   115
25
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   116
00:01:28,115 --> 00:01:30,920
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   117
and D and I have a size function.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   118
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   119
26
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   120
00:01:30,920 --> 00:01:33,140
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   121
The size function takes
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   122
a regular expression as
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   123
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   124
27
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   125
00:01:33,140 --> 00:01:36,215
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   126
argument and produces in teacher.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   127
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   128
28
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   129
00:01:36,215 --> 00:01:39,980
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   130
And essentially it takes
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   131
this rec expression scene as
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   132
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   133
29
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   134
00:01:39,980 --> 00:01:44,045
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   135
a tree and count how many
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   136
nodes are in this tree.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   137
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   138
30
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   139
00:01:44,045 --> 00:01:49,490
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   140
And so if I take this even
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   141
one reg expression, this one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   142
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   143
31
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   144
00:01:49,490 --> 00:01:52,160
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   145
and increase now this n. So you
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   146
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   147
32
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   148
00:01:52,160 --> 00:01:54,680
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   149
can already see
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   150
for any cross one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   151
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   152
33
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   153
00:01:54,680 --> 00:01:56,540
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   154
the size of this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   155
record expression is
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   156
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   157
34
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   158
00:01:56,540 --> 00:01:59,615
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   159
five and you see it
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   160
slowly increases.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   161
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   162
35
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   163
00:01:59,615 --> 00:02:02,150
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   164
And this 20 n equals 20.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   165
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   166
36
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   167
00:02:02,150 --> 00:02:07,100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   168
The size of this record
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   169
expression is SMOW already a 119.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   170
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   171
37
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   172
00:02:07,100 --> 00:02:10,145
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   173
So now the interesting
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   174
line as this one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   175
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   176
38
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   177
00:02:10,145 --> 00:02:13,295
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   178
Remember it when we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   179
built the derivative,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   180
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   181
39
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   182
00:02:13,295 --> 00:02:17,150
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   183
very often parts of a reg
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   184
expression gets copied.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   185
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   186
40
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   187
00:02:17,150 --> 00:02:19,280
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   188
So if you have like EVA,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   189
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   190
41
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   191
00:02:19,280 --> 00:02:22,325
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   192
one of 2019 nodes,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   193
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   194
42
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   195
00:02:22,325 --> 00:02:25,475
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   196
now this will be often copied.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   197
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   198
43
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   199
00:02:25,475 --> 00:02:31,475
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   200
And we want to see what's the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   201
resulting tree look like,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   202
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   203
44
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   204
00:02:31,475 --> 00:02:32,780
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   205
how many nodes it has.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   206
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   207
45
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   208
00:02:32,780 --> 00:02:34,985
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   209
So I take here either one of 20
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   210
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   211
46
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   212
00:02:34,985 --> 00:02:38,405
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   213
and the derivative
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   214
according to 20 a's.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   215
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   216
47
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   217
00:02:38,405 --> 00:02:41,820
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   218
And just have a look
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   219
what the size is.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   220
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   221
48
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   222
00:02:43,210 --> 00:02:45,680
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   223
Okay, that takes away.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   224
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   225
49
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   226
00:02:45,680 --> 00:02:48,410
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   227
You see now this rec expression,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   228
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   229
50
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   230
00:02:48,410 --> 00:02:52,280
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   231
the derivative has already
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   232
8 million plus nodes.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   233
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   234
51
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   235
00:02:52,280 --> 00:02:55,400
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   236
And now nullable and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   237
derivative have to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   238
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   239
52
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   240
00:02:55,400 --> 00:02:58,430
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   241
traverse these trees with
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   242
a million plus nodes.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   243
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   244
53
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   245
00:02:58,430 --> 00:03:01,400
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   246
So it's no wonder
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   247
that this is slow.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   248
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   249
54
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   250
00:03:01,400 --> 00:03:03,860
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   251
The first thing we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   252
can try to mitigate
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   253
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   254
55
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   255
00:03:03,860 --> 00:03:06,350
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   256
this explosion problem is to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   257
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   258
56
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   259
00:03:06,350 --> 00:03:09,050
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   260
have an explicit and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   261
times reg expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   262
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   263
57
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   264
00:03:09,050 --> 00:03:11,600
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   265
So instead of expanding
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   266
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   267
58
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   268
00:03:11,600 --> 00:03:13,415
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   269
it to the sequence
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   270
reg expression,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   271
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   272
59
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   273
00:03:13,415 --> 00:03:17,510
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   274
let's just have a single
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   275
wreck expression and times,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   276
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   277
60
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   278
00:03:17,510 --> 00:03:20,540
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   279
which takes an expression and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   280
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   281
61
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   282
00:03:20,540 --> 00:03:24,470
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   283
a number and keeps that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   284
regular expression Small.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   285
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   286
62
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   287
00:03:24,470 --> 00:03:27,095
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   288
I'm here in the fire V2,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   289
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   290
63
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   291
00:03:27,095 --> 00:03:29,090
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   292
which is also on Keats.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   293
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   294
64
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   295
00:03:29,090 --> 00:03:32,570
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   296
And the only change I made
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   297
is I added explicitly
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   298
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   299
65
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   300
00:03:32,570 --> 00:03:33,860
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   301
a wrecker expression for
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   302
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   303
66
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   304
00:03:33,860 --> 00:03:36,770
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   305
N times the optional
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   306
reg expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   307
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   308
67
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   309
00:03:36,770 --> 00:03:39,920
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   310
Very leaf out at the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   311
moment because this a
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   312
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   313
68
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   314
00:03:39,920 --> 00:03:41,975
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   315
optional is represented as
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   316
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   317
69
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   318
00:03:41,975 --> 00:03:44,645
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   319
a plus one and doesn't
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   320
explain too much.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   321
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   322
70
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   323
00:03:44,645 --> 00:03:47,375
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   324
The really the culprit
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   325
is this n times.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   326
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   327
71
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   328
00:03:47,375 --> 00:03:51,095
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   329
And instead of expanding
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   330
it n times, which has,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   331
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   332
72
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   333
00:03:51,095 --> 00:03:54,275
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   334
take here a wreck expression
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   335
and a natural number,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   336
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   337
73
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   338
00:03:54,275 --> 00:03:56,960
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   339
which says how many times
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   340
it should be repeated.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   341
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   342
74
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   343
00:03:56,960 --> 00:03:59,165
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   344
And in this week we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   345
can keep it small.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   346
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   347
75
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   348
00:03:59,165 --> 00:04:01,370
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   349
But by adding that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   350
reg expression,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   351
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   352
76
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   353
00:04:01,370 --> 00:04:05,150
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   354
we now have to think about
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   355
cases for nullable and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   356
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   357
77
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   358
00:04:05,150 --> 00:04:07,340
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   359
derivative so that we have
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   360
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   361
78
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   362
00:04:07,340 --> 00:04:10,205
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   363
to now calculate next
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   364
what they look like.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   365
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   366
79
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   367
00:04:10,205 --> 00:04:14,060
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   368
We can actually
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   369
calculate what the rule
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   370
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   371
80
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   372
00:04:14,060 --> 00:04:17,525
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   373
for nullable should be from
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   374
how we defined it earlier.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   375
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   376
81
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   377
00:04:17,525 --> 00:04:19,580
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   378
Remember, if you have
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   379
a regular expression,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   380
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   381
82
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   382
00:04:19,580 --> 00:04:21,980
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   383
R and B take in
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   384
times of this are,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   385
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   386
83
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   387
00:04:21,980 --> 00:04:25,220
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   388
then indicates if n equals 0,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   389
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   390
84
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   391
00:04:25,220 --> 00:04:28,130
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   392
we find that as the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   393
one reg expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   394
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   395
85
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   396
00:04:28,130 --> 00:04:30,380
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   397
If n equals one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   398
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   399
86
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   400
00:04:30,380 --> 00:04:32,495
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   401
it will be just a
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   402
single copy of on.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   403
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   404
87
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   405
00:04:32,495 --> 00:04:33,725
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   406
If n equals two,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   407
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   408
88
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   409
00:04:33,725 --> 00:04:35,270
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   410
it will be two copies.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   411
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   412
89
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   413
00:04:35,270 --> 00:04:39,260
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   414
Sequence if three, we have
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   415
three copies and so on.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   416
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   417
90
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   418
00:04:39,260 --> 00:04:41,390
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   419
Now we have to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   420
somehow characterize
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   421
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   422
91
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   423
00:04:41,390 --> 00:04:44,285
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   424
when these cases all nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   425
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   426
92
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   427
00:04:44,285 --> 00:04:47,810
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   428
Well, if n equals 0,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   429
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   430
93
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   431
00:04:47,810 --> 00:04:49,850
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   432
then this will be defined as one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   433
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   434
94
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   435
00:04:49,850 --> 00:04:52,100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   436
so one can match
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   437
the empty string.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   438
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   439
95
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   440
00:04:52,100 --> 00:04:54,785
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   441
So that should be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   442
definitely true.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   443
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   444
96
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   445
00:04:54,785 --> 00:04:57,725
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   446
Okay, if any cross one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   447
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   448
97
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   449
00:04:57,725 --> 00:05:00,470
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   450
when can this reg expression
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   451
match the empty string?
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   452
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   453
98
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   454
00:05:00,470 --> 00:05:02,000
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   455
So vent should be nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   456
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   457
99
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   458
00:05:02,000 --> 00:05:07,535
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   459
Well, if nullable of our holes,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   460
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   461
100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   462
00:05:07,535 --> 00:05:09,860
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   463
okay, so if I can match
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   464
the empty string,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   465
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   466
101
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   467
00:05:09,860 --> 00:05:12,110
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   468
then we can match
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   469
the empty string.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   470
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   471
102
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   472
00:05:12,110 --> 00:05:14,870
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   473
When can this regular expression
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   474
match the empty string?
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   475
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   476
103
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   477
00:05:14,870 --> 00:05:16,265
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   478
So these are now two copies of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   479
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   480
104
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   481
00:05:16,265 --> 00:05:20,690
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   482
our well-posed copies need
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   483
to match the empty string.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   484
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   485
105
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   486
00:05:20,690 --> 00:05:22,820
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   487
So again, we have to ask
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   488
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   489
106
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   490
00:05:22,820 --> 00:05:25,774
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   491
both of them need to be nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   492
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   493
107
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   494
00:05:25,774 --> 00:05:28,520
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   495
Ok? Similarly, in the third case,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   496
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   497
108
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   498
00:05:28,520 --> 00:05:30,710
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   499
all three copies need to be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   500
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   501
109
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   502
00:05:30,710 --> 00:05:33,230
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   503
able to match the empty
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   504
string. Men, is that the case?
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   505
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   506
110
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   507
00:05:33,230 --> 00:05:38,360
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   508
Well, if nullable of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   509
our holes and so on.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   510
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   511
111
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   512
00:05:38,360 --> 00:05:48,754
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   513
So we can actually define that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   514
if n equals 0, then true.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   515
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   516
112
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   517
00:05:48,754 --> 00:05:56,045
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   518
Else we have to ask with
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   519
nullable of our holes.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   520
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   521
113
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   522
00:05:56,045 --> 00:05:58,550
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   523
So that will be the clause we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   524
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   525
114
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   526
00:05:58,550 --> 00:06:01,625
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   527
have to implement for
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   528
n times and nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   529
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   530
115
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   531
00:06:01,625 --> 00:06:04,280
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   532
Deriving the definition for
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   533
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   534
116
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   535
00:06:04,280 --> 00:06:06,920
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   536
the derivative of the n terms
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   537
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   538
117
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   539
00:06:06,920 --> 00:06:10,175
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   540
reg expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   541
It's not that easy.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   542
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   543
118
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   544
00:06:10,175 --> 00:06:12,755
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   545
So we have to look again
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   546
how it was defined
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   547
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   548
119
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   549
00:06:12,755 --> 00:06:16,010
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   550
earlier and we somehow
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   551
have to spot a pattern.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   552
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   553
120
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   554
00:06:16,010 --> 00:06:18,380
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   555
The voice, our
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   556
algorithm will be again
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   557
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   558
121
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   559
00:06:18,380 --> 00:06:20,975
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   560
quite slow if you don't
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   561
spot that pattern.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   562
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   563
122
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   564
00:06:20,975 --> 00:06:22,550
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   565
So let's have a look.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   566
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   567
123
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   568
00:06:22,550 --> 00:06:26,240
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   569
So in the case that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   570
n is equal to 0,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   571
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   572
124
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   573
00:06:26,240 --> 00:06:29,885
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   574
then r n times most
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   575
defined as just one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   576
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   577
125
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   578
00:06:29,885 --> 00:06:32,030
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   579
What would be the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   580
derivative of one?
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   581
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   582
126
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   583
00:06:32,030 --> 00:06:36,140
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   584
So the derivative of c of one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   585
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   586
127
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   587
00:06:36,140 --> 00:06:38,990
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   588
Peaches defined as 0.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   589
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   590
128
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   591
00:06:38,990 --> 00:06:41,465
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   592
Okay, fair enough.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   593
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   594
129
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   595
00:06:41,465 --> 00:06:44,960
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   596
If he have any cross one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   597
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   598
130
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   599
00:06:44,960 --> 00:06:48,125
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   600
then we just have one copy
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   601
of this regular expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   602
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   603
131
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   604
00:06:48,125 --> 00:06:50,120
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   605
So there's not much as we can do.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   606
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   607
132
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   608
00:06:50,120 --> 00:06:53,735
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   609
We would have to calculate
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   610
the derivative of air are.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   611
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   612
133
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   613
00:06:53,735 --> 00:06:57,395
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   614
Now in the n equals two case.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   615
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   616
134
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   617
00:06:57,395 --> 00:07:00,245
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   618
That would mean we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   619
have two copies of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   620
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   621
135
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   622
00:07:00,245 --> 00:07:03,425
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   623
R. And they would be a sequence.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   624
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   625
136
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   626
00:07:03,425 --> 00:07:07,775
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   627
How would be the derivative C of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   628
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   629
137
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   630
00:07:07,775 --> 00:07:10,340
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   631
R four by R be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   632
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   633
138
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   634
00:07:10,340 --> 00:07:13,265
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   635
defined where we would
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   636
look up the definition.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   637
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   638
139
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   639
00:07:13,265 --> 00:07:15,470
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   640
And it would say that's
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   641
the complicated case
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   642
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   643
140
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   644
00:07:15,470 --> 00:07:16,760
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   645
d sequence or
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   646
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   647
141
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   648
00:07:16,760 --> 00:07:21,875
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   649
if null a bowl of R,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   650
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   651
142
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   652
00:07:21,875 --> 00:07:25,250
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   653
Then the most complicated case.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   654
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   655
143
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   656
00:07:25,250 --> 00:07:28,225
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   657
Else, That's the easy
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   658
case that would be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   659
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   660
144
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   661
00:07:28,225 --> 00:07:32,660
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   662
derivative of c of R four
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   663
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   664
145
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   665
00:07:32,660 --> 00:07:35,540
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   666
by R. And then I
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   667
just have to copy
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   668
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   669
146
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   670
00:07:35,540 --> 00:07:40,775
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   671
that derivative of C
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   672
of four by r here.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   673
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   674
147
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   675
00:07:40,775 --> 00:07:43,130
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   676
But in this case I have also
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   677
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   678
148
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   679
00:07:43,130 --> 00:07:51,145
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   680
the alternative derivative
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   681
of c of r. And from that,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   682
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   683
149
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   684
00:07:51,145 --> 00:07:55,030
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   685
it looks like we can
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   686
do much better than
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   687
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   688
150
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   689
00:07:55,030 --> 00:07:58,390
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   690
that unless we do
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   691
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   692
151
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   693
00:07:58,390 --> 00:08:02,560
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   694
a little bit of magic and the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   695
magic to do with this case.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   696
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   697
152
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   698
00:08:02,560 --> 00:08:07,420
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   699
So let me look at this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   700
case a bit more closely.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   701
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   702
153
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   703
00:08:07,420 --> 00:08:09,819
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   704
Let me go back to slides
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   705
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   706
154
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   707
00:08:09,819 --> 00:08:12,940
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   708
because actually the calculation
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   709
might be a bit hairy.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   710
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   711
155
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   712
00:08:12,940 --> 00:08:16,945
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   713
So remember we are in this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   714
case where n equals two.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   715
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   716
156
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   717
00:08:16,945 --> 00:08:18,550
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   718
And this was defined as
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   719
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   720
157
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   721
00:08:18,550 --> 00:08:20,680
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   722
this sequence work
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   723
expression R followed
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   724
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   725
158
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   726
00:08:20,680 --> 00:08:23,080
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   727
by r. And the question was,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   728
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   729
159
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   730
00:08:23,080 --> 00:08:26,365
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   731
can we somehow make sense
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   732
out of this derivative
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   733
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   734
160
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   735
00:08:26,365 --> 00:08:30,370
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   736
where we have to build the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   737
derivative of a sequence.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   738
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   739
161
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   740
00:08:30,370 --> 00:08:33,020
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   741
So features the definition.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   742
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   743
162
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   744
00:08:33,020 --> 00:08:36,050
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   745
We would ask if
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   746
the r is nullable,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   747
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   748
163
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   749
00:08:36,050 --> 00:08:39,095
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   750
In this case, we return
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   751
this alternative.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   752
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   753
164
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   754
00:08:39,095 --> 00:08:40,640
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   755
And if it's not nullable,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   756
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   757
165
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   758
00:08:40,640 --> 00:08:44,135
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   759
It is just this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   760
record expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   761
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   762
166
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   763
00:08:44,135 --> 00:08:49,550
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   764
Now my claim is that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   765
this whole if condition
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   766
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   767
167
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   768
00:08:49,550 --> 00:08:55,895
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   769
can be replaced by just this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   770
simple derivative here.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   771
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   772
168
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   773
00:08:55,895 --> 00:08:58,775
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   774
And if that claim is correct,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   775
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   776
169
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   777
00:08:58,775 --> 00:09:01,520
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   778
there would be very nice
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   779
because in contrast to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   780
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   781
170
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   782
00:09:01,520 --> 00:09:04,130
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   783
this if condition where
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   784
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   785
171
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   786
00:09:04,130 --> 00:09:06,280
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   787
we have to calculate
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   788
like nullable,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   789
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   790
172
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   791
00:09:06,280 --> 00:09:08,330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   792
decide in which branch we are.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   793
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   794
173
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   795
00:09:08,330 --> 00:09:10,580
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   796
We don't have to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   797
calculate your now,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   798
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   799
174
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   800
00:09:10,580 --> 00:09:13,880
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   801
but we can just replace
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   802
it by this expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   803
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   804
175
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   805
00:09:13,880 --> 00:09:16,670
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   806
So if we can
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   807
substantiate that claim,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   808
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   809
176
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   810
00:09:16,670 --> 00:09:19,860
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   811
that will be definitely
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   812
good file algorithm.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   813
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   814
177
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   815
00:09:20,140 --> 00:09:22,775
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   816
And to substantiate that,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   817
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   818
178
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   819
00:09:22,775 --> 00:09:26,795
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   820
I will focus on this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   821
record expression here.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   822
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   823
179
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   824
00:09:26,795 --> 00:09:31,100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   825
And notice that this record
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   826
expression the only be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   827
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   828
180
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   829
00:09:31,100 --> 00:09:35,780
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   830
called or only be generated
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   831
if r is nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   832
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   833
181
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   834
00:09:35,780 --> 00:09:38,075
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   835
So in any other case,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   836
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   837
182
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   838
00:09:38,075 --> 00:09:40,060
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   839
I will actually not go into it
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   840
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   841
183
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   842
00:09:40,060 --> 00:09:43,850
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   843
that if branch and would
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   844
be in the other one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   845
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   846
184
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   847
00:09:43,850 --> 00:09:45,260
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   848
So if we are in this if branch,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   849
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   850
185
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   851
00:09:45,260 --> 00:09:47,705
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   852
we definitely know
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   853
that R is nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   854
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   855
186
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   856
00:09:47,705 --> 00:09:52,955
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   857
Okay? Okay, so here's
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   858
our regular expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   859
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   860
187
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   861
00:09:52,955 --> 00:09:55,940
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   862
And we know it's nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   863
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   864
188
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   865
00:09:55,940 --> 00:09:57,920
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   866
So we have to somehow find
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   867
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   868
189
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   869
00:09:57,920 --> 00:10:00,380
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   870
an equivalent expression that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   871
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   872
190
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   873
00:10:00,380 --> 00:10:04,100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   874
is smaller or simpler
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   875
than that one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   876
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   877
191
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   878
00:10:04,100 --> 00:10:05,945
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   879
Let's see what we can do.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   880
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   881
192
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   882
00:10:05,945 --> 00:10:10,160
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   883
So the first thing
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   884
actually is we multiplying
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   885
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   886
193
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   887
00:10:10,160 --> 00:10:16,595
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   888
this right hand side of the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   889
alternative is times one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   890
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   891
194
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   892
00:10:16,595 --> 00:10:19,700
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   893
We can do that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   894
because this does not
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   895
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   896
195
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   897
00:10:19,700 --> 00:10:23,090
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   898
change which strings this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   899
work expression can match.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   900
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   901
196
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   902
00:10:23,090 --> 00:10:25,685
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   903
Remember we even had it
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   904
as a simplification row,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   905
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   906
197
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   907
00:10:25,685 --> 00:10:27,425
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   908
just in this case B,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   909
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   910
198
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   911
00:10:27,425 --> 00:10:29,705
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   912
don't apply it as a
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   913
simplification will
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   914
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   915
199
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   916
00:10:29,705 --> 00:10:31,310
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   917
actually make this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   918
work expression
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   919
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   920
200
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   921
00:10:31,310 --> 00:10:32,720
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   922
a bit more complicated.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   923
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   924
201
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   925
00:10:32,720 --> 00:10:34,910
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   926
But times one doesn't make
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   927
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   928
202
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   929
00:10:34,910 --> 00:10:37,820
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   930
a difference because it
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   931
means the end of the string,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   932
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   933
203
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   934
00:10:37,820 --> 00:10:40,070
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   935
we still want to match
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   936
the empty string.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   937
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   938
204
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   939
00:10:40,070 --> 00:10:42,155
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   940
Okay, so that is possible.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   941
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   942
205
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   943
00:10:42,155 --> 00:10:45,740
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   944
I can do that. Once
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   945
we have done that,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   946
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   947
206
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   948
00:10:45,740 --> 00:10:48,410
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   949
you will notice that this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   950
factor derivative of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   951
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   952
207
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   953
00:10:48,410 --> 00:10:51,860
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   954
stuff are exactly the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   955
same as that one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   956
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   957
208
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   958
00:10:51,860 --> 00:10:54,650
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   959
And in between is a plus.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   960
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   961
209
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   962
00:10:54,650 --> 00:10:57,440
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   963
So you probably remember the law
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   964
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   965
210
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   966
00:10:57,440 --> 00:11:00,170
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   967
from school math
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   968
that I can pull out
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   969
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   970
211
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   971
00:11:00,170 --> 00:11:02,735
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   972
this factor derivative of c of r.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   973
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   974
212
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   975
00:11:02,735 --> 00:11:06,320
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   976
And I'm inside the parentheses
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   977
is left with that.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   978
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   979
213
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   980
00:11:06,320 --> 00:11:09,245
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   981
So now I have r plus one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   982
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   983
214
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   984
00:11:09,245 --> 00:11:13,055
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   985
Usually we cannot
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   986
simplify r plus one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   987
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   988
215
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   989
00:11:13,055 --> 00:11:15,530
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   990
If it had been R
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   991
plus 0, then yes,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   992
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   993
216
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   994
00:11:15,530 --> 00:11:18,665
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   995
we could have got rid of the CRO.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   996
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   997
217
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   998
00:11:18,665 --> 00:11:21,590
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   999
Plus one often
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1000
makes a difference,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1001
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1002
218
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1003
00:11:21,590 --> 00:11:22,970
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1004
but not in our case.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1005
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1006
219
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1007
00:11:22,970 --> 00:11:25,940
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1008
Remember, we know that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1009
this R is nullable,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1010
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1011
220
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1012
00:11:25,940 --> 00:11:29,840
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1013
so on its own can already
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1014
match the empty string.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1015
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1016
221
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1017
00:11:29,840 --> 00:11:33,305
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1018
So we don't really need this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1019
alternative plus one there,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1020
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1021
222
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1022
00:11:33,305 --> 00:11:35,300
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1023
so we can just get rid of that.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1024
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1025
223
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1026
00:11:35,300 --> 00:11:37,070
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1027
Okay, and so now we have
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1028
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1029
224
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1030
00:11:37,070 --> 00:11:40,535
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1031
a much simpler wound
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1032
reg expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1033
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1034
225
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1035
00:11:40,535 --> 00:11:44,285
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1036
And this actually helps a
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1037
lot for our if condition.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1038
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1039
226
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1040
00:11:44,285 --> 00:11:46,925
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1041
Look, this was the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1042
original if condition
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1043
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1044
227
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1045
00:11:46,925 --> 00:11:50,270
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1046
and this is direct expression
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1047
h. We just simplified.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1048
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1049
228
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1050
00:11:50,270 --> 00:11:53,105
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1051
If we replace it with this one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1052
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1053
229
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1054
00:11:53,105 --> 00:11:56,090
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1055
then we just end up with this.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1056
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1057
230
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1058
00:11:56,090 --> 00:11:59,510
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1059
And now you will see that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1060
the if condition is actually
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1061
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1062
231
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1063
00:11:59,510 --> 00:12:02,750
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1064
pointless because you
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1065
check if it's null above,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1066
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1067
232
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1068
00:12:02,750 --> 00:12:05,060
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1069
we return this reg
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1070
expression or it's
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1071
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1072
233
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1073
00:12:05,060 --> 00:12:08,210
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1074
not nullable and we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1075
return exactly the same.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1076
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1077
234
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1078
00:12:08,210 --> 00:12:10,025
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1079
That doesn't make any difference.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1080
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1081
235
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1082
00:12:10,025 --> 00:12:11,750
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1083
So we can just get rid of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1084
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1085
236
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1086
00:12:11,750 --> 00:12:14,645
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1087
that one and can
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1088
replace it by that.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1089
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1090
237
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1091
00:12:14,645 --> 00:12:16,865
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1092
And you see, this is now
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1093
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1094
238
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1095
00:12:16,865 --> 00:12:20,720
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1096
a much simpler case than
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1097
what we had before.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1098
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1099
239
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1100
00:12:20,720 --> 00:12:24,170
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1101
So let's take stock
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1102
what we have so far.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1103
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1104
240
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1105
00:12:24,170 --> 00:12:26,915
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1106
So we know India CEO case,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1107
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1108
241
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1109
00:12:26,915 --> 00:12:30,920
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1110
the derivative needs
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1111
to be defined as 0.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1112
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1113
242
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1114
00:12:30,920 --> 00:12:33,095
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1115
So because we define this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1116
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1117
243
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1118
00:12:33,095 --> 00:12:36,785
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1119
and times as one,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1120
the derivative is 0.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1121
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1122
244
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1123
00:12:36,785 --> 00:12:39,889
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1124
For chest r, this will
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1125
be the derivative.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1126
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1127
245
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1128
00:12:39,889 --> 00:12:42,170
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1129
And we can't do any
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1130
better than that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1131
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1132
246
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1133
00:12:42,170 --> 00:12:45,620
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1134
for our followed by
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1135
RB just found out.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1136
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1137
247
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1138
00:12:45,620 --> 00:12:47,270
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1139
Actually it is quite simple.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1140
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1141
248
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1142
00:12:47,270 --> 00:12:51,410
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1143
Reg expression is equivalent
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1144
to the derivative.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1145
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1146
249
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1147
00:12:51,410 --> 00:12:53,870
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1148
Now, we have to continue with
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1149
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1150
250
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1151
00:12:53,870 --> 00:12:56,090
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1152
that case where n is
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1153
equal to three and we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1154
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1155
251
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1156
00:12:56,090 --> 00:12:58,099
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1157
now have three copies
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1158
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1159
252
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1160
00:12:58,099 --> 00:13:02,390
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1161
of this or what should
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1162
be the derivative?
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1163
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1164
253
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1165
00:13:02,390 --> 00:13:05,330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1166
Well, if you look very carefully
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1167
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1168
254
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1169
00:13:05,330 --> 00:13:08,465
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1170
at this emerging pattern,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1171
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1172
255
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1173
00:13:08,465 --> 00:13:12,410
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1174
I have to say then
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1175
what would be nice if,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1176
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1177
256
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1178
00:13:12,410 --> 00:13:16,400
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1179
if he could show that in
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1180
the n equals three case,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1181
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1182
257
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1183
00:13:16,400 --> 00:13:18,275
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1184
we end up with this.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1185
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1186
258
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1187
00:13:18,275 --> 00:13:21,290
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1188
Because then what we have is.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1189
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1190
259
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1191
00:13:21,290 --> 00:13:25,370
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1192
We can define our
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1193
nullable for n times
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1194
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1195
260
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1196
00:13:25,370 --> 00:13:31,025
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1197
s. If any cross 0 then
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1198
true as nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1199
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1200
261
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1201
00:13:31,025 --> 00:13:33,875
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1202
And for the derivative,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1203
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1204
262
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1205
00:13:33,875 --> 00:13:37,190
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1206
we can save if n is equal to 0,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1207
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1208
263
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1209
00:13:37,190 --> 00:13:40,235
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1210
then we return the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1211
Sierra reg expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1212
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1213
264
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1214
00:13:40,235 --> 00:13:43,295
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1215
Otherwise, as you can see
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1216
from this pattern here,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1217
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1218
265
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1219
00:13:43,295 --> 00:13:50,735
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1220
it would be derivative of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1221
c r four by r n minus one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1222
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1223
266
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1224
00:13:50,735 --> 00:13:54,770
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1225
Okay? And the only
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1226
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1227
267
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1228
00:13:54,770 --> 00:13:56,330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1229
thing we have to make choice that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1230
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1231
268
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1232
00:13:56,330 --> 00:13:58,175
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1233
this pattern actually holds.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1234
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1235
269
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1236
00:13:58,175 --> 00:14:00,470
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1237
So that's, I will
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1238
show you next in
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1239
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1240
270
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1241
00:14:00,470 --> 00:14:03,735
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1242
the case for n equals three.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1243
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1244
271
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1245
00:14:03,735 --> 00:14:07,810
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1246
If we have a wreck expression R
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1247
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1248
272
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1249
00:14:07,810 --> 00:14:09,820
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1250
and it's followed
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1251
by r and another r,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1252
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1253
273
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1254
00:14:09,820 --> 00:14:11,275
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1255
three copies of it.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1256
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1257
274
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1258
00:14:11,275 --> 00:14:14,245
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1259
We can just unfold
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1260
again the definition.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1261
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1262
275
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1263
00:14:14,245 --> 00:14:16,930
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1264
So we would ask if I is nullable,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1265
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1266
276
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1267
00:14:16,930 --> 00:14:19,765
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1268
then we have this if branch.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1269
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1270
277
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1271
00:14:19,765 --> 00:14:23,905
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1272
And if i is not nullable
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1273
or we have this as branch.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1274
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1275
278
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1276
00:14:23,905 --> 00:14:27,010
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1277
Okay? What can we do here?
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1278
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1279
279
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1280
00:14:27,010 --> 00:14:30,310
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1281
Well, we notice that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1282
this one is just now
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1283
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1284
280
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1285
00:14:30,310 --> 00:14:34,510
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1286
the derivative of two
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1287
Rs, one after another.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1288
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1289
281
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1290
00:14:34,510 --> 00:14:37,330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1291
But this we just
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1292
calculated a moment ago,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1293
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1294
282
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1295
00:14:37,330 --> 00:14:40,120
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1296
so we can just
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1297
replace it by this.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1298
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1299
283
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1300
00:14:40,120 --> 00:14:43,255
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1301
Ok. That's what we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1302
calculated earlier.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1303
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1304
284
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1305
00:14:43,255 --> 00:14:46,665
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1306
But now you will see
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1307
again this factor,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1308
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1309
285
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1310
00:14:46,665 --> 00:14:48,695
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1311
and this factor is the same.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1312
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1313
286
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1314
00:14:48,695 --> 00:14:52,700
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1315
So I can pull that
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1316
out to be like that.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1317
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1318
287
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1319
00:14:52,700 --> 00:14:57,380
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1320
And I have now followed
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1321
by R plus R. Oh,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1322
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1323
288
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1324
00:14:57,380 --> 00:14:59,030
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1325
hey, man, now you probably
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1326
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1327
289
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1328
00:14:59,030 --> 00:15:00,680
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1329
remember how we did it earlier.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1331
290
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1332
00:15:00,680 --> 00:15:03,080
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1333
We can now pull out one copy of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1334
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1335
291
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1336
00:15:03,080 --> 00:15:06,020
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1337
this are to just get
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1338
something like this.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1339
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1340
292
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1341
00:15:06,020 --> 00:15:08,765
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1342
We have to add one essentially,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1343
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1344
293
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1345
00:15:08,765 --> 00:15:11,615
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1346
but we now get r plus one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1347
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1348
294
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1349
00:15:11,615 --> 00:15:15,065
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1350
And this r here is
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1351
now just pulled out.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1352
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1353
295
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1354
00:15:15,065 --> 00:15:18,995
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1355
Well, here again kicks
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1356
in this reasoning.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1357
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1358
296
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1359
00:15:18,995 --> 00:15:22,700
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1360
We go in this if branch
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1361
only if r is nullable,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1362
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1363
297
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1364
00:15:22,700 --> 00:15:26,150
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1365
so on its own can already
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1366
match the empty string.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1367
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1368
298
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1369
00:15:26,150 --> 00:15:28,895
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1370
So I don't need
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1371
really this plus one.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1372
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1373
299
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1374
00:15:28,895 --> 00:15:30,695
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1375
I can just get rid of it.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1376
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1377
300
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1378
00:15:30,695 --> 00:15:33,140
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1379
And so I now just have
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1380
to rearrange the parent,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1381
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1382
301
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1383
00:15:33,140 --> 00:15:35,450
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1384
the thesis which we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1385
said we can also do.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1386
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1387
302
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1388
00:15:35,450 --> 00:15:37,595
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1389
So we have something like that.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1390
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1391
303
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1392
00:15:37,595 --> 00:15:39,740
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1393
And here again, the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1394
same reasoning,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1395
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1396
304
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1397
00:15:39,740 --> 00:15:41,975
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1398
we have a if condition
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1399
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1400
305
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1401
00:15:41,975 --> 00:15:43,310
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1402
where it doesn't
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1403
really matter what
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1404
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1405
306
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1406
00:15:43,310 --> 00:15:44,405
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1407
we're going to return,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1408
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1409
307
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1410
00:15:44,405 --> 00:15:46,205
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1411
it's in both branches the same.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1412
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1413
308
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1414
00:15:46,205 --> 00:15:48,470
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1415
So we can just
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1416
replace it by that.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1417
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1418
309
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1419
00:15:48,470 --> 00:15:51,920
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1420
And yes, now we can be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1421
pretty sure they'll
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1422
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1423
310
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1424
00:15:51,920 --> 00:15:55,310
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1425
work for all the n times
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1426
regular expressions.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1427
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1428
311
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1429
00:15:55,310 --> 00:15:57,860
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1430
And leave that to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1431
the calculation for
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1432
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1433
312
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1434
00:15:57,860 --> 00:16:02,570
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1435
maybe R to the four to you.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1436
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1437
313
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1438
00:16:02,570 --> 00:16:04,490
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1439
And the reason why I do it
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1440
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1441
314
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1442
00:16:04,490 --> 00:16:06,605
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1443
in such a detail,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1444
this calculation,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1445
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1446
315
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1447
00:16:06,605 --> 00:16:08,960
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1448
this is really meant
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1449
to help you with
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1450
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1451
316
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1452
00:16:08,960 --> 00:16:13,200
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1453
the coursework which is
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1454
coming up this week.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1455
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1456
317
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1457
00:16:13,210 --> 00:16:16,250
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1458
I'm now back in our
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1459
implementation.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1460
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1461
318
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1462
00:16:16,250 --> 00:16:20,660
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1463
In this Reto, said We have
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1464
this explicit constructor now
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1465
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1466
319
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1467
00:16:20,660 --> 00:16:25,535
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1468
for n times b can now fill
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1469
in the cases for nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1470
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1471
320
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1472
00:16:25,535 --> 00:16:27,635
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1473
So if we have R in times,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1474
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1475
321
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1476
00:16:27,635 --> 00:16:30,995
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1477
if this n is equal to
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1478
0, we return true.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1479
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1480
322
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1481
00:16:30,995 --> 00:16:34,190
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1482
Otherwise we have to test
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1483
whether eyes nullable.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1484
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1485
323
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1486
00:16:34,190 --> 00:16:37,565
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1487
And in the derivative case, oi,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1488
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1489
324
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1490
00:16:37,565 --> 00:16:40,339
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1491
if this n is equal to 0,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1492
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1493
325
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1494
00:16:40,339 --> 00:16:43,564
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1495
the return this 0
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1496
wreck expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1497
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1498
326
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1499
00:16:43,564 --> 00:16:46,700
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1500
Otherwise we return the
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1501
sequence of the derivative
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1502
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1503
327
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1504
00:16:46,700 --> 00:16:50,270
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1505
of psi of r four by n times of r,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1506
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1507
328
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1508
00:16:50,270 --> 00:16:54,545
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1509
but n minus one times and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1510
everything else stays the same.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1511
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1512
329
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1513
00:16:54,545 --> 00:16:56,510
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1514
Here's the function for strings,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1515
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1516
330
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1517
00:16:56,510 --> 00:16:58,430
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1518
derivative function for strings.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1519
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1520
331
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1521
00:16:58,430 --> 00:17:01,595
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1522
In the main mantra
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1523
function as all the same.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1524
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1525
332
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1526
00:17:01,595 --> 00:17:04,820
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1527
We still require this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1528
definition because
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1529
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1530
333
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1531
00:17:04,820 --> 00:17:06,050
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1532
we haven't done anything about
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1533
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1534
334
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1535
00:17:06,050 --> 00:17:08,090
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1536
the optional record
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1537
expression yet.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1538
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1539
335
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1540
00:17:08,090 --> 00:17:10,670
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1541
And we have now at this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1542
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1543
336
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1544
00:17:10,670 --> 00:17:13,250
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1545
either warm and evil
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1546
2-break expression.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1547
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1548
337
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1549
00:17:13,250 --> 00:17:15,290
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1550
And let's test it. And let's be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1551
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1552
338
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1553
00:17:15,290 --> 00:17:17,000
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1554
a bit more ambitious.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1555
Be testing it.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1556
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1557
339
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1558
00:17:17,000 --> 00:17:20,315
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1559
The strings between 01000
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1560
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1561
340
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1562
00:17:20,315 --> 00:17:22,580
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1563
and let's see what the time say.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1564
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1565
341
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1566
00:17:22,580 --> 00:17:26,210
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1567
I'm testing this again
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1568
inside the ammonite rebel.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1569
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1570
342
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1571
00:17:26,210 --> 00:17:30,180
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1572
And you'll see it should
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1573
be now much quicker.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1574
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1575
343
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1576
00:17:30,610 --> 00:17:34,640
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1577
Okay, it might slow
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1578
down also around 600.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1579
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1580
344
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1581
00:17:34,640 --> 00:17:40,490
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1582
700 needs two seconds,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1583
three seconds, 4800.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1584
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1585
345
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1586
00:17:40,490 --> 00:17:43,940
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1587
Let's see about it
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1588
needs 4 thousand.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1589
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1590
346
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1591
00:17:43,940 --> 00:17:47,435
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1592
But you have to remember
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1593
Ruby and Python.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1594
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1595
347
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1596
00:17:47,435 --> 00:17:51,530
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1597
They needed half a
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1598
minute to just 43 TAs.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1599
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1600
348
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1601
00:17:51,530 --> 00:17:54,485
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1602
We need a little bit
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1603
more than six seconds,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1604
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1605
349
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1606
00:17:54,485 --> 00:17:57,110
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1607
but we are processing a string of
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1608
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1609
350
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1610
00:17:57,110 --> 00:18:00,575
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1611
1000 days so that success.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1612
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1613
351
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1614
00:18:00,575 --> 00:18:04,775
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1615
So this speed is also explained
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1616
if you look at the sizes.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1617
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1618
352
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1619
00:18:04,775 --> 00:18:08,975
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1620
Since we now have this explicit
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1621
and times constructor,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1622
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1623
353
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1624
00:18:08,975 --> 00:18:11,930
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1625
it doesn't really matter
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1626
how big this n is.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1627
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1628
354
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1629
00:18:11,930 --> 00:18:14,540
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1630
This evil one reg
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1631
expression will always be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1632
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1633
355
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1634
00:18:14,540 --> 00:18:17,195
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1635
of this size seven,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1636
the beginning.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1637
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1638
356
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1639
00:18:17,195 --> 00:18:20,315
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1640
And you can also see if you
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1641
now build the derivatives,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1642
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1643
357
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1644
00:18:20,315 --> 00:18:22,550
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1645
they still grow in size,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1646
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1647
358
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1648
00:18:22,550 --> 00:18:24,740
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1649
but much more moderately.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1650
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1651
359
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1652
00:18:24,740 --> 00:18:28,100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1653
And let's try out this
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1654
example, this 20 a.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1655
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1656
360
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1657
00:18:28,100 --> 00:18:31,685
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1658
So we build the derivative
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1659
according to 20 character A's.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1660
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1661
361
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1662
00:18:31,685 --> 00:18:33,890
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1663
In the earlier example,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1664
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1665
362
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1666
00:18:33,890 --> 00:18:35,780
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1667
we ended up this a
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1668
wreck expression which
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1669
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1670
363
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1671
00:18:35,780 --> 00:18:37,895
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1672
had like 8 million plus nodes.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1673
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1674
364
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1675
00:18:37,895 --> 00:18:39,830
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1676
And if we do this now,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1677
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1678
365
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1679
00:18:39,830 --> 00:18:43,205
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1680
then we just have a wreck
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1681
expression with 211 nodes.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1682
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1683
366
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1684
00:18:43,205 --> 00:18:44,750
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1685
And that is much smaller and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1686
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1687
367
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1688
00:18:44,750 --> 00:18:47,165
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1689
all the calculations
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1690
would be much quicker.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1691
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1692
368
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1693
00:18:47,165 --> 00:18:49,550
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1694
So yeah, there's
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1695
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1696
369
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1697
00:18:49,550 --> 00:18:52,205
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1698
this push off CKY algorithm
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1699
and this improvement.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1700
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1701
370
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1702
00:18:52,205 --> 00:18:54,890
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1703
We're now running
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1704
circles around Ruby and
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1705
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1706
371
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1707
00:18:54,890 --> 00:18:58,445
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1708
Python because they're just
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1709
stuck here at the beginning.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1710
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1711
372
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1712
00:18:58,445 --> 00:19:00,230
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1713
Because they need already
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1714
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1715
373
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1716
00:19:00,230 --> 00:19:02,975
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1717
like half a minute
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1718
for just 30 a's.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1719
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1720
374
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1721
00:19:02,975 --> 00:19:05,930
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1722
We now can do something
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1723
like thousand a's.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1724
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1725
375
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1726
00:19:05,930 --> 00:19:07,580
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1727
And in reasonable time.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1728
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1729
376
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1730
00:19:07,580 --> 00:19:09,740
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1731
I think this must be
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1732
timing I obtained with
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1733
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1734
377
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1735
00:19:09,740 --> 00:19:12,635
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1736
my older laptop some time ago.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1737
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1738
378
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1739
00:19:12,635 --> 00:19:14,210
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1740
Because remember we
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1741
had something like
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1742
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1743
379
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1744
00:19:14,210 --> 00:19:16,670
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1745
six seconds here, it says 15.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1746
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1747
380
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1748
00:19:16,670 --> 00:19:18,080
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1749
So you always have to take
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1750
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1751
381
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1752
00:19:18,080 --> 00:19:20,885
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1753
these times with
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1754
the pinch of salt.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1755
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1756
382
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1757
00:19:20,885 --> 00:19:22,670
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1758
It's essentially only the trend,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1759
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1760
383
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1761
00:19:22,670 --> 00:19:25,100
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1762
but it's clear we are
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1763
much, much better.
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1764
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1765
384
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1766
00:19:25,100 --> 00:19:27,065
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1767
So we have worked a lot,
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1768
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1769
385
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1770
00:19:27,065 --> 00:19:30,720
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1771
but we also got something
f9686b22db7e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
  1772
for it in return.