\documentclass[11pt]{article}
\usepackage{palatino}
\usepackage{latexsym}
\usepackage{verbatim}
\usepackage{alltt}
\usepackage{amsmath,proof,amsthm,amssymb,enumerate,mathabx}
\usepackage{china2e} % to get \Integer, \Natural
\usepackage{math-cmds}
\usepackage{listings}
\usepackage{url}

% FIXME be more precise about parens in question 2

\lstset{tabsize=3, basicstyle=\ttfamily\small, commentstyle=\itshape\rmfamily, numbers=left, numberstyle=\tiny, language=C,moredelim=[il][\sffamily]{?},mathescape=true,showspaces=false,showstringspaces=false,columns=fullflexible,xleftmargin=15pt,escapeinside={(@}{@)}, morekeywords=[1]{let,ref,policy,external,component,connects,to,meth,val,where,return,group,by,within,count,connect,with,attr,html,head,title,style,body,div,keyword}}
\lstloadlanguages{C,Java}

\newcommand{\question}[2]
  {\bigskip \noindent
   {\bf Question #1} (#2 points).}

\newcommand{\extracreditquestion}[1]
  {\bigskip \noindent
   {\bf Question #1} (EXTRA CREDIT).}

\newcommand{\definition}[2]
  {\bigskip
   \begin{tabular}{p{1.5in}p{4.0in}}
        \textbf{#1} & #2 \\
        \end{tabular}
  }

\def\prop{\textsf{\,\,prop}}
\def\thm{\textsf{\,\,thm}}
\def\implies{\Rightarrow}

\newcommand{\parg}[1] % program argument
  {\ldbrack #1 \rdbrack}
  
\newcommand{\join}{\sqcup}
\newcommand{\meet}{\sqcap}
\newcommand{\alap}{\sqsubseteq}



\title{Reading Questions Set 4\\
Symbolic Execution and Finite Precision Analysis}
\author{15-819O: Program Analysis\\
        Jonathan Aldrich\\
		{\tt jonathan.aldrich@cs.cmu.edu}}
\date{Due: Wednesday, March 3, 2013 (1:00 pm) \\[1em]
10 points total
}

\begin{document}
\begin{sloppypar}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}

\newcommand{\pfalse}{\mbox{false}}
\newcommand{\ptrue}{\mbox{true}}
\newcommand{\pand}{\mbox{and}}
\newcommand{\por}{\mbox{or}}
\newcommand{\pskip}{\mbox{skip}}
\newcommand{\pif}{\mbox{if}}
\newcommand{\pthen}{\mbox{then}}
\newcommand{\pelse}{\mbox{else}}
\newcommand{\pdo}{\mbox{do}}
\newcommand{\pwhile}{\mbox{while}}




\maketitle

Read the following papers:

\begin{itemize}

\item Khoo Yit Phang, Bor-Yuh Evan Chang, and Jeffrey S. Foster.  Mixing Type Checking and Symbolic Execution.  PLDI 2010.  \\
\small\url{http://www.cs.colorado.edu/~bec/papers/pldi10-mix.pdf} \textit{When reading, focus primarily on the formalization of symbolic execution in section 3.1.}

\item Eric Goubault and Sylvie Putot.  Static Analysis of Finite Precision Computations.  VMCAI 2011.\\
\small\url{http://www.lix.polytechnique.fr/Labo/Sylvie.Putot/Publications/vmcai11.pdf}

\end{itemize}

Answer the questions below in a text file that you email to the instructor (aldrich@cs.cmu.edu) with subject ``RQ 4'':

\clearpage

\question{1}{5}
\begin{quote}

Symbolically execute the following program, which is given in the language of the first paper, and also in the equivalent C code.  Give the result of symbolic execution as a pair $<$S'; s$>$.

\begin{lstlisting}
// code in the language of the paper
foo(int y, int z)
	let w = y;
	let x = ref (w + z);
	if (!x == y)
		x := !x + z;
	x
	
// equivalent C code
foo(int y, int z)
	int w = y;
	int *x = malloc(sizeof(int));
	*x = w + z;
	if (*x == y)
		*x = *x + z;
	return x;
\end{lstlisting}

\end{quote}

\question{2}{5}
\begin{quote}

Consider the following program, in which all variables hold IEEE 754 double-precision floating point numbers:

\[
\begin{array}{l}
x := [0, 5]\\
y := 2 * x\\
z := 10 - y\\
w = x + z\\
\end{array}
\]

As with Example 1 in the second paper, compute the range of $w$ using (A) interval analysis and (B) relational analysis.  Finally, choose one of these two techniques (say which) and (C) compute the error of $y$.  Show your work on all parts (A)-(C).

Notes: When computing the error, assume round-to-nearest mode.  You may also assume some fixed values for $\delta_r$ and $\delta_a$ from Equation 1 in the paper (e.g. 0.001 and 0.00001) but if anyone wants to find or compute the actual values from the IEEE standard I am curious what they are.

\end{quote}




\end{sloppypar}
\end{document}
