--- layout: fc_discuss_archives title: Message 36 from Frama-C-discuss on June 2010 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Problem with loop invariant



Hello,

in the loop below, both assertion can be verified, but not the loop
invariant. The assertions are the same as the 3rd loop invariant that
can't be proved. Since the assertion holds (as proved by Jessie) both at
the beginning and at the end of the loop body, I don't understand why
the loop invariant can't be proved.

I should have used integer instead of int in the specification, btw.

/*@
	loop variant MSGCOUNT - internal.msgnum;
	loop invariant 0 <= internal.msgnum &&
		\forall int x; 0 <= x < internal.msgnum ==>
                       tosend->data[x] == received->data[x];
	*/
for (internal.msgnum = 0;internal.msgnum < MSGCOUNT; internal.msgnum++)
{
	//@ assert \forall int x; 0 <= x < internal.msgnum ==>
                         tosend->data[x] == received->data[x];
	sreadi(msg_send,tosend,internal.msgnum);
	abpRound(msg_send,msg_receive,&channel,&internal);
	swritei(received,msg_receive,internal.msgnum);
	//@ assert \forall int x; 0 <= x < internal.msgnum ==>
                         tosend->data[x] == received->data[x];
}


-- 
Regards,
Boris