\documentclass[12pt]{article}

\title{CSC 455 - Assignment 3}
\author{Robert Krency}
\date{\today}

\usepackage{tikz}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{multicol}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{setspace}

% Geometry 
\usepackage{geometry}
\geometry{letterpaper, left=20mm, top=20mm, right=20mm, bottom=20mm}

% Add vertical spacing to tables
\renewcommand{\arraystretch}{1.4}

\onehalfspacing

% Macros
\newcommand{\definition}[1]{\underline{\textbf{#1}}}

\newenvironment{rcases}
  {\left.\begin{aligned}}
  {\end{aligned}\right\rbrace}

% Begin Document
\begin{document}

\maketitle

\section{Question 1}

\begin{enumerate}

    \item $<var>[1].actual\_type \leftarrow$ look-up(B) Rule(4)
    \item $<expr>.expected\_type \leftarrow <var>.actual\_type$ Rule(1)
    \item $<var>[2].expected\_type \leftarrow$ look-up(B) Rule(1) \\
          $<var>[3].expected\_type \leftarrow$ look-up(A) Rule(1)
    \item $<expr>.expected\_type \leftarrow$ type will be real Rule(2)
    \item $<expr>.expected\_type == <expr>.actual\_type$ false, type mismatch Rule(2)
\end{enumerate}

This will not be a valid statement. The right side will evaluate to a Real variable, following rule 2.
A real value cannot be assigned to an int variable.

\pagebreak

\section{Question 2}

\begin{enumerate}

    \item Find the weakest precondition of the expression $a = a + 2 *\b - 1, \{ a > 1 \}$
    \begin{flalign*}
        & a > 1 && \\
        & a + 2 * b - 1 > 1 && \\
        & a + 2 * b > 2 &&
    \end{flalign*}

    \item Find the weakest precondition of the expressions
    \begin{flalign*}
        & a = 2 * b + 1 && \\
        & b = a - 3 && \\
        & \{ b < 0 \} &&
    \end{flalign*}

    \begin{flalign*}
        & b < 0 && \\
        & a - 3 < 0 && \\
        & a < 3 && \\
        & 2 * b + 1 < 3 && \\
        & 2 * b < 2 && \\
        & b < 1 && 
    \end{flalign*}

\end{enumerate}


\end{document}

