language.tex 4.21 KB
 Robbert Krebbers committed Oct 17, 2016 1 2 3 \section{Language} \label{sec:language}  Ralf Jung committed Jun 14, 2019 4 A \emph{language} $\Lang$ consists of a set \Expr{} of \emph{expressions} (metavariable $\expr$), a set \Val{} of \emph{values} (metavariable $\val$), a set $\Obs$ of \emph{observations}\footnote{See \url{https://gitlab.mpi-sws.org/iris/iris/merge_requests/173} for how observations are useful to encode prophecy variables.} (or observable events'') and a set $\State$ of \emph{states} (metavariable $\state$) such that  Ralf Jung committed Dec 12, 2016 5 \begin{itemize}[itemsep=0pt]  Robbert Krebbers committed Oct 17, 2016 6 7 8 9 \item There exist functions $\ofval : \Val \to \Expr$ and $\toval : \Expr \pfn \Val$ (notice the latter is partial), such that \begin{mathpar} {\All \expr, \val. \toval(\expr) = \val \Ra \ofval(\val) = \expr} \and {\All\val. \toval(\ofval(\val)) = \val}  Robbert Krebbers committed Oct 17, 2016 10 \end{mathpar}  Ralf Jung committed Jun 06, 2019 11 12 13 \item There exists a \emph{primitive reduction relation} $(-,- \;\step[-]\; -,-,-) \subseteq (\Expr \times \State) \times \List(\Obs) \times (\Expr \times \State \times \List(\Expr))$ A reduction $\expr_1, \state_1 \step[\vec\obs] \expr_2, \state_2, \vec\expr$ indicates that, when $\expr_1$ in state $\state_1$ reduces to $\expr_2$ with new state $\state_2$, the new threads in the list $\vec\expr$ is forked off and the observations $\vec\obs$ are made. We will write $\expr_1, \state_1 \step \expr_2, \state_2$ for $\expr_1, \state_1 \step[()] \expr_2, \state_2, ()$, \ie when no threads are forked off and no observations are made. \\  Robbert Krebbers committed Oct 17, 2016 14 15 16 17 18 19 \item All values are stuck: $\expr, \_ \step \_, \_, \_ \Ra \toval(\expr) = \bot$ \end{itemize} \begin{defn} An expression $\expr$ and state $\state$ are \emph{reducible} (written $\red(\expr, \state)$) if  Ralf Jung committed Jun 06, 2019 20  $\Exists \vec\obs, \expr_2, \state_2, \vec\expr. \expr,\state \step[\vec\obs] \expr_2,\state_2,\vec\expr$  Robbert Krebbers committed Oct 17, 2016 21 22 23 \end{defn} \begin{defn}  Ralf Jung committed Dec 12, 2017 24  An expression $\expr$ is \emph{weakly atomic} if it reduces in one step to something irreducible:  Ralf Jung committed Jun 06, 2019 25  $\atomic(\expr) \eqdef \All\state_1, \vec\obs, \expr_2, \state_2, \vec\expr. \expr, \state_1 \step[\vec\obs] \expr_2, \state_2, \vec\expr \Ra \lnot \red(\expr_2, \state_2)$  Ralf Jung committed Dec 12, 2017 26  It is \emph{strongly atomic} if it reduces in one step to a value:  Ralf Jung committed Jun 06, 2019 27  $\stronglyAtomic(\expr) \eqdef \All\state_1, \vec\obs, \expr_2, \state_2, \vec\expr. \expr, \state_1 \step[\vec\obs] \expr_2, \state_2, \vec\expr \Ra \toval(\expr_2) \neq \bot$  Robbert Krebbers committed Oct 17, 2016 28 \end{defn}  Ralf Jung committed Dec 12, 2017 29 30 31 We need two notions of atomicity to accommodate both kinds of weakest preconditions that we will define later: If the weakest precondition ensures that the program cannot get stuck, weak atomicity is sufficient. Otherwise, we need strong atomicity.  Robbert Krebbers committed Oct 17, 2016 32 33  \begin{defn}[Context]  Robbert Krebbers committed Oct 17, 2016 34  A function $\lctx : \Expr \to \Expr$ is a \emph{context} if the following conditions are satisfied:  Robbert Krebbers committed Oct 17, 2016 35 36  \begin{enumerate}[itemsep=0pt] \item $\lctx$ does not turn non-values into values:\\  Ralf Jung committed Jun 06, 2019 37  $$\All\expr. \toval(\expr) = \bot \Ra \toval(\lctx(\expr)) = \bot$$  Robbert Krebbers committed Oct 17, 2016 38  \item One can perform reductions below $\lctx$:\\  Ralf Jung committed Jun 06, 2019 39  $$\All \expr_1, \state_1, \vec\obs, \expr_2, \state_2, \vec\expr. \expr_1, \state_1 \step[\vec\obs] \expr_2,\state_2,\vec\expr \Ra \lctx(\expr_1), \state_1 \step[\vec\obs] \lctx(\expr_2),\state_2,\vec\expr$$  Robbert Krebbers committed Oct 17, 2016 40  \item Reductions stay below $\lctx$ until there is a value in the hole:\\  Ralf Jung committed Jun 06, 2019 41 42 43 44  \begin{align*} &\All \expr_1', \state_1, \vec\obs, \expr_2, \state_2, \vec\expr. \toval(\expr_1') = \bot \land \lctx(\expr_1'), \state_1 \step[\vec\obs] \expr_2,\state_2,\vec\expr \Ra {}\\ &\qquad \Exists\expr_2'. \expr_2 = \lctx(\expr_2') \land \expr_1', \state_1 \step[\vec\obs] \expr_2',\state_2,\vec\expr \end{align*}  Robbert Krebbers committed Oct 17, 2016 45 46 47  \end{enumerate} \end{defn}  Ralf Jung committed Dec 10, 2017 48 \subsection{Concurrent Language}  Robbert Krebbers committed Oct 17, 2016 49 50 51 52 53  For any language $\Lang$, we define the corresponding thread-pool semantics. \paragraph{Machine syntax} $ Robbert Krebbers committed Oct 17, 2016 54  \tpool \in \ThreadPool \eqdef \List(\Expr)  Robbert Krebbers committed Oct 17, 2016 55 56 $  Ralf Jung committed Jun 06, 2019 57 \judgment[Machine reduction]{\cfg{\tpool}{\state} \tpstep[\vec\obs]  Robbert Krebbers committed Oct 17, 2016 58 59 60  \cfg{\tpool'}{\state'}} \begin{mathpar} \infer  Ralf Jung committed Jun 06, 2019 61 62  {\expr_1, \state_1 \step[\vec\obs] \expr_2, \state_2, \vec\expr} {\cfg{\tpool \dplus [\expr_1] \dplus \tpool'}{\state_1} \tpstep[\vec\obs]  Robbert Krebbers committed Oct 17, 2016 63  \cfg{\tpool \dplus [\expr_2] \dplus \tpool' \dplus \vec\expr}{\state_2}}  Robbert Krebbers committed Oct 17, 2016 64 65 \end{mathpar}  Ralf Jung committed Jun 06, 2019 66 67 We use $\tpsteps[-]$ for the reflexive transitive closure of $\tpstep[-]$, as usual concatenating the lists of observations of the individual steps.  Ralf Jung committed Dec 12, 2016 68 69 70 71 72  %%% Local Variables: %%% mode: latex %%% TeX-master: "iris" %%% End: