\documentclass[11pt]{article}
\newcommand{\tuple}[1]{\ensuremath \langle #1 \rangle}
\usepackage{color}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{mathrsfs}
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage[all]{xy}
\newtheorem{theorem}{Theorem}
\newtheorem{prop}{Proposition}
\newtheorem{lem}{Lemma}
\newtheorem{defn}{Definition}
\newcommand{\note}[1]{{\color{red} \bf [[#1]]}}
\newcommand{\push}[1][1]{\hskip\dimexpr #1\algorithmicindent\relax}
\begin{document}


\setlength\parindent{0pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text


\section{\textbf{Introduction}}







\section{\textbf{Server}}
The server maintains a collection of slots such that each slot contains some data.
The operations on the slot are as follows:
\begin{itemize}
    \item Put slot
    \item Get slot
    \item Delete Slot
\end{itemize}

\subsection{\textbf{Server Notation Conventions}}
$s \in SN$ is a server sequence number\\
$sv \in SV$ is a slot's value\\
$slot_s = \tuple{s, sv} \in SL \subseteq SN \times SV$

\subsection{\textbf{Server State}}
\textit{n = current server sequence number}\\
\textit{SL = set of live slots on the server}\\

\textbf{Initial Server State}\\
$SL = \emptyset$\\
$n = 0$

\subsection{\textbf{Put Slot}}
Put slot is an operation that inserts data into a new slot at the server.\\

\textbf{Put Function:}
\begin{algorithmic}[1]
\Function{PutSlotServer}{$sv_p$}
    \State $s_p \gets n$
    \State $n \gets n + 1$
    \State $SL \gets SL \cup \{\tuple{s_p,sv_p}\}$
\EndFunction
\end{algorithmic}


\subsection{\textbf{Get Slot}}
Get slot is an operation that returns all server slots that are greater than some server sequence number.\\

\textbf{Get Function:}
\begin{algorithmic}[1]
\Function{GetSlotServer}{$s_g$}
    \State \Return{$\{\tuple{s, sv} \in SL \mid s \geq s_g\}$}
\EndFunction
\end{algorithmic}

\subsection{\textbf{Delete Slot}}
Delete slot is an operation that deletes all live slots that have server sequence numbers that are equal to or less than some server sequence number.\\

\textbf{Delete Function:}
\begin{algorithmic}[1]
\Function{DeleteSlotServer}{$s_d$}
    \State $SD \gets \{\tuple{s, sv} \in SL \mid s \leq s_g\}$
    \State $SL \gets SL - SD$
\EndFunction
\end{algorithmic}








\section{\textbf{Client}}
The data structure acts as a key store where key-value pairs can be read and set.
The data structure exposes the following functions:
\begin{itemize}
    \item Put Transaction
    \item Get key-value pair
    \item Create new key
\end{itemize}

\subsection{\textbf{Client Notation Conventions}}
$mid_s \in MID$ is the machine ID for the device that created $record_s$.\\
$hmac_s$ is the HMAC of $record_s$\\
$c_{mid}$ is the latest read clock for a device with machine ID $mid$\\
$vc_s = \{c_{mid} | mid \in MID\}$\\


$payload_s = \{x_1, x_2,..., x_k | \forall k, x_k \in \{$transaction, commit, abort, resize, new-key, sequence, delete$\}\}$\\
$record_s = \tuple{mid_s, vc_s, hmac_s, payload_s}$ \\

\subsection{\textbf{Client State}}
\textit{s = largest server sequence number pulled from the server by a device} \\


\subsection{Helper Functions}
The following helper functions are needed:\\

\textbf{Get Latest Data Structure From Server:}\\
\textbf{Delete Records:}\\
\textbf{Check Data Structure for Malicious Activity:}


\subsection{\textbf{Put Transaction}}



\subsection{\textbf{Get key-value pair}}
\subsection{\textbf{Create new key}}

\end{document}
