[PPL-devel] [Xsb-development] Arithmetic evaluation bug in the CVS HEAD version of XSB

Michael Kifer kifer at cs.sunysb.edu
Sun Sep 23 20:25:23 CEST 2007


Perhaps a better workaround is

:- import eval/2 from eval.
bug2(Term, N) :- eval(Term,N).



Interestingly, the problem occurs only with compiled rules.
If one asserts the same rule

?- assert((bug(Term, N) :- N is Term)).

then it works right.


	--michael  


> --===============1739232661==
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>   <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
>   <title></title>
> </head>
> <body text="#000000" bgcolor="#ffffff">
> As I'm sure you know, the is/2 predicate is nonlogical.   This
> difference is also in previous versions of XSB.  In this instance,
> there is a simple alternate:<br>
> <br>
> [broome at localhost bin]$ ./xsb-bits64<br>
> [xsb_configuration loaded]<br>
> [sysinitrc loaded]<br>
> <br>
> XSB Version 3.1 (Incognito) of August 10, 2007<br>
> [x86_64-unknown-linux-gnu; mode: optimal; engine: slg-wam; gc:
> indirection; scheduling: local]<br>
> <br>
> | ?- [user].<br>
> [Compiling user]<br>
> side_step_term_as_arithmetic_argument_bug(Term,N) :-<br>
>   call(N is Term).<br>
> end_of_file.<br>
> [user compiled, cpu time used: 0.0090 seconds]<br>
> [user loaded]<br>
> <br>
> | ?- side_step_term_as_arithmetic_argument_bug(1+1+1,N).<br>
> <br>
> N = 3;<br>
> <br>
> no<br>
> | ?-<br>
> End XSB (cputime 0.02 secs, elapsetime 74.23 secs)<br>
> <br>
> <br>
> I hope this helps.<br>
> <br>
> Paul<br>
> <br>
> <a class="moz-txt-link-freetext" href="http://www.duologues.net">http://www.duologues.net</a><br>
> <br>
> <br>
> Roberto wrote the following:<br>
> <blockquote type="cite">
>   <div class="moz-text-plain" wrap="true" graphical-quote="true"
>  style="font-family: -moz-fixed; font-size: 12px;" lang="x-western">
>   <pre wrap="">$ cat bug.P
> bug(Term, N) :-
>    N is Term.
> [roberto at zoltan tmp]$
> $ xsb
> [xsb_configuration loaded]
> [sysinitrc loaded]
> 
> XSB Version 3.1 (Incognito) of August 10, 2007
> [x86_64-unknown-linux-gnu; mode: optimal; engine: slg-wam; gc: indirection; scheduling: local]
> 
> | ?- ['bug.P'].
> [Compiling ./bug]
> [bug compiled, cpu time used: 0.0080 seconds]
> [bug loaded]
> 
> yes
> | ?- bug(1+1+1, Y).
> 
> Y = 1 + 1 + 1
> 
> yes
> | ?-
> End XSB (cputime 0.02 secs, elapsetime 365.32 secs)
> 
> <div class="moz-txt-sig">-- 
> Prof. Roberto Bagnara
> Computer Science Group
> Department of Mathematics, University of Parma, Italy
> <a class="moz-txt-link-freetext"
>  href="http://www.cs.unipr.it/%7Ebagnara/">http://www.cs.unipr.it/~bagnara/</a>
> <a class="moz-txt-link-freetext" href="mailto:bagnara at cs.unipr.it">mailto:bagnara at cs.unipr.it</a>
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> <a class="moz-txt-link-freetext"
>  href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/">http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a>
> _______________________________________________</div></pre>
>   </div>
> </blockquote>
> <blockquote type="cite">
>   <div class="moz-text-plain" wrap="true" graphical-quote="true"
>  style="font-family: -moz-fixed; font-size: 12px;" lang="x-western">
>   <pre wrap=""><div class="moz-txt-sig">
> Xsb-development mailing list
> <a class="moz-txt-link-abbreviated"
>  href="mailto:Xsb-development at lists.sourceforge.net">Xsb-development at lists.sourceforge.net</a>
> <a class="moz-txt-link-freetext"
>  href="https://lists.sourceforge.net/lists/listinfo/xsb-development">https://lists.sourceforge.net/lists/listinfo/xsb-development</a>
> 
> 
> </div></pre>
>   </div>
> </blockquote>
> <br>
> </body>
> </html>
> 
> 
> 
> --===============1739232661==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> --===============1739232661==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> _______________________________________________
> Xsb-development mailing list
> Xsb-development at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xsb-development
> 
> --===============1739232661==--
> 





More information about the PPL-devel mailing list