Tuesday, October 28, 2025
What questions do you have? What questions does your neighbor have?
Let’s simplify and consider arithmetic expressions with variables:
\[ \begin{array}{rrrl} \text{expressions} & e& \mathrel{::=}& x\mid n\mid e_1 \mathbin{\mathit{bop}} e_2 \\ \text{binary operators} & \mathit{bop}& \mathrel{::=}& \texttt{+}\mid\texttt{-}\mid\texttt{*}\mid\texttt{/} \\\\ \text{number properties} & N& \mathrel{::=}& \circ\mid N,n \end{array} \]
Define \(\lbrace\!\lbrack\!\lbrack e \rbrack\!\rbrack\!\rbrace = \lambda P.N\) by induction on the structure of expression \(e\).
\[ \begin{array}{rrl} \lbrace\!\lbrack\!\lbrack n \rbrack\!\rbrack\!\rbrace\, P & \mathrel{:=}& \{ n \} \\ \lbrace\!\lbrack\!\lbrack e_1 \mathbin{+} e_2 \rbrack\!\rbrack\!\rbrace\, P & \mathrel{:=}& \{ n_1 + n_2 \mid \text{$n_1 \in \lbrace\!\lbrack\!\lbrack e_1 \rbrack\!\rbrack\!\rbrace\,P$ and $n_2 \in \lbrace\!\lbrack\!\lbrack e_2 \rbrack\!\rbrack\!\rbrace\,P$} \} \\ \lbrace\!\lbrack\!\lbrack x \rbrack\!\rbrack\!\rbrace\, P & \mathrel{:=}& \{ \rho(x) \mid \rho\in P \} \end{array} \]
Let us abstract number properties in a finite manner by partitioning into signs:
\[ \begin{array}{rrrl} \text{signs} & \mathit{sign}& \mathrel{::=}& \mathsf{-}\mid\mathsf{0}\mid\mathsf{+} \\ \text{abstract numbers} & \hat{n}& \mathrel{::=}& \bot \mid\mathit{sign}\mid\top \end{array} \]
Define a concretization relation \(n \models \hat{n}\) by cases on \(\hat{n}\).
We write \(\gamma(\hat{n}) = N\) for the concretization function such that \(\gamma(\hat{n}) = N\) iff \(n \models \hat{n}\) for all \(n\in N\).
\[ \begin{array}{lcl} n \models \mathsf{-} & \text{iff} & n< 0 \\ n \models \mathsf{0} & \text{iff} & n= 0 \\ n \models \mathsf{+} & \text{iff} & n> 0 \\ n \models \top & \text{always} \\ n \models \bot & \text{never} \end{array} \]
\[ \begin{array}{lcl} \gamma(\mathsf{-}) & \mathrel{:=}& \{ n \mid n< 0 \} \\ \gamma(\mathsf{0}) & \mathrel{:=}& \{ n \mid n= 0 \} \\ \gamma(\mathsf{+}) & \mathrel{:=}& \{ n \mid n> 0 \} \\ \gamma(\top) & \mathrel{:=}& \{ n \mid \text{true} \} \\ \gamma(\bot) & \mathrel{:=}& \emptyset \end{array} \]
Define operations on abstract numbers:
\(\fbox{$\hat{n}_1 \mathbin{\mathbin{\hat{+}}} \hat{n}_2 = \hat{n}'$}\)
\(\fbox{$\hat{n}_1 \mathbin{\mathbin{\hat{-}}} \hat{n}_2 = \hat{n}'$}\)
\(\fbox{$\hat{n}_1 \mathbin{\mathbin{\hat{\cdot}}} \hat{n}_2 = \hat{n}'$}\)
\(\fbox{$\hat{n}_1 \mathbin{\mathbin{\hat{\div}}} \hat{n}_2 = \hat{n}'$}\)
State soundness of these abstract operations.
Lemma 1 (Local Soundness)
| \(\mathbin{\hat{\cdot}}\) | \(\mathsf{-}\) | \(\mathsf{0}\) | \(\mathsf{+}\) | ||
|---|---|---|---|---|---|
| \(\mathsf{-}\) | \(\mathsf{+}\) | \(\mathsf{0}\) | \(\mathsf{-}\) | ||
| \(\mathsf{0}\) | \(\mathsf{0}\) | \(\mathsf{0}\) | \(\mathsf{0}\) | ||
| \(\mathsf{+}\) | \(\mathsf{-}\) | \(\mathsf{0}\) | \(\mathsf{+}\) |
| \(\mathbin{\hat{+}}\) | \(\mathsf{-}\) | \(\mathsf{0}\) | \(\mathsf{+}\) | \(\top\) | |
|---|---|---|---|---|---|
| \(\mathsf{-}\) | \(\mathsf{-}\) | \(\mathsf{-}\) | \(\top\) | \(\top\) | |
| \(\mathsf{0}\) | \(\mathsf{-}\) | \(\mathsf{0}\) | \(\mathsf{+}\) | \(\top\) | |
| \(\mathsf{+}\) | \(\top\) | \(\mathsf{+}\) | \(\mathsf{+}\) | \(\top\) | |
| \(\top\) | \(\top\) | \(\top\) | \(\top\) | \(\top\) |
| \(\mathbin{\hat{\div}}\) | \(\mathsf{-}\) | \(\mathsf{0}\) | \(\mathsf{+}\) | \(\top\) | \(\bot\) |
|---|---|---|---|---|---|
| \(\mathsf{-}\) | \(\mathsf{+}\) | \(\bot\) | \(\mathsf{-}\) | \(\top\) | \(\bot\) |
| \(\mathsf{0}\) | \(\mathsf{0}\) | \(\bot\) | \(\mathsf{0}\) | \(\mathsf{0}\) | \(\bot\) |
| \(\mathsf{+}\) | \(\mathsf{-}\) | \(\bot\) | \(\mathsf{+}\) | \(\top\) | \(\bot\) |
| \(\top\) | \(\top\) | \(\bot\) | \(\top\) | \(\top\) | \(\bot\) |
| \(\bot\) | \(\bot\) | \(\bot\) | \(\bot\) | \(\bot\) | \(\bot\) |
What are the relationships between number values \(n\), abstract numbers \(\hat{n}\), and number properties \(N\)?
Consider the non-relational abstract store:
\[ \begin{array}{rr} \text{(non-relational) abstract stores} & \hat{\rho}& \mathrel{::=}& \circ\mid\hat{\rho},x \mapsto\hat{n} \end{array} \]
Define the abstract interpretation function \(\lbrack\!\lbrack e \rbrack\!\rbrack^\sharp = \lambda \hat{\rho}.\hat{n}\) by induction on the structure of \(e\).
State soundness of this abstract interpretation function.
Or similarly, define the abstract interpretation judgment form \(\fbox{\(\hat{\rho} \vdash e \mathrel{\Downarrow^\sharp}\hat{n}\)}\).
State soundness of this abstract interpretation relation.