I am trying to verify the addition of two 2d arrays but I constantly take a timeout error regardless of the solver that I use.
The code that I am trying to verify is the following:
typedef struct{
float mem[3];
}BaseMatrix3x1;
/*@ requires \valid(b1) && \valid(b2);
@ ensures A: \forall integer i; 0 <= i < 3 ==>
b1->mem[i] == \old(b1)->mem[i] + b2->mem[i];
@ assigns b1->mem[0..2];
@*/
void baseMatrixAssignAdd3x1(BaseMatrix3x1 *b1, BaseMatrix3x1 *b2){
/*@ loop invariant 0 <= i <= 3;
loop invariant \forall integer k;
0 <= k < i ==>
\at(b1->mem[k], LoopCurrent) ==
\at(b1->mem[k], LoopEntry) + \at(b2->mem[k], LoopEntry);
loop assigns i, b1->mem[0..2];*/
for(unsigned int i=0; i<3; i++){
b1->mem[i] += b2->mem[i];
}
}
The second loop invariant is the one that causes all the solvers to timeout.
Do you have any suggestions?
Edit: I fixed the assign error (which was not the problem though).
I don't call this function somewhere yet, I am just trying to prove the loop invariants. From my understanding, in order to verify a function, we do not care about the way that this function will be called. We care only about the Pre and Post conditions that we have.