@@ -78,10 +78,10 @@ where the $n$-equivalence at the bottom is meant to apply to the pairs of elemen
In other words, extension carries the decomposition of $\meltB$ into $\meltB_1$ and $\meltB_2$ over the $n$-equivalence of $\melt$ and $\meltB$, and yields a corresponding decomposition of $\melt$ into $\melt_1$ and $\melt_2$.
This operation is needed to prove that $\later$ commutes with existential quantification and separating conjunction:
We write just one mask for a view shift when $\mask_1=\mask_2$.
The convention for omitted masks is generous:
An omitted $\mask$ is $\top$ for Hoare triples and $\emptyset$ for view shifts.
% PDS: We're repeating ourselves. We gave Γ conventions and we're about to give Θ conventions. Also, the scope of "Below" is unclear.
% Below, we implicitly assume the same context for all judgements which don't have an explicit context at \emph{all} pre-conditions \emph{and} the conclusion.
Henceforward, we implicitly assume a proof context, $\pfctx$, is added to every constituent of the rules.
Generally, this is an arbitrary proof context.
We write $\provesalways$ to denote judgments that can only be extended with a boxed proof context.
\ralf{Give the actual base rules from the Coq development instead}
By modus ponens and \ruleref{Necessity}, it suffices to show~\eqref{eq:boxin:as}, which is exactly our assumption.
For the other direction, assume~\eqref{eq:boxin:goal}. We have to show~\eqref{eq:boxin:as}. By \ruleref{AlwaysIntro} and implication introduction, it suffices to show
The first is restricted to deterministic pure reductions, like $\beta$-reduction.
The second is suited to proving triples for (possibly non-deterministic) atomic expressions; for example, with $\expr\eqdef\;!\ell$ (dereferencing $\ell$) and $\state\eqdef h \mtimes\ell\mapsto\valB$ and $\pred(\val, \state')\eqdef\state' =(h \mtimes\ell\mapsto\valB)\land\val=\valB$, one obtains the axiom $\All h, \ell, \valB. \hoare{\ownPhys{h \mtimes\ell\mapsto\valB}}{!\ell}{\Ret\val. \val=\valB\land\ownPhys{h \mtimes\ell\mapsto\valB}}$.
%Axioms for CAS-like operations can be obtained by first deriving rules for the two possible cases, and then using the disjunction rule.
\section{Derived constructions}
In this section we describe some constructions that we will use throughout the rest of the appendix.
A \emph{language}$\Lang$ consists of a set \textdom{Exp} of \emph{expressions} (metavariable $\expr$), a set \textdom{Val} of \emph{values} (metavariable $\val$), and a set \textdom{State} of \emph{states} (metvariable $\state$) such that
\begin{itemize}
% \item A set \textdom{Exp} of \emph{expressions} (metavariable $\expr$) with a
% subset \textdom{Val} of values ($\val$). We assume that if $\expr$ is an
% expression then so is $\fork{\expr}$. We moreover assume a value
% \textsf{fRet} (giving the intended return value of a fork), and we assume that
That is, a set $\mcar{M}$ with two distinguished elements $\mzero$ (zero, undefined) and $\munit$ (one, unit) and an operation $\mtimes$ (times, combine) such that
Let $\mcarp{M}\eqdef |\monoid| \setminus\{\mzero\}$.
\item Arbitrary additional types and terms.
\item There exist functions $\ofval : \textdom{Val}\to\textdom{Expr}$ and $\toval : \textdom{Expr}\pfn\textdom{val}$ (notice the latter is partial), such that
\item There exists a \emph{primitive reduction relation}\[(-,-\step-,-,-)\subseteq\textdom{Expr}\times\textdom{State}\times\textdom{Expr}\times\textdom{State}\times(\textdom{Expr}\uplus\set{()})\]
We will write $\expr_1, \state_1\step\expr_2, \state_2$ for $\expr_1, \state_1\step\expr_2, \state_2, ()$. \\
A reduction $\expr_1, \state_1\step\expr_2, \state_2, \expr'$ indicates that, when $\expr_1$ reduces to $\expr$, a \emph{new thread}$\expr'$ is forked off.
\item All values are stuck:
\[\expr, \_\step\_, \_, \_\Ra\toval(\expr)=\bot\]
\item There is a predicate defining \emph{atomic} expressions satisfying
To instantiate Iris, you need to define the following parameters:
\begin{itemize}
\item A language $\Lang$
\item A locally contractive functor $\iFunc : \COFEs\to\CMRAs$ defining the ghost state
\end{itemize}
\paragraph{Signatures.}
We use a signature to account syntactically for the logic's parameters.
A \emph{signature}$\Sig=(\SigType, \SigFn)$ comprises a set
\noindent
As usual for higher-order logics, you can furthermore pick a \emph{signature}$\Sig=(\SigType, \SigFn, \SigAx)$ to add more types, symbols and axioms to the language.
You have to make sure that $\SigType$ includes the base types:
of base types (or base \emph{sorts}) and a set $\SigFn$ of typed function symbols.
This means that each function symbol has an associated \emph{arity} comprising a natural number $n$ and an ordered list of $n+1$ base types.
Elements of $\SigType$ are ranged over by $\sigtype$.
Each function symbol in $\SigFn$ has an associated \emph{arity} comprising a natural number $n$ and an ordered list of $n+1$ types $\type$ (the grammar of $\type$ is defined below, and depends only on $\SigType$).
to express that $\sigfn$ is a function symbol with the indicated arity.
\dave{Say something not-too-shabby about adequacy: We don't spell out what it means.}
Furthermore, $\SigAx$ is a set of \emph{axioms}, that is, terms $\term$ of type $\Prop$.
Again, the grammar of terms and their typing rules are defined below, and depends only on $\SigType$ and $\SigFn$, not on $\SigAx$.
Elements of $\SigAx$ are ranged over by $\sigax$.
\section{Syntax}
\subsection{Grammar}\label{sec:grammar}
\paragraph{Syntax.}
Iris syntax is built up from a signature $\Sig$ and a countably infinite set $\textdom{Var}$ of variables (ranged over by metavariables $x$, $y$, $z$):
\begin{align*}
\type ::={}&
\sigtype\mid
\unitsort\mid
\type\times\type\mid
\type\to\type
\\[0.4em]
\term, \prop, \pred ::={}&
x \mid
\sigfn(\term_1, \dots, \term_n) \mid
...
...
@@ -115,14 +95,14 @@ Iris syntax is built up from a signature $\Sig$ and a countably infinite set $\t
(\term, \term) \mid
\pi_i\;\term\mid
\Lam x.\term\mid
\term\;\term\mid
\term(\term)\mid
\mzero\mid
\munit\mid
\term\mtimes\term\mid
\\&
\FALSE\mid
\TRUE\mid
\term =_\sort\term\mid
\term =_\type\term\mid
\prop\Ra\prop\mid
\prop\land\prop\mid
\prop\lor\prop\mid
...
...
@@ -130,8 +110,8 @@ Iris syntax is built up from a signature $\Sig$ and a countably infinite set $\t
\prop\wand\prop\mid
\\&
\MU\var. \pred\mid
\Exists\var:\sort. \prop\mid
\All\var:\sort. \prop\mid
\Exists\var:\type. \prop\mid
\All\var:\type. \prop\mid
\\&
\knowInv{\term}{\prop}\mid
\ownGGhost{\term}\mid
...
...
@@ -139,66 +119,58 @@ Iris syntax is built up from a signature $\Sig$ and a countably infinite set $\t
\always\prop\mid
{\later\prop}\mid
\pvsA{\prop}{\term}{\term}\mid
\dynA{\term}{\pred}{\term}\mid
\timeless{\prop}
\\[0.4em]
\sort ::={}&
\type\mid
\unitsort\mid
\sort\times\sort\mid
\sort\to\sort
\dynA{\term}{\pred}{\term}
\end{align*}
Recursive predicates must be \emph{guarded}: in $\MU\var. \pred$, the variable $\var$ can only appear under the later $\later$ modality.
\paragraph{Metavariable conventions.}
We introduce additional metavariables ranging over terms and generally let the choice of metavariable indicate the term's sort:
We introduce additional metavariables ranging over terms and generally let the choice of metavariable indicate the term's type:
\[
\begin{array}{r|l}
\text{metavariable}&\text{sort}\\\hline
\text{metavariable}&\text{type}\\\hline
\term, \termB&\text{arbitrary}\\
\val, \valB&\textsort{Val}\\
\expr&\textsort{Exp}\\
\ectx&\textsort{Ectx}\\
\state&\textsort{State}\\
\end{array}
\qquad\qquad
\begin{array}{r|l}
\text{metavariable}&\text{sort}\\\hline
\text{metavariable}&\text{type}\\\hline
\iname&\textsort{InvName}\\
\mask&\textsort{InvMask}\\
\melt, \meltB&\textsort{Monoid}\\
\melt, \meltB&\textsort{M}\\
\prop, \propB, \propC&\Prop\\
\pred, \predB, \predC&\sort\to\Prop\text{(when $\sort$ is clear from context)}\\
\pred, \predB, \predC&\type\to\Prop\text{(when $\type$ is clear from context)}\\
\end{array}
\]
\paragraph{Variable conventions.}
We often abuse notation, using the preceding \emph{term} meta-variables to range over (bound) \emph{variables}.
We omit type annotations in binders, when the type is clear from context.
We assume that, if a term occurs multiple times in a rule, its free variables are exactly those binders which are available at every occurrence.
\subsection{Types}\label{sec:types}
Iris terms are simply-typed.
The judgment $\vctx\proves_\Sig\wtt{\term}{\sort}$ expresses that, in signature $\Sig$ and variable context $\vctx$, the term $\term$ has sort $\sort$.
In giving the rules for this judgment, we omit the signature (which does not change).
The judgment $\vctx\proves\wtt{\term}{\type}$ expresses that, in variable context $\vctx$, the term $\term$ has type $\type$.
A variable context, $\vctx= x_1:\sort_1, \dots, x_n:\sort_n$, declares a list of variables and their sorts.
In writing $\vctx, x:\sort$, we presuppose that $x$ is not already declared in $\vctx$.
A variable context, $\vctx= x_1:\type_1, \dots, x_n:\type_n$, declares a list of variables and their types.
In writing $\vctx, x:\type$, we presuppose that $x$ is not already declared in $\vctx$.
We write just one mask for a view shift when $\mask_1=\mask_2$.
The convention for omitted masks is generous:
An omitted $\mask$ is $\top$ for Hoare triples and $\emptyset$ for view shifts.
% PDS: We're repeating ourselves. We gave Γ conventions and we're about to give Θ conventions. Also, the scope of "Below" is unclear.
% Below, we implicitly assume the same context for all judgements which don't have an explicit context at \emph{all} pre-conditions \emph{and} the conclusion.
\paragraph{Laws of primitive view shifts.}
Henceforward, we implicitly assume a proof context, $\pfctx$, is added to every constituent of the rules.
Generally, this is an arbitrary proof context.
We write $\provesalways$ to denote judgments that can only be extended with a boxed proof context.
\paragraph{Laws of weakest preconditions.}
\ralf{Give the actual base rules from the Coq development instead}
By modus ponens and \ruleref{Necessity}, it suffices to show~\eqref{eq:boxin:as}, which is exactly our assumption.
For the other direction, assume~\eqref{eq:boxin:goal}. We have to show~\eqref{eq:boxin:as}. By \ruleref{AlwaysIntro} and implication introduction, it suffices to show
The first is restricted to deterministic pure reductions, like $\beta$-reduction.
The second is suited to proving triples for (possibly non-deterministic) atomic expressions; for example, with $\expr\eqdef\;!\ell$ (dereferencing $\ell$) and $\state\eqdef h \mtimes\ell\mapsto\valB$ and $\pred(\val, \state')\eqdef\state' =(h \mtimes\ell\mapsto\valB)\land\val=\valB$, one obtains the axiom $\All h, \ell, \valB. \hoare{\ownPhys{h \mtimes\ell\mapsto\valB}}{!\ell}{\Ret\val. \val=\valB\land\ownPhys{h \mtimes\ell\mapsto\valB}}$.
%Axioms for CAS-like operations can be obtained by first deriving rules for the two possible cases, and then using the disjunction rule.