prelude.tex 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. \usepackage[english]{babel}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage{upgreek}
  5. \usepackage{paralist}
  6. \usepackage{enumitem}
  7. \usepackage{caption}
  8. \usepackage{mdframed}
  9. \usepackage{subcaption}
  10. % \usepackage{subfig}
  11. \usepackage[numbers,longnamesfirst]{natbib}
  12. % ------------------------------------------------------------------------
  13. \usepackage{xspace}
  14. \usepackage{xcolor}
  15. \usepackage[ruled,vlined]{algorithm2e}
  16. \usepackage{nicefrac}
  17. \usepackage{bbm}
  18. \usepackage{graphicx}
  19. % ------------------------------------------------------------------------
  20. % ------------------------------------------------------------------------
  21. \usepackage{mathpartir}
  22. \usepackage{bbold}
  23. \usepackage{yfonts}
  24. \usepackage{amsmath,amsfonts,amssymb}
  25. % ------------------------------------------------------------------------
  26. \usepackage{todonotes}
  27. \newcommand{\gb}[1]{\ifdraft\todo[author=Gilles,color=green, inline]{#1}\fi}
  28. \newcommand{\te}[1]{\ifdraft\todo[author=Thomas,color=yellow, inline]{#1}\fi}
  29. \newcommand{\jh}[1]{\ifdraft\todo[author=Justin, inline]{#1}\fi}
  30. \newcommand{\lf}[1]{\ifdraft\todo[author=Luis, color=cyan, inline]{#1}\fi}
  31. % ------------------------------------------------------------------------
  32. \usepackage{xargs}
  33. % \newcommandx{\note}[2][1=]{\todo[inline,linecolor=red,backgroundcolor=red!25,bordercolor=red,#1]{#2}}
  34. % ------------------------------------------------------------------------
  35. \newtheorem{thm}{Theorem}
  36. \newtheorem{defi}{Definition}
  37. \newtheorem{lem}[thm]{Lemma}
  38. \newtheorem{prop}[thm]{Proposition}
  39. \newtheorem{cor}[thm]{Corollary}
  40. \newtheorem{conj}[thm]{Conjecture}
  41. \newcommand{\rname}[1]{[{\sc #1}]}
  42. % ------------------------------------------------------------------------
  43. \DeclareMathOperator{\id}{id}
  44. \newcommand{\Dist}{\ensuremath{\mathbf{Distr}}}
  45. \newcommand{\dom}{\text{dom}}
  46. \newcommand{\dc}[1]{\langle{#1} \rangle}
  47. \newcommand{\dg}[2]{{#1}_{{[}{#2}{]}}}
  48. \newcommand{\ar}[2]{\nicefrac{#1}{#2}}
  49. \newcommand{\pr}[1]{\oint{#1}}
  50. \newcommand{\ex}[1]{\mathbb{E}[#1]}
  51. \newcommand{\fint}[2]{\int_{#1}\!{#2}}
  52. \newcommand{\aform}{\ensuremath{\phi}}
  53. \newcommand{\bform}{\ensuremath{\psi}}
  54. \newcommand{\genp}{\ensuremath{\mathcal{P}}}
  55. \newcommand{\genq}{\ensuremath{\mathcal{Q}}}
  56. \newcommand{\True}{\ensuremath{\mathop{\top}}}
  57. \newcommand{\False}{\ensuremath{\mathop{\perp}}}
  58. \newcommand{\Set}[1]{\{#1\}}
  59. % Sets
  60. \newcommand{\Nats}{\mathbb{N}}
  61. \newcommand{\Ints}{\mathbb{Z}}
  62. \newcommand{\Reals}{\mathbb{R}}
  63. % Distributions
  64. \newcommand{\bernD}{\mathbf{Bern}}
  65. \newcommand{\geomD}{\mathbf{Geom}}
  66. \newcommand{\unifD}{\mathbf{Unif}}
  67. \newcommand{\normD}{\mathbf{Norm}}
  68. \newcommand{\bd}[1]{\mathbf{#1}}
  69. \newcommand{\NN}{\mathbf{N}}
  70. \newcommand{\ZZ}{\mathbf{Z}}
  71. \newcommand{\RR}{\mathbf{R}}
  72. \newcommand{\BB}{\mathbf{B}}
  73. \newcommand{\FF}{\mathbf{F}}
  74. \newcommand{\T}{\mathbf{T}}
  75. \newcommand{\Mes}{\mathbf{Mes}}
  76. \newcommand{\Mem}{\mathsf{Mem}}
  77. \newcommand{\rv}[1]{\mathfrak{#1}}
  78. \newcommand{\A}{\mathfrak{A}}
  79. \newcommand{\B}{\mathfrak{B}}
  80. \newcommand{\M}{\mathfrak{M}}
  81. \newcommand{\X}{\mathfrak{X}}
  82. \newcommand{\Y}{\mathfrak{Y}}
  83. \newcommand{\Z}{\mathfrak{Z}}
  84. \newcommand{\dif} {\mathrm{d}}
  85. \newcommand{\Prob}{\mathbb{P}}
  86. \newcommand{\ExpSymb}{\mathbf{E}}
  87. \newcommand{\Exp}[1]{\ExpSymb[#1]}
  88. \newcommand{\CondExp}[2]{\ExpSymb[#1 \mid #2]}
  89. \newcommand{\indFn}[1]{\mathbb{1}_{\{#1\}}}
  90. \newcommand{\SigmaAlgebra}[1][F]{\mathcal{#1}}
  91. \newcommand{\col}[1]{\left[\begin{matrix} #1 \end{matrix} \right]}
  92. \newcommand{\comb}[2]{\binom{#1^2 + #2^2}{#1+#2}}
  93. \newcommand\q{[\![}
  94. \newcommand\p{]\!]}
  95. \newcommand\Sem[1]{\q #1 \p}
  96. \newcommand{\dsem}[2]{\denot{#2}_{#1}}
  97. \newcommand\bind[2]{\mathrm{bind} (#1, #2)}
  98. \newcommand\unit[1]{\mathrm{unit} (#1)}
  99. \newcommand{\pWhile}{\textsf{pWhile}\xspace}
  100. \newcommand{\expr}{\mathcal{E}}
  101. \newcommand{\dexpr}{\mathcal{D}}
  102. % Language
  103. \newcommand{\abort}{\mathsf{abort}}
  104. \newcommand{\skp}{\mathsf{skip}}
  105. \newcommand{\Var}{\mathcal{X}}
  106. \newcommand{\SVar}{\mathcal{S}}
  107. \newcommand{\Expr}{\mathcal{E}}
  108. \newcommand{\DExpr}{\mathcal{DE}}
  109. \newcommand{\Instr}{\mathcal{I}}
  110. \newcommand{\Cmd}{\mathcal{C}}
  111. \newcommand{\Seq}[2]{#1;\ #2}
  112. \newcommand{\while}[2]{\mathsf{while}\ #1\ \mathsf{do}\ #2}
  113. \newcommand{\ifstmt}[3]{\mathsf{if}\ #1\ \mathsf{then}\ #2\ \mathsf{else}\ #3}
  114. \newcommand{\Condt}[2]{\mathsf{if}\ #1\ \mathsf{then}\ #2}
  115. \newcommand{\Skip}{\mathsf{skip}}
  116. \newcommand{\Ass}[2]{#1 \leftarrow #2}
  117. \newcommand{\Rand}[2]{#1 \stackrel{\raisebox{-.25ex}[.25ex]%
  118. {\tiny $\mathdollar$}}{\raisebox{-.2ex}[.2ex]{$\leftarrow$}} #2}
  119. \newcommand{\Cond}[3]{\mathsf{if}\ #1\ \mathsf{then}\ #2\ \mathsf{else}\ #3}
  120. \newcommand{\WWhile}[2]{\mathsf{while}\ #1\ \mathsf{do}\ #2}
  121. \newcommand{\Call}[3]{#1 \leftarrow #2\mathsf{(}#3\mathsf{)}}
  122. \newcommand{\rnd}[2]{#1 \stackrel{\raisebox{-.25ex}[.25ex]{\tiny $\mathdollar$}}{\raisebox{-.2ex}[.2ex]{$\leftarrow$}} #2}
  123. \renewcommand{\Pr}[2]{\mathrm{Pr}_{#1}{\left[ #2 \right]}}
  124. \newcommand{\pre}{\Psi}
  125. \newcommand{\post}{\Phi}
  126. \newcommand{\Inv}{\varphi}
  127. \newcommand{\Equiv}[4]{%
  128. \vDash #1 \sim {#2}: {#3} \Rightarrow {#4} }
  129. \newcommand{\infr}[2]{
  130. {\renewcommand{\arraystretch}{1.1}
  131. \begin{array}{c}
  132. {#1}\\
  133. \hline
  134. {#2}
  135. \end{array}}}
  136. \newcommand{\side}[1]{\langle #1 \rangle}
  137. \newcommand{\sidel}{\side{1}}
  138. \newcommand{\sider}{\side{2}}
  139. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  140. % Listings setup
  141. \usepackage{listings}
  142. % Nice looking setup (stolen from TeX gurus), requires the beramono
  143. % package thou.
  144. \usepackage[T1]{fontenc}
  145. \usepackage{microtype}
  146. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  147. % Solution 1
  148. % \usepackage[scaled]{beramono}
  149. % \newcommand\Small{\fontsize{7pt}{7.2pt}\selectfont}
  150. % \newcommand*\LSTfont{\Small\ttfamily\SetTracking{encoding=*}{-60}\lsstyle}
  151. % End solution 1
  152. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  153. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  154. % Solution 2 (variation on 1)
  155. \usepackage[scaled]{beramono}
  156. \newcommand\Small{\fontsize{8.2pt}{8.4pt}\selectfont}
  157. \newcommand*\LSTfont{\Small\ttfamily\SetTracking{encoding=*}{-60}\lsstyle}
  158. % End solution 2
  159. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  160. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  161. % Solution 3 (Using inconsolata)
  162. % \usepackage{inconsolata}
  163. % \newcommand\Small{\fontsize{8.3pt}{8.5pt}\selectfont}
  164. % \newcommand*\LSTfont{\Small\ttfamily\SetTracking{encoding=*}{-60}\lsstyle}
  165. % End solution 3
  166. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  167. \def\lstrnd{\stackrel{\raisebox{-.15ex}{\ensuremath{\scriptscriptstyle\$}}}{\raisebox{-.2ex}{\ensuremath{\leftarrow}}}}
  168. \lstset{
  169. language=ML,
  170. basicstyle=\LSTfont\small,
  171. % basicstyle=\ttfamily\footnotesize,
  172. % numbersep=5pt,
  173. % tabsize=2,
  174. extendedchars=true,
  175. breaklines=true,
  176. keywordstyle=\bfseries,
  177. morekeywords={param,array,set,for,to,fi,var,return},
  178. % keywordstyle=\color{red},
  179. % frame=b,
  180. mathescape=true,
  181. literate={->}{{$\to$}}1%
  182. {=>}{{$\Rightarrow$}}1%
  183. {-->}{{$\qquad \leadsto$}}1%
  184. {~~}{{$\;\lstrnd\,$}}1%
  185. {:=}{{$\;\leftarrow\,$}}1%
  186. {<>}{{$\;\neq$}}2%
  187. {emptyset}{{$\emptyset$}}1,
  188. stringstyle=\ttfamily,
  189. showspaces=false,
  190. showtabs=false,
  191. xleftmargin=8pt,
  192. showstringspaces=false
  193. }
  194. \newcommand{\lstt}[1]{\mbox{\LSTfont #1}}
  195. \newcommand\lstiny{\fontsize{6.6pt}{6.8pt}\selectfont}
  196. \newcommand{\lstts}[1]{\mbox{\lstiny\ttfamily\SetTracking{encoding=*}{-60}\lsstyle #1}}
  197. % End listings setup
  198. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  199. \usepackage{xcolor}
  200. \definecolor{DarkGreen}{rgb}{0.1,0.5,0.1}
  201. \definecolor{DarkRed}{rgb}{0.5,0.1,0.1}
  202. \definecolor{DarkBlue}{rgb}{0.1,0.1,0.5}
  203. \usepackage{hyperref}
  204. \hypersetup{
  205. unicode=false, % non-Latin characters in Acrobat's bookmarks
  206. pdftoolbar=true, % show Acrobat toolbar?
  207. pdfmenubar=true, % show Acrobat menu?
  208. pdffitwindow=false, % page fit to window when opened
  209. pdftitle={}, % title
  210. pdfauthor={}
  211. pdfsubject={}, % subject of the document
  212. pdfnewwindow=true, % links in new window
  213. pdfkeywords={keywords}, % list of keywords
  214. colorlinks=true, % false: boxed links; true: colored links
  215. linkcolor=DarkRed, % color of internal links
  216. citecolor=DarkGreen, % color of links to bibliography
  217. filecolor=DarkRed, % color of file links
  218. urlcolor=DarkBlue, % color of external links
  219. }
  220. \usepackage{cleveref}
  221. \crefname{section}{\S}{\S}
  222. \Crefname{section}{\S}{\S}
  223. \crefname{prop}{proposition}{propositions}
  224. \Crefname{prop}{Proposition}{Propositions}
  225. \crefname{lem}{lemma}{lemmas}
  226. \Crefname{lem}{Lemma}{Lemmas}
  227. \crefname{thm}{theorem}{theorems}
  228. \Crefname{thm}{Theorem}{Theorems}
  229. \crefname{defi}{definition}{definitions}
  230. \Crefname{defi}{Definition}{Definitions}