For Programmers: Free Programming Magazines  


Home > Archive > Prolog > May 2006 > Bug detected in buggy GNU-Prolog









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bug detected in buggy GNU-Prolog
Advait

2006-05-18, 4:01 am

Hi,
Here is a bug


gprolog 1.2.16

Knowledege Base
p(X) :- a(X).
p(X) :- b(X),c(X),d(X),e(X).
p(X) :- f(X).
a(1).
b(1).
c(1).
b(2).
c(2).
d(2).
e(2).
f(3).
END Knowledge Base

For query
| ?- p(X).
responce should be
X = 1 ;
X = 2 ;
X = 3 ;
no

but gprolog-1.2.16 gives
X = 1 ? ;

X = 3



----------------
yours
Advait

Bart Demoen

2006-05-18, 4:01 am

Advait wrote:
> Hi,
> Here is a bug
>
>
> gprolog 1.2.16
>
> Knowledege Base
> p(X) :- a(X).
> p(X) :- b(X),c(X),d(X),e(X).
> p(X) :- f(X).
> a(1).
> b(1).
> c(1).
> b(2).
> c(2).
> d(2).
> e(2).
> f(3).
> END Knowledge Base
>
> For query
> | ?- p(X).
> responce should be
> X = 1 ;
> X = 2 ;
> X = 3 ;
> no
>
> but gprolog-1.2.16 gives
> X = 1 ? ;
>
> X = 3
>
>
>
> ----------------
> yours
> Advait
>


It is not a bug, it is a feature :-)
The reason of this behaviour is that your clauses (gor b/1) are not grouped together.
It is not nice of GNU-Prolog not to warn you about that.

Cheers

Bart Demoen
Advait

2006-05-18, 7:06 pm


Bart Demoen wrote:

> It is not a bug, it is a feature :-)


But it seems that this feature may go wrong in database manipulation.
However SWI generates correct solution.




-----------------------------
yours
Advait

Bart Demoen

2006-05-18, 7:06 pm

Advait wrote:
> Bart Demoen wrote:
>
>
>
>
> But it seems that this feature may go wrong in database manipulation.


What do you mean ? A concrete example perhaps ?

Cheers

Bart Demoen
Duncan Patton

2006-05-18, 7:06 pm

On Thu, 18 May 2006 22:07:21 +0200
Bart Demoen <bmd@cs.kuleuven.be> wrote:

> Advait wrote:
>
> What do you mean ? A concrete example perhaps ?
>
> Cheers
>
> Bart Demoen


It's a feature. He should read the stuff on split predicate clauses.

Dhu


--
???????????????????????????????????????

Open Systems Integration

Contact Fubar the Hack: fubar AT neotext.ca

Area code seven eight zero, Exchange four six six, Local zero one zero nine

Highland terms, Canadian workmanship.

All persons named herein are purely fictional victims
of the Canidian Bagle Breeder's Association.

Save the Bagle!

Sun Dhu


???????????????????????????????????????

Christopher Browne

2006-05-19, 7:03 pm

Quoth "Advait" <advait_raut@indiatimes.com>:
> Bart Demoen wrote:
>
>
> But it seems that this feature may go wrong in database manipulation.
> However SWI generates correct solution.


Based on what you're telling us, SWI is generating an *incorrect*
solution because you did not expressly declare that the predicate was discontiguous...
--
let name="cbbrowne" and tld="gmail.com" in String.concat "@" [name;tld];;
http://linuxdatabases.info/info/slony.html
Rules of the Evil Overlord #226. "I will have a staff of competent
detectives handy. If I learn that someone in a certain village is
plotting against me, I will have them find out who rather than wipe
out the entire village in a preemptive strike."
<http://www.eviloverlord.com/>
Jens Kilian

2006-05-22, 7:08 pm

Christopher Browne <cbbrowne@acm.org> writes:
> Based on what you're telling us, SWI is generating an *incorrect*
> solution because you did not expressly declare that the predicate was discontiguous...


Does the standard actually prohibit an implementation from treating all
predicates as discontiguous?

--
mailto:jjk@acm.org As the air to a bird, or the sea to a fish,
http://www.bawue.de/~jjk/ so is contempt to the contemptible. [Blake]
http://del.icio.us/jjk
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com