On 11/23/2013 09:17 PM, Larry D. Lee jr. wrote:
> There appears to be a bug in Kics2 (version 0.2.4, but probably higher
> as well).
> The bug appears to be in the way that Kics2 shares non-deterministic
> values.
> The scenario that produced this bug is presented below.
>
> I have a non-deterministic function named db, which is defined as follows:
> 'db "is raining" = [0.9]'
> 'db "is cloudy" = [0.7]'
>
> and another non-deterministic function named conjunction. Originally
> defined as follows:
> 'conjunction db p q = union (db p) (db q)'
>
> When I evaluated 'conjunction db "is raining" "is raining"', I received
> the correct result: '[0.9]'.
> When I evaluated 'conjunction db "is raining" "is cloudy"', I received
> 'no more results', which is clearly wrong.
> The correct answer is '[0.9, 0.7]'.
> When I evaluated 'union (db "is raining") (db "is cloudy")' I received
> the correct answer.
Maybe you can send me your complete program since I can't reproduce
your problem. In principle, the two occurrences of 'db' in the
definition of 'conjunction' are shared. However, since 'db' is
an operation, the application of 'db' to p or q is not shared,
thus, you should get the intended answer. Actually, I tried the
following source program:
---
import List
db "is raining" = [0.9]
db "is cloudy" = [0.7]
conjunction db p q = union (db p) (db q)
---
Here is the output of my program run:
_ _ ____ ___ ___ ___
( )/ )(_ _)/ __)/ __)(__ \
) ( _)(_( (__ \__ \ / _/
(_)\_)(____)\___)(___/(____)
Version 0.2.4 of 2013-07-11 (installed at Fri Jul 12 09:32:52 CEST 2013)
Type ":h" for help
Prelude> :l lee
...
lee> conjunction db "is raining" "is cloudy"
...
Evaluating expression: conjunction db "is raining" "is cloudy"
[0.9,0.7]
Thus, everything seems to work as intended.
Best regards,
Michael
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mo Nov 25 2013 - 17:41:20 CET