Compute the weakest precondition for each of the following selection constructs and their postconditions: a. if (a

Question:

Compute the weakest precondition for each of the following selection constructs and their postconditions:

a. if (a == b)
      b = 2 * a + 1
    else
      b = 2 * a;
    {b > 1}

b. if (x < y)
       x = x + 1
    else
       x = 3 * x
    {x < 0}

c. if (x > y)
       y = 2 * x + 1
    else
       y = 3 * x - 1;
    {y > 3}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Concepts Of Programming Languages

ISBN: 9780133943023

11th Edition

Authors: Robert Sebesta

Question Posted: