iris.sty 10.6 KB
Newer Older
1 2 3 4 5
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{iris}

\RequirePackage{tikz}
\RequirePackage{scalerel}
6 7 8 9 10 11 12
\RequirePackage{array}
\RequirePackage{dashbox}
\RequirePackage{tensor}
\RequirePackage{xparse}
\RequirePackage{xstring}
\RequirePackage{mathtools}

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SETUP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\usetikzlibrary{shapes}
%\usetikzlibrary{snakes}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\tikzstyle{state}=[circle, draw, minimum size=1.2cm, align=center]
\tikzstyle{trans}=[arrows={->[scale=1.4]}]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MATH SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DeclareMathOperator*{\Sep}{\scalerel*{\ast}{\sum}}
\newcommand{\bigast}{\Sep}

\newcommand*{\sep}[1][]{\mathrel{\#_{#1}}}	% bad name; it's a different "sep"
\newcommand\dplus{\mathbin{+\kern-1.0ex+}}
\newcommand{\upclose}{\mathord{\uparrow}}
\newcommand{\ALT}{\ |\ }

\newcommand{\spac}{\;} % a space

\def\All #1.{\forall #1.\spac}%
\def\Exists #1.{\exists #1.\spac}%
\def\Ret #1.{#1.\spac}%

\newcommand{\any}{{\rule[-.2ex]{1ex}{.4pt}}}%

\newcommand{\judgment}[2]{\paragraph{#1}\hspace{\stretch{1}}\fbox{$#2$}}

\newcommand{\pfn}{\rightharpoonup}
\newcommand\fpfn{\xrightharpoonup{\kern-0.25ex\textrm{fin}\kern-0.25ex}}
\newcommand{\ra}{\rightarrow}
\newcommand{\Ra}{\Rightarrow}
\newcommand{\Lra}{\Leftrightarrow}
54 55
\newcommand\monra{\xrightarrow{\kern-0.15ex\textrm{mon}\kern-0.05ex}}
\newcommand\nfn{\xrightarrow{\kern-0.15ex\textrm{ne}\kern-0.05ex}}
56
\newcommand{\eqdef}{\triangleq}
Ralf Jung's avatar
Ralf Jung committed
57 58
\newcommand{\bnfdef}{\vcentcolon\vcentcolon=}

59 60
\newcommand*\setComp[2]{\left\{#1\spac\middle|\spac#2\right\}}
\newcommand*\set[1]{\left\{#1\right\}}
61
\newcommand*\record[1]{\left\{\spac#1\spac\right\}}
Ralf Jung's avatar
Ralf Jung committed
62
\newcommand*\recordComp[2]{\left\{\spac#1\spac\middle|\spac#2\spac\right\}}
63 64 65 66 67 68 69 70 71 72 73 74 75

\newenvironment{inbox}[1][]{
  \begin{array}[#1]{@{}l@{}}
}{
  \end{array}
}

\newcommand{\dom}{\mathrm{dom}}
\newcommand{\cod}{\mathrm{cod}}
\newcommand{\chain}{\mathrm{chain}}

\newcommand{\pset}[1]{\wp(#1)} % Powerset
\newcommand{\psetdown}[1]{\wp^\downarrow(#1)}
Ralf Jung's avatar
Ralf Jung committed
76
\newcommand{\finpset}[1]{\wp^\mathrm{fin}(#1)}
77 78 79 80 81 82 83 84 85 86 87 88

\newcommand{\Func}{F} % functor

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MODEL-SPECIFIC SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\textdom}[1]{\textit{#1}}

\newcommand{\wIso}{\xi}

\newcommand{\rs}{r}
\newcommand{\rsB}{s}
Ralf Jung's avatar
Ralf Jung committed
89
\newcommand{\rss}{R}
90 91 92 93 94 95

\newcommand{\pres}{\pi}
\newcommand{\wld}{w}
\newcommand{\ghostRes}{g}

%% Various pieces of syntax
Ralf Jung's avatar
Ralf Jung committed
96 97
\newcommand{\wsat}[3]{#1 \models_{#2} #3}
\newcommand{\wsatpre}{\textdom{pre-wsat}}
98 99 100 101 102 103 104 105

\newcommand{\wtt}[2]{#1 : #2} % well-typed term

\newcommand{\nequiv}[1]{\ensuremath{\mathrel{\stackrel{#1}{=}}}}
\newcommand{\notnequiv}[1]{\ensuremath{\mathrel{\stackrel{#1}{\neq}}}}
\newcommand{\nequivset}[2]{\ensuremath{\mathrel{\stackrel{#1}{=}_{#2}}}}
\newcommand{\nequivB}[1]{\ensuremath{\mathrel{\stackrel{#1}{\equiv}}}}
\newcommand{\latert}{\mathord{\blacktriangleright}}
Ralf Jung's avatar
Ralf Jung committed
106
\newcommand{\latertinj}{\textlog{next}}
107 108 109 110 111 112 113 114

\newcommand{\Sem}[1]{\llbracket #1 \rrbracket}

\newcommand{\sembox}[1]{\hfill \normalfont \mbox{\fbox{\(#1\)}}}
\newcommand{\typedsection}[2]{\subsubsection*{\rm\em #1 \sembox{#2}}}


%% Some commonly used identifiers
Ralf Jung's avatar
Ralf Jung committed
115
\newcommand{\SProp}{\textdom{SProp}}
116
\newcommand{\UPred}{\textdom{UPred}}
Ralf Jung's avatar
Ralf Jung committed
117 118
\newcommand{\mProp}{\textdom{Prop}} % meta-level prop
\newcommand{\iProp}{\textdom{iProp}}
Ralf Jung's avatar
Ralf Jung committed
119
\newcommand{\iPreProp}{\textdom{iPreProp}}
Ralf Jung's avatar
Ralf Jung committed
120
\newcommand{\Wld}{\textdom{Wld}}
Ralf Jung's avatar
Ralf Jung committed
121
\newcommand{\Res}{\textdom{Res}}
122

Ralf Jung's avatar
Ralf Jung committed
123 124
\newcommand{\cofe}{T}
\newcommand{\cofeB}{U}
125 126
\newcommand{\COFEs}{\mathcal{U}} % category of COFEs
\newcommand{\iFunc}{\Sigma}
Ralf Jung's avatar
Ralf Jung committed
127
\newcommand{\fix}{\textdom{fix}}
128 129 130 131 132 133 134

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CMRA (RESOURCE ALGEBRA) SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\textmon}[1]{\textsc{#1}}

\newcommand{\monoid}{M}
Ralf Jung's avatar
Ralf Jung committed
135
\newcommand{\mval}{\mathcal{V}}
136 137 138 139 140 141 142

\newcommand{\melt}{a}
\newcommand{\meltB}{b}
\newcommand{\meltC}{c}
\newcommand{\melts}{A}
\newcommand{\meltsB}{B}

Ralf Jung's avatar
Ralf Jung committed
143 144
\newcommand{\f}{\mathrm{f}} % for "frame"

145 146
\newcommand{\mcar}[1]{|#1|}
\newcommand{\mcarp}[1]{\mcar{#1}^{+}}
147
\newcommand{\munit}{\varepsilon}
Ralf Jung's avatar
Ralf Jung committed
148
\newcommand{\mcore}[1]{\lfloor#1\rfloor}
149 150 151
\newcommand{\mtimes}{\mathbin{\cdot}}

\newcommand{\mupd}{\rightsquigarrow}
152
\newcommand{\mincl}[1][]{\ensuremath{\mathrel{\stackrel{#1}{\preccurlyeq}}}}
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

\newcommand{\CMRAs}{\mathcal{R}} % category of CMRAs

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOGIC SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\textlog}[1]{\textsf{#1}}

\newcommand{\Sig}{\mathcal{S}}
\newcommand{\SigType}{\mathcal{T}}
\newcommand{\SigFn}{\mathcal{F}}
\newcommand{\SigAx}{\mathcal{A}}
\newcommand{\sigtype}{T}
\newcommand{\sigfn}{F}
\newcommand{\sigax}{A}

\newcommand{\type}{\tau}

\newcommand{\var}{x}
\newcommand{\varB}{y}
\newcommand{\varC}{z}

\newcommand{\term}{t}
\newcommand{\termB}{u}

\newcommand{\vctx}{\Gamma}
\newcommand{\pfctx}{\Theta}

\newcommand{\prop}{P}
\newcommand{\propB}{Q}
\newcommand{\propC}{R}

\newcommand{\pred}{\varphi}
\newcommand{\predB}{\psi}
\newcommand{\predC}{\zeta}

\newcommand{\gname}{\gamma}
\newcommand{\iname}{\iota}

\newcommand{\mask}{\mathcal{E}}
\newcommand{\namesp}{\mathcal{N}}
Ralf Jung's avatar
Ralf Jung committed
194
\newcommand{\namecl}[1]{{#1^{\kern0.2ex\uparrow}}}
195 196 197 198 199 200

%% various pieces of Syntax
\def\MU #1.{\mu #1.\spac}%
\def\Lam #1.{\lambda #1.\spac}%

\newcommand{\proves}{\vdash}
Ralf Jung's avatar
Ralf Jung committed
201
\newcommand{\provesIff}{\mathrel{\dashv\vdash}}
202 203 204 205 206 207 208 209

\newcommand{\wand}{\;{{\mbox{---}}\!\!{*}}\;}

% oh my... I have to wrap the "-" in a \mathrm, otherwise all hell breaks lose...
\newcommand{\fmapsto}[1][\mathrm{-}]{\xmapsto{#1}}
\newcommand{\gmapsto}{\hookrightarrow}%
\newcommand{\fgmapsto}[1][\mathrm{-}]{\xhookrightarrow{#1}}%

210
\NewDocumentCommand\wpre{m O{} m}%
211
  {\textlog{wp}_{#2}\spac#1\spac{\{#3\}}}
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229

\newcommand{\later}{\mathord{\triangleright}}
\newcommand{\always}{\Box{}}

%% Invariants and Ghost ownership
% PDS: Was 0pt inner, 2pt outer.
% \boxedassert [tikzoptions] contents [name]
\tikzstyle{boxedassert_border} = [sharp corners,line width=0.2pt]
\NewDocumentCommand \boxedassert {O{} m o}{%
	\tikz[baseline=(m.base)]{
		%	  \node[rectangle, draw,inner sep=0.8pt,anchor=base,#1] (m) {${#2}\mathstrut$};
		\node[rectangle,inner sep=0.8pt,outer sep=0.2pt,anchor=base] (m) {${#2}\mathstrut$};
		\draw[#1,boxedassert_border] ($(m.south west) + (0,0.65pt)$) rectangle ($(m.north east) + (0, 0.7pt)$);
	}\IfNoValueF{#3}{^{\,#3}}%
}
\newcommand*{\knowInv}[2]{\boxedassert{#2}[#1]}
\newcommand*{\ownGhost}[2]{\boxedassert[densely dashed]{#2}[#1]}
\newcommand*{\ownGGhost}[1]{\boxedassert[densely dashed]{#1}}
230
\newcommand{\ownM}[1]{\textlog{Own}(#1)}
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
\newcommand{\ownPhys}[1]{\textlog{Phy}(#1)}

%% View Shifts
\NewDocumentCommand \vsGen {O{} m O{}}%
  {\mathrel{%
    \ifthenelse{\equal{#3}{}}{%
      % Just one mask, or none
      {#2}_{#1}%
    }{%
      % Two masks
      \tensor*[^{#1}]{#2}{^{#3}}
    }%
  }}%
\NewDocumentCommand \vs {O{} O{}} {\vsGen[#1]{\Rrightarrow}[#2]}
\NewDocumentCommand \vsL {O{} O{}} {\vsGen[#1]{\Lleftarrow}[#2]}
\NewDocumentCommand \vsE {O{} O{}} %
  {\vsGen[#1]{\Lleftarrow\!\!\!\Rrightarrow}[#2]}
\NewDocumentCommand \pvs {O{} O{}} {\mathord{\vsGen[#1]{{\mid\kern-0.4ex\Rrightarrow\kern-0.25ex}}[#2]\kern0.2ex}}


%% Hoare Triples
\newcommand*{\hoaresizebox}[1]{%
  \hbox{$\mathsurround=0pt{#1}\mathstrut$}}
\newcommand*{\hoarescalebox}[2]{%
  \hbox{\scalerel*[1ex]{#1}{#2}}}
\newcommand{\triple}[5]{%
  \setbox0=\hoaresizebox{{#3}{#5}}%
  \setbox1=\hoarescalebox{#1}{\copy0}%
  \setbox2=\hoarescalebox{#2}{\copy0}%
  \copy1{#3}\copy2%
  \;{#4}\;%
  \copy1{#5}\copy2}
\NewDocumentCommand \hoare {m m m O{}}{
	\triple\{\}{#1}{#2}{#3}%
	_{#4}%
}

\newcommand{\bracket}[4][]{%
  \setbox0=\hbox{$\mathsurround=0pt{#1}{#4}\mathstrut$}%
  \scalerel*[1ex]{#2}{\copy0}%
  {#4}%
  \scalerel*[1ex]{#3}{\copy0}}
% \curlybracket[other] x
\newcommand{\curlybracket}[2][]{\bracket[{#1}]\{\}{#2}}
\newcommand{\anglebracket}[2][]{\bracket[{#1}]\langle\rangle{#2}}
% \hoareV[t] pre c post [mask]
\NewDocumentCommand \hoareV {O{c} m m m O{}}{
		{\begin{aligned}[#1]
		&\curlybracket{#2} \\
		&\quad{#3} \\
		&{\curlybracket{#4}}_{#5}
		\end{aligned}}%
}
% \hoareHV[t] pre c post [mask]
\NewDocumentCommand \hoareHV {O{c} m m m O{}}{
	{\begin{aligned}[#1]
	&\curlybracket{#2} \; {#3} \\
	&{\curlybracket{#4}}_{#5}
	\end{aligned}}%
}


%% Some commonly used identifiers
\newcommand{\timeless}[1]{\textlog{timeless}(#1)}
\newcommand{\physatomic}[1]{\textlog{$#1$ phys.\ atomic}}
\newcommand{\infinite}{\textlog{infinite}}

\newcommand{\Prop}{\textlog{Prop}}
\newcommand{\Pred}{\textlog{Pred}}

\newcommand{\TRUE}{\textlog{True}}
\newcommand{\FALSE}{\textlog{False}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ralf Jung's avatar
Ralf Jung committed
305
% GENERIC LANGUAGE SYNTAX AND SEMANTICS
306 307 308 309 310 311 312 313
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\expr}{e}
\newcommand{\val}{v}
\newcommand{\valB}{w}
\newcommand{\state}{\sigma}
\newcommand{\step}{\ra}
\newcommand{\lctx}{K}

314 315 316 317
\newcommand{\toval}{\mathrm{expr2val}}
\newcommand{\ofval}{\mathrm{val2expr}}
\newcommand{\atomic}{\mathrm{atomic}}
\newcommand{\red}{\mathrm{red}}
318 319 320 321 322 323
\newcommand{\Lang}{\Lambda}

\newcommand{\tpool}{T}

\newcommand{\cfg}[2]{{#1};{#2}}

324 325 326 327 328 329
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STANDARD DERIVED CONSTRUCTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Agreement
\newcommand{\agm}{\ensuremath{\textmon{Ag}}}
Ralf Jung's avatar
Ralf Jung committed
330
\newcommand{\aginj}{\textlog{ag}}
331 332 333 334 335 336

% Fraction
\newcommand{\fracm}{\ensuremath{\textmon{Frac}}}

% Exclusive
\newcommand{\exm}{\ensuremath{\textmon{Ex}}}
Ralf Jung's avatar
Ralf Jung committed
337
\newcommand{\exinj}{\textlog{ex}}
338 339 340 341 342 343 344 345 346

% Auth
\newcommand{\authm}{\textmon{Auth}}
\newcommand{\authfull}{\mathord{\bullet}\,}
\newcommand{\authfrag}{\mathord{\circ}\,}

\newcommand{\AuthInv}{\textsf{AuthInv}}
\newcommand{\Auth}{\textsf{Auth}}

Ralf Jung's avatar
Ralf Jung committed
347 348 349 350 351 352
% One-Shot
\newcommand{\oneshotm}{\ensuremath{\textmon{OneShot}}}
\newcommand{\ospending}{\textlog{pending}}
\newcommand{\osshot}{\textlog{shot}}

% STSs
353 354 355 356 357 358 359 360 361 362 363 364 365
\newcommand{\STSCtx}{\textlog{StsCtx}}
\newcommand{\STSSt}{\textlog{StsSt}}
\newcommand{\STSS}{\mathcal{S}} % states
\newcommand{\STST}{\mathcal{T}} % tokens
\newcommand{\STSL}{\mathcal{L}} % labels
\newcommand{\ststrans}{\ra^{*}}%	the relation relevant to the STS rules


\tikzstyle{sts} = [->,every node/.style={rectangle, rounded corners, draw, minimum size=1.2cm, align=center}]
\tikzstyle{sts_arrows} = [arrows={->[scale=1.5]},every node/.style={font=\sffamily\small}]

%% Stored Propositions
\newcommand{\mapstoprop}{\mathrel{\mapstochar\Ra}}
366 367 368


\endinput