Question: Using the assignment axiom, the rule of sequential composition, and the inference rule for selection, Find the weakest precondition for the following statement. if(a >
Using the assignment axiom, the rule of sequential composition, and the inference rule for selection, Find the weakest precondition for the following statement.
if(a > b) {
temp = a;
a = c;
c = temp
}
else {
temp = b;
b = c;
c = temp;
}
{ c > 5 }
Note: The inference rule for selection is:
{B and P} S1 {Q}, {(not B) and P} S2 {Q}
------------------------------------------------------
{P} if B then S1 else S2 {Q}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
