From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,ec6f74e58e86b38b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news4.google.com!news3.google.com!feeder.news-service.com!feeder.visyn.net!visyn.net!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Lost in translation (with SPARK user rules) Date: Thu, 27 May 2010 12:55:04 +0200 Organization: Ada At Home Message-ID: References: <0466e131-cc80-4db4-b080-eec9aefcb1c7@z17g2000vbd.googlegroups.com> NNTP-Posting-Host: VsdMw8HJ6uo7b6guDb/gnA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.53 (Win32) Xref: g2news2.google.com comp.lang.ada:12070 Date: 2010-05-27T12:55:04+02:00 List-Id: Le Thu, 27 May 2010 10:13:55 +0200, Yannick Duch=C3=AAne (Hibou57) = a =C3=A9crit: > Finally, there is a work-around: if the Simplifier expect an expressio= n = > which exactly match the one provided as a user rule, and there is not = a = > direct matching expression in the source, then just use Simplifier's = > embedded rules to prove an expression is equivalent to the one the = > Simplifier expect an exact match. > > That is, if there a user rule of the form > > my_rule(1) Conclusion_1 may_be_deduced_from [Expression_1]. > > and the source unfortunately contains only > > Expression_2 > > then try something like > > --# check Expression_2 -> Intermediate_Expression(1); > --# check ...; > --# check ...; > --# check Intermediate_Expression(N) -> Expression_1; > > and here it is. > Unfortunately, I came into another trouble. I was trying this, and used = = intermediate variables to help. But Simplifier insist on using expressio= ns = instead of variables, so it can't find a match. An example will be more expressive: Here is an excerpt of a source (T is a modular type): ... --# check T'Pos (B) >=3D 0; -- Check #1 --# check T'Pos (B) <=3D 1; -- Check #2 --# check (T'Pos (B) =3D 0) or (T'Pos (B) =3D 1); -- Check #3 ... Here is a rule in a user rules file: my_rule(1): (X=3D0) or (X=3D1) may_be_deduced_from [ integer(X), X>=3D= 0, X<=3D1 = ]. And Simplifier fails to prove Check #3 ; an excerpt of the *.SIV file = shows why (conclusion associated to Check #3): C1: bit__and(v, 1) =3D 0 or bit__and(v, 1) =3D 1 . It replaces B with the source expression of the value of B and is thus = unable to find a match with the rule. By the way, it drops Check #1 and = = Check #2, which does not appears at all in the hypotheses list (possibly= = it seems to much obvious to Simplifier). I've tried to use an Assert instead of a Check, this did not change = anything. So if Simplifier requires an exact match to user rules, is there a way t= o = avoid the simplifier to brake any attempt to prove an expression match a= = rule ? -- = There is even better than a pragma Assert: a SPARK --# check. --# check C and WhoKnowWhat and YouKnowWho; --# assert Ada; -- i.e. forget about previous premises which leads to conclusion -- and start with new conclusion.