W3C home > Mailing lists > Public > public-rif-wg@w3.org > February 2010

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

From: Christian De Sainte Marie <csma@fr.ibm.com>
Date: Wed, 3 Feb 2010 14:26:11 +0100
To: Gary Hallmark <gary.hallmark@oracle.com>
Cc: public-rif-wg@w3.org, public-rif-wg-request@w3.org
Message-ID: <OF942280F4.ADB756FD-ONC12576BE.006D3CA1-C12576BF.0049D033@fr.ibm.com>
Hi Gary, all,
You are right, of course. I realized in the train back home that  I had 
the wrong def of safeness in mind when I wrote that email!

So, I gave a try at  writing down the required normalization steps and the 
related explanations.

It turned out to be quite tricky, especially explaining that a variable is 
not bound if the conjunct in which it occurs is not part of the match: 
e.g., what of the case where both disjuncts are matched? We still need two 
different instances...

So, any way I tried, I ended up having to introduce a notion of "matched 
facts", in one form or another :-(

Since the normalization that you propose requires that the rules be, 
first, rewritten in disjunctive normal form, anyway, I propose that we 
normalize by splitting rules with disjunctive conditions into as many 
sub-rules as there are disjuncts, instead.

That requires only the addition of a short paragraph in preamble to the 
specification of the operational semantics, it is simple, intuitive and 
close to what most engines actually do, and that resolves our problem of 
disjunctions without loss of generality.

I made that a section, just before the "Definitions and notational 
conventions", to make it more visible [1].

With that, we do not have to change the definition of rule instance in any 
way, nor the spec of refraction or whatever, so, I rolled back the changes 
I proposed previously, and reverted the wiki version to the PRD CR, before 
adding the paragraph.

I have also modified the definition of a PR system state to introduce the 
transitional states (reused the def as from the rolled-back version) [2], 
and I added, where necessary, the precision about the type of system state 
(cycle or transitional). These changes resolve the problem that the 
atomicity of action blocks raised wrt refraction and recency.

Further editorial changes will be needed, e.g. move the definition of PR 
system state after the definition of rule and action instances, because it 
now refers to them.

But, again, these will be purely editorial, and I will implement them only 
at the end, after doing the Modify stuff, so that we can easily compare 
the new draft and the CR version wrt the essential changes only (see [3] 
for the diff at this point).

What do you think?

[1] 
http://www.w3.org/2005/rules/wiki/PRD#Rules_with_disjunctive_conditions
[2] http://www.w3.org/2005/rules/wiki/PRD#def-system-state
[3] 
http://www.w3.org/2005/rules/wiki/index.php?title=PRD&diff=12075&oldid=11437

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




From:
Gary Hallmark <gary.hallmark@oracle.com>
To:
Christian De Sainte Marie/France/IBM@IBMFR
Cc:
public-rif-wg@w3.org, public-rif-wg-request@w3.org
Date:
02/02/2010 19:56
Subject:
Re: [PRD] Rule instances, refraction and Modify [Was: Re: Fwd: Clips 
behavior]
Sent by:
public-rif-wg-request@w3.org



?y and ?z are bound in every disjunct in which they occur, and they do 
not occur elsewhere, hence I believe the rule is safe. It would be odd 
that such as simple transformation could change the safeness status. If 
that were true, would that not be a bug in the safeness defn?

Christian De Sainte Marie wrote:
>
> Gary,
>
> Gary wrote on 02/02/2010 17:27:26:
> >
> > > 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 don't understand. Surely if the only fact is foo(1), then ?y is 
bound
> > to 1 and ?z is unbound. Similarly, if the only fact is bar(B), then ?y
> > is unbound and ?z is bound to B...
>
> Unfortunately, that rule
>
> > > Rule: FORALL ?x, ?y, ?z, IF test(?x) AND ( ?y=1 AND foo(?y) OR ?
> > > z=B AND bar(?z) ) THEN...
>
> is unsafe (since ?y and ?z are not bound in every disjunct).
>
> The rule:
>
> FORALL ?x, ?y, ?z, IF test(?x) AND ?y=1 AND ?z=B AND (foo(?y) OR 
bar(?z))
>
> is safe, but the binding of the universal variables does not 
> discriminate the two instances :-(
>
> And I see no easy way to explain that ?y is not bound if the instance 
> matches bar(?z); I mean, not easier than introducing the notion of 
> matched facts, of something similar.
>
> If we do not want to add the dummy (disjunct counter) variable, we can 
> explicitely "annotate" each rule instance with the disjunct it matches 
> in the disjunctive normal form (as defined for the purpose of checking 
> safeness); if the rule is not disjunctive, the disjunct if the 
> condition itself.
>
> And two instances are equal only if they bind the universal variables 
> to the same values, and if they matched the same disjunct.
>
> That would mimick the way it actually works in most engines (if not 
> all): that is, disjunctive rules are really handled as one rule per 
> disjunct, with all the same action part...
>
> Actually, I would prefer that: it requires a change in the definition 
> of rule instance (esp. rule instances equality), but it is simpler 
> (more intuitive) than adding the notion of matched facts, and it is 
> less artificial than adding a fake universal variable just for 
> differentiating the disjuncts...
>
> What do you think?
>
> 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
>





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 Wednesday, 3 February 2010 13:26:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 February 2010 13:26:55 GMT