Question: 1. (6 marks/ Prove that the following code satisfies the Partial Correctness property. In particular: assume that the code terminates, and prove that the following

1. (6 marks/ Prove that the following code satisfies the Partial Correctness property. In particular: assume that the code terminates, and prove that the following two statements are true: . (pre is true when line 1 is reached) (assert is true when line 4 is reached) . (assert is true when line 4 is reached) post is true when line 10 is reached) Note: You need to provide your own assert statement for line 4. If you are having trouble proving either of the two statements above, you might need to change your assert statement. Algorithm 1 1: //pre: y == 3 2:22 3: 2+ +y 4: //assert: 5: if y> 0 then 6: 2+ 2+1 7: else 8: 2+0 9: end if 10: //post: z == 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
