prelude.tex 8.7 KB

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