As for speed: after some experimenting, I discovered that just inserting
//@ switch (i) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: }
at the top of the loop body reduces the verification time to a
few seconds. Of course, applying this technique in the case of
64-bit ints might not completely solve the performance issue.
As for the other problem you mention: do you mean the need to call these _def lemmas? One solution might be to extend VeriFast so that you can mark a variable as "/*@ bitvector @*/". Then their value would be a term of SMT solver type "bitvector(N)" rather than "int".
Might be a good task for an intern ;-)
--
You received this message because you are subscribed to the Google Groups "VeriFast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to verifast+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/verifast/ad250f0b-0aff-4ed3-8055-991a168ee856n%40googlegroups.com.
I just pushed a commit so that the following now verifies (in less than a second):
//@ Z_of_uint8(0x80U);
//@ Z_of_uint8(0x7FU);
//@ Z z_n0 = Z_of_uint8(n);
while( ( n & 0x80U ) != 0 )
/*@
invariant 0 <= i && i <= 8U && n == shift_left(z_n0, i);
@*/
{
//@ switch (i) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: }
//@ Z_of_uint8(n);
uint8_t low_bits = (uint8_t) (n & 0x7FU);
n = (uint8_t) (low_bits << 1U);
//@ Z_of_uint8(n);
i++;
}
return i;
}
So, no bitvectors yet, but so far it seems that by inserting Z_of_uint{N} calls in the appropriate places one can get pretty low annotation overhead and pretty good performance without them.
Best,
Bart