-
Notifications
You must be signed in to change notification settings - Fork 0
/
thesis.tex
1016 lines (901 loc) · 34.1 KB
/
thesis.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% Alternative style: http://cleanthesis.der-ric.de/
% Related work:
% Object representation of scope during translation (coined "scope graph"):
% http://www.lirmm.fr/~ducour/Doc-objets/ECOOP/papers/0276/02760071.pdf
% MetaOcaml & related work by Walid Taha
% Interesting sugary languages: Dylan, Julia, Nim
% From Joe, "See S8. And also the whole paper.":
% https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/compiling-without-continuations.pdf
% PHOAS?
% Chipala ICFP'08 https://archive.alvb.in/msc/10_infomepcs1/literature/PHOAS_Chlipala.pdf
% Extensible Grammars for Language Specialization (must CITE)
% Cardelli, Matthes, Abadi - DigEquipRC
% Scratch space:
% \(\W\)t\(\W\) -> \1e\2
% Terminology:
% macro argument -> parameter
% ast -> term (when appropriate)
% ? -> constructor
% label, ? -> syntactic construct
% constant -> value
% transformation -> rewrite / desugaring
% syntactic constant -> primitive value
% Make sure to introduce:
% expansion
% Make sure to search for:
% TODO, REF, CITE, CHECK, Pombrio, qqq
\RequirePackage{silence} % :-\
\WarningFilter{scrbook}{Usage of package `titlesec'}
\WarningFilter{titlesec}{Non standard sectioning command detected}
\documentclass[
10pt,
paper=letter,
footinclude=true,
headinclude=true,
american
]{scrbook}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Packages
\PassOptionsToPackage{utf8}{inputenc}
\usepackage{inputenc}
\PassOptionsToPackage{
eulermath=true, % use awesome Euler fonts for mathematical formulae (only with pdfLaTeX)
beramono=true % toggle a nice monospaced font (w/ bold)
}{classicthesis}
\usepackage[T1]{fontenc}
\usepackage[
linedheaders=true,
parts=true
]{classicthesis/classicthesis}
% More symbols
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pifont} % for x-mark
\usepackage{newunicodechar}
% More commands
\usepackage{xargs}
\usepackage{xspace}
\usepackage{xifthen}
% More environments
\usepackage{listings}
\usepackage{multicol}
\usepackage{alltt}
\usepackage{semantic}
\usepackage{bussproofs}
\usepackage{fancyvrb} % for BVerbatim
% More formatting
\usepackage{rotating}
\usepackage{multirow}
\usepackage{enumitem}
\usepackage{adjustbox}
\usepackage{booktabs}
\usepackage{array}
% More nice things
\usepackage{cleveref}
\usepackage{color}
%\usepackage{inconsolata}
% Scope stuff
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{matrix}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Settings
% Colors
\definecolor{goodRed}{rgb} {0.70, 0.37, 0.41} % LAB (50, 35, 10)
\definecolor{goodBlue}{rgb} {0.04, 0.50, 0.70} % LAB (50, -10, -35)
\definecolor{goodGreen}{rgb}{0.35, 0.50, 0.29} % LAB (50, -25, 27)
\hypersetup{
colorlinks=false,
citebordercolor=goodBlue,
linkbordercolor=goodRed,
urlbordercolor=goodGreen
}
% LstListing
\lstset{basicstyle=\ttfamily,breaklines=true,mathescape=true}
\lstset{framextopmargin=50pt,frame=bottomline}
% Theorems
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{assumption}{Assumption}
\newtheorem{corollary}{Corollary}
\newtheorem{property}{Property}
\newtheorem{goal}{Goal}
% Unicode "support"
\newunicodechar{λ}{$\lambda$}
\newunicodechar{Γ}{$\Gamma$}
\newunicodechar{ϵ}{$\epsilon$}
\newunicodechar{⊢}{$\vdash$}
\newunicodechar{ρ}{$\rho$}
\newunicodechar{α}{$\alpha$}
\newunicodechar{β}{$\beta$}
\newunicodechar{γ}{$\gamma$}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Commands
% General Formatting
\newcommand{\Sc}[1]{\textsc{#1}}
\newcommand{\Desc}[1]{\unskip\par\noindent\textsc{#1}}
\newenvironment{Table}
{\begin{center}\begin{tabular}{l l l @{\quad}l}}
{\end{tabular}\end{center}}
\newenvironment{TableForMitch}
{\begin{center}\begin{tabular}{r l l @{\quad}l}}
{\end{tabular}\end{center}}
\newenvironment{ProofTable}
{~\\\begin{tabular}{r l @{\quad} l}}
{\end{tabular}~\\}
\newenvironment{LongTable}
{\begin{center}\begin{tabular}
{l @{\;} c @{\;} l @{\;} c @{\;} l @{\;} c @{\;} l @{\quad} l}}
{\end{tabular}\end{center}}
\newcommand{\Indent}{\-\quad\quad}
%http://ftp.math.purdue.edu/mirrors/ctan.org/info/epslatex/english/epslatex.pdf
\newenvironment{Wide}{
\begin{list}{}{
\setlength{\topsep}{0pt}
\ifthenelse{\isodd{\thepage}}{
\setlength{\leftmargin}{-9em}
\setlength{\rightmargin}{0em}
}{
\setlength{\leftmargin}{0em}
\setlength{\rightmargin}{-9em}
}
\setlength{\listparindent}{\parindent}
\setlength{\itemindent}{\parindent}
\setlength{\parsep}{\parskip}}
\item[]}{\end{list}}
\newcommand{\InABox}[1]{
\vspace{4mm}
\noindent
\fbox{
\begin{minipage}{\dimexpr\linewidth-4\fboxsep-2\fboxrule}
#1
\end{minipage}
}
}
\newcommand{\Sample}[1]{
\textbf{#1}
}
\newcommand{\Img}[1]{
\begin{minipage}[b]{0.35\textwidth}
\input{img/#1.tex}
\end{minipage}
}
\newcommand{\BoxedHeading}[1]{\vspace{1em}\framebox{\textbf{#1}}\newline}
\newcommand{\TinyHeading}[1]{\textsc{#1}}
\newenvironment{SidewaysFigure}{
\begin{figure*}[h!]\begin{turn}{270}\begin{minipage}{18cm}
\bgroup\def\arraystretch{4}
}{
\egroup\end{minipage}\end{turn}\end{figure*}
}
\newenvironment{SidewaysTable}{
\begin{table*}[h!]\begin{turn}{270}\begin{minipage}{21cm}
\bgroup
}{
\egroup\end{minipage}\end{turn}\end{table*}
}
% Rotate table headers: https://tex.stackexchange.com/questions/98388/how-to-make-table-with-rotated-table-headers-in-latex
\newcolumntype{R}[2]{%
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
l%
<{\egroup}%
}
\newcommand*\rot{\multicolumn{1}{R{90}{1em}}}
% Math Notation
\newcommand{\ddd}{\;\dots\;}
\newcommand{\dd}{\,...\,}
\newcommandx*{\seq}[3][1=1,3=n]{{#2}_{#1}\dots{#2}_{#3}}
\newcommand{\Exists}[1]{\exists{#1}.\,\,}
\newcommand{\ExistsUnique}[1]{\exists!{#1}.\,\,}
\newcommand{\NotExists}[1]{\not\exists{#1}.\,\,}
\newcommand{\Forall}[1]{\forall{#1}.\,\,}
\newcommand{\NotForall}[1]{\not\forall{#1}.\,\,}
\newcommand{\Iff}{\;\;\text{ iff }\;\;}
\newcommand{\SetSuchThat}[2]{\{#1 \;|\; #2\}}
\newcommand{\DisjUnion}{\,\dot\cup\,}
\newcommand{\To}{\Rightarrow}
\newcommand{\Defeq}{\;\triangleq\;}
\newcommand{\St}[2]{\{#1\,|\,#2\}}
\newcommandx*{\Seqn}[3][1 = 1, 3 = n]{{#2}_{#1}\,...\,{#2}_{#3}}
\newcommand{\DoublePlus}{+\kern-1.3ex+\kern0.8ex}
% Code notation
\newcommand{\Code}[1]{\texttt{#1}}
\newenvironment{Codes}
{\begin{alltt}\leftskip=1.5em} % \small
{\end{alltt}}
% PL Notation
\newcommand{\CoreStep}{{\rule{0pt}{1.2\baselineskip}{\ensuremath\longrightarrow}}}
\newcommand{\SurfStep}{{\rule{0pt}{1.2\baselineskip}{\ensuremath\dashrightarrow}}}
% Inference Rules
\newcommandx*{\Inference}[3][1=\empty]{\inference[#1]{#2}{#3}\hspace{1em}\vspace{1.5em}}
\newcommand{\IS}{\vspace{0.25em}} % Not enough space by default...
\newcommand{\TypeLabel}[1]{
\setlength{\fboxsep}{3pt}\fbox{$#1$}~\\
}
\newcommand{\sideLabel}[2]{
\raisebox{2em}{(#1)}
\hspace*{\fill}
#2
\hspace*{\fill}
\phantom{\raisebox{1em}{(#1)}}
}
% Misc Notation
\newcommand{\xmark}{\ding{55}}
\newcommand{\cmark}{\ding{51}}
\newcommand{\qmark}{\framebox{?}}
% Matching and Substitution
\newcommand{\Subs}[2]{#1 \bullet #2}
\newcommand{\Match}[2]{#1 / #2}
\newcommand{\subs}{\bullet}
\newcommand{\match}{/}
% Matching & Subs
\newcommand{\SimpleMatch}[2]{#1 / #2}
\newcommand{\SimpleSubs}[2]{#1 \bullet #2}
% Judgements
\newcommand{\SaysSubs}[4]{\SimpleSubs{#2}{#3} = #4}
\newcommand{\SaysMatch}[5]{#1 \vdash \SimpleMatch{#2}{#3} = #4,#5}
\newcommand{\SaysExpr}[3]{#1 \vdash #2 : #3}
\newcommand{\SaysPatt}[4]{#1;#2 \vdash #3 : #4}
\newcommand{\SaysRule}[4]{#1 \vdash #2 : #3 \to #4}
\newcommand{\SaysEnv}[3]{#1 \vdash #2 : #3}
\newcommand{\SaysDesugar}[3]{#1 \vdash desugar(#2) = #3}
\newcommand{\SaysDs}[3]{#1 \vdash #2 \rightsquigarrow_\text{ds} #3}
\newcommand{\SaysDss}[3]{#1 \vdash #2 \rightsquigarrow^{*}_\text{ds} #3}
\newcommand{\SaysExp}[3]{#1 \vdash #2 \rightsquigarrow_\text{exp} #3}
\newcommand{\SaysResugar}[3]{#1 \vdash resugar(#2) = #3}
\newcommand{\SaysRs}[3]{#1 \vdash #2 \rightsquigarrow_\text{rs} #3}
\newcommand{\SaysRss}[3]{#1 \vdash #2 \rightsquigarrow^{*}_\text{rs} #3}
\newcommand{\SaysUnexp}[3]{#1 \vdash #2 \rightsquigarrow_\text{unexp} #3}
\newcommand{\SaysCanBind}[3]{#1 \vdash #2 \sim_{bind} #3}
\newcommand{\SaysCanShadow}[3]{#1 \vdash #2 \sim_{shadow} #3}
% Syntypes
\newcommand{\TRefn}{\textrm{Refn}}
\newcommand{\TDecl}{\textrm{Decl}}
\newcommand{\TString}{\textrm{String}}
% Scope
\newcommand{\Bind}[3]{\texttt{bind } #3 \texttt{ in } #2 \ensuremath{\in #1}}
\newcommand{\Prov}[2]{\texttt{provide } #2 \ensuremath{\in #1}}
\renewcommand{\<}{\le}
\newcommand{\Bound}{\mapsto}
% Expressions
\newcommand{\Variable}[4]{
{\textit{#3}}\textrm{\textsc{$#2$}}_\mathit{#1}^\textsc{#4}}
\newcommand{\ConstRm}[1]{\texttt{#1}}
\newcommand{\NodeRm}[2]{\Node{\texttt{#1}}{#2}}
\newcommand{\NodeStd}{\Node{C}{\Seqn[1]{e}[n]}}
\newcommand{\ASTNode}[4]{(\Variable{#3}{}{#2}{#1}\;#4)}
%\newcommandx*{\Node}[3][2=\empty]{({#1}_{#2}\;#3)}
\newcommandx*{\Node}[2]{({#1}\;#2)}
\newcommandx*{\Core}[3][2=\empty]{\ASTNode{Core}{#1}{#2}{#3}}
\newcommandx*{\Aux}[3][2=\empty]{\ASTNode{Aux}{#1}{#2}{#3}}
\newcommandx*{\Surf}[3][2=\empty]{\ASTNode{Surf}{#1}{#2}{#3}}
%\newcommand{\CoreLabel}{\Variable{Core}{}{}{C}}
%\newcommand{\AuxLabel}{\Variable{Aux}{}{}{C}}
%\newcommand{\SurfLabel}{\Variable{Surf}{}{}{C}}
\newcommandx*{\Decl}[3][1=\empty, 3=\empty]{\Variable{#1}{#2}{#3}{d}}
\newcommandx*{\Refn}[3][1=\empty, 3=\empty]{\Variable{#1}{#2}{#3}{r}}
\newcommand{\Value}{\textit{value}}
\newcommand{\Tag}[2]{(\Code{Tag}\ #1\ #2)}
\newcommand{\MacHead}[2]{(\Code{Head}\ #1\ #2)}
\newcommand{\MacBody}[1]{(\Code{Body}\ {#1})}
\newcommand{\MacHeadf}{\Code{Head}}
\newcommand{\MacBodyf}{\Code{Body}}
%\newcommand{\Tag}[3]{(\Code{Tag}_{#1 \To #2} #3)}
\newcommand{\Subterm}{\sqsubseteq}
% Specific Variables
\newcommand{\VarX}{\Variable{\empty}{x}{}{}}
\newcommand{\VarXi}{\Variable{i}{x}{}{}}
\newcommand{\VarXj}{\Variable{j}{x}{}{}}
\newcommand{\VarY}{\Variable{\empty}{y}{}{}}
\newcommand{\VarYi}{\Variable{i}{y}{}{}}
\newcommand{\VarYj}{\Variable{j}{y}{}{}}
\newcommandx*{\DeclX}[1][1=\empty]{\Decl[#1]{x}}
\newcommandx*{\DeclXi}[1][1=\empty]{\Decl[i]{x}[#1]}
\newcommandx*{\DeclXj}[1][1=\empty]{\Decl[j]{x}[#1]}
\newcommandx*{\DeclXk}[1][1=\empty]{\Decl[k]{x}[#1]}
\newcommandx*{\DeclXl}[1][1=\empty]{\Decl[l]{x}[#1]}
\newcommandx*{\DeclY}[1][1=\empty]{\Decl[#1]{y}}
\newcommandx*{\DeclYi}[1][1=\empty]{\Decl[i]{y}[#1]}
\newcommandx*{\DeclYj}[1][1=\empty]{\Decl[j]{y}[#1]}
\newcommandx*{\RefnX}[1][1=\empty]{\Refn[#1]{x}}
\newcommandx*{\RefnXi}[1][1=\empty]{\Refn[i]{x}[#1]}
\newcommandx*{\RefnXj}[1][1=\empty]{\Refn[j]{x}[#1]}
\newcommandx*{\RefnXk}[1][1=\empty]{\Refn[k]{x}[#1]}
\newcommandx*{\RefnY}[1][1=\empty]{\Refn[#1]{y}}
\newcommandx*{\RefnYi}[1][1=\empty]{\Refn[i]{y}[#1]}
\newcommandx*{\RefnYj}[1][1=\empty]{\Refn[j]{y}[#1]}
% Patterns
\newcommand{\Fresh}[2]{(\Code{Fresh}\,#1.\,#2)}
\newcommand{\PVar}{\alpha}
\newcommand{\PVarA}{\alpha}
\newcommand{\PVarB}{\beta}
\newcommand{\PVarC}{\delta}
\newcommand{\PVarD}{\epsilon}
% SeqPatterns
\newcommand{\Cons}[2]{#1, #2}
\newcommand{\Rep}[2]{#1\ {*}_{#2}}
\newcommand{\Ell}[1]{#1*}
\newcommand{\EList}[1]{\lceil #1 \rceil}
% Types
\newcommand{\ValueT}{\texttt{Value}}
\newcommand{\DeclT}{\texttt{Decl}}
\newcommand{\RefnT}{\texttt{Refn}}
% Desugaring Rules
\newcommand{\DsRule}[2]{\Code{sugar}\;\Variable{}{}{#1}{} = \{#2\}}
\newcommand{\DsRuleFancy}[3]{\Code{sugar}\;#1 =
\begin{cases}
#2 \\
\quad ... \\
#3
\end{cases}
}
\newcommand{\DsRuleCase}[3]{#2;F;#1 \To #3}
% Environments
\newcommand{\EmptyEnv}{\{\}}
\newcommand{\ConsEnv}[3]{#1:#2,\,#3}
\newcommand{\BList}[1]{\lceil #1 \rceil}
% Substitutions
\newcommand{\EmptySubs}{\{\}}
% Hacks
\newcommand{\WhitePhantom}[1]{{\color{white}#1}}
\newcommand{\tall}{\phantom{Q}\!\!\!\!}
\newenvironment{CorrectlyIndentedCodes}{
\newline\begin{minipage}{\linewidth}\vspace{0.75em}\begin{Codes}
}{
\end{Codes}\end{minipage}\vspace{0.75em}
}
\newcommand{\RomanNumbering}{
\clearscrheadfoot
\pagenumbering{roman}
\cfoot[]{\pagemark}
}
\newcommand{\ArabicNumbering}{
\clearscrheadfoot
\pagenumbering{arabic}
% Taken from classicthesis. The only way I see to restore this is to duplicate the code:
\lehead{\mbox{\llap{\small\pagemark\kern2em}\headmark\hfil}}
\rohead{\mbox{\hfil{\headmark}\rlap{\small\kern2em\pagemark}}}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Evaluation
\newcommand{\Expand}[1]{\Code{exp}_{\Rs}\ {#1}}
\newcommand{\Unexpand}[2]{\Code{unexp}_{\Rs}\ {#1}\ {#2}}
\newcommand{\SurfaceToTerm}[1]{\Code{s->e}\ \,#1}
\newcommand{\CoreToTerm}[1]{\Code{c->e}\ \,#1}
\newcommand{\TermToSurface}[1]{\Code{e->s}\ \,#1}
\newcommand{\TermToCore}[1]{\Code{e->c}\ \,#1}
% Possible alternative to fancyD and fancyR:
%\newcommand{\FullExpand}{\Code{desugar}^*_{\Rs}}
%\newcommand{\FullUnexpand}{\Code{resugar}^*_{\Rs}}
\newcommand{\Expandf}{\Code{exp}_{\Rs}}
\newcommand{\ExpandRec}[1]{\textnormal{\Code{desugar}}_{\Rs}\ {#1}}
\newcommand{\ExpandRecf}{\textnormal{\Code{desugar}}_{\Rs}}
\newcommand{\ExpandRecff}{\textnormal{\Code{desugar}}}
\newcommand{\Unexpandf}{\textnormal{\Code{unexp}}_{\Rs}}
\newcommand{\UnexpandRec}[1]{\textnormal{\Code{resugar}}_{\Rs}\ {#1}}
\newcommand{\UnexpandRecf}{\textnormal{\Code{resugar}}_{\Rs}}
\newcommand{\UnexpandRecff}{\textnormal{\Code{resugar}}}
\newcommand{\UnexpandRecH}[1]{\textnormal{\Code{R}}_{\Rs}'\ {#1}}
\newcommand{\Expd}[1]{\textnormal{\Code{E}}\ {#1}}
\newcommand{\Expdf}{\textnormal{\Code{E}}}
\newcommand{\Unexp}[2]{\textnormal{\Code{U}}\ {#1}\ {#2}}
\newcommand{\Unexpf}{\textnormal{\Code{U}}}
\newcommand{\ExpR}[1]{\textnormal{\Code{Des}}\ {#1}}
\newcommand{\ExpRf}{\textnormal{\Code{Des}}}
\newcommand{\UnexpR}[1]{\textnormal{\Code{Res}}\ {#1}}
\newcommand{\UnexpRf}{\textnormal{\Code{Res}}}
\newcommand{\compose}{\cup} % Was \cdot in the original paper, which was terrible notation.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Types
\newcommand{\Isurf}{I_\textit{surf}}
\newcommand{\Icore}{I_\textit{core}}
\newcommand{\Jsurf}{J_\textit{surf}}
% Judgments
\newcommand{\saysEq}[2]{\{#1 = #2\}}
\newcommand{\saysEqs}[3]{\{#1 = #2 = #3\}}
\newcommand{\saysT}[3]{#1 \vdash #2 : #3}
\newcommand{\saysTt}[3]{#1 \vdash \texttt{#2} : \texttt{#3}}
\newcommand{\saysTtt}[3]{#1 \vdash \texttt{#2} : #3}
\newcommand{\saysTL}[3]{#1 \vdash #2 \Leftarrow #3}
\newcommand{\saysTR}[3]{#1 \vdash #2 \Rightarrow #3}
\newcommand{\saysE}[3]{#1 \vdash #2 \Downarrow #3}
\newcommand{\saysJ}[2]{#1 \Vdash #2}
\newcommand{\saysD}[2]{#1 \Vdash #2}
\newcommand{\saysVD}[3]{#1 \Vdash #2 \to #3}%{#2 \vdash_{#1} #3}
\newcommand{\saysVJ}[3]{#1 \Vdash #2\,/\,#3}
\newcommand{\saysTJ}[4]{#2 \Vdash #3 : #4 \text{ by } #1}
% Derivations
\newcommandx*{\RZero}[2][1=\empty]{\AxiomC{$#2$}}
\newcommandx*{\ROne}[2][1=\empty]{\LeftLabel{\small{#1}}\UnaryInfC{$#2$}}
\newcommandx*{\RTwo}[2][1=\empty]{\LeftLabel{\small{#1}}\BinaryInfC{$#2$}}
\newcommandx*{\RThree}[2][1=\empty]{\LeftLabel{\small{#1}}\TrinaryInfC{$#2$}}
\newcommandx*{\RFour}[2][1=\empty]{\LeftLabel{\small{#1}}\QuaternaryInfC{$#2$}}
\newcommandx*{\RFive}[2][1=\empty]{\LeftLabel{\small{#1}}\QuinaryInfC{$#2$}}
\newcommand{\squeeze}[2]{\hspace{-#1}{#2}\hspace{-#1}}
% Terminology
\newcommand{\Lang}{\mathcal{L}}
\newcommand{\ResugarTy}[2]{\ConstrIt{resugar}{#1, #2}}
% Ellipses
\newcommand{\nodeTt}[2]{({\texttt{#1}}\;{#2})}
\newcommand{\cons}[2]{\nodeTt{cons}{#1\ #2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Scope
% Ports
\definecolor{imColor}{rgb}{0.0 0.36 0.84}
\definecolor{exColor}{rgb}{0.63 0.0 0.0}
\newcommand{\ImSymb}{{\color{imColor}\uparrow}}
\newcommand{\ExSymb}{{\color{exColor}\downarrow}}
\newcommand{\ImSymbBackwards}{{\color{imColor}\downarrow}}
\newcommand{\ExSymbBackwards}{{\color{exColor}\uparrow}}
\newcommand{\im}{\ImSymb}
\newcommand{\ex}{\ExSymb}
\newcommand{\ImSymbCirc}{\ImSymb}
\newcommand{\ExSymbCirc}{\ExSymb}
\newcommand{\Root}{\textrm{\textsc{r}}}
\newcommand{\Imp}{\textrm{\textsc{r}}^\ImSymb\!}
\newcommand{\Exp}{\textrm{\textsc{r}}^\ExSymb\!}
% Scope Terminology
\newcommand{\sap}{scope-as-a-preorder}
\newcommand{\Sap}{Scope-as-a-preorder}
\newcommand{\sas}{scope-as-sets}
\newcommand{\Sas}{Scope-as-sets}
\newcommand{\SAS}{\textsc{sas}}
\newcommand{\SAP}{\textsc{sap}}
% Scope Specifications
\newcommand{\SpecImpt}[1]{\texttt{import}\; #1}
\newcommand{\SpecExpt}[1]{\texttt{export}\; #1}
\newcommand{\SpecBind}[2]{\texttt{bind}\; #2 \;\texttt{in}\; #1}
\newcommand{\SpecSelf}{\texttt{re-export}}
\newcommand{\SigImpt}[2]{\ensuremath{\SpecImpt{#2} \in \Sigma[#1]}}
\newcommand{\SigExpt}[2]{\ensuremath{\SpecExpt{#2} \in \Sigma[#1]}}
\newcommand{\SigSelf}[1]{\ensuremath{\SpecSelf \in \Sigma[#1]}}
\newcommand{\SigBind}[3]{\ensuremath{\SpecBind{#2}{#3} \in \Sigma[#1]}}
\newcommand{\SigNotBind}[3]{\ensuremath{\SpecBind{#2}{#3} \not\in \Sigma[#1]}}
\newcommand{\SigImptRm}[2]{\ensuremath{\SpecImpt{#2} \in \Sigma[\texttt{#1}]}}
\newcommand{\SigExptRm}[2]{\ensuremath{\SpecExpt{#2} \in \Sigma[\texttt{#1}]}}
\newcommand{\SigSelfRm}[1]{\ensuremath{\SpecSelf \in \Sigma[\texttt{#1}]}}
\newcommand{\SigBindRm}[3]{\ensuremath{\SpecBind{#2}{#3} \in \Sigma[\texttt{#1}]}}
\newcommand{\SigPImpt}[1]{\SigImpt{C}{#1}}
\newcommand{\SigPExpt}[1]{\SigExpt{C}{#1}}
\newcommand{\SigPBind}[2]{\SigBind{C}{#1}{#2}}
\newcommand{\SigPSelf}{\SigSelf{C}}
\newcommand{\FactP}[2]{#1 \< #2 \in \Sigma[C]}
% Scope Enviroments
\newcommand{\SigmaCore}{\Sigma_\mathit{core}}
\newcommand{\SigmaSurf}{\Sigma_\mathit{surf}}
% Judgements
\newcommandx*{\SaysScope}[4][1=\Sigma]{#1,#2 \vdash #3 \< #4}
\newcommand{\SaysScopeNot}[3]{\Sigma,#1 \not\vdash #2 \< #3}
\newcommand{\SaysScopeBound}[3]{\Sigma,#1 \vdash #2 \Bound #3}
\newcommand{\SaysScopeNotBound}[3]{\Sigma,#1 \not\vdash #2 \Bound #3}
\newcommand{\SaysScopeConflict}[3]{\Sigma,#1 \vdash #2 \textit{ conflicts } #3}
\newcommandx*{\SaysScopeEqa}[3][1=\Sigma]{#1 \vdash #2 =_\alpha #3}
\newcommandx*{\SaysScopeEqv}[3][1=\Sigma]{#1 \vdash #2 \cong #3}
\newcommand{\SaysScopeEqs}[2]{\Sigma \vdash #1 =_\mathit{shape} #2}
\newcommand{\SaysScopeS}[3]{\ensuremath{#1 \!\vdash\! #2 \!\<\! #3}} % Shorthand for proof
\newcommand{\SaysScopeWB}[1]{\Sigma \vdash \textsc{wb}\;#1}
% Scope Diagrams
\definecolor{arrowColor}{rgb}{0.25 0.55 0.55}
\definecolor{arrowColorHL}{rgb}{0.7 0.45 0.25}
\newenvironment{tikzScopeDiagram}[1][]
{\def\tikzScopeDiagramMode{#1}
\begin{tikzpicture}}
{\end{tikzpicture}}
\newenvironment{tikzEdges}
{\begin{pgfonlayer}{background}}
{\end{pgfonlayer}}
\newenvironment{scopeDescription}
{\noindent\begin{minipage}[t]{0.85\dimexpr\linewidth}\vspace{-0.25em}\setlength{\columnsep}{1em}\begin{multicols}{2}}
{\end{multicols}\vspace{-0.25em}\end{minipage}}
% Scope Diagrams - With Ports
\newcommand{\tikzRoot}[2]{%
#2{#1}{}
}
\newcommand{\tikzChild}[3]{%
\node(#2)[#3]{\Code{#1}};
\ifthenelse{\equal{\tikzScopeDiagramMode}{simple}}{}{
\node(#2-)[left= -0.7em of #2]{$\ImSymbCirc$};
\node(#2+)[right= -0.7em of #2]{$\ExSymbCirc$};
}
}
\newcommand{\tikzParentOne}[5]{%
\tikzChild{#1}{#4}{#5};
\ifthenelse{\equal{\tikzScopeDiagramMode}{simple}}{
#3{#2}{below = 2em of #4.center};
}{
#3{#2}{below = 2em of #4.center};
}
\path[-,thick,dotted] (#4) edge (#2);
}
\newcommand{\tikzParentTwo}[7]{%
\tikzChild{#1}{#6}{#7};
\ifthenelse{\equal{\tikzScopeDiagramMode}{simple}}{
#3{#2}{below left = 2em and 1.2em of #6.center};
#5{#4}{below right = 2em and 1.2em of #6.center};
}{
#3{#2}{below left = 2.5em and 1.5em of #6.center};
#5{#4}{below right = 2.5em and 1.5em of #6.center};
}
\path[-,thick,dotted] (#6) edge (#2);
\path[-,thick,dotted] (#6) edge (#4);
}
\newcommand{\tikzParentThree}[9]{%
\tikzChild{#1}{#8}{#9};
\ifthenelse{\equal{\tikzScopeDiagramMode}{simple}}{
#3{#2}{below left = 2em and 2.33em of #8.center};
#5{#4}{below = 2em of #8.center};
#7{#6}{below right = 2em and 2.33em of #8.center};
}{
#3{#2}{below left = 2.5em and 3em of #8.center};
#5{#4}{below = 2.5em of #8.center};
#7{#6}{below right = 2.5em and 3em of #8.center};
}
\path[-,thick,dotted] (#8) edge (#2);
\path[-,thick,dotted] (#8) edge (#4);
\path[-,thick,dotted] (#8) edge (#6);
}
\newcommand{\tikzParentThreeWide}[9]{%
\tikzChild{#1}{#8}{#9};
\ifthenelse{\equal{\tikzScopeDiagramMode}{simple}}{
#3{#2}{below left = 2em and 2.66em of #8.center};
#5{#4}{below = 2em of #8.center};
#7{#6}{below right = 2em and 2.66em of #8.center};
}{
#3{#2}{below left = 2.5em and 4em of #8.center};
#5{#4}{below = 2.5em of #8.center};
#7{#6}{below right = 2.5em and 4em of #8.center};
}
\path[-,thick,dotted] (#8) edge (#2);
\path[-,thick,dotted] (#8) edge (#4);
\path[-,thick,dotted] (#8) edge (#6);
}
\newcommand{\tikzParentFour}[2]{%
\def\ArgI{#1}%
\def\ArgII{#2}%
\tikzParentFourContinued
}
\newcommand{\tikzParentFourContinued}[9]{%
\tikzChild{\ArgI}{#8}{#9};
#1{\ArgII}{below left = 3.5em and 7.5em of #8.center};
#3{#2}{below left = 3.5em and 1em of #8.center};
#5{#4}{below right = 3.5em and 1em of #8.center};
#7{#6}{below right = 3.5em and 6em of #8.center};
\path[-,thick,dotted] (#8) edge (\ArgII);
\path[-,thick,dotted] (#8) edge (#2);
\path[-,thick,dotted] (#8) edge (#4);
\path[-,thick,dotted] (#8) edge (#6);
}
% Scope Diagrams - Edges
\newcommand{\tikzEdgeTemplate}[4]{
\path[->, line width=0.15em, color=teal,
shorten <=-0.2em, shorten >=-0.2em, #3]
(#2) edge node [below] {#4} (#1);
}
\newcommandx*{\tikzEdge}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{#3}{#4}}
\newcommandx*{\tikzEdgeL}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend right=15,#3}{#4}}
\newcommandx*{\tikzEdgeR}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend left=15,#3}{#4}}
\newcommandx*{\tikzEdgeLL}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend right=30,#3}{#4}}
\newcommandx*{\tikzEdgeRR}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend left=30,#3}{#4}}
\newcommandx*{\tikzEdgeLLL}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend right=45,#3}{#4}}
\newcommandx*{\tikzEdgeRRR}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend left=45,#3}{#4}}
\newcommandx*{\tikzEdgeRRRR}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend left=85,#3}{#4}}
\newcommandx*{\tikzEdgeD}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{dashed,#3}{#4}}
\newcommandx*{\tikzEdgeDL}[4][3=\empty,4=\empty]{
\tikzEdgeTemplate{#1}{#2}{bend right=15,dashed,#3}{#4}}
% Scope Diagrams: binding specs
\newenvironment{ScopeRules}
{\begin{tabular}{l @{\;} c @{\;} l}}
{\end{tabular}}
\newcommand{\RuleImpt}[2]{\SpecImpt{\Code{#2}} &$\in$& $\Sigma[\Code{#1}]$}
\newcommand{\RuleExpt}[2]{\SpecExpt{\Code{#2}} &$\in$& $\Sigma[\Code{#1}]$}
\newcommand{\RuleSelf}[1]{\SpecSelf &$\in$& $\Sigma[\Code{#1}]$}
\newcommand{\RuleBind}[3]{\SpecBind{\Code{#2}}{\Code{#3}} &$\in$& $\Sigma[\Code{#1}]$}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Terminology
\newcommand{\Constr}[2]{\ifthenelse{\isempty{#2}}{#1}{#1(#2)}}
\newcommand{\ConstrTt}[2]{\Constr{\texttt{#1}}{#2}}
\newcommand{\ConstrIt}[2]{\Constr{\textit{#1}}{#2}}
\newcommand{\ConstrCal}[2]{\Constr{\mathcal{#1}}{#2}}
\newcommand{\ConstrBb}[2]{\Constr{\mathbb{#1}}{#2}}
\newcommand{\ConstrSub}[3]{\ifthenelse{\isempty{#2}}{#1}{#1_{#2}(#3)}}
\newcommand{\ConstrSubTt}[3]{\ConstrSub{\texttt{#1}}{#2}{#3}}
\newcommand{\ConstrSubIt}[3]{\ConstrSub{\textit{#1}}{#2}{#3}}
\newcommand{\ConstrSubCal}[3]{\ConstrSub{\mathcal{#1}}{#2}{#3}}
% Math Terminology
\newcommand{\Op}[2]{\ConstrIt{#1}{#2}}
\newcommand{\Arity}[1]{\ConstrIt{arity}{#1}}
\newcommand{\Domain}[1]{\ConstrIt{domain}{#1}}
\newcommand{\Range}[1]{\ConstrIt{range}{#1}}
\newcommand{\Image}[1]{\ConstrIt{image}{#1}}
% Resugaring Terminology
\newcommand{\Tool}{\textit{Resugarer}\xspace}
\newcommand{\Desugar}[1]{\ConstrBb{D}{#1}}
\newcommand{\Resugar}[1]{\ConstrBb{R}{#1}}
\newcommand{\Resugarer}{\Sc{Confection}}
\newcommand{\DesugarRule}[2]{\texttt{#1}\;\;\Rightarrow\;\;\texttt{#2}}
\newcommand{\LongDesugarRule}[2]{\texttt{#1}\\\;\;\Rightarrow\;\;\texttt{#2}}
\newcommand{\rulelist}{rulelist}
\newcommand{\rulelists}{rulelists}
\newcommand{\Rulelist}{Rulelist}
\newcommand{\Getput}{\emph{GetPut}}
\newcommand{\Putget}{\emph{PutGet}}
\newcommand{\Rs}{\mathit{rs}}
% Scope Terminology
\newcommand{\Scopeset}[1]{\ConstrIt{scope\mbox{-}set}{#1}}
\newcommand{\Scope}[1]{\ConstrCal{S}{#1}}
\newcommand{\ConvA}[1]{\ConstrIt{Conv1}{#1}}
\newcommand{\ConvB}[1]{\ConstrIt{Conv2}{#1}}
\newcommand{\Norm}[1]{\ConstrIt{Norm}{#1}}
\newcommand{\PVars}[1]{\ConstrIt{pattern-vars}{#1}}
% Evaluation Terminology
\newcommand{\Sugar}[1]{\ConstrIt{sugars}{#1}}
\newcommand{\Head}[1]{\ConstrIt{head}{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Brown Thesis Style
%% (brownthesis.cls, provided by the department)
\makeatletter
\newif\if@draft
\newif\ifc@pyright
\newif\ifl@fpage
\newif\ifl@tpage
\newif\ifl@epage
\newif\ift@cpage
\newif\if@sigpage
\DeclareOption{draft}{\@drafttrue\PassOptionsToClass{draft,twoside}{book}}
\DeclareOption{final}{\@draftfalse\PassOptionsToClass{final,oneside}{book}}
\DeclareOption{twoside}{\PassOptionsToClass{twoside}{book}}
\DeclareOption{oneside}{\PassOptionsToClass{oneside}{book}}
\DeclareOption{contents}{\t@cpagetrue}
\DeclareOption{nocontents}{\t@cpagefalse}
\DeclareOption{figures}{\l@fpagetrue}
\DeclareOption{nofigures}{\l@fpagefalse}
\DeclareOption{tables}{\l@tpagetrue}
\DeclareOption{notables}{\l@tpagefalse}
\DeclareOption{examples}{\l@epagetrue}
\DeclareOption{noexamples}{\l@epagefalse}
\DeclareOption{copyright}{\c@pyrighttrue}
\DeclareOption{nocopyright}{\c@pyrightfalse}
\DeclareOption{signature}{\@sigpagetrue}
\DeclareOption{nosignature}{\@sigpagefalse}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ExecuteOptions{11pt,final,copyright,contents,figures,tables,noexamples,signature}
\ProcessOptions\relax
\def\single@spacing{\def\baselinestretch{1}}
\def\final@spacing{\def\baselinestretch{1.3}}
\if@draft\single@spacing\else\final@spacing\fi
% Redefine thebibliography to add an entry in the table of contents
\let\@ldthebibliography=\thebibliography
\def\thebibliography#1{\@ldthebibliography{#1}%
\addcontentsline{toc}{chapter}{\bibname}}
% \author, \title are defined in book; here are the rest of the
% front matter defining macros
\def\dept#1{\gdef\@dept{#1}}
\def\degrees#1{\gdef\@degrees{#1}}
\def\principaladviser#1{\gdef\@principaladviser{#1, Director}}
\def\advis@r{Adviser}
\def\principaladvisor#1{\gdef\@principaladviser{#1, Director}%
\gdef\advis@r{Advisor}}
\def\dean#1{\gdef\@dean{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\def\copyrightyear#1{\gdef\@copyrightyear{#1}}
% -- Manos
% A paragraph must be inserted after the toc, that gives the
% places where parts of the thesis have been published before
\def\disclaimer#1{\gdef\@disclaimer{#1}}
%the default, however, is nothing
\let\@disclaimer\@empty
\def\@dept{Computer Science}
\def\@degrees{}
\def\@principaladviser{}
\def\@dean{}
\def\@submitdate{\ifcase\the\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space \number\the\year}
\ifnum\month=12
\@tempcnta=\year \advance\@tempcnta by 1
\edef\@copyrightyear{\number\the\@tempcnta}
\else
\def\@copyrightyear{\number\the\year}
\fi
% macros to deal with thesis readers.
% Up to 3 readers are allowed and at least 2 must be supplied
\newcount\@readers \@readers=1
\def\reader@one{\@latex@error{No \noexpand\reader supplied}\@ehc}
\def\reader@two{\@latex@error{At least two thesis readers are needed}\@ehc}
\let\reader@three\@empty
\let\@firstreaderfrom\@empty
\let\@secondreaderfrom\@empty
\let\@thirdreaderfrom\@empty
\newcommand*{\reader}[2][\@empty]{\ifcase\the\@readers\or
\gdef\@firstreaderfrom{#1} \gdef\reader@one{#2, Reader}\or
\gdef\@secondreaderfrom{#1} \gdef\reader@two{#2, Reader}\or
\gdef\@thirdreaderfrom{#1} \gdef\reader@three{#2, Reader}\or
\@latex@error{Too many readers supplied (max 3)\@ehc}\fi
\ifnum\@readers < 4 \global\advance\@readers\@ne\fi}
\def\titlep{%
\null\vskip 0.5in%
\begin{center}\@title\end{center}
\vfill
\begin{center}%
by\\
\@author\\
\@degrees%
\end{center}
\vfill
\begin{center}%
A dissertation submitted in partial fulfillment of the\\
requirements for the Degree of Doctor of Philosophy\\
in the Department of \@dept{} at Brown University%
\end{center}
\vfill
\begin{center}%
Providence, Rhode Island\\
\@submitdate%
\end{center}
\vskip.5in}
\def\copyrightpage{%
\null\vfill
\begin{center}
\Large\copyright\ Copyright \@copyrightyear{} by \@author
\end{center}
\vspace{12cm}
\vfill}
\def\signaturepage{%
\if@sigpage
\setcounter{page}{3}
%\evensidemargin 0.5in % [Justin]
\def\make@sigline##1##2{%
\begin{tabular}{lc}
Date \rule{1in}{.05mm}\hspace*{.75in} & \rule{3in}{.05mm}\\
& ##1\\ & ##2
\end{tabular}}%
\null\vskip.2in
\begin{center}
This dissertation by \@author{} is accepted in its present form by\\
the Department of \@dept{} as satisfying the dissertation requirement \\
for the degree of Doctor of Philosophy.
\end{center}
\vspace{.75in}
\let\old@stretch\baselinestretch \single@spacing\selectfont
\make@sigline{\@principaladviser}{\@empty}\\[.4in]
\centerline{Recommended to the Graduate Council}\\[.75in]
\make@sigline{\reader@one}{\@firstreaderfrom}\\[.40in]
\make@sigline{\reader@two}{\@secondreaderfrom}
\ifnum\@readers>3 \\[.40in]\make@sigline{\reader@three}{\@thirdreaderfrom}\fi
\\[.5in]\centerline{Approved by the Graduate Council}\\[.75in]
\make@sigline{\@dean}{Dean of the Graduate School}
\def\baselinestretch{\old@stretch}\selectfont
\clearpage
\thispagestyle{empty}
%\thispagestyle{plain} % [Justin]
\setcounter{page}{2}\cleardoublepage
\setcounter{page}{4}
%\evensidemargin 0in % [Justin]
\else
\setcounter{page}{1}
\fi
}
\def\abstract#1{\gdef\d@abstract{#1}}
\def\d@abstract{}
\def\abstractpage{%
\thispagestyle{empty}
%\thispagestyle{plain} % [Justin]
\noindent Abstract of ``\@title''
by \@author, Ph.D., Brown University, \@submitdate.\\[.5in]
\d@abstract\vfill\newpage}
\def\beforepreface{
\thispagestyle{empty}
\titlep\cleardoublepage
\ifc@pyright
\thispagestyle{empty} % [Justin]
\copyrightpage
\cleardoublepage
\addtocounter{page}{-1}
\fi
%\pagestyle{plain}
\signaturepage\cleardoublepage}
%\def\prefacesection#1{\chapter*{#1}\addcontentsline{toc}{chapter}{#1}}
% We don't really won't the preface sections to appear in the TOC
\def\prefacesection#1{\cleardoublepage\chapter*{#1}}
\long
\def\afterpreface{\cleardoublepage
\ift@cpage
\tableofcontents
\ifx\@disclaimer\@empty
\else
\vspace{0.5cm}
\single@spacing
\noindent
\hangindent\parindent
\makebox[\parindent][l]{\raisebox{0.2ex}{\large{$\star$}} }\@disclaimer
\if@draft\single@spacing\else\final@spacing\fi
\fi
% I don't have any tables
% \cleardoublepage\fi
% \ifl@tpage\addcontentsline{toc}{chapter}{List of Tables}\listoftables
\cleardoublepage\fi
\ifl@fpage\addcontentsline{toc}{chapter}{List of Figures}\listoffigures
\cleardoublepage\fi
\ifl@epage\addcontentsline{toc}{chapter}{List of Examples}\listofexamples
\cleardoublepage\fi}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Thesis
\begin{document}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\RomanNumbering
\title{Resugaring:\\Lifting Languages through Syntactic Sugar}
\author{Justin Pombrio}
\degrees{B.~S., Worcester Polytechnic Institute, 2011}
\principaladvisor{Shriram Krishnamurthi}
\reader[Northeastern Computer Science]{Mitchell Wand}
\reader[TU Delft Computer Science]{Eelco Visser}
\dean{}
\abstract{
Syntactic sugar is pervasive in language technology. Programmers use
it to shrink the size of a core language; to define domain-specific
languages; and even to extend their language. Unfortunately, when
syntactic sugar is eliminated by transformation, it obscures the
relationship between the user's source program and the transformed
program. First, it obscures the evaluation steps the program takes
when it runs, since these evaluation steps happen in the core
(desugared) language rather than the surface (pre-desugaring)
language the program was written in. Second, it obscures the
scoping rules for the surface language, making it difficult for
\Sc{ide}s and other tools to obtain binding information. And
finally, it obscures the types of surface programs, which can result
in type errors that reference terms the programmer did not write. I
address these problems by showing how evaluation steps, scoping
rules, and type rules can all be lifted---or \emph{resugared}---from
core to surface languages, thus restoring the abstraction provided
by syntactic sugar.
}
\abstractpage
\beforepreface
\prefacesection{Acknowledgements}
To Dad, for being my foundation.\\
\noindent To Nick and Alec and Andy, for building worlds with me.\\
\noindent To Joey and Eric and Chris, for making high-school fun.\\
\noindent To the board-gamers, tea-goers, movie-goers, and
puzz-lers. I'd name you all, but you're too many and I'd leave
someone out. You know who you are.\\
\noindent To Evan, for all the hugs.\\\\\\
%\noindent\rule{\textwidth}{.4pt}\\
\noindent To Roberta Thompson, Dan Dougherty, and Joshua Guttman,
for teaching me how to reason.\\
\noindent To Shriram, for teaching me how to write, how to present,
how to critique, how to be a researcher.\\
\noindent To Mitchell Wand and Eelco Visser, for overseeing this
large and technical body of work.\\
\noindent To Sorawee ``Oak'' Porncharoenwase, for diving deep into
Pyret with me.\\
\noindent To the NSF, which partially funded all of this work.\\
\noindent To the many \emph{anonymous, unpaid} reviewers who gave me
detailed feedback on my work.
\afterpreface
\ArabicNumbering