% flag to use fancy fonts / graphics
\newif\ifjnf\jnftrue

\documentclass[11pt]{article}

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

\usepackage{csnotes}
\newcommand{\lam}[2]{\ensuremath{\lambda #1.\,#2}}
\newcommand{\subst}[3]{\ensuremath{#1[#2/#3]}}

\begin{document}

\header{15 November, 2011}{Shrutarshi Basu}

\section{The Constructive Method}

\begin{enumerate}
  \item A Model of Computation
  \item Logic to encode propositions
  \item Evidence Semantics
\end{enumerate}

As an example involving languages and parsers:

\begin{enumerate}
  \item For the proposition $w$:word $\in$ [$G$:Grammar] the evidence is a
    \textit{parse tree}.
  \item For the proposition $\forall w$:word $w \in [G] \lor w \notin [G] w$ the
    evidence is a \textit{parser}.
  \item For the proposition $\forall G:LALR(1) \forall w:$word $w \in [G] \lor w
    \notin [G]$ the evidence is a \textit{parser generator}.
\end{enumerate}

\section{A Logic For Distributed Systems}
Use the logic of Message Sequence Diagrams (MSDs) already used by programmers to
reason about real-world distributed systems. A MSD can be considered an Event
Ordering of Events (E), assignments of locations (L) to events and Lamport's
Causal Ordering Relation ($\alpha$): $\langle E, L:E \rightarrow L, \alpha
\rangle$

\subsection{Axioms}

\begin{enumerate}
  \item $=, <$ (equality and before) are decidable
  \item $<$ is transitive, strongly well founded and locally finite
  \item $<$ is a total ordering of events at the same location
\end{enumerate}

\section{A Model of Computation for Distributed Systems}
The model is that of Communicating Processes based on Processes, Messages, and
Locations which can be combined to give Components and Systems, all executing in
an Environment. Critically, Messages may contain other Processes or some
information that can be used to extract a Process. We wish to give definitions
of these concepts in terms of standard $\lambda$ calculus and type theory so
that existing machinery (like NuPRL) can be applied to reason about them.

In the following definitions, a \textit{Bag} is an unordered collection of items
allowing duplicates (hence neither a list nor a set).

\subsection{Model Definitions}

\begin{enumerate}
  \item Process $\subseteq$ Msg $\rightarrow$ Process $\times$ Bag (Loc $\times$
    Msg)
  \item Component = Location $\times$ Process
  \item System = Bag Component $\times$ Bag (Loca $\times$ Msg)
  \item An Environment is responsible for deciding which message is to be
    delivered next
\end{enumerate}

\subsection{Co-Recursive Types}
Co-Recursive Types are required in order to encode the property of extracting
Processes from the contents of messages.

If F is a function from types to types (F::Type $\rightarrow$ Type) and $\top$
is the universal type, then
\[
corec(T.F[T]) = \bigcap_{n:\mathbb{N}}F^n (\top)
\]

For example, $corec(T.\mathbb{Z}\times T)$ is the type of streams of integers.

F is continuous if
\[\bigcap_{n:\mathbb{N}}FX_i \subseteq F(\bigcap_{n:\mathbb{N}}X_i)\]

F is monotone if \[A \subseteq B \rightarrow F(A) \subseteq F(B)\]

\subsection{Model Definitions using Types}
Using the notion of corecursive types we can restate the above
definitions. Assume that P is some data in a message that can be used to
construct a process. Parentheses are used in definitions and square brackets in
applications.

\begin{enumerate}
  \item Process $\subseteq$ Msg(Process) $\rightarrow$ Process $\times$
    Bag(Loc$\times$Msg(Process))
  \item M(P) = Header $\times$ (Data + P)
  \item Ext(P) = Bag (Loc $\times$ M[P])
  \item F(P) = M[P] $\rightarrow$ P $\times$ Ext[P]
  \item Process = corec(P.F[P])
  \item Msg = M(Process)
  \item Environment = $\mathbb{N} \rightarrow b$ : Bag(Loc $\times$ Msg)
    $\rightarrow$ {$b_1, b_2$ : Ext $\times$ Ext} such that
    
    \begin{enumerate}
      \item $b_1 + b_2 = b$
      \item There is no repeat in the locations of $b_1$
    \end{enumerate}

\end{enumerate}

This then provides the basic required to encode configurations of the system as
groups of processes and generate the evidence semantics which can in turn be
used to reason about the behavior of such systems.

\end{document}
