Homework # 6 - due Tuesday October 4th
19. Compute the weakest precondition for each of the following statements and postconditions
a. a = 2 * (b – 1) – 1 {a > 0}
2*(b-1)-1 > 0
2b – 2 -1 > 0
2b – 3 > 0
2b > 3
b > 3/2 Ü required answer (derivation is optional)
b. b = (c + 10) / 3 { b > 6}
(c+10)/3
> 6
(c+10) > 18
c > 8 Ü required answer (derivation is optional)
20. Compute the weakest precondition for each of the following sequences of assignment statements and their postconditions
a. a = 2 * b + 1;
b = a – 3
{ b < 0}
a – 3 < 0
a < 3
Ü
required answer (derivation is
optional)