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+Why 2.23+Gappa 0.12.3 unable to prove many binary_search VCs


  • Subject: [Frama-c-discuss] Jessie+Why 2.23+Gappa 0.12.3 unable to prove many binary_search VCs
  • From: dwheeler at dwheeler.com (David A. Wheeler)
  • Date: Wed, 06 Jan 2010 15:58:54 -0500 (EST)

The updated Why version 2.23 seems to be working well with Frama-C+Jessie plug-in once loops are annotated with loop variants.  In the modified binary_search example, alt-ergo can prove all the VCs, and CVC3 can prove most of them in reasonable time.  That's great!

Surprisingly (to me), Gappa 0.12.3 cannot handle most of the VCs, even ones that I would *think* Gappa could handle.  Instead, I get "?" markings for most VCs when using gwhy.  Have I mis-installed something?  Is this a problem in the mapping to Gappa by Jessie or Why?  Or, is this a limitation of Gappa itself?  If it's a Gappa limitation, is there an easy way to recover what is sent to Gappa  (other than creating a stub for the "gappa" program) so that I can submit a bug report to the Gappa developers?

Below is the modified binary_search.c file I use, which I process using:
 frama-c -jessie binary_search.c

Thanks.

--- David A. Wheeler 

=================== Modified binary_search.c =================================
/* Not really necessary, but a useful test for lemmas: */
/*@ lemma mean: \forall integer x, y; x <= y ==> x <= (x+y)/2 <= y; */

//@ requires n >= 0 && \valid_range(t,0,n-1);
int binary_search(int* t, int n, int v) {
  int l = 0, u = n-1, p = -1;
  /*@ loop invariant 0 <= l && u <= n-1;
    @ loop variant u-l; */
  while (l <= u ) {
    int m = l + (u - l) / 2;   // NOTE this is changed for bounded calculation
    if (t[m] < v)
      l = m + 1;
    else if (t[m] > v)
      u = m - 1;
    else {
      p = m; break;
    }
  }
  return p;
}