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 ACSL annotations
- Subject: [Frama-c-discuss] Problem with ACSL annotations
- From: intissar_mzalouat at yahoo.fr (intissar mzalouat)
- Date: Fri, 21 Dec 2012 08:32:59 +0000 (GMT)
- In-reply-to: <50D1CD7D.2060901@cea.fr>
- References: <25842C23E9421645904C0919C9881E9F1ECDBE6D@CURIE.fokus.fraunhofer.de> <50D1CD7D.2060901@cea.fr>
Hello Patrick, Thank you for your answer. Bur my problem is not solved. I tried to follow the max_element in the ACSL_By_example. This is my new program annotated: /*@ requires \valid_range(queue,0,n-1) && n>0; ??? assigns \nothing; ??? ensures \forall integer i; 0 <= i <= n-1 ==> \result >= queue[i]; ??? ensures \exists integer e; 0 <= e <= n-1 && \result == queue[e]; */ int find_array_max(int* queue, int n){ ? int i, largest; ? largest = 0; /*@ loop variant n - i; ??? loop invariant 0 <= i <= n; ?? loop invariant \forall integer k; 0 <= k < i ==> queue[k] <= largest ; ?? loop invariant \exists integer e; 0 <= e <= n-1 && largest == queue[e]; */ ? for (i = 0; i < n; i++) { ??? if (queue[i] > largest) ????? largest = queue[i]; ? } ? return largest; } Could you, please, tell me why I am still not able to verify all the VC? The problem still in the " loop invariant \exists integer e; 0 <= e <= n-1 && largest == queue[e];". Thanks in advance. Best regards, Intissar ________________________________ De?: BAUDIN Patrick <Patrick.Baudin at cea.fr> ??: frama-c-discuss at lists.gforge.inria.fr Envoy? le : Mercredi 19 d?cembre 2012 15h21 Objet?: Re: [Frama-c-discuss] Problem with ACSL annotations Hello Initisar, Yes, It is a good idea to look at ACSL tutorial recommended by Jens. But, just looking at these two lines of your previous mail : > This new version is verifiable: > ensures \exists int e; 0<=e && (\forall int i; 0<=i<15 && e > queue[i]) && ( (e >= 5) || (e >= 10) ) ==> \result == 0; I can see that you didn't fully understand the answer of Virgile. That ensures is almost equivalent to: ensures false ==> what_ever; This is always true what ever does your code! The ensures of your first mail is almost equivalent to ? ensures what_ever ==> false; A function doing the impossible can be compliant with this specification. That is difficult to implement! An alternative is to implement a function which doesn't terminate (while(true);). I guess your code is not like that. So, in addition to the tutorial, look again more carefully at the answer of Virgile. That should help you in understanding why your specification is equivalent to what I say. Patrick. -- Patrick Baudin, DILS/LSL, B?t. 862, Point Courrier n? 174 Institut CARNOT CEA LIST, CEA Saclay Nano-INNOV, 91191 Gif-sur-Yvette cedex, France. tel: +33 (0)1 6908 2072 _______________________________________________ Frama-c-discuss mailing list Frama-c-discuss at lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/frama-c-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20121221/6aa9ce58/attachment.html>
- References:
- [Frama-c-discuss] Problem with ACSL annotations
- From: jens.gerlach at fokus.fraunhofer.de (Gerlach, Jens)
- [Frama-c-discuss] Problem with ACSL annotations
- From: Patrick.Baudin at cea.fr (BAUDIN Patrick)
- [Frama-c-discuss] Problem with ACSL annotations
- Prev by Date: [Frama-c-discuss] Problem with ACSL annotations
- Previous by thread: [Frama-c-discuss] Problem with ACSL annotations
- Next by thread: [Frama-c-discuss] Frama-C and Linux verification?
- Index(es):