macros.tex 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. \newlength\TODOWidth
  2. % Administrative
  3. \newcommand\TODO[1]{\footnote{TODO: {#1}}}
  4. % \newcommand\TODO[1]{
  5. % \par
  6. % \vspace{1mm}
  7. % \fbox{
  8. % \setlength\TODOWidth{\textwidth}
  9. % \addtolength\TODOWidth{-60pt}
  10. % \begin{tabular}{p{\TODOWidth}}
  11. % TODO: #1
  12. % \end{tabular}}
  13. % }
  14. % \newcommand\TODO[1]{\par{
  15. % \setbox0=\vbox{{\small \parbox{35mm}{#1}}} %{\parbox{3.5cm}{{\small #1}}}
  16. % \hskip-50mm\copy0
  17. % \vskip-\ht0
  18. % \vskip-2mm
  19. % }\par
  20. % }
  21. \newcommand\Core{{\sf\bf MLF}}
  22. % Misc
  23. \renewcommand\Or{~~|~~}
  24. \newcommand\C{\mathcal C}
  25. \newcommand\Pair[1]{\langle#1\rangle}
  26. % Syntax
  27. \newcommand\SET{\mathsf{Set}}
  28. \newcommand\EL{\mathsf{El}\,}
  29. \newcommand\unify{\mathsf{unify}}
  30. \newcommand\inscope{\mathsf{InScope}}
  31. \newcommand\PI[2]{(#1:#2)\to{}}
  32. \newcommand\LAM[1]{\lambda #1.{}}
  33. \newcommand\Subst[3]{ {#1} [ {#3} / {#2} ] }
  34. \newcommand\SubstD[2]{{#1} [ {#2} ] }
  35. % Judgement forms
  36. % Core
  37. \newcommand\IsSigCS[1]{{} \vdash_{#1}}
  38. \newcommand\IsCtxCS[2]{{#2} \vdash_{#1}}
  39. \newcommand\IsTypeCS[3]{{#2} \vdash_{#1}#3 ~ \mathbf{type}}
  40. \newcommand\HasTypeCS[4]{{#2} \vdash_{#1} {#3} : {#4}}
  41. \newcommand\CheckTypeCS[4]{{#2} \vdash_{#1}#3\uparrow#4}
  42. \newcommand\InferTypeCS[4]{{#2} \vdash_{#1}#3\downarrow#4}
  43. \newcommand\EqualTypeCS[4]{{#2} \vdash_{#1}#3=#4}
  44. \newcommand\EqualCS[5]{{#2} \vdash_{#1}#3=#4:#5}
  45. \newcommand\IsCtxC[1]{\IsCtxCS{}{#1}}
  46. \newcommand\IsTypeC[2]{\IsTypeCS{}{#1}{#2}}
  47. \newcommand\HasTypeC[3]{\HasTypeCS{}{#1}{#2}{#3}}
  48. \newcommand\CheckTypeC[3]{\CheckTypeCS{}{#1}{#2}{#3}}
  49. \newcommand\InferTypeC[3]{\InferTypeCS{}{#1}{#2}{#3}}
  50. \newcommand\EqualTypeC[3]{\EqualTypeCS{}{#1}{#2}{#3}}
  51. \newcommand\EqualC[4]{\EqualCS{}{#1}{#2}{#3}{#4}}
  52. % With metas
  53. \newcommand\Cs{\mathcal{C}}
  54. \newcommand\Ext[1]{{#1},\,{}}
  55. \newcommand\ExplicitJudgement[3]{
  56. \langle {#1} \rangle ~ {#2} \Longrightarrow \langle {#3} \rangle
  57. }
  58. \newcommand\MetaDecl[2]{{#1} : {#2}}
  59. \newcommand\IMetaDecl[3]{{#1} : {#2} = {#3}}
  60. \newcommand\ConstDecl[4]{{#1} : {#2} = {#3} ~\mathbf{when}~ {#4}}
  61. \newcommand\AddMeta[2]{\mathsf{AddMeta}({#1} : {#2})}
  62. \newcommand\AddConst[4]{\mathsf{AddConst}({#1} : {#2} = {#3}~\mathbf{when}~{#4})}
  63. \newcommand\InstMeta[2]{{#1} := {#2}}
  64. \newcommand\LookupMeta[2]{\mathsf{LookupMeta}({#1} = {#2})}
  65. \newcommand\LookupConst[2]{\mathsf{LookupConst}({#1} = {#2})}
  66. \newcommand\LookupType[2]{\mathsf{Lookup}({#1} : {#2})}
  67. \newcommand\InScope[2]{\mathsf{InScope}_{#1}({#2})}
  68. \newcommand\Simplify{\mathsf{SolveConstraints}}
  69. \newcommand\WithSig[1]{\langle {#1} \rangle \,}
  70. \newcommand\UpdateGuard[2]{\mathsf{UpdateGuard}( {#1},\, {#2} )}
  71. \newcommand\LookupClause[3]{\mathsf{Lookup}({#1}~{#2} = {#3})}
  72. \newcommand\Match[3]{\mathsf{Match}({#1}\,{#2} = {#3})}
  73. \newcommand\Guarded[1]{\mathsf{Guarded}({#1})}
  74. \newcommand\Uninstantiated[1]{\mathsf{Uninstantiated}({#1})}
  75. \newcommand\Blocked[1]{\mathsf{Blocked}({#1})}
  76. \newcommand\Inline[2]{{#1} \to_{\mathit{inline}} {#2}}
  77. \newcommand\IsTypeCtx[3]{{#1} \vdash {#2} ~ \mathbf{type} ~ \leadsto {#3}}
  78. \newcommand\CheckTypeCtx[4]{{#1} \vdash {#2} \uparrow {#3} \leadsto {#4}}
  79. \newcommand\InferTypeCtx[4]{{#1} \vdash {#2} \downarrow {#3} \leadsto {#4}}
  80. \newcommand\EqualTypeCtx[4]{{#1} \vdash {#2} = {#3} \leadsto {#4}}
  81. \newcommand\EqualCtx[5]{{#1} \vdash {#2} = {#3} : {#4} \leadsto {#5}}
  82. \newcommand\EqualWhnfCtx[5]{{#1} \vdash {#2} \doteq {#3} : {#4} \leadsto {#5}}
  83. % \newcommand\EqualWhnfCtx[5]{{#1} \vdash {#2} \mathrel{\stackrel{\mathit{whnf}}=} {#3} : {#4} \leadsto {#5}}
  84. \newcommand\TypeConstrCtx[3]{\EqualTypeC {#1} {#2} {#3}}
  85. \newcommand\TermConstrCtx[4]{\EqualC {#1} {#2} {#3} {#4}}
  86. \newcommand\TypeConstr[2]{\TypeConstrCtx \Gamma {#1} {#2}}
  87. \newcommand\TermConstr[3]{\TermConstrCtx \Gamma {#1} {#2} {#3}}
  88. \newcommand\ValidConstr[2]{\vdash_{#1} {#2} ~ \mathbf{ok}}
  89. \newcommand\TrueConstr[2]{\vdash_{#1} {#2} ~ \mathbf{true}}
  90. \newcommand\IsType[2]{\IsTypeCtx \Gamma {#1} {#2}}
  91. \newcommand\CheckType[3]{\CheckTypeCtx \Gamma {#1} {#2} {#3}}
  92. \newcommand\InferType[3]{\InferTypeCtx \Gamma {#1} {#2} {#3}}
  93. \newcommand\EqualType[3]{\EqualTypeCtx \Gamma {#1} {#2} {#3}}
  94. \newcommand\Equal[4]{\EqualCtx \Gamma {#1} {#2} {#3} {#4}}
  95. \newcommand\EqualWhnf[4]{\EqualWhnfCtx \Gamma {#1} {#2} {#3} {#4}}
  96. \newcommand\CheckConstr[2]{{#1} \leadsto {#2}}
  97. \newcommand\whnf[2]{{#1} \to_{\mathit{whnf}} {#2}}
  98. \newcommand\Normalise[2]{{#1} \to_{\mathit{nf}} {#2}}
  99. \newcommand\FV[1]{\mathsf{FV}({#1})}
  100. \newcommand\AppSub[2]{{#2}{#1}}
  101. \newcommand\CombinedSig[3]{\mathsf{Combine}({#1},{#2},{#3})}
  102. \newcommand\CoreSig[1]{\left|{#1}\right|}
  103. \newcommand\Implements[2]{{#2} \propto {#1}}
  104. \newcommand\Extends[2]{{#1} ~ \mathit{extends} ~ {#2}}
  105. \newcommand\Rules[2]{
  106. \par~\par
  107. {\setlength\parindent{0mm}
  108. {\em #1}{\small
  109. \[\begin{array}{c}
  110. #2
  111. \end{array}\]
  112. }
  113. }}
  114. \newcommand\URules[1]{
  115. {\small\[\begin{array}{c}
  116. #1
  117. \end{array}\]
  118. }}
  119. \newcommand\Rule[2]{\frac{\displaystyle{#2}}{\displaystyle\begin{array}{l}#1\end{array}}}