comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Thornley <phil.jpthornley@gmail.com>
Subject: Re: Question about round__ proof function in SPARK proofs.
Date: Sat, 15 Jan 2011 10:11:41 -0800 (PST)
Date: 2011-01-15T10:11:41-08:00	[thread overview]
Message-ID: <150284e4-ec97-45ea-b09d-2ed83bfb92c0@j25g2000vbs.googlegroups.com> (raw)
In-Reply-To: Gb6dnSUL7-xIRqzQ4p2dnAA@giganews.com

On Jan 15, 5:39 pm, "Peter C. Chapin" <PCha...@vtc.vsc.edu> wrote:
> I'm trying to discharge a VC in a SPARK proof. After simplification I
> have just:
>
> H1: julian_date >= 4830771 / 2 .
> H2: julian_date <= 2489665 .
>
> The conclusions are:
>
> C1: round__(julian_date + 1 / 2) >= - 2147483648 .
> C2: round__(julian_date + 1 / 2) <= 2147483647 .
>
> This VC is the result of a type conversion from a floating point type to
> an integer type. It seems evident that the conclusions are true for any
> reasonable definition of round__. I assume the simplifier is not proving
> this VC because it doesn't have any built-in knowledge of the proof
> function round__, even though it was inserted automatically be the
> examiner. So I think maybe I'm supposed to specify the properties of
> round__ somewhere. Am I on track here?

You're quite correct about the round__ function - and the only way to
discharge the VC is to supply user rules that state properties of the
function.

An obvious form for the rule is:

round(1): round__(X) <= Y
            may_be_deduced from
        [ X <= Y,
          goal(checktype(Y, integer)) ] .

and similarly for the lower bound.

On their own these rules probably aren't going to work for this VC
(although it's worth a try) because there isn't a direct match for the
X<=Y sidecondition.  Adding a preceding check annotation might do the
trick:

--# check (julian_date + 0.5) in Integer;

Cheers,

Phil



  reply	other threads:[~2011-01-15 18:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-15 17:39 Question about round__ proof function in SPARK proofs Peter C. Chapin
2011-01-15 18:11 ` Phil Thornley [this message]
2011-01-16 13:47   ` Peter C. Chapin
replies disabled

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