Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Problem with loop invariant


  • Subject: [Frama-c-discuss] Problem with loop invariant
  • From: hollas at informatik.htw-dresden.de (Boris Hollas)
  • Date: Thu, 17 Jun 2010 19:18:41 +0200

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