Question: Homework: Proofs of Program Correctness Consider the following program fragment, with initial and final assertions added: { n > 0 } ans = 0 ;
Homework: Proofs of Program Correctness
Consider the following program fragment, with initial and final assertions added:
ans ;
;
Invariant:
while and ans
a Fill in the invariant assertion above.
b Prove that the loop terminates.
c Give a proof of partial correctness that this program produces its final assertion when started with the initial assertion holding true. Be very clear about each inference rule that you use.
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
