468
+ − 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 2
% Masters/Doctoral Thesis
+ − 3
% LaTeX Template
+ − 4
% Version 2.5 (27/8/17)
+ − 5
%
+ − 6
% This template was downloaded from:
+ − 7
% http://www.LaTeXTemplates.com
+ − 8
%
+ − 9
% Version 2.x major modifications by:
+ − 10
% Vel (vel@latextemplates.com)
+ − 11
%
+ − 12
% This template is based on a template by:
+ − 13
% Steve Gunn (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
+ − 14
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
+ − 15
%
+ − 16
% Template license:
+ − 17
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
+ − 18
%
+ − 19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 20
+ − 21
%----------------------------------------------------------------------------------------
+ − 22
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
+ − 23
%----------------------------------------------------------------------------------------
+ − 24
+ − 25
\documentclass[
+ − 26
11pt, % The default document font size, options: 10pt, 11pt, 12pt
+ − 27
%oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
+ − 28
english, % ngerman for German
+ − 29
singlespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
+ − 30
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
+ − 31
%nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
+ − 32
%liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
+ − 33
%toctotoc, % Uncomment to add the main table of contents to the table of contents
+ − 34
%parskip, % Uncomment to add space between paragraphs
+ − 35
%nohyperref, % Uncomment to not load the hyperref package
+ − 36
headsepline, % Uncomment to get a line under the header
+ − 37
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
471
+ − 38
consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
468
+ − 39
]{MastersDoctoralThesis} % The class file specifying the document structure
+ − 40
+ − 41
\usepackage[utf8]{inputenc} % Required for inputting international characters
+ − 42
\usepackage[T1]{fontenc} % Output font encoding for international characters
505
+ − 43
%\usepackage{fdsymbol} % Loads unicode-math
468
+ − 44
+ − 45
\usepackage{mathpazo} % Use the Palatino font by default
+ − 46
\usepackage{hyperref}
+ − 47
\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)
500
+ − 48
\usepackage{stmaryrd}
468
+ − 49
+ − 50
\addbibresource{example.bib} % The filename of the bibliography
+ − 51
+ − 52
\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography
+ − 53
+ − 54
%My Newly added Libraries in addition to template
+ − 55
\usepackage{graphic}
+ − 56
\usepackage{data}
+ − 57
+ − 58
%\usepackage{algorithm}
+ − 59
\usepackage{amsmath}
506
+ − 60
\usepackage{amsthm}
+ − 61
\usepackage{amssymb}
505
+ − 62
%\usepackage{mathtools}
468
+ − 63
\usepackage[noend]{algpseudocode}
+ − 64
\usepackage{enumitem}
+ − 65
\usepackage{nccmath}
+ − 66
\usepackage{tikz-cd}
+ − 67
\usepackage{tikz}
472
+ − 68
\usetikzlibrary{automata, positioning, calc}
468
+ − 69
+ − 70
%----------------------------------------------------------------------------------------
+ − 71
% MARGIN SETTINGS
+ − 72
%----------------------------------------------------------------------------------------
+ − 73
+ − 74
\geometry{
+ − 75
paper=a4paper, % Change to letterpaper for US letter
+ − 76
inner=2.5cm, % Inner margin
+ − 77
outer=3.8cm, % Outer margin
+ − 78
bindingoffset=.5cm, % Binding offset
+ − 79
top=1.5cm, % Top margin
+ − 80
bottom=1.5cm, % Bottom margin
+ − 81
%showframe, % Uncomment to show how the type block is set on the page
+ − 82
}
+ − 83
+ − 84
%----------------------------------------------------------------------------------------
+ − 85
% THESIS INFORMATION
+ − 86
%----------------------------------------------------------------------------------------
+ − 87
+ − 88
\thesistitle{POSIX Regular Expression Matching and Lexing} % Your thesis title, this is used in the title and abstract, print it elsewhere with \ttitle
+ − 89
\supervisor{Dr. Christian \textsc{Urban}} % Your supervisor's name, this is used in the title page, print it elsewhere with \supname
+ − 90
\examiner{} % Your examiner's name, this is not currently used anywhere in the template, print it elsewhere with \examname
+ − 91
\degree{Doctor of Philosophy} % Your degree name, this is used in the title page and abstract, print it elsewhere with \degreename
+ − 92
\author{Chengsong \textsc{Tan}} % Your name, this is used in the title page and abstract, print it elsewhere with \authorname
+ − 93
\addresses{} % Your address, this is not currently used anywhere in the template, print it elsewhere with \addressname
+ − 94
+ − 95
\subject{Computer Science} % Your subject area, this is not currently used anywhere in the template, print it elsewhere with \subjectname
+ − 96
\keywords{} % Keywords for your thesis, this is not currently used anywhere in the template, print it elsewhere with \keywordnames
+ − 97
\university{\href{https://www.kcl.ac.uk}{King's College London}} % Your university's name and URL, this is used in the title page and abstract, print it elsewhere with \univname
+ − 98
\department{\href{https://www.kcl.ac.uk/informatics}{Department or Informatics}} % Your department's name and URL, this is used in the title page and abstract, print it elsewhere with \deptname
471
+ − 99
\group{\href{https://www.kcl.ac.uk/research/ssy}{Software Systems Group}} % Your research group's name and URL, this is used in the title page, print it elsewhere with \groupname
468
+ − 100
\faculty{\href{http://faculty.university.com}{Chengsong Tan}} % Your faculty's name and URL, this is used in the title page and abstract, print it elsewhere with \facname
+ − 101
+ − 102
\AtBeginDocument{
+ − 103
\hypersetup{pdftitle=\ttitle} % Set the PDF's title to your title
+ − 104
\hypersetup{pdfauthor=\authorname} % Set the PDF's author to your name
+ − 105
\hypersetup{pdfkeywords=\keywordnames} % Set the PDF's keywords to your keywords
+ − 106
}
+ − 107
+ − 108
\begin{document}
+ − 109
+ − 110
\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages
+ − 111
+ − 112
\pagestyle{plain} % Default to the plain heading style until the thesis style is called for the body content
+ − 113
+ − 114
%----------------------------------------------------------------------------------------
+ − 115
% TITLE PAGE
+ − 116
%----------------------------------------------------------------------------------------
+ − 117
+ − 118
\begin{titlepage}
+ − 119
\begin{center}
+ − 120
+ − 121
\vspace*{.06\textheight}
+ − 122
{\scshape\LARGE \univname\par}\vspace{1.5cm} % University name
+ − 123
\textsc{\Large Doctoral Thesis}\\[0.5cm] % Thesis type
+ − 124
+ − 125
\HRule \\[0.4cm] % Horizontal line
+ − 126
{\huge \bfseries \ttitle\par}\vspace{0.4cm} % Thesis title
+ − 127
\HRule \\[1.5cm] % Horizontal line
+ − 128
+ − 129
\begin{minipage}[t]{0.4\textwidth}
+ − 130
\begin{flushleft} \large
+ − 131
\emph{Author:}\\
+ − 132
\href{https://kclpure.kcl.ac.uk/portal/en/persons/chengsong-tan(a63b381b-04bc-4cd7-beea-beb3e96cb153).html}{\authorname} % Author name - remove the \href bracket to remove the link
+ − 133
\end{flushleft}
+ − 134
\end{minipage}
+ − 135
+ − 136
+ − 137
\begin{minipage}[t]{0.4\textwidth}
+ − 138
\begin{flushright} \large
+ − 139
\emph{Supervisor:} \\
+ − 140
\href{https://www.kcl.ac.uk/people/christian-urban}{\supname} % Supervisor name - remove the \href bracket to remove the link
+ − 141
\end{flushright}
+ − 142
\end{minipage}\\[3cm]
+ − 143
+ − 144
\vfill
+ − 145
+ − 146
\large \textit{A thesis submitted in fulfillment of the requirements\\ for the degree of \degreename}\\[0.3cm] % University requirement text
+ − 147
\textit{in the}\\[0.4cm]
+ − 148
\groupname\\\deptname\\[2cm] % Research group name and department name
+ − 149
+ − 150
\vfill
+ − 151
+ − 152
{\large \today}\\[4cm] % Date
+ − 153
%\includegraphics{Logo} % University/department logo - uncomment to place it
+ − 154
+ − 155
\vfill
+ − 156
\end{center}
+ − 157
\end{titlepage}
+ − 158
+ − 159
%----------------------------------------------------------------------------------------
+ − 160
% DECLARATION PAGE
+ − 161
%----------------------------------------------------------------------------------------
+ − 162
+ − 163
\begin{declaration}
+ − 164
\addchaptertocentry{\authorshipname} % Add the declaration to the table of contents
+ − 165
\noindent I, \authorname, declare that this thesis titled, \enquote{\ttitle} and the work presented in it are my own. I confirm that:
+ − 166
+ − 167
\begin{itemize}
+ − 168
\item This work was done wholly or mainly while in candidature for a research degree at this University.
+ − 169
\item Where any part of this thesis has previously been submitted for a degree or any other qualification at this University or any other institution, this has been clearly stated.
+ − 170
\item Where I have consulted the published work of others, this is always clearly attributed.
+ − 171
\item Where I have quoted from the work of others, the source is always given. With the exception of such quotations, this thesis is entirely my own work.
+ − 172
\item I have acknowledged all main sources of help.
+ − 173
\item Where the thesis is based on work done by myself jointly with others, I have made clear exactly what was done by others and what I have contributed myself.\\
+ − 174
\end{itemize}
+ − 175
+ − 176
\noindent Signed:\\
+ − 177
\rule[0.5em]{25em}{0.5pt} % This prints a line for the signature
+ − 178
+ − 179
\noindent Date:\\
+ − 180
\rule[0.5em]{25em}{0.5pt} % This prints a line to write the date
+ − 181
\end{declaration}
+ − 182
+ − 183
\cleardoublepage
+ − 184
+ − 185
%----------------------------------------------------------------------------------------
+ − 186
% QUOTATION PAGE
+ − 187
%----------------------------------------------------------------------------------------
+ − 188
+ − 189
\vspace*{0.2\textheight}
+ − 190
+ − 191
\noindent\enquote{\itshape Thanks to my solid academic training, today I can write hundreds of words on virtually any topic without possessing a shred of information, which is how I got a good job in journalism.}\bigbreak
+ − 192
+ − 193
\hfill Dave Barry
+ − 194
+ − 195
%----------------------------------------------------------------------------------------
+ − 196
% ABSTRACT PAGE
+ − 197
%----------------------------------------------------------------------------------------
+ − 198
+ − 199
\begin{abstract}
+ − 200
\addchaptertocentry{\abstractname} % Add the abstract to the table of contents
471
+ − 201
This work is about regular expressions and derivatives. It combines functional algorithms and their formal verification in the Isabelle/HOL theorem prover.
468
+ − 202
+ − 203
Theoretical results say that regular expression matching
+ − 204
should be linear with respect to the input.
+ − 205
Under a certain class of regular expressions and inputs though,
+ − 206
practical implementations suffer from non-linear or even
+ − 207
exponential running time,
+ − 208
allowing a ReDoS (regular expression denial-of-service ) attack.
+ − 209
+ − 210
+ − 211
The reason behind is that regex libraries in popular language engines
+ − 212
often want to support richer constructs
+ − 213
than the most basic regular expressions, and lexing rather than matching
+ − 214
is needed for sub-match extraction.
+ − 215
+ − 216
This work aims to address the above vulnerability by the combination
+ − 217
of Brzozowski's derivatives and interactive theorem proving. We give an
+ − 218
improved version of Sulzmann and Lu's bit-coded algorithm using
+ − 219
derivatives, which come with a formal guarantee in terms of correctness and
+ − 220
running time as an Isabelle/HOL proof.
+ − 221
Then we improve the algorithm with an even stronger version of
+ − 222
simplification, and prove a time bound linear to input and
+ − 223
cubic to regular expression size using a technique by
+ − 224
Antimirov.
+ − 225
The result is an algorithm with provable guarantees on
+ − 226
correctness and running time. We believe this is the first
+ − 227
work with these two guarantees together.
+ − 228
+ − 229
+ − 230
+ − 231
\end{abstract}
+ − 232
+ − 233
%----------------------------------------------------------------------------------------
+ − 234
% ACKNOWLEDGEMENTS
+ − 235
%----------------------------------------------------------------------------------------
+ − 236
+ − 237
\begin{acknowledgements}
+ − 238
\addchaptertocentry{\acknowledgementname} % Add the acknowledgements to the table of contents
+ − 239
The acknowledgments and the people to thank go here, don't forget to include your project advisor\ldots
+ − 240
\end{acknowledgements}
+ − 241
+ − 242
%----------------------------------------------------------------------------------------
+ − 243
% LIST OF CONTENTS/FIGURES/TABLES PAGES
+ − 244
%----------------------------------------------------------------------------------------
+ − 245
+ − 246
\tableofcontents % Prints the main table of contents
+ − 247
+ − 248
\listoffigures % Prints the list of figures
+ − 249
+ − 250
\listoftables % Prints the list of tables
+ − 251
+ − 252
%----------------------------------------------------------------------------------------
+ − 253
% ABBREVIATIONS
+ − 254
%----------------------------------------------------------------------------------------
+ − 255
+ − 256
\begin{abbreviations}{ll} % Include a list of abbreviations (a table of two columns)
+ − 257
+ − 258
\textbf{LAH} & \textbf{L}ist \textbf{A}bbreviations \textbf{H}ere\\
+ − 259
\textbf{WSF} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or\\
+ − 260
500
+ − 261
+ − 262
\newtheorem{theorem}{Theorem}
+ − 263
\newtheorem{lemma}{Lemma}
505
+ − 264
%proof
+ − 265
500
+ − 266
503
+ − 267
\newcommand\sflat[1][]{\textit{sflat} \, #1}
+ − 268
\newcommand{\ASEQ}[3]{\textit{ASEQ}_{#1} \, #2 \, #3}
+ − 269
\newcommand{\bderssimp}[2]{#1 \backslash_{bsimp} #2}
+ − 270
\newcommand{\rderssimp}[2]{#1 \backslash_{rsimp} #2}
+ − 271
\newcommand{\sflataux}[1]{\lbracket #1 \rbracket}
468
+ − 272
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}%
+ − 273
\newcommand{\ZERO}{\mbox{\bf 0}}
+ − 274
\newcommand{\ONE}{\mbox{\bf 1}}
503
+ − 275
\newcommand{\AALTS}[2]{\XOR {\scriptstyle #1}\, #2}
+ − 276
468
+ − 277
\def\lexer{\mathit{lexer}}
+ − 278
\def\mkeps{\mathit{mkeps}}
+ − 279
500
+ − 280
\def\AZERO{\textit{AZERO}}
+ − 281
\def\AONE{\textit{AONE}}
+ − 282
\def\ACHAR{\textit{ACHAR}}
503
+ − 283
+ − 284
+ − 285
\def\ALTS{\textit{ALTS}}
500
+ − 286
\def\ASTAR{\textit{ASTAR}}
468
+ − 287
\def\DFA{\textit{DFA}}
+ − 288
\def\bmkeps{\textit{bmkeps}}
+ − 289
\def\retrieve{\textit{retrieve}}
+ − 290
\def\blexer{\textit{blexer}}
+ − 291
\def\flex{\textit{flex}}
+ − 292
\def\inj{\mathit{inj}}
+ − 293
\def\Empty{\mathit{Empty}}
+ − 294
\def\Left{\mathit{Left}}
+ − 295
\def\Right{\mathit{Right}}
+ − 296
\def\Stars{\mathit{Stars}}
+ − 297
\def\Char{\mathit{Char}}
+ − 298
\def\Seq{\mathit{Seq}}
+ − 299
\def\Der{\mathit{Der}}
+ − 300
\def\nullable{\mathit{nullable}}
+ − 301
\def\Z{\mathit{Z}}
+ − 302
\def\S{\mathit{S}}
+ − 303
\def\rup{r^\uparrow}
500
+ − 304
%\def\bderssimp{\mathit{bders}\_\mathit{simp}}
+ − 305
\def\distinctWith{\textit{distinctWith}}
+ − 306
503
+ − 307
\def\rexp{\mathbf{rexp}}
500
+ − 308
\def\simp{\mathit{simp}}
+ − 309
\def\simpALTs{\mathit{simp}\_\mathit{ALTs}}
+ − 310
\def\map{\mathit{map}}
+ − 311
\def\distinct{\mathit{distinct}}
+ − 312
\def\blexersimp{\mathit{blexer}\_\mathit{simp}}
+ − 313
\def\map{\textit{map}}
+ − 314
\def\vsuf{\textit{vsuf}}
+ − 315
\def\sflataux{\textit{sflat}\_\textit{aux}}
+ − 316
\def\rrexp{\textit{rrexp}}
+ − 317
\def\rsize{\textit{rsize}}
+ − 318
\def\asize{\textit{asize}}
+ − 319
\def\rerase{\textit{rerase}}
+ − 320
\def\erase{\textit{erase}}
+ − 321
\def\STAR{\textit{STAR}}
+ − 322
\def\flts{\textit{flts}}
468
+ − 323
503
+ − 324
+ − 325
468
+ − 326
\end{abbreviations}
+ − 327
+ − 328
+ − 329
+ − 330
%----------------------------------------------------------------------------------------
+ − 331
% SYMBOLS
+ − 332
%----------------------------------------------------------------------------------------
+ − 333
+ − 334
\begin{symbols}{lll} % Include a list of Symbols (a three column table)
+ − 335
+ − 336
$a$ & distance & \si{\meter} \\
+ − 337
$P$ & power & \si{\watt} (\si{\joule\per\second}) \\
+ − 338
%Symbol & Name & Unit \\
+ − 339
+ − 340
\addlinespace % Gap to separate the Roman symbols from the Greek
+ − 341
+ − 342
$\omega$ & angular frequency & \si{\radian} \\
+ − 343
+ − 344
\end{symbols}
+ − 345
+ − 346
%----------------------------------------------------------------------------------------
+ − 347
% DEDICATION
+ − 348
%----------------------------------------------------------------------------------------
+ − 349
+ − 350
\dedicatory{For/Dedicated to/To my\ldots}
+ − 351
+ − 352
%----------------------------------------------------------------------------------------
+ − 353
% THESIS CONTENT - CHAPTERS
+ − 354
%----------------------------------------------------------------------------------------
+ − 355
+ − 356
\mainmatter % Begin numeric (1,2,3...) page numbering
+ − 357
+ − 358
\pagestyle{thesis} % Return the page headers back to the "thesis" style
+ − 359
+ − 360
% Include the chapters of the thesis as separate files from the Chapters folder
+ − 361
% Uncomment the lines as you write the chapters
+ − 362
+ − 363
\include{Chapters/Chapter1}
+ − 364
\include{Chapters/Chapter2}
+ − 365
\include{Chapters/Chapter3}
+ − 366
%\include{Chapters/Chapter4}
+ − 367
%\include{Chapters/Chapter5}
+ − 368
+ − 369
%----------------------------------------------------------------------------------------
+ − 370
% THESIS CONTENT - APPENDICES
+ − 371
%----------------------------------------------------------------------------------------
+ − 372
+ − 373
\appendix % Cue to tell LaTeX that the following "chapters" are Appendices
+ − 374
+ − 375
% Include the appendices of the thesis as separate files from the Appendices folder
+ − 376
% Uncomment the lines as you write the Appendices
+ − 377
+ − 378
\include{Appendices/AppendixA}
+ − 379
%\include{Appendices/AppendixB}
+ − 380
%\include{Appendices/AppendixC}
+ − 381
+ − 382
%----------------------------------------------------------------------------------------
+ − 383
% BIBLIOGRAPHY
+ − 384
%----------------------------------------------------------------------------------------
+ − 385
+ − 386
\printbibliography[heading=bibintoc]
+ − 387
+ − 388
%----------------------------------------------------------------------------------------
+ − 389
+ − 390
\end{document}