Newer
Older
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{iris}
\RequirePackage{tikz}
\RequirePackage{scalerel}
\RequirePackage{array}
\RequirePackage{dashbox}
\RequirePackage{tensor}
\RequirePackage{xparse}
\usetikzlibrary{shapes}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FONTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\textdom}[1]{\textit{#1}} % for domains/sets/types
\newcommand{\textproj}[1]{\textsc{#1}} % for projections/fields
\newcommand{\textlog}[1]{\textsf{\upshape #1}} % for mathematical/logic-level identifiers (make sure we do not inherit italic shape from the environment)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MATH SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareMathOperator*{\Sep}{\scalerel*{\ast}{\sum}} % big-star
\newcommand*{\disj}[1][]{\mathrel{\#_{#1}}}
\newcommand\pord{\sqsubseteq}
\newcommand\dplus{\mathbin{+\kern-1.0ex+}}
\newcommand\fmap{\mathrel{\langle\$\rangle}}
\newcommand{\upclose}{\mathord{\uparrow}}
\newcommand{\ALT}{\ |\ }
\newcommand{\spac}{\nobreak\hskip 0.2em plus 0.1em} % 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}}}%
% For some reason \paragraph gives the weirdest errors ("missing \item").
\newcommand{\judgment}[2][]{\bigskip\noindent\textit{#1}\hspace{\stretch{1}}\fbox{$#2$}\nopagebreak}
\newcommand{\pfn}{\rightharpoonup}
\newcommand\fpfn{\xrightharpoonup{\smash{\raisebox{-.3ex}{\ensuremath{\scriptstyle\kern-0.25ex\textlog{fin}\kern-0.1ex}}}}}
\newcommand{\ra}{\rightarrow}
\newcommand{\Ra}{\Rightarrow}
\newcommand{\Lra}{\Leftrightarrow}
\newcommand\monra[1][]{\xrightarrow{\smash{\raisebox{-.3ex}{\ensuremath{\scriptstyle\kern-0.15ex\textlog{mon}_{#1}\kern-0.05ex}}}}}
\newcommand\monnra{\xrightarrow{\smash{\raisebox{-.3ex}{\ensuremath{\scriptstyle\kern-0.15ex\textlog{mon,ne}\kern-0.05ex}}}}}
\newcommand\nfn{\xrightarrow{\smash{\raisebox{-.3ex}{\ensuremath{\scriptstyle\kern-0.15ex\textlog{ne}\kern-0.05ex}}}}}
\newcommand*\setComp[2]{\left\{#1\spac\middle|\spac#2\right\}}
\newcommand*\set[1]{\left\{#1\right\}}
\newcommand*\record[1]{\left\{\spac#1\spac\right\}}
\newcommand*\recordComp[2]{\left\{\spac#1\spac\middle|\spac#2\spac\right\}}
\newenvironment{inbox}[1][]{
\begin{array}[#1]{@{}l@{}}
}{
\end{array}
}
\newcommand{\op}{\textlog{op}}
\newcommand{\dom}{\textlog{dom}}
\newcommand{\cod}{\textlog{cod}}
\renewcommand{\lim}{\textlog{lim}}
\newcommand{\Chains}{\textdom{Chains}}
\newcommand{\pset}[1]{\wp(#1)} % Powerset
\newcommand{\psetdown}[1]{\wp^\downarrow(#1)}
\newcommand{\finpset}[1]{\wp^\textlog{fin}(#1)}
\newcommand{\finpmultiset}[1]{\wp^{\textlog{fin},+}(#1)}
\newcommand{\Func}{F} % functor
\newcommand{\subst}[3]{{#1}[{#3} / {#2}]}
\newcommand{\mapelem}[2]{#1\mathop{\la}#2}
\newcommand{\mapinsert}[3]{#3\!\left[\mapelem{#1}{#2}\right]}
\newcommand{\mapdelete}[2]{#2\setminus\set{#1}}
\newcommand{\mapsingleton}[2]{\mapinsert{#1}{#2}{\,}}
\newcommand{\mapinsertComp}[4]
{\mapinsert{#1}{#2 \spac\middle|\spac #3}{#4}}
\newcommand{\mapComp}[3]
{\mapinsertComp{#1}{#2}{#3}{}}
\newcommand{\nil}{\epsilon}
% displaced dot
\newcommand{\dispdot}[2][.2ex]{\dot{\raisebox{0pt}[\dimexpr\height+#1][\depth]{$#2$}}}% \dispdot[<displace>]{<stuff>}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MODEL-SPECIFIC SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\wIso}{\xi}
\newcommand{\rs}{r}
\newcommand{\rsB}{s}
\newcommand{\pres}{\pi}
\newcommand{\wld}{w}
\newcommand{\ghostRes}{g}
%% Various pieces of syntax
\newcommand{\wsat}[3]{#1 \models_{#2} #3}
\newcommand{\wsatpre}{\textdom{pre-wsat}}
\newcommand{\wtt}[2]{#1 : #2} % well-typed term
\newcommand{\nequiv}[1]{\ensuremath{\mathrel{\stackrel{#1}{=}}}}
\newcommand{\nincl}[1]{\ensuremath{\mathrel{\stackrel{#1}{\subseteq}}}}
\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}}
\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
\newcommand{\UPred}{\textdom{UPred}}
\newcommand{\mProp}{\textdom{Prop}} % meta-level prop
\newcommand{\iProp}{\textdom{iProp}}
Robbert Krebbers
committed
% List
\newcommand{\List}{\ensuremath{\textdom{List}}}
\newcommand{\ofe}{T}
\newcommand{\ofeB}{U}
\newcommand{\cofe}{\ofe}
\newcommand{\cofeB}{\ofeB}
\newcommand{\OFEs}{\mathbf{OFE}} % category of OFEs
\newcommand{\COFEs}{\mathbf{COFE}} % category of COFEs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CMRA (RESOURCE ALGEBRA) SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\monoid}{M}
\newcommand{\melt}{a}
\newcommand{\meltB}{b}
\newcommand{\meltC}{c}
\newcommand{\melts}{A}
\newcommand{\meltsB}{B}
\newcommand{\f}{\textlog{f}} % used as subscript, for "frame"
\newcommand{\munit}{\varepsilon}
\newcommand{\mcore}[1]{{\mid}#1{\mid}} % using "|" here makes LaTeX diverge. WTF.
\newcommand{\bigmcore}[1]{{\big|}#1{\big|}} % using "|" here makes LaTeX diverge. WTF.
\newcommand{\mtimes}{\mathbin{\cdot}}
\newcommand{\mundef}{\lightning}
\newcommand{\exclusive}{\textlog{exclusive}}
\newcommand{\mupd}{\rightsquigarrow}
\newcommand{\lupd}{\rightsquigarrow_{\textlog{L}}}
\newcommand{\mincl}[1][]{%
\ensuremath{\mathrel{\vbox{\offinterlineskip\ialign{%
\hfil##\hfil\cr
\ensuremath{\scriptstyle #1}\cr
\noalign{\kern-0.25ex}
$\preccurlyeq$\cr
}}}}}
\newcommand{\CMRAs}{\mathbf{Camera}} % category of Cameras/CMRAs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOGIC SYMBOLS & NOTATION & IDENTIFIERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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}
% pure propositions
\newcommand{\pprop}{\phi}
\newcommand{\ppropB}{\psi}
\newcommand{\pred}{\varPhi}
\newcommand{\predB}{\Psi}
\newcommand{\predC}{\Zeta}
\newcommand{\gname}{\gamma}
\newcommand{\iname}{\iota}
\newcommand{\mask}{\mathcal{E}}
\newcommand{\namesp}{\mathcal{N}}
\def\MU #1.{\mu #1.\spac}%
\def\Lam #1.{\lambda #1.\spac}%
\newcommand{\proves}{\vdash}
\newcommand{\wand}{\mathrel{-\!\!\ast}}
\newcommand{\wandIff}{\mathrel{\ast\!\!{-}\!\!\ast}}
% oh my... I have to wrap the "-" in a \mathrm, otherwise all hell breaks lose...
\newcommand{\fmapsto}[1][]{\xmapsto{\smash{\raisebox{-.15ex}{\ensuremath{\scriptstyle #1}}}}}
\newcommand{\gmapsto}{\hookrightarrow}%
\newcommand{\fgmapsto}[1][\mathrm{-}]{\xhookrightarrow{#1}}%
\NewDocumentCommand\wpre{O{} m O{} m}%
{\textlog{wp}^{#1}_{#3}\spac#2\spac{\left\{#4\right\}}}
\newcommand\stuckness{s}
\newcommand\NotStuck{\textlog{NotStuck}}
\newcommand\MaybeStuck{\textlog{Stuck}}
\newcommand{\later}{\mathop{{\triangleright}}}
\newcommand*{\lateropt}[1]{\mathop{{\later}^{#1}}}
\newcommand{\always}{\mathop{\boxempty}}
\newcommand{\pers}{\mathop{\boxdot}}
%% 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*{\invM}[2]{\textlog{Inv}^{#1}\left(#2\right)}
\newcommand*{\ownGhost}[2]{\boxedassert[densely dashed]{#2}[#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 \bvs {O{} O{}} {\vsGen[#1]{\dispdot[0.02ex]{\Rrightarrow}}[#2]}
\NewDocumentCommand \vsL {O{} O{}} {\vsGen[#1]{\Lleftarrow}[#2]}
\NewDocumentCommand \vsE {O{} O{}} %
{\vsGen[#1]{\Lleftarrow\!\!\!\Rrightarrow}[#2]}
Jacques-Henri Jourdan
committed
\NewDocumentCommand \pvs {O{} O{}} {\mathord{\vsGen[#1]{{\mid\kern-0.5ex\Rrightarrow\kern-0.25ex}}[#2]\kern0.2ex}}
Jacques-Henri Jourdan
committed
\newcommand\vsWand{{\displaystyle\equiv\kern-1.6ex-\kern-1.5ex\smash{\scalerel*{\vphantom-\ast}{\sum}}\kern-0.2ex}}
\NewDocumentCommand \vsW {O{} O{}} {\vsGen[#1]{\vsWand}[#2]}
\newcommand\vsWandStep{{\displaystyle\raisebox{0.106ex}{\scaleobj{0.82}{\later}}\kern-1.65ex\equiv\kern-1.6ex-\kern-1.5ex\smash{\scalerel*{\vphantom-\ast}{\sum}}\kern-0.2ex}}
\NewDocumentCommand \vsWS {O{} O{}} {\vsGen[#1]{\vsWandStep}[#2]}
% for now, the update modality looks like a pvs without masks.
\NewDocumentCommand \upd {} {\mathop{\dispdot[-0.2ex]{\mid\kern-0.4ex\Rrightarrow\kern-0.25ex}}}
\NewDocumentCommand\Acc{O{} O{} m m}{#3 \mathrel{~\vsGen[#1]{\propto}[#2]~} #4}
% needs extra {...} for some weird reason
\newcommand{\curlybracket}[1]{{\left\{#1\right\}}}
\NewDocumentCommand \hoare {m m m O{}}{
\curlybracket{#1}\spac #2 \spac \curlybracket{#3}_{#4}%
}
% \hoareV[t] pre c post [mask]
\NewDocumentCommand \hoareV {O{c} m m m O{}}{
{\begin{aligned}[#1]
&\curlybracket{#2} \\
&\quad{#3} \\
\end{aligned}}%
}
% \hoareHV[t] pre c post [mask]
\NewDocumentCommand \hoareHV {O{c} m m m O{}}{
{\begin{aligned}[#1]
&\curlybracket{#2} \spac {#3} \\
&\curlybracket{#4}_{#5}
\end{aligned}}%
}
% \hoareVH[t] pre c post [mask]
\NewDocumentCommand \hoareVH {O{c} m m m O{}}{
{\begin{aligned}[#1]
&\curlybracket{#2} \\
& {#3}\spac \curlybracket{#4}_{#5}
\end{aligned}}%
}
%% Some commonly used identifiers
\newcommand{\infinite}{\textlog{infinite}}
\newcommand{\timeless}[1]{\textlog{timeless}(#1)}
\newcommand{\persistent}[1]{\textlog{persistent}(#1)}
\newcommand\InvName{\textdom{InvName}}
\newcommand\GName{\textdom{GName}}
\newcommand{\Prop}{\textdom{iProp}}
\newcommand{\Pred}{\textdom{Pred}}
\newcommand{\TRUE}{\textlog{True}}
\newcommand{\FALSE}{\textlog{False}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\expr}{e}
\newcommand{\val}{v}
\newcommand{\valB}{w}
\newcommand{\state}{\sigma}
\newcommand{\step}[1][]{\xrightarrow{{#1}}_{\textlog{t}}}
\newcommand{\hstep}[1][]{\xrightarrow{{#1}}_{\textlog{h}}}
\newcommand{\tpstep}[1][]{\xrightarrow{{#1}}_{\textlog{tp}}}
\newcommand{\tpsteps}[1][]{\xrightarrow{{#1}}\mathrel{\vphantom{\to}^{*}_{\textlog{tp}}}}
\newcommand{\Lctx}{\textdom{Ctx}}
\newcommand{\State}{\kern-0.05em\textdom{State}}
\newcommand{\Val}{\kern-0.2em\textdom{Val}}
\newcommand{\Loc}{\kern-0.05em\textdom{Loc}}
\newcommand{\Expr}{\kern-0.05em\textdom{Expr}}
\newcommand{\Var}{\kern-0.2em\textdom{Var}}
\newcommand{\Obs}{\kern-0.1em\textdom{Obs}}
\newcommand{\ThreadPool}{\kern-0.05em\textdom{ThreadPool}}
\newcommand{\toval}{\textlog{expr\any to\any val}}
\newcommand{\ofval}{\textlog{val\any to\any expr}}
\newcommand{\atomic}{\textlog{atomic}}
\newcommand{\stronglyAtomic}{\textlog{strongly\any{}atomic}}
\newcommand{\red}{\textlog{red}}
\newcommand{\Lang}{\Lambda}
\newcommand{\tpool}{T}
\newcommand{\cfg}[2]{{#1};{#2}}
\def\fillctx#1[#2]{#1 {[}\, #2\,{]} }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STANDARD DERIVED CONSTRUCTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\agm}{\ensuremath{\textdom{Ag}}}
\newcommand{\fracm}{\ensuremath{\textdom{Frac}}}
\newcommand{\exm}{\ensuremath{\textdom{Ex}}}
\newcommand{\authm}{\textdom{Auth}}
\newcommand{\authinj}{\textlog{auth}}
\newcommand{\authfull}{\mathord{\bullet}}
\newcommand{\authfrag}{\mathord{\circ}}
\newcommand{\AuthInv}{\textsf{AuthInv}}
\newcommand{\Auth}{\textsf{Auth}}
\newcommand{\csumm}{\mathrel{+_{\!\mundef}}}
\newcommand{\cinl}{\textsf{inl}}
\newcommand{\cinr}{\textsf{inr}}
\newcommand{\STSCtx}{\textlog{StsCtx}}
\newcommand{\STSInv}{\textlog{StsInv}}
\newcommand{\STSSt}{\textlog{StsSt}}
\newcommand{\STSclsd}{\textlog{closed}}
\newcommand{\STSauth}{\textlog{auth}}
\newcommand{\STSfrag}{\textlog{frag}}
\newcommand{\STSS}{\mathcal{S}} % states
\newcommand{\STST}{\mathcal{T}} % tokens
\newcommand{\STSL}{\mathcal{L}} % labels
\newcommand{\stsstep}{\ra}
\newcommand{\ststrans}{\ra^{*}}% the relation relevant to the STS rules
\newcommand{\stsfstep}[1]{\xrightarrow{#1}}
\newcommand{\stsftrans}[1]{\stsfstep{#1}^{*}}
\newcommand{\stsinterp}{\varphi}
\tikzstyle{sts_state} = [rectangle, rounded corners, draw, minimum size=1.2cm, align=center]
\tikzstyle{sts_arrows} = [->,arrows={->[scale=1.5]},every node/.style={font=\sffamily\small}]
\newcommand{\mapstoprop}{\mathrel{\kern-0.5ex\tikz[baseline=(m)]{\node at (0,0) (m){}; \draw[line cap=round] (0,0.16) -- (0,-0.004);}\kern-1.5ex\Ra}}
%% Cancellable invariants
\newcommand\CInv[3]{\textlog{CInv}^{#1,#2}(#3)}
\newcommand*\CInvTok[2]{{[}\textlog{CInv}:#1{]}_{#2}}
\newcommand*\pid{p}
\newcommand\NaInv[3]{\textlog{NaInv}^{#1.#2}(#3)}
\newcommand*\NaTok[1]{{[}\textlog{NaInv}:#1{]}}
\newcommand*\NaTokE[2]{{[}\textlog{NaInv}:#1.#2{]}}
\newcommand*\sname{\iota}
\newcommand*\BoxState{\textdom{BoxState}}
\newcommand*\BoxFull{\textlog{full}}
\newcommand*\BoxEmp{\textlog{empty}}
\newcommand*\BoxSlice[3]{\textlog{BoxSlice}(#1, #2, #3)}
\newcommand*\ABox[3]{\textlog{Box}(#1, #2, #3)}