reversing rules with 'or'
Hans Chalupsky <[email protected]>
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
Joshua,
>>>>> Joshua N Pritikin <Joshua> writes:
> How do I write the reverse implication "<=" for this rule?
> (defrelation situation-intention-p-vs-p? ((?s Situation))
> :axioms ((forall ((?s Situation))
> (=>
> (or
> (and (= (actor-intention (situation-actor1 ?s)) Personal)
> (= (actor-intention (situation-actor2 ?s)) Purity))
> (and (= (actor-intention (situation-actor2 ?s)) Personal)
> (= (actor-intention (situation-actor1 ?s)) Purity)))
> (situation-intention-p-vs-p? ?s)))))
This is how you would write it:
(defrelation situation-intention-p-vs-p? ((?s Situation))
:axioms ((forall ((?s Situation))
(<=>
(or
(and (= (actor-intention (situation-actor1 ?s)) Personal)
(= (actor-intention (situation-actor2 ?s)) Purity))
(and (= (actor-intention (situation-actor2 ?s)) Personal)
(= (actor-intention (situation-actor1 ?s)) Purity)))
(situation-intention-p-vs-p? ?s)))))
Then the assertion or forward inference of
(situation-intention-p-vs-p? ?s) plus the negation of one of the
conjuncts, e.g., (not (= (actor-intention Nausicaa0-actor2) Personal)),
would allow you to infer the conjuncts of the other disjunct.
The problem is that your example exposes a couple of bugs with function
propositions which need a temporary workaround to get the inference you want.
Here's a run-through:
STELLA(28): (clear-module "Aleader")
:VOID
STELLA(29): (load "/tmp/aleader.ploom")
()
STELLA(30): (load "/tmp/nausicaa.ploom")
()
STELLA(31): (cc "Aleader")
|MDL|/PL-KERNEL-KB/PL-USER/Aleader
;;; Bug#1: for function propositions you currently need to call
;;; retract+unassert to get rid of all relevant assertions (we'll
;;; release a patch of this soon):
STELLA(32): (retract (actor-intention Nausicaa0-actor1 personal))
|P|(= (ACTOR-INTENTION NAUSICAA0-ACTOR1) |SK|(ACTOR-INTENTION NAUSICAA0-ACTOR1))
STELLA(33): (unassert (actor-intention Nausicaa0-actor1 personal))
NULL
;;; just to check, now we can't derive the intention of actor1 anymore:
STELLA(34): (retrieve all (= (actor-intention Nausicaa0-actor1) ?i))
Processing check-types agenda...
No solutions.
;;; Bug#2: the function terms in your formulation of the relation
;;; prevented the forward inference to go through due to an
;;; existential quantifier introduced by the function output
;;; variables. If you rewrite the relation as follows the inference
;;; goes through:
STELLA(35): (defrelation situation-intention-p-vs-p-new? ((?s Situation) ?a1 ?a2)
:axioms ((forall ((?s Situation) ?a1 ?a2)
(<=> (or
(and (= (actor-intention ?a1) Personal)
(= (actor-intention ?a2) Purity))
(and (= (actor-intention ?a2) Personal)
(= (actor-intention ?a1) Purity)))
(situation-intention-p-vs-p-new? ?s ?a1 ?a2)))))
|r|SITUATION-INTENTION-P-VS-P-NEW?
;;; Important: you need to assert some negative information to allow
;;; PowerLoom to infer a particular disjunct. Otherwise, it can only
;;; infer the disjunction but not which disjunct is true:
STELLA(36): (assert (not (actor-intention NAUSICAA0-ACTOR2 Personal)))
|P|(NOT (= (ACTOR-INTENTION NAUSICAA0-ACTOR2) PERSONAL))
;;; Now I assert this directly, but as long as it is inferred during
;;; forward inference it would work the same:
STELLA(37): (assert (SITUATION-INTENTION-P-VS-P-new? NAUSICAA0 NAUSICAA0-ACTOR1 NAUSICAA0-ACTOR2))
|P|(SITUATION-INTENTION-P-VS-P-NEW? NAUSICAA0 NAUSICAA0-ACTOR1 NAUSICAA0-ACTOR2)
;;; Ta da:
STELLA(38): (retrieve all (= (actor-intention Nausicaa0-actor1) ?i))
There is 1 solution:
#1: ?I=PERSONAL
STELLA(39):
This inference chain relies entirely on forward inference which is
somewhat brittle, since our forward chainer is still limited. I.e.,
minor reformulations of your rules might prevent this inference from
going through again - sorry.
We'll work on fixing the problems this uncovered and will release
updates as soon as they become available.
Hans
--------------------------------------------------------------------------
PowerLoom home page: http://www.isi.edu/isd/LOOM/PowerLoom
PowerLoom forum: [email protected]
PowerLoom request line: [email protected]
STELLA home page: http://www.isi.edu/isd/LOOM/Stella
--------------------------------------------------------------------------