Re: assert vs instance-of and other questions

Kotaro Funakoshi <[email protected]>
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
Hi, 

On 2006/01/13, at 8:36, Hans Chalupsky wrote:

> Here's a little trick to work around the restriction of `instance-of'
> in PowerLoom.  You can define your own relation, e.g., `isa', to do
> what you want.  For example:
>
> STELLA(16): (defconcept animal)
> |c|ANIMAL
> STELLA(17): (defconcept monkey (animal))
> |c|MONKEY
> STELLA(18): (defrelation isa (?i ?c))
> |r|ISA
> STELLA(19): (assert (=>> (and (isa ?i ?c)
>                               (concept ?c))
>                          (and (instance-of ?i ?c)  ;; not really necessary
>                               (?c ?i))))
> |P|(FORALL (?i ?c)
>    (=>> (AND (ISA ?i ?c) (CONCEPT ?c))
>        (AND (INSTANCE-OF ?i ?c) (HOLDS ?c ?i))))
> STELLA(20): (assert (isa george monkey))
> |P|(ISA GEORGE MONKEY)
> STELLA(21): (ask (animal george))
> TRUE

This is nice.

> STELLA(22): (all-facts-of george)
> (|P|(ISA GEORGE MONKEY) |P?|(MONKEY GEORGE) |P?|(INSTANCE-OF GEORGE MONKEY))
> STELLA(23): 
>
> The `all-facts-of' shows that `(MONKEY GEORGE)' was inferred via
> forward-inference.

You mean |P?| indicates a forward-inference proposition, right?
Now another mystery is resolved :-)

Thank you very much.
I also CC this mail to the ML. This info might be helpful for others.

Kotaro

>
> Hans
>
>>>>>> Hans Chalupsky <[email protected]> writes:
>
>> One follow-up to Tom's reply:
>>>>>> Kotaro FUNAKOSHI <[email protected]> writes:
>
>>> Dear members,
>>> I have three questions about PowerLoom.  I will highly appreciate it 
>>> if somebody gives me answers.
>
>>> (1) assert vs instance-of
>
>>> I found an asymmetricity between (A) asserting conceptual propositions using 
>>> command "assert" directly and (B) asserting conceptual propositions using 
>>> relation "instance-of".
>
>>> ...
>
>>> Why cannot PowerLoom answer that (monkey george) is TRUE when I use
>>> "instance-of" even though it answers correctly against (ask (instance-of george animal))?
>
>>> I just wanted to use "instance-of" because I prefer frame-style descriptions
>>> such as
>>> (definstance george 
>>> :instance-of monkey
>>> :likes banana
>>> :at forest1
>>> :age 4).
>
>>> I can simply avoid this problem by using always command "assert" like
>>> (definstance george
>>> :likes banana
>>> :at forest1
>>> :age 4)
>>> (assert (monkey george)).  ( yet not so elegant :-( )
>
>>> Even avoidable, such a behavior of PowerLoom makes me feel ill at ease...
>>> Is this an intended behavior or just a bug?
>
>> Well it's somewhere inbetween.  "instance-of" and "type-of" are really
>> just intended to be query relations that allow you to retrieve the types
>> an instance belongs to.  PowerLoom's inference machinery makes strong
>> assumptions about the nature of type assertions in many places and
>> looks for assertions of the type `(<concept> <i>)', but not for
>> `(instance-of <i> <concept>)'.  Currently, `instance-of' assertions
>> are not forbidden but also not normalized into the corresponding
>> `(<concept> <i>)' assertion.  One way to work around this would be
>> by adding a rule as you suggest below, however, there are two caveats:
>
>> (1) the rule should be a forward rule for efficiency, that way every
>> time you assert `instance-of' the corresponding type assertion is
>> generated instantly and no inference is needed during backchaining to
>> generate it.  You would do this as follows (note the double arrow):
>
>> (forall (?x ?c)  (=>> (and (concept ?c) (instance-of ?x ?c)) (?c ?x)))
>
>> This also avoids the rule indexing problem.
>
>> (2) unfortunately, this doesn't work since for performance reasons
>> `instance-of' is currently marked as a non-chainable relation, so the
>> rule will not do what you want it to.  Conceivably, this might be
>> relaxed at some point.
>
>>> (2)  Warning: PowerLoom can't index the rule
>
>>> I tried to avoid the problem described above by using a rule. But I got a
>>> warning message "Warning: PowerLoom can't index the rule"  and the rule
>>> seems not to work.
>
>>> The rule is here:
>>> (defrule "instance-of TO assert"
>>> (forall (?x ?c)  (=> (and (concept ?c) (instance-of ?x ?c)) (?c ?x))))
>
>>> What's the meaning of the message and what's wrong with my rule?
>
>> Just to elaborate on Tom's reply: the reason that this can't be
>> indexed is that the rule consequent is second-order since it has a
>> variable in the relation position.  This rule would be way too general
>> and could lead to serious performance problems, since it would match
>> any unary goal.  Turning the rule into a forward rule fixes this,
>> since in that case the relation variable ?c gets instantiated during
>> forward inference and produces a regular assertion (again with the
>> caveat that currently this won't work for "instance-of").
>
>> Hans
>> _______________________________________________
>> powerloom-forum mailing list
>> [email protected]
>> http://mailman.isi.edu/mailman/listinfo/powerloom-forum
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.