comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Thornley <phil.jpthornley@googlemail.com>
Subject: Re: Lost in translation (with SPARK user rules)
Date: Sun, 30 May 2010 02:26:12 -0700 (PDT)
Date: 2010-05-30T02:26:12-07:00	[thread overview]
Message-ID: <927d98bd-9219-426d-815a-392c28211908@j12g2000pri.googlegroups.com> (raw)
In-Reply-To: op.vdhoz5gcule2fv@garhos

On 30 May, 00:03, Yannick Duchêne (Hibou57) <yannick_duch...@yahoo.fr>
wrote:
> In this area, the Simplifier sometimes shows slight capacities to be  
> boring.
>
> Let a Check clause be “--# check ((2 ** Count) < (2 ** 8)) -> (Count < 8);”
> Let a user rule be “my_rule: ((X ** Y) < (X ** Z)) -> (Y < Z)  
> may_be_deduced_from [some-obvious-conditions].”
>
> There should be an exact match, isn't it ?
>
> Well, I guess you guess: it fails to prove the Check clause. Now, if you  
> would like to know why, here is: it replaces this by “2 ** count < 256 ->  
> count < 8”, ... it turns “(2 ** 8)” into “256”, so that it can't see any  
> more an exact match with the user rule
>
> I've check in the *.SLG file, this is indeed due to simplification, this  
> is not due to an hypothetical related error.

The full description of all the simplification steps is in section 3
of the Simplifier User Manual, so if you read this and follow through
the steps in a simplification log file then you should get a better
understanding of how the tool works - and so how to write user rules
that are effective.

Application of user rules is the final step (out of about a dozen)
that the Simplifier uses, so at that point a conclusion is likely to
have been changed from the form of the annotation that generated it.

In the case you describe here Count must be defined as a constant with
value 8, and that replacement is the first step that the Simplifier
takes.  Then it will convert 2**8 to 256 in a subsequent step. (A
basic strategy of the Simplifier is to replace any expressions with a
simpler version wherever possible - perhaps that's why it called the
Simplifier rather than the 'Prover' :-).

Section 3.12 describes how the Simplifier uses user rules - and it is
clear from this description that the rule needs to match expressions
in the VC as they are at the end of the process, not as in the
original VC.

You can see why this is sensible (even if it has some drawbacks*).
Generally the way that a user rule is written is in response to an
unproven conclusion in a simplified VC, so the author of the rule uses
the final form of the unproven VC to write the rule. Therefore the
rule can only be reliably applied at the point where the VC has
reached its final form.

I guess it might be possible for the Simplifier to try all the user
rules at each stage of the process - but the developers of the tool
have been concentrating heavily on making simplification as quick as
possible (quite rightly in my view) and would not want to do anything
that might slow it down without a very strong argument for the
advantages of doing that.

* The main drawback that I see is that some user rules define
replacements that must be made for the VC to be provable, but at
present these are made too late for them to be effective, since the
Simplifier has already exhausted all its other strategies.
It would be nice to have replacements defined in user rules applied in
the first simplification stage, how about:
my_rewrite(1): A must_be_replaced_by B if [...] .

(Of course nothing is ever simple, for example what happens if one
rewrite rule requires another to be applied before its sideconditions
are satisfied - are all such rules tried repeatedly until none are
used, or is it a once-only pass? etc...)

Cheers,

Phil



  parent reply	other threads:[~2010-05-30  9:26 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 10:09 Lost in translation (with SPARK user rules) Yannick Duchêne (Hibou57)
2010-05-26 10:38 ` Phil Thornley
2010-05-26 10:57   ` Yannick Duchêne (Hibou57)
2010-05-26 14:15     ` Pascal Obry
2010-05-26 14:28       ` Dmitry A. Kazakov
2010-05-26 19:28         ` Yannick Duchêne (Hibou57)
2010-05-26 20:14           ` Dmitry A. Kazakov
2010-05-26 21:14             ` Yannick Duchêne (Hibou57)
2010-05-26 21:15               ` Yannick Duchêne (Hibou57)
2010-05-26 22:01             ` Peter C. Chapin
2010-05-27 12:32               ` Mark Lorenzen
2010-05-27 18:34               ` Pascal Obry
2010-05-27 19:18                 ` Yannick Duchêne (Hibou57)
2010-05-28  9:39                 ` Maciej Sobczak
2010-05-28 11:57                 ` SPARK and testing. Was: " Peter C. Chapin
2010-05-28 12:59                   ` SPARK and testing Peter C. Chapin
2010-05-28 23:06                     ` Yannick Duchêne (Hibou57)
2010-05-26 19:16       ` Lost in translation (with SPARK user rules) Yannick Duchêne (Hibou57)
2010-05-26 19:32         ` Pascal Obry
2010-05-26 20:56           ` Yannick Duchêne (Hibou57)
2010-05-26 22:06           ` Peter C. Chapin
2010-05-27 18:39             ` Pascal Obry
2010-05-26 22:17         ` Peter C. Chapin
2010-05-27 10:11       ` Sockets package in SPARK (Was: Lost in translation (with SPARK user rules)) Jacob Sparre Andersen
2010-05-27 18:41         ` Pascal Obry
2010-05-27 19:20           ` Yannick Duchêne (Hibou57)
2010-05-28  7:43             ` Sockets package in SPARK Jacob Sparre Andersen
2010-05-27  8:13     ` Lost in translation (with SPARK user rules) Yannick Duchêne (Hibou57)
2010-05-27 10:55       ` Yannick Duchêne (Hibou57)
2010-05-27 11:32         ` Yannick Duchêne (Hibou57)
2010-05-27 11:41           ` Phil Thornley
2010-05-27 12:42             ` Yannick Duchêne (Hibou57)
2010-05-27 12:22         ` stefan-lucks
2010-05-27 11:37           ` Yannick Duchêne (Hibou57)
2010-05-27 11:57           ` Phil Thornley
2010-05-27 12:36             ` Yannick Duchêne (Hibou57)
2010-05-27 13:38               ` Phil Thornley
2010-06-03  2:44                 ` Yannick Duchêne (Hibou57)
2010-05-27 19:53 ` Warren
2010-05-29 23:03 ` Yannick Duchêne (Hibou57)
2010-05-30  6:55   ` Yannick Duchêne (Hibou57)
2010-05-30  9:30     ` Phil Thornley
2010-05-30  9:46       ` Yannick Duchêne (Hibou57)
2010-05-30  9:26   ` Phil Thornley [this message]
2010-05-30  9:57     ` Yannick Duchêne (Hibou57)
2010-06-01  5:42 ` Yannick Duchêne (Hibou57)
replies disabled

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