comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <PChapin@vtc.vsc.edu>
Subject: Re: SPARK loop VCs that go "one beyond" the loop?
Date: Sun, 25 Mar 2012 06:57:05 -0400
Date: 2012-03-25T06:57:05-04:00	[thread overview]
Message-ID: <YridnaJ19_2RZ_PS4p2dnAA@giganews.com> (raw)
In-Reply-To: <MPG.29d2da3de11de090989696@news.zen.co.uk>

On 2012-03-20 14:18, Phil Thornley wrote:

> Peter,
>
> The clue to the fact that you needed to add I=I% is in the hypotheses.
>
> I put enough code around the code in your initial post to get the VC that
> you also posted.
>
> Then, with the additional condition, there are two particular hypotheses:
> H2:    fld_description_size(element(event_array, [i]))<=
>            description__index__subtype__1__last .
> H13:   loop__2__j<  fld_description_size(element(event_array, [
>            i__entry__loop__2])) .
> where the conclusion is:
> C1: loop__2__j<  description__index__subtype__1__last .
>
> so by including I=I% in the loop invariant (which becomes i=i__entry__loop__2
> in the VC) the conclusion is provable.

Thanks for your comments. They are helpful, as always. The problem I'm 
having, in general (no longer related to any specific VC), is that if 
the loop assertion mentions the loop index variable there is a tendency 
for SPARK to generate an unprovable VC of the form

Hx: loop__1__i <= some_array__index__subtype__1__last
...
Cy: loop__1__i + 1 <= some_array__index__subtype__1__last

This is for the path from the assertion to the assertion and it's trying 
to show that the loop index variable is always in bounds of some 
array... even *after* the last iteration. This generally isn't true, but 
it doesn't matter because there is no "next" iteration in that case.

If I write a loop assertion that doesn't mention the loop index variable 
this problem doesn't arise, naturally. However, I can avoid it anyway by 
doing... something... with that loop assertion. My problem is that I 
haven't quite figured out what triggers VCs like the one above so I have 
to kind of guess my way around how to avoid them.

Peter



  reply	other threads:[~2012-03-25 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04 16:11 SPARK loop VCs that go "one beyond" the loop? Peter C. Chapin
2012-03-04 18:43 ` Phil Thornley
2012-03-04 19:44   ` Peter C. Chapin
2012-03-06 10:17     ` mark.lorenzen
2012-03-20 18:18     ` Phil Thornley
2012-03-25 10:57       ` Peter C. Chapin [this message]
2012-03-25 14:14         ` Phil Thornley
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox