From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,b49755ab898bcffd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: SPARK again : for-loop vs single loop - a strange case Date: Fri, 28 May 2010 11:00:14 +0200 Organization: Ada At Home Message-ID: References: <2b6ae662-77e2-4d1a-a2b2-3df54f8ab98e@v37g2000vbv.googlegroups.com> NNTP-Posting-Host: GzQnrNzaoPGtXNRJOLsqnw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.53 (Win32) Xref: g2news2.google.com comp.lang.ada:12110 Date: 2010-05-28T11:00:14+02:00 List-Id: Le Fri, 28 May 2010 10:14:56 +0200, Phil Thornley = a =C3=A9crit: > You can get it back by adding L <=3D Length to the assertion. [You > might also need to change the test to > exit when L >=3D Length;] > > It is put in there aotomatically for a 'for' loop but not for a simple= > loop. You're wonderful Phil! This was something near to that: I've added L <=3D= = Length, it was not OK, so I though if the upper bound hypothesis was los= t, = so as well was probably the one of the lower bound. So I've added L >=3D= 1, = then figured that the Checked expression was not verified for L lower th= an = zero, so thought if one hypothesis was required, this was this only one,= = the one for the lower bound. So I removed the L <=3D Length and left L >= =3D 1 = only, which was shown to be enough. Without you, I would not have been able to guess the trouble was there, = as = to me, it was obvious L >=3D 1, as the type of L, which is really = Length_Type, has Length_Type'First =3D 1. This is still strange in some way, as if I do L >=3D Length_Type'First, = it = works. So the Assert clause even drops implicit hypotheses about numeric type = bounds ? I was thinking this ones were preserved even after an Assert = clause. I was pretty sure Assert was still preserving somethings, as I feel I = remember I have read something suggesting that in one of the Praxis's = documentation and in yours as well (do not remember which PDF file, and = = there many to check). > * If the code is too big to put in a message then you can send it by > email to the address on the proof tutorials and I'll be happy to have > a look at it. Not too big, this was just that as I was afraid my style with SPARK may = = not be good enough to be posted here. I have lot of lines of SPARK proof= s = for few lines of Ada text, which may seems silly to someones... also tha= t = I like to have explicit things, because it is more easy to understand an= d = to track. -- = There is even better than a pragma Assert: a SPARK --# check. --# check C and WhoKnowWhat and YouKnowWho; --# assert Ada; -- i.e. forget about previous premises which leads to conclusion -- and start with new conclusion as premise.