There's definitely something wrong there. I'll let you know what we find out when we've tracked it down. Thanks for the report!

On Aug 23, 2007, at 12:47 AM, Aaron Novstrup wrote:

We seem to have found a problem with logical dependencies in Jess. We have a fact (b) that logically depends on a fact (a). If (b) is retracted, it is automatically reasserted as long as (a) is still true. Initially, we assert (a) as fact 0. This causes (b) to be asserted as fact 1. We retract fact 1, causing (b) to be reasserted as fact 2. Finally, we retract fact 0. At this point, (b) is not in working memory, but a rule or query with (b) on the LHS still fires. The code and output appear below. Looking at the trace, you'll note that when (a) is retracted, fact 1 is consequently retracted (even though it was already retracted) and fact 2 is not retracted (even though it depends on (a)).

Code:

(defrule r
   (logical (a))
   (not (b))
   =>
   (assert (b)))

(defmodule mod)

(defrule bad-rule
   (b)
   =>
   (printout t "BAD!!!" crlf))

(watch all)
(assert (a))
(run)
(retract 1) ;; (retract (b))
(run)
(retract 0) ;; (retract (a))
(focus mod)
(run)
(facts *)


Output:
Jess, the Rule Engine for the Java Platform
Copyright (C) 2006 Sandia Corporation
Jess Version 7.0p1 12/21/2006

==> f-0 (MAIN::a)
==> Activation: MAIN::r :  f-0,
FIRE 1 MAIN::r f-0,
==> f-1 (MAIN::b)
==> Activation: mod::bad-rule :  f-1
<== f-1 (MAIN::b)
==> Activation: MAIN::r :  f-0,
<== Activation: mod::bad-rule :  f-1
FIRE 1 MAIN::r f-0,
==> f-2 (MAIN::b)
==> Activation: mod::bad-rule :  f-2
<== f-0 (MAIN::a)
<== f-1 (MAIN::b)
<== Focus MAIN
==> Focus mod
FIRE 1 mod::bad-rule f-2
BAD!!!
<== Focus mod
==> Focus MAIN
For a total of 0 facts in all modules.
<anovstrup.vcf>

---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550                 http://www.jessrules.com

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to