comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: SPARK and integer arithmetic
Date: Sun, 18 Sep 2016 12:10:34 +0200
Date: 2016-09-18T12:10:34+02:00	[thread overview]
Message-ID: <87poo1a57p.fsf@mid.deneb.enyo.de> (raw)

I'm trying to find out the capabilities of the SPARK when it comes to
verifying the correctness of integer arithmetic (and absence of
constraint errors).

The Barnes book (in the 2006 edition) is not really that helpful.  I'm
not even using the current SPARK tools, but the SPARK 2012 GPL
edition, but the command line options still are different from those
described in the book.

The warm-up exercise goes like this:

   package Sum is
      
      function Add (A, B : Integer) return Integer;
      --# pre 0 <= A and A <= 10 and 0 <= B and B <= 10;
      --# return A + B;
      
   end Sum;
   
   package body Sum is
      
      function Add (A, B : Integer) return Integer is
      begin
         return A + B;
      end Add;
      
   end Sum;

The SPARK configuration file contains:

   package Standard is
      type Integer is range -2147483648 .. 2147483647;
   end Standard;
   
I found the -vcg option, which causes spark the generate a sum/add.vcg
file, which shows that there is something to prove.  The sum/add.rls
contains the type range information from the configuration file.

Running sparksimp outputs:

   /home/fw/tmp/ada/arith/sum/add.vcg
      *** ERROR - The Simplifier failed.

The exit status is still zero, but I assume that this means that the
required proofs could not be performed.  Is this because the built-in
prover is not sufficiently powerful, or is there something else I can
do here (such as using an external prover)?


             reply	other threads:[~2016-09-18 10:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-18 10:10 Florian Weimer [this message]
2016-09-18 15:37 ` SPARK and integer arithmetic Simon Wright
2016-09-18 18:01   ` Florian Weimer
2016-09-18 19:33     ` Paul Rubin
2016-09-18 19:49       ` Florian Weimer
2016-09-19  7:14         ` Paul Rubin
2017-08-09 19:47     ` moy
2016-10-03 10:09 ` Mark Lorenzen
2016-10-03 15:39   ` Florian Weimer
replies disabled

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