|
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 |
|
38 %consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout |
|
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 |
|
43 |
|
44 \usepackage{mathpazo} % Use the Palatino font by default |
|
45 \usepackage{hyperref} |
|
46 \usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA) |
|
47 |
|
48 \addbibresource{example.bib} % The filename of the bibliography |
|
49 |
|
50 \usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography |
|
51 |
|
52 %My Newly added Libraries in addition to template |
|
53 \usepackage{graphic} |
|
54 \usepackage{data} |
|
55 |
|
56 %\usepackage{algorithm} |
|
57 \usepackage{amsmath} |
|
58 \usepackage[noend]{algpseudocode} |
|
59 \usepackage{enumitem} |
|
60 \usepackage{nccmath} |
|
61 \usepackage{tikz-cd} |
|
62 \usepackage{tikz} |
|
63 \usetikzlibrary{automata, positioning} |
|
64 |
|
65 %---------------------------------------------------------------------------------------- |
|
66 % MARGIN SETTINGS |
|
67 %---------------------------------------------------------------------------------------- |
|
68 |
|
69 \geometry{ |
|
70 paper=a4paper, % Change to letterpaper for US letter |
|
71 inner=2.5cm, % Inner margin |
|
72 outer=3.8cm, % Outer margin |
|
73 bindingoffset=.5cm, % Binding offset |
|
74 top=1.5cm, % Top margin |
|
75 bottom=1.5cm, % Bottom margin |
|
76 %showframe, % Uncomment to show how the type block is set on the page |
|
77 } |
|
78 |
|
79 %---------------------------------------------------------------------------------------- |
|
80 % THESIS INFORMATION |
|
81 %---------------------------------------------------------------------------------------- |
|
82 |
|
83 \thesistitle{POSIX Regular Expression Matching and Lexing} % Your thesis title, this is used in the title and abstract, print it elsewhere with \ttitle |
|
84 \supervisor{Dr. Christian \textsc{Urban}} % Your supervisor's name, this is used in the title page, print it elsewhere with \supname |
|
85 \examiner{} % Your examiner's name, this is not currently used anywhere in the template, print it elsewhere with \examname |
|
86 \degree{Doctor of Philosophy} % Your degree name, this is used in the title page and abstract, print it elsewhere with \degreename |
|
87 \author{Chengsong \textsc{Tan}} % Your name, this is used in the title page and abstract, print it elsewhere with \authorname |
|
88 \addresses{} % Your address, this is not currently used anywhere in the template, print it elsewhere with \addressname |
|
89 |
|
90 \subject{Computer Science} % Your subject area, this is not currently used anywhere in the template, print it elsewhere with \subjectname |
|
91 \keywords{} % Keywords for your thesis, this is not currently used anywhere in the template, print it elsewhere with \keywordnames |
|
92 \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 |
|
93 \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 |
|
94 \group{\href{https://www.kcl.ac.uk/research/ssy}{Software Systems}} % Your research group's name and URL, this is used in the title page, print it elsewhere with \groupname |
|
95 \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 |
|
96 |
|
97 \AtBeginDocument{ |
|
98 \hypersetup{pdftitle=\ttitle} % Set the PDF's title to your title |
|
99 \hypersetup{pdfauthor=\authorname} % Set the PDF's author to your name |
|
100 \hypersetup{pdfkeywords=\keywordnames} % Set the PDF's keywords to your keywords |
|
101 } |
|
102 |
|
103 \begin{document} |
|
104 |
|
105 \frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages |
|
106 |
|
107 \pagestyle{plain} % Default to the plain heading style until the thesis style is called for the body content |
|
108 |
|
109 %---------------------------------------------------------------------------------------- |
|
110 % TITLE PAGE |
|
111 %---------------------------------------------------------------------------------------- |
|
112 |
|
113 \begin{titlepage} |
|
114 \begin{center} |
|
115 |
|
116 \vspace*{.06\textheight} |
|
117 {\scshape\LARGE \univname\par}\vspace{1.5cm} % University name |
|
118 \textsc{\Large Doctoral Thesis}\\[0.5cm] % Thesis type |
|
119 |
|
120 \HRule \\[0.4cm] % Horizontal line |
|
121 {\huge \bfseries \ttitle\par}\vspace{0.4cm} % Thesis title |
|
122 \HRule \\[1.5cm] % Horizontal line |
|
123 |
|
124 \begin{minipage}[t]{0.4\textwidth} |
|
125 \begin{flushleft} \large |
|
126 \emph{Author:}\\ |
|
127 \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 |
|
128 \end{flushleft} |
|
129 \end{minipage} |
|
130 |
|
131 |
|
132 \begin{minipage}[t]{0.4\textwidth} |
|
133 \begin{flushright} \large |
|
134 \emph{Supervisor:} \\ |
|
135 \href{https://www.kcl.ac.uk/people/christian-urban}{\supname} % Supervisor name - remove the \href bracket to remove the link |
|
136 \end{flushright} |
|
137 \end{minipage}\\[3cm] |
|
138 |
|
139 \vfill |
|
140 |
|
141 \large \textit{A thesis submitted in fulfillment of the requirements\\ for the degree of \degreename}\\[0.3cm] % University requirement text |
|
142 \textit{in the}\\[0.4cm] |
|
143 \groupname\\\deptname\\[2cm] % Research group name and department name |
|
144 |
|
145 \vfill |
|
146 |
|
147 {\large \today}\\[4cm] % Date |
|
148 %\includegraphics{Logo} % University/department logo - uncomment to place it |
|
149 |
|
150 \vfill |
|
151 \end{center} |
|
152 \end{titlepage} |
|
153 |
|
154 %---------------------------------------------------------------------------------------- |
|
155 % DECLARATION PAGE |
|
156 %---------------------------------------------------------------------------------------- |
|
157 |
|
158 \begin{declaration} |
|
159 \addchaptertocentry{\authorshipname} % Add the declaration to the table of contents |
|
160 \noindent I, \authorname, declare that this thesis titled, \enquote{\ttitle} and the work presented in it are my own. I confirm that: |
|
161 |
|
162 \begin{itemize} |
|
163 \item This work was done wholly or mainly while in candidature for a research degree at this University. |
|
164 \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. |
|
165 \item Where I have consulted the published work of others, this is always clearly attributed. |
|
166 \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. |
|
167 \item I have acknowledged all main sources of help. |
|
168 \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.\\ |
|
169 \end{itemize} |
|
170 |
|
171 \noindent Signed:\\ |
|
172 \rule[0.5em]{25em}{0.5pt} % This prints a line for the signature |
|
173 |
|
174 \noindent Date:\\ |
|
175 \rule[0.5em]{25em}{0.5pt} % This prints a line to write the date |
|
176 \end{declaration} |
|
177 |
|
178 \cleardoublepage |
|
179 |
|
180 %---------------------------------------------------------------------------------------- |
|
181 % QUOTATION PAGE |
|
182 %---------------------------------------------------------------------------------------- |
|
183 |
|
184 \vspace*{0.2\textheight} |
|
185 |
|
186 \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 |
|
187 |
|
188 \hfill Dave Barry |
|
189 |
|
190 %---------------------------------------------------------------------------------------- |
|
191 % ABSTRACT PAGE |
|
192 %---------------------------------------------------------------------------------------- |
|
193 |
|
194 \begin{abstract} |
|
195 \addchaptertocentry{\abstractname} % Add the abstract to the table of contents |
|
196 This work is a combination of functional algorithms |
|
197 and formal methods. |
|
198 Regular expression matching and lexing has been |
|
199 widely-used and well-implemented |
|
200 in software industry. |
|
201 |
|
202 Theoretical results say that regular expression matching |
|
203 should be linear with respect to the input. |
|
204 Under a certain class of regular expressions and inputs though, |
|
205 practical implementations suffer from non-linear or even |
|
206 exponential running time, |
|
207 allowing a ReDoS (regular expression denial-of-service ) attack. |
|
208 |
|
209 |
|
210 The reason behind is that regex libraries in popular language engines |
|
211 often want to support richer constructs |
|
212 than the most basic regular expressions, and lexing rather than matching |
|
213 is needed for sub-match extraction. |
|
214 |
|
215 This work aims to address the above vulnerability by the combination |
|
216 of Brzozowski's derivatives and interactive theorem proving. We give an |
|
217 improved version of Sulzmann and Lu's bit-coded algorithm using |
|
218 derivatives, which come with a formal guarantee in terms of correctness and |
|
219 running time as an Isabelle/HOL proof. |
|
220 Then we improve the algorithm with an even stronger version of |
|
221 simplification, and prove a time bound linear to input and |
|
222 cubic to regular expression size using a technique by |
|
223 Antimirov. |
|
224 The result is an algorithm with provable guarantees on |
|
225 correctness and running time. We believe this is the first |
|
226 work with these two guarantees together. |
|
227 |
|
228 |
|
229 |
|
230 \end{abstract} |
|
231 |
|
232 %---------------------------------------------------------------------------------------- |
|
233 % ACKNOWLEDGEMENTS |
|
234 %---------------------------------------------------------------------------------------- |
|
235 |
|
236 \begin{acknowledgements} |
|
237 \addchaptertocentry{\acknowledgementname} % Add the acknowledgements to the table of contents |
|
238 The acknowledgments and the people to thank go here, don't forget to include your project advisor\ldots |
|
239 \end{acknowledgements} |
|
240 |
|
241 %---------------------------------------------------------------------------------------- |
|
242 % LIST OF CONTENTS/FIGURES/TABLES PAGES |
|
243 %---------------------------------------------------------------------------------------- |
|
244 |
|
245 \tableofcontents % Prints the main table of contents |
|
246 |
|
247 \listoffigures % Prints the list of figures |
|
248 |
|
249 \listoftables % Prints the list of tables |
|
250 |
|
251 %---------------------------------------------------------------------------------------- |
|
252 % ABBREVIATIONS |
|
253 %---------------------------------------------------------------------------------------- |
|
254 |
|
255 \begin{abbreviations}{ll} % Include a list of abbreviations (a table of two columns) |
|
256 |
|
257 \textbf{LAH} & \textbf{L}ist \textbf{A}bbreviations \textbf{H}ere\\ |
|
258 \textbf{WSF} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or\\ |
|
259 |
|
260 \newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% |
|
261 \newcommand{\ZERO}{\mbox{\bf 0}} |
|
262 \newcommand{\ONE}{\mbox{\bf 1}} |
|
263 \def\lexer{\mathit{lexer}} |
|
264 \def\mkeps{\mathit{mkeps}} |
|
265 |
|
266 \def\DFA{\textit{DFA}} |
|
267 \def\bmkeps{\textit{bmkeps}} |
|
268 \def\retrieve{\textit{retrieve}} |
|
269 \def\blexer{\textit{blexer}} |
|
270 \def\flex{\textit{flex}} |
|
271 \def\inj{\mathit{inj}} |
|
272 \def\Empty{\mathit{Empty}} |
|
273 \def\Left{\mathit{Left}} |
|
274 \def\Right{\mathit{Right}} |
|
275 \def\Stars{\mathit{Stars}} |
|
276 \def\Char{\mathit{Char}} |
|
277 \def\Seq{\mathit{Seq}} |
|
278 \def\Der{\mathit{Der}} |
|
279 \def\nullable{\mathit{nullable}} |
|
280 \def\Z{\mathit{Z}} |
|
281 \def\S{\mathit{S}} |
|
282 \def\rup{r^\uparrow} |
|
283 |
|
284 \end{abbreviations} |
|
285 |
|
286 %---------------------------------------------------------------------------------------- |
|
287 % PHYSICAL CONSTANTS/OTHER DEFINITIONS |
|
288 %---------------------------------------------------------------------------------------- |
|
289 |
|
290 \begin{constants}{lr@{${}={}$}l} % The list of physical constants is a three column table |
|
291 |
|
292 % The \SI{}{} command is provided by the siunitx package, see its documentation for instructions on how to use it |
|
293 |
|
294 Speed of Light & $c_{0}$ & \SI{2.99792458e8}{\meter\per\second} (exact)\\ |
|
295 %Constant Name & $Symbol$ & $Constant Value$ with units\\ |
|
296 |
|
297 \end{constants} |
|
298 |
|
299 %---------------------------------------------------------------------------------------- |
|
300 % SYMBOLS |
|
301 %---------------------------------------------------------------------------------------- |
|
302 |
|
303 \begin{symbols}{lll} % Include a list of Symbols (a three column table) |
|
304 |
|
305 $a$ & distance & \si{\meter} \\ |
|
306 $P$ & power & \si{\watt} (\si{\joule\per\second}) \\ |
|
307 %Symbol & Name & Unit \\ |
|
308 |
|
309 \addlinespace % Gap to separate the Roman symbols from the Greek |
|
310 |
|
311 $\omega$ & angular frequency & \si{\radian} \\ |
|
312 |
|
313 \end{symbols} |
|
314 |
|
315 %---------------------------------------------------------------------------------------- |
|
316 % DEDICATION |
|
317 %---------------------------------------------------------------------------------------- |
|
318 |
|
319 \dedicatory{For/Dedicated to/To my\ldots} |
|
320 |
|
321 %---------------------------------------------------------------------------------------- |
|
322 % THESIS CONTENT - CHAPTERS |
|
323 %---------------------------------------------------------------------------------------- |
|
324 |
|
325 \mainmatter % Begin numeric (1,2,3...) page numbering |
|
326 |
|
327 \pagestyle{thesis} % Return the page headers back to the "thesis" style |
|
328 |
|
329 % Include the chapters of the thesis as separate files from the Chapters folder |
|
330 % Uncomment the lines as you write the chapters |
|
331 |
|
332 \include{Chapters/Chapter1} |
|
333 \include{Chapters/Chapter2} |
|
334 \include{Chapters/Chapter3} |
|
335 %\include{Chapters/Chapter4} |
|
336 %\include{Chapters/Chapter5} |
|
337 |
|
338 %---------------------------------------------------------------------------------------- |
|
339 % THESIS CONTENT - APPENDICES |
|
340 %---------------------------------------------------------------------------------------- |
|
341 |
|
342 \appendix % Cue to tell LaTeX that the following "chapters" are Appendices |
|
343 |
|
344 % Include the appendices of the thesis as separate files from the Appendices folder |
|
345 % Uncomment the lines as you write the Appendices |
|
346 |
|
347 \include{Appendices/AppendixA} |
|
348 %\include{Appendices/AppendixB} |
|
349 %\include{Appendices/AppendixC} |
|
350 |
|
351 %---------------------------------------------------------------------------------------- |
|
352 % BIBLIOGRAPHY |
|
353 %---------------------------------------------------------------------------------------- |
|
354 |
|
355 \printbibliography[heading=bibintoc] |
|
356 |
|
357 %---------------------------------------------------------------------------------------- |
|
358 |
|
359 \end{document} |