comp.lang.ada
 help / color / mirror / Atom feed
From: "Phil Thornley" <phil.jpthornley@gmail.com>
Subject: Re: Issue with SPARK 2014
Date: Sun, 18 Oct 2015 09:44:43 +0100
Date: 2015-10-18T09:44:43+01:00	[thread overview]
Message-ID: <mvvm5v$1oth$1@adenine.netfront.net> (raw)
In-Reply-To: <eafa9031-41df-4a27-ac38-a94ca54e3909@googlegroups.com>

On Tuesday, 15 October 2015 18:28:39 UTC+1, Serge Robyns  wrote:
[snip]
> When trying to build a small standalone body I gets proved successfully 
> with the below code. However the call is using constant values.
> I'm wondering if the fact that here the prover has constants in the 
> procedure call makes it possible for him to prove it.

No, the use of constants in the procedure call is irrelevant.

> Now in essence the moves are either given by a player or selected by an 
> algorithm.  I was expecting that SPARK could prove the procedure by using 
> the procedure signature, in worst case pre/post conditions.

That's exactly what is done - the Evaluate_Board procedure is proved for all 
possible (valid) calls.

> The essence I'm trying to state in the loop invariant (which I've put to 
> shut up other SPARK messages) is that the count will never exceed a 
> certain range.  You can't have more "tiles" than there is space to put 
> them.

Every loop has a loop invariant (it's needed to cut the code as Stuart 
explained). If you don't supply one the SPARK tools create a default one.

The messages that you get without an explicit loop invariant are because the 
default loop invariant isn't strong enough for this code.

> Now I play with this code from time to time when I've an urge to make it 
> proven or when I read about how nice spark is.

[code snipped]

I don't think that you need more than one Loop_Variant in any loop, this is 
only needed to prove termination of the loop and just one valid loop variant 
should be enough.

Cheers,

Phil


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---


  reply	other threads:[~2015-10-18  8:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 17:37 Issue with SPARK 2014 Serge Robyns
2015-10-13 20:40 ` joakimds
2015-10-14 15:25   ` Serge Robyns
2015-10-14  6:16 ` Simon Wright
2015-10-14 15:23   ` Serge Robyns
2015-10-14 20:04 ` Stuart
2015-10-15  8:44   ` Phil Thornley
2015-10-15 11:23     ` Stuart
2015-10-15 17:28       ` Serge Robyns
2015-10-18  8:44         ` Phil Thornley [this message]
2015-10-19  9:13           ` Serge Robyns
replies disabled

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