Thursday, August 28, 2025
What questions do you have? What questions does your neighbor have?
\[ \begin{array}{rrrl} \text{values} & v& \mathrel{::=}& n\mid b \\ \text{expressions} & e& \mathrel{::=}& n\mid b \mid x \mid\mathop{\mathit{uop}} e_1 \mid e_1 \mathbin{\mathit{bop}} e_2 \\ \text{unary operators} & \mathit{uop}& \mathrel{::=}& \texttt{-} \mid\texttt{!} \\ \text{binary operators} & \mathit{bop}& \mathrel{::=}& \texttt{+} \mid\texttt{-} \mid\texttt{*} \mid\texttt{/} \mid\texttt{\&\&} \mid\texttt{||} \mid\texttt{===} \mid\texttt{!==} \mid\texttt{<} \mid\texttt{<=} \mid\texttt{>} \mid\texttt{>=} \\ \text{numbers} & n \\ \text{booleans} & b \\ \text{variables} & x \end{array} \]
\[ \begin{array}{rrrl} \text{statements} & s& \mathrel{::=}& \texttt{;} \mid x \mathrel{\texttt{=}}e \mid s_1 \mathbin{\texttt{;}} s_2 \mid\mathbf{if}\;\texttt{(}e\texttt{)}\;s_1\;\mathbf{else}\;s_2 \mid\mathbf{while}\;\texttt{(}e\texttt{)}\;s_1 \end{array} \]
\[ \begin{array}{rrrl} \text{stores} & \rho& \mathrel{::=}& \circ \mid\rho,x \mapsto v \end{array} \]
\[ \rho \vdash e \Downarrow v \]
A judgment form is …
A set of inference rules …
A derivation …
Define a judgment form \(\rho \vdash s \Downarrow\rho'\) that says, “In store \(\rho\), statement \(s\) executes to yield store \(\rho'\).”
Theorem 1 (Evenness Invariant, Operationally) For any expression \(e\) and store \(\rho\) such that \(\rho(\texttt{i})\) is even, if \[ \mathcal{D}:: \rho \vdash \mathbf{while}\;\texttt{(}e\texttt{)}\; \texttt{i} \mathrel{\texttt{=}} \texttt{i} \mathbin{\texttt{+}} \texttt{2} \Downarrow\rho' \] then \(\rho'(\texttt{i})\) is even.
Define a judgment form \(\langle \rho, s \rangle \rightarrow\langle \rho', s' \rangle\) that says, “In store \(\rho\), statement \(s\) reduces to statement \(s'\) in store \(\rho'\).”
Prove an equivalence between big-step evaluation and small-step reduction. You will first need to define iterating the small-step relation to state the theorem. Then, you will need to come up with a lemma that relates single-step reduction with evaluation.