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] [Jessie] loop invariant


  • Subject: [Frama-c-discuss] [Jessie] loop invariant
  • From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
  • Date: Thu, 22 Aug 2013 11:55:19 -0300

Hi,

We have a function to be proved (attached).

To include the code annotations we followed the tutorial (
www.acm.org/conferences/sac/sac2013/T4-Handout.pdf).

First, we have included the "loop assigns".

After that, we have tried to include one "loop invariant" for each variable
of the "loop assigns".

The analysis of the loop has run without errors when there were not if
clauses in the code. After including the if clauses the analysis has given
four errors.

Why our code annotation is incomplete?

We are using the plugin Jessie, Carbon version.

Best regards,
Nanci, Luciana, Rovedy
------------------------------------------------------------------------------------------------
#pragma JessieIntegerModel(math)
#pragma JessieTerminationPolicy(user)
#pragma JessieFloatModel(math)

float acel[3], soma;
unsigned char  a, b, i, pri;

/*@ requires 0 <= i<= 2;
    requires a==1 || a==0;
    requires b==1 || b==0;
*/
void test()
{
  int j;

  if(a == 1 && b == 0 )
     {
     pri = 0;
     i = 0;
     soma = 0.0;
     }

  acel[i] = 5.0;
  i = i + 1;

  if (i > 2)
     {
     i = 0;
     pri = 1;
     }

  if (pri == 1)
     {
      soma = 0.0;

/*@ loop invariant 0 <= j <= 3;
    loop invariant soma >= 0.0;
    loop invariant \forall integer k; 0 <= k < 3 ==> (soma <= soma +
acel[k]);
    loop assigns j, soma;
*/
       for(j=0;j<3;j++)
       {
           soma = soma + acel[j];
       }
     }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20130822/5c990866/attachment.html>