A segment of a program is shown below:

_ _ _ _ _ _
z = x - 7;
(|z = 5 ∧ n = 4|)

What is the dashed line hiding?

My solution:
I think the dashed line is hiding: (|x - 7 = 5|)
However, I am not sure if it is the correct solution, it would be nice to know how to solve this trivial problem.

  • 1
    $\begingroup$ I don't understand what you mean "the dashed line hiding" something... What is your reasoning? How did you arrive at that answer? What general rule for Hoare logic reasoning seems applicable to this particular case? $\endgroup$
    – D.W.
    Jan 6, 2021 at 19:32
  • $\begingroup$ How did z get to be 5 & how did n get to be 4? (Which is just a restatement of the question.) $\endgroup$
    – philipxy
    Jan 7, 2021 at 23:38
  • $\begingroup$ @philipxy It's a question from an old exam, so I have no idea $\endgroup$ Jan 8, 2021 at 12:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.