Re: [PRD] Rule instances, refraction and Modify [Was: Re: Fwd: Clips behavior]

All,

Gary wrote on 01/02/2010 01:01:11:
> 
>> 3. the binding of the rule (universal) variables is not always 
>> discriminant enough to characterize a rule instance [...]
> 
> Can you do a simple transformation:
> 
>    Rule: FORALL ?x, ?y, ?z, IF test(?x) AND ( ?y=1 AND foo(?y) OR ?
> z=B AND bar(?z) ) THEN...
> 
> And then use our existing rule instances. I'm a bit concerned about a 
> new notion of matchedFact. I don't know what that is, exactly.

As we discussed yesterday, this would be a very nice way to correct the 
problem and cover the case of disjunctive rules.

Unfortunately, I cannot find the right way to normalize :-(

The transformation that you propose does not work, since ?y will always be 
bound to 1 and ?z to B, whether the instance matched foo(1) or bar(B) 
(and, thus, the two different instances will always have the same bindings 
for all their universal variables).

I could not find a way to keep the current definition of rule instance and 
still cover the case of disjunctions without adding a dummy variable that 
differentiate the disjuncts. Something like:

Rule: FORALL ?x ?y, IF test(?x) AND ( (foo(1) AND ?y=1) OR (bar(B) AND 
?y=2) ) THEN...

That's ugly, but that works. So, the trick is not to normalize the 
conditions in a way similar to CLP for the purpose of defining rule 
instances, but define rule instances wrt to rules are put in the same 
disjunctive normal form as specified for the purpose of defining safeness, 
with an extra universal variable added, that is equated to a different 
value in each top-level disjunct.

Since we can reuse the same normal form as for defining safeness, the 
change in hte text is not that big (something like a couple lines added 
before the -essentially unchanged- definition of rule instance).

That solution is less elegant than what Gary suggested, but I cannot find 
a better one; and it works (since it is essentially equivalent to 
rewriting disjunctive rules into a set of conjunctive ones).

I propose that we use it, unless or until somebody finds a better way to 
do the same thing.

Cheers,

Christian

IBM
9 rue de Verdun
94253 - Gentilly cedex - FRANCE
Tel. +33 1 49 08 35 00
Fax +33 1 49 08 35 10


Sauf indication contraire ci-dessus:/ Unless stated otherwise above:
Compagnie IBM France
Siege Social : 17 avenue de l'Europe, 92275 Bois-Colombes Cedex
RCS Nanterre 552 118 465
Forme Sociale : S.A.S.
Capital Social : 611.451.766,20 ?
SIREN/SIRET : 552 118 465 03644

Received on Tuesday, 2 February 2010 15:42:51 UTC