In: Computer Science
According to the loop invariant theorem, a valid loop invariant ?(?)I(n) must have the property that
Select one:
a. ?(?)=0I(n)=0 after a finite number of steps.
b. After the loop, ?→?(?)P→I(N) where ?P is the postcondition.
c. ?(0)→?I(0)→Q, where ?Q is the precondition.
d. None of the other answers are correct
THE LOOP INVARIANT THEOREM
A->B means that A implies B
(d) is the correct answer as none of the option is correct
(a) is wrong because I(n) does not beomes 0 after a finite number of steps, it is the G which becomes 0 after a finite number of steps.
(b) is wrong because after the loop I(N) implies P as given in point IV of algorithm
(c) is wrong because Q implies I(0) as given in point I of the algorithm