Question

Compute the weakest precondition for the following sequence of statements, given the stated post condition. Hint:...

  1. Compute the weakest precondition for the following sequence of statements, given the stated post condition.

Hint: Start by deciding what variable or variables should be mentioned in the precondition. Recall the rule for sequences: the precondition for a statement in a sequence is equal to the post-condition for the statement that precedes it. Note: Your answer will involve a relationship between a and b.

{??}

x = 4 * (3 * y – x);

y = 2 * x – 2;

{y > 10}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Consider y > 10

Substitute y = 2 * x – 2 in the above.

2 * x – 2 > 10

2 * x > 10+2

2 * x > 12

x > 6

Substitute x = 4 * (3 * y – x) in the above.

4 * (3 * y – x) > 6

3 * y – x > 6/4

3 * y – x > 1.5

3 * y > 1.5 + x

y > (1.5 + x)/3

Therefore the weakest precondition is y > (1.5 + x)/3.

Add a comment
Know the answer?
Add Answer to:
Compute the weakest precondition for the following sequence of statements, given the stated post condition. Hint:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT