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!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!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: Sun, 30 May 2010 08:55:13 +0200 Organization: Ada At Home Message-ID: References: NNTP-Posting-Host: qUfwAWuer84MZJ3PpksnTQ.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:12155 Date: 2010-05-30T08:55:13+02:00 List-Id: Le Sun, 30 May 2010 01:03:31 +0200, Yannick Duch=C3=AAne (Hibou57) = a =C3=A9crit: > Let a Check clause be =E2=80=9C--# check ((2 ** Count) < (2 ** 8)) -> = (Count < = > 8);=E2=80=9D > Let a user rule be =E2=80=9Cmy_rule: ((X ** Y) < (X ** Z)) -> (Y < Z) = = > may_be_deduced_from [some-obvious-conditions].=E2=80=9D > > There should be an exact match, isn't it ? > > Well, I guess you guess: it fails to prove the Check clause. Now, if y= ou = > would like to know why, here is: it replaces this by =E2=80=9C2 ** cou= nt < 256 = > -> count < 8=E2=80=9D, ... it turns =E2=80=9C(2 ** 8)=E2=80=9D into =E2= =80=9C256=E2=80=9D, so that it can't see = > any more an exact match with the user rule I didn't wanted to add rules for all constants, like 256, and etc. = Fortunately, there is a somewhat cleaner way to work around, which still= = involves a constant, but a nice one : 2. If =E2=80=9Cmy_rule(1): ((X ** Y) < (X ** Z)) -> (Y < Z) may_be_deduced_= from = [...].=E2=80=9D is completed with another rule like, =E2=80=9Cmy_rule(2)= : ((2 ** Y) < (2 = ** Z)) -> (Y < Z) may_be_deduced_from [...].=E2=80=9D, then it did not c= hange = anymore 2 ** 8 into 256 and see a match. I don't know what it do in the background, nor why it preserve the = expression when the rule to match contains at least a constant, however,= = what is nice with this work around, it that it will work with all powers= = of two. I still would like to know about the details : why when X is replaced by= = the literal 2, it does not match the same way ? Important to notice anyway. -- = 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 as premise.