Question: This exercise contains a while loop and a predicate. Prove that if the values of the variables in the predicate make the predicate true before
This exercise contains a while loop and a predicate. Prove that if the values of the variables in the predicate make the predicate true before entry to the loop, then after execution of the loop the new values of the variables also make the predicate true.
loop: while m and m
m : m
end while
predicate:
m m
Proof: Let mo denote the old value of m before each entry into the loop, and let mn denote the new value of m after each exit from the loop.
Suppose the predicate is true before entry to the loop.
Then
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
