Re: Assertion is false - its complement unknown?
Thomas Russ <[email protected]> Wed, 6 Apr 2011 10:40:28 -0700
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
On Apr 6, 2011, at 2:41 AM, Oliver Uwira wrote:
> Hello everybody,
>
> I have encountered a peculiar issue in PowerLoom that I have failed to
> solve by studying the PowerLoom documention. My problem boils down to
> the following:
>
> An assertion is evaluated as FALSE. Now I would expect it's
> complement, e.g. inserting the very statement into a (not) clause, to
> evaluate as TRUE. It does, however, evaluate to UNKNOWN. I hope
> somebody on here is able to give me some advice on this. Below I
> explain what I have done in more detail.
There seems to be something else going on, since I get different
results trying your example.
Nevertheless, I do have the solution.
>
> I'm currently trying to model the existence of things along the time
> line by asserting the start and end points of their existence. Time
> points are to be simple integers:
>
> (defconcept PREDICATOR)
> (defconcept THING-PREDICATOR (?p PREDICATOR))
>
> (deffunction EXISTENCE-START ((?p THING-PREDICATOR)) :-> (?t INTEGER)
> :axioms (single-valued EXISTENCE-START)
> )
> (deffunction EXISTENCE-END ((?p THING-PREDICATOR)) :-> (?t INTEGER)
> :axioms (single-valued EXISTENCE-END)
Just a note that functions are by definition single-valued, so you
don't need to explicitly assert that.
> The goal is to be able to answer questions as to a thing's existence
> at a certain point in time. Thus I modeled the following relation:
>
> (defrelation EXISTING ((?p THING-PREDICATOR) (?t INTEGER)))
>
> I planned to let PowerLoom infer the existence of a thing ?p existing
> at a point in time ?t according to the following rule (in plain
> language):
>
> (a) If both EXISTENCE-START and EXISTENCE-END have been asserted, a
> thing exists at a point in time t if t lies in between EXISTENCE-START
> and EXISTENCE-END.
>
> (b) If EXISTENCE-START has been asserted but EXISTENCE-END end has not
> been asserted, a thing exists at a point in time t if t is >=
> EXISTENCE-START.
>
> Case (b) is giving me trouble. I tried to model the above rule as
> follows:
>
> (defrule EXISTENCE
> (forall (?p ?t)
> (=>
> (and
> (exists ?s
> (and
> (= (EXISTENCE-START ?p) ?s)
> (not (< ?t ?s))
> )
> )
> (or
> (not (exists ?e (= (EXISTENCE-END ?p) ?e)))
> (exists ?e
> (and
> (= (EXISTENCE-END ?p) ?e)
> (not (> ?t ?e))
> )
> )
> )
> )
> (EXISTING ?p ?t)
> )
> )
> )
>
> Now asserting only EXISTENCE-START of a thing, PowerLoom cannot infer
> the existence of that thing according to the rule above.
>
> (assert (THING-PREDICATOR t3))
> (assert (= (EXISTENCE-START t3) 10))
>
> Now (ask (EXISTING t3 33)) returns FALSE.
That seems incorrect.
When I try this, I get UNKNOWN, which is the answer I would expect.
Which version of PowerLoom are you using?
I checked this in 3.2.52 and 4.0.0.beta and both returned unknown for
me.
> I was able to track this down to the following. The first part of the
> (or) clause in the above rule evaluates to UNKNOWN. That is, even
> though
>
> (exists ?e (= (EXISTENCE-END t3) ?e)))
>
> evaluates to FALSE as expected,
I'm not sure what is going on here, since this should evaluate to
UNKNOWN, which is what it does when I try it.
> it's complement, which is used in the
> (or) clause,
>
> (ask (not (exists ?e (= (EXISTENCE-END t3) ?e))))
>
> evaluates to UNKNOWN.
What you want to do here is use the FAIL clause instead of the NOT
clause.
NOT, in PowerLoom is a strict negation and therefore requires a proof
that the negated clause fails. In other words, the (exists ?e ...)
clause would have to return FALSE. But at least in my system and in a
correct PowerLoom system this should return UNKNOWN because the value
of existence-end is unknown and therefore it is not known whether
there is such a value or not.
FAIL, on the other hand, is a closed-world, failure as negation
construct. It will return TRUE if the inner clause is FALSE or
UNKNOWN. Since that is the result that you want, you should change
your rule to use FAIL instead of NOT around this clause.
When I make the following change, I get the results that you would want:
(defrule EXISTENCE
(forall (?p ?t)
(=> (and (exists ?s (and (= (EXISTENCE-START ?p) ?s)
(not (< ?t ?s))))
(or (fail (exists ?e (= (EXISTENCE-END ?p) ?e)))
(exists ?e (and
(= (EXISTENCE-END ?p) ?e)
(not (> ?t ?e))))))
(EXISTING ?p ?t))))
|P|(FORALL (?p ?t)
(<= (EXISTING ?p ?t)
(EXISTS (?s)
(AND (= (EXISTENCE-START ?p) ?s) (NOT (< ?t ?s)) (OR (FAIL
(EXISTS (?e)
(= (EXISTENCE-END ?p) ?e))) (EXISTS (?e)
(AND (= (EXISTENCE-END ?p) ?e) (NOT (> ?t ?
e)))))))))
PL-USER> (ask (exists ?e (= (EXISTENCE-END t3) ?e)))
UNKNOWN
PL-USER> (ask (existing t3 33))
TRUE
PL-USER> (ask (existing t3 10))
TRUE
PL-USER> (ask (existing t3 8))
UNKNOWN
As another syntax note, you could use the function existence-start and
existence-end as functional terms to simplify your rule:
(defrule EXISTENCE
(forall (?p ?t)
(=> (and (not (< ?t (EXISTENCE-START ?p)))
(or (fail (exists ?e (= (EXISTENCE-END ?p) ?e)))
(not (> ?t (EXISTENCE-END ?p)))))
(EXISTING ?p ?t))))
This could also use additional comparison operations:
(defrule EXISTENCE
(forall (?p ?t)
(=> (and (>= ?t (EXISTENCE-START ?p))
(or (fail (exists ?e (= (EXISTENCE-END ?p) ?e)))
(=< ?t (EXISTENCE-END ?p))))
(EXISTING ?p ?t))))
The only odd part of the comparison operators in PowerLoom was that we
had to change less-than-or-equal to be "=<" since we wanted to use
"<=" as an implication arrow.
>
> Many thanks in advance on any effort to put me back on the right
> track,
> Oliver Uwira
>