Re: Unexpected Powerloom truth maintenance behavior....

Thomas Russ <[email protected]> Thu, 21 Aug 2008 15:23:35 -0700
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Aug 21, 2008, at 10:59 AM, Srini Ram wrote:

> Another issue I observed:
> (defmodule "TEST"
>   :includes ("PL-USER"))
> (in-module "TEST");;  repeat this if evaluating in STELLA
>
> (clear-module "TEST")
> (reset-features)
>
> (defconcept person (?x))
> (defrelation alive (?x))
> (defrelation spouse ((?x person) (?y person))
>   :axioms (symmetric spouse))
>
> (defrelation married ((?x person) (?y person))
>     :<=> (and (spouse ?x ?y) (alive ?x) (alive ?y)))
>
> STELLA> (ask (forall ?x ?y (=> (and (spouse ?x ?y) (alive ?x)  
> (alive ?y)) (married ?x ?y))))
> :NULL_VALUE
> STELLA> (ask (forall (?x person) (?y person) (=> (and (spouse ?x ?y)  
> (alive ?x) (alive ?y)) (married ?x ?y))))
> :NULL_VALUE
>
> Shouldnt the above asks work? Is there any error in the asks?

The asks are syntactically mal-formed.  You need to put parentheses  
around the variable list, like so:

    (ask (forall (?x ?y) (=> (and (spouse ?x ?y) (alive ?x) (alive ? 
y)) (married ?x ?y))))

Then it works for me.  The query returns TRUE.

When I tried your original version, I got the following error message:

PARSING ERROR: Illegal ASK query: `((FORALL ?X ?Y
                                      (=>
                                       (AND (SPOUSE ?X ?Y) (ALIVE ?X)
                                        (ALIVE ?Y))
                                       (MARRIED ?X ?Y))))'.


Did that not show up in your version?
Do you redirect *error-output* by any chance?

This also works similarly for the second query:

(ask (forall ((?x person) (?y person)) (=> (and (spouse ?x ?y) (alive ? 
x) (alive ?y)) (married ?x ?y))))

>
>
> I tried (setq *type-check-strategy* :NONE)

If you typed this at the top level in Lisp, then it would
explain the second error you reported.  This will set the
value of *type-check-strategy* to the LISP keyword :NONE,
and it needs to be set to the STELLA keyword :NONE instead.

To make sure you get Stella keywords, you have to take a
bit more care.  It is one area where the integration with
the Lisp READ-EVAL-PRINT loop is not complete.  That is because
we don't really want to muck around with the reader to change
the way symbols are read.  So you have to make sure you provide
the appropriate keyword value.

The easiest way to do that is to use the PLI:GET-KEYWORD function:

STELLA> (pli:get-keyword "NONE")
:NONE
STELLA> (cl:describe cl:*)
:NONE is an instance of class #<COMMON-LISP:STANDARD-CLASS KEYWORD>.
The following slots have :INSTANCE allocation:
  HOME-CONTEXT    :NULL_VALUE
  SYMBOL-NAME     "NONE"
  SYMBOL-ID       24
; No value
STELLA> (cl:describe :none)
:NONE is an external symbol in #<COMMON-LISP:PACKAGE "KEYWORD">.
It is a constant; its value is :NONE.
; No value

So you would need to do

    (setq *type-check-strategy* (pli:get-keyword "NONE"))

in order to have things work properly.