Question: Counting Modulo 7 5+2010+5 credits Question 3 Consider the following code fragment that we refer to as Count below, and we refer to the body

 Counting Modulo 7 5+2010+5 credits Question 3 Consider the following code

Counting Modulo 7 5+2010+5 credits Question 3 Consider the following code fragment that we refer to as Count below, and we refer to the body of the loop (i.e. the two assignments together with the if-statement) as Body while (y n) y:= y + 1; xx1; if x7) then x0 else x-x The goal of the exercise is to show that {7jcount( 7} 1. Given the desired postcondition, what is a suitable invariant P for the loop? You just need to state the invariant 2. Give a Hoare Logic proof of the fact that your invariant above is indeed an invariant, i.e. prove the Hoare-triple PBody[P 3. Hence, or otherwise, give a Hoare-logie proof of the triple f7Count

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!