Oliver Uwira | 13 Apr 2011 11:14
Picon

What happens if an assertion contradicts a rule?

Hello everybody,

I am trying to model the existence of things in time, where points in 
time are to be simple integers.

Specifically, I want to implement two functions representing the start 
and end points of existence:

(defconcept PREDICATOR)
(defconcept THING-PREDICATOR (?p PREDICATOR))
			
(deffunction EXISTENCE-START ((?p THING-PREDICATOR)) :-> (?t INTEGER))
(deffunction EXISTENCE-END   ((?p THING-PREDICATOR)) :-> (?t INTEGER))

Going from there, I want to make sure that the start point of existence 
must always precede the end point of existence. In order to ensure this, 
I added the following rule:

(defrule EXISTENCE-START-END
   (forall (?p ?s ?e)
     (=>
       (and
         (= (EXISTENCE-START ?p) ?s)
         (= (EXISTENCE-END   ?p) ?e)
       )
       (< ?s ?e)
     )
   )
)

However, this rule doesn't seem to prevent PowerLoom from accepting 
assertions that contradict it:

(assert (THING-PREDICATOR t1))
(assert (= (EXISTENCE-START t1) 10))
(assert (= (EXISTENCE-END   t1)  8))

The last assertion contradicts above rule, but no error message pops up. 
I wonder what is the correct approach for keeping a knowledge base 
consistent.

Many thanks in advance,
Oliver Uwira

Gmane