comp.lang.ada
 help / color / mirror / Atom feed
* SPARK and integer arithmetic
@ 2016-09-18 10:10 Florian Weimer
  2016-09-18 15:37 ` Simon Wright
  2016-10-03 10:09 ` Mark Lorenzen
  0 siblings, 2 replies; 9+ messages in thread
From: Florian Weimer @ 2016-09-18 10:10 UTC (permalink / 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)?


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-08-09 19:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-18 10:10 SPARK and integer arithmetic Florian Weimer
2016-09-18 15:37 ` 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

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