<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% flag to use fancy fonts / graphics
\newif\ifjnf\jnftrue

\documentclass[11pt]{article}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{listings}
\usepackage{cmtt}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{ upgreek }
\usepackage{url}
\usepackage[margin=1in]{geometry}

\usepackage{csnotes}
\lstset{morekeywords={rfork,rjoin,ref}}
% local definitions for this lecture
\newcommand{\lam}[2]{\ensuremath{\lambda #1.\,#2}}
\newcommand{\definedas}{\ensuremath{\triangleq}}
\newcommand{\subst}[3]{\ensuremath{#1[#2/#3]}}

\newcommand{\ctx}{\ensuremath{\upvarepsilon}}
\begin{document}

\header{22 November 2011}{Owen Arden}

\section{Semantics of concurrent revisions}

In concurrent revisions, each thread gets its own isolated thread of control.  All updates to ``shared'' state occur at joins.

\paragraph{Contributions}
\begin{enumerate}
  \item  Semantics
  \item Proof of determinancy
  \item Formalizes connection to snapshot isolation
\end{enumerate}

\paragraph{Canonical example}
\begin{lstlisting}
        x=0
        y=0
        r = rfork { if y=0 then x++ }
        if x=0 then y++;
        rjoin r;
\end{lstlisting}

Assuming versioned types for x and y, output is $x==1$ and $y==1$.

\section{Encoding transactions in concurrent revisions}

\paragraph{Grammar}
\begin{eqnarray*}
        v ::=&amp; c \mid x \mid l \mid r \mid \lambda x.e \\
        e ::=&amp; v \mid e e \mid ( e?~e : e ) \mid \texttt{ref } e \mid \\
        &amp; !e \mid e := e \mid \texttt{rfork }e \mid \texttt{rjoin }e \\
        \ctx ::=&amp; \square \mid \ctx \; e \mid v\;\ctx
        \mid ( \ctx?~e:E) \mid \texttt{ref } e \\
        &amp; !\ctx \mid \ctx := e \mid l := \ctx \mid \texttt{rjoin } \ctx
\end{eqnarray*}

$s \in Rid \rightharpoonup \texttt{Store} \times \texttt{Store} \times \texttt{Expr} $

\paragraph{Selected rules}
\begin{definition*}
        \begin{eqnarray*}
        s \rightarrow_r s'
        \end{eqnarray*}
\end{definition*}
\begin{definition*}[Apply]
        \begin{eqnarray*}
                s~(r \mapsto \langle \sigma, \tau, \ctx[(\lambda x.e) v] \rangle ]) \rightarrow_r
                s~[r \mapsto \langle \sigma, \tau, \ctx[\subst{e}{v}{x}] \rangle ]
        \end{eqnarray*}
\end{definition*}
\begin{definition*}[Deref]
        \begin{eqnarray*}
                s~(r \mapsto \langle \sigma, \tau, \ctx[!\ell] \rangle ]) \rightarrow_r
                s~[r \mapsto \langle \sigma, \tau, \ctx[(\sigma :: \tau)(\ell)] \rangle ]
        \end{eqnarray*}
\end{definition*}
\begin{definition*}[Fork]
        \begin{eqnarray*}
                s~(r \mapsto \langle \sigma, \tau, \ctx[\texttt{rfork } e] \rangle ]) \rightarrow_r
                s~[r \mapsto \langle \sigma, \tau, \ctx[r'] \rangle \quad 
                r' \mapsto \langle \sigma::\tau, \cdot, e \rangle ]
        \end{eqnarray*}
\end{definition*}
\begin{definition*}[Join]
        \begin{eqnarray*}
                s~[r \mapsto \langle \sigma, \tau, \ctx[\texttt{rjoin } r'] \rangle \quad 
                r' \mapsto \langle \sigma', \tau', v \rangle ] \rightarrow_r&amp;
                s [ r \mapsto \langle \sigma, \tau :: \tau', \ctx [v] \rangle, r' \mapsto \bot] \\
                s~[r \mapsto \langle \sigma, \tau, \ctx[\texttt{rjoin } r'] \rangle \quad 
                r' \mapsto \langle \sigma', \tau', \bot \rangle ] \rightarrow_r&amp; \texttt{error}
        \end{eqnarray*}
\end{definition*}

\paragraph{Notation} $e \downarrow s$  Evaluating $e$ results in the store $s$

\begin{definition*}{Equivalence} 

           $s \approx s' \iff \exists \alpha, \beta . s = \alpha(\beta(s'))$

           Where $\alpha$ and $\beta$ rewrite thread ids and location ids. 
\end{definition*}

\paragraph{Theorem} If $e \downarrow s$ and $e \downarrow s'$ then $s \approx s'$

\paragraph{Lemma} $\rightarrow_r$ preserves $\approx$

\paragraph{Lemma} If $s_1, s_1'$ are reachable and $s_1 \approx s_1' $ and
    \begin{eqnarray*}
            s_1 \rightarrow_r&amp; s_2 \\
            s_1' \rightarrow_r'&amp; s_2'
    \end{eqnarray*}
    then  $\exists s_3,s_3'$
    \begin{eqnarray*}
            s_2 \rightarrow_r'&amp; s_3 \\
            s_2' \rightarrow_r&amp; s_3'
    \end{eqnarray*}
    and $s_3 \approx s_3'$
\end{document}
</pre></body></html>