\[
  \begin{array}{l l l}
    \delta & \coloneq & \checkedref \mid \unsaferef
  \\[8pt]
    \ectx & \coloneq & \ehole \mid \ectx~e \mid (\vlam{x}{e})~\ectx \mid \vectorgen{v,\ldots,\ectx,e,\ldots} \mid
  \\      & &      \delta~E~e \mid \delta~v~E
  \end{array}
\]

\fbox{$\typesto{\delta~e~e}{\tau}$}
\begin{mathpar}
  \inferrule*[left=T-Check]{
    \typesto{e_1}{\tarray}
    \\
    \typesto{e_2}{\tint}
  }{
    \typesto{\checkedref~e_1~e_2}{\tint}
  }

  \inferrule*[left=T-Unsafe]{
    \typesto{\vectorvn}{\tarray}
    \\
    \typesto{i}{\tint}
  }{
    \typesto{\unsaferef~\vectorvn~i}{\tint}
  }
\end{mathpar}


\fbox{$\smallstep{e}{e}$}
\begin{mathpar}
  \inferrule*[left=E-Ctx]{
    \smallstep{e}{e'}
  }{
    \smallstep{\ectx[e]}{\ectx[e']}
  }

  \inferrule*[left=E-Lam]{
  }{
    \smallstep{(\vlam{x}{e})~v}{e\esubst{x}{v}}
  }

  \inferrule*[left=E-CheckPass]{
    0 \le i < n
  }{
    \smallstep{\checkedref~\vectorvn~i}{v_i}
  }

  \inferrule*[left=E-CheckFail]{
    i < 0 ~~\vee~~ i \ge n
  }{
    \smallstep{\checkedref~\vectorvn~i}{\indexerror}
  }

  \inferrule*[left=E-UnsafePass]{
    0 \le i < n
  }{
    \smallstep{\unsaferef~\vectorvn~i}{v_i}
  }

  \inferrule*[left=E-UnsafeFail]{
    i < 0 ~~\vee~~ i \ge n
    \\
    x \in \ints \cup \{ \segfault \}
  }{
    \smallstep{\unsaferef~\vectorvn~i}{x}
  }
\end{mathpar}

