Quiz. Computing weakest preconditions [004l]

Consider the following statement:


  x := y + 1;
  if x > 0 then
    z := 1
  else
    z := -1

Answer the following questions:

  1. What is \(\texttt {wp}(s, z > 0)\)
  2. What is \(\texttt {wp}(s, z \leq 0)\)
  3. Can we prove \(\{-1 \leq y\}\ s\ \{z > 0\}\)
  4. What about \(\{y > -1\}\ s\ \{z > 0\}\)