I'm trying to create a loop invariant to check if all the elements of an array with an even index have the number 2on them (program to find prime numbers, in this step it's generating the SPF).
However, when I try this:
/*@ loop invariant (\forall integer j; (4<=j<i && j%2==0 ==> prime[j]==2));
*/
for (int i = 4; i <= n; i += 2) {
prime[i] = 2;
}
I get the following error:
Warning:
invalid E-ACSL construct
`invalid guard 4 ≤ j < i_0 ∧ j % 2 ≡ 0 in quantification
∀ ℤ j; 4 ≤ j < i_0 ∧ j % 2 ≡ 0 ⇒ *(prime + j) ≡ 2'.
Ignoring annotation.
I really can't understand what's happening here, but any help is much appreciated