Sunday, September 24, 2006

Inference Collection - Fact Modification Semantics

I need to specify the semantics for the various ways to change a fact in the inference engine. There are three ways to reassert a fact. The first is to explicitly retract the existing assertion and then to assert its replacement. The second is to replace an assertion using the replace function. The third is to modify (the fact within) an assertion using the modify function. Each of these has a different set of semantics - largely associated with the level of reuse.
Retract and Assert
By explicitly retracting an assertion, all reference to it should be removed. This is true in terms of the rule network, but currently references to the assertion may still exist in rule instances retained as the reasons for other assertions. I need to think of a better mechanism to retain the relevant information from the rule instance or give up on consistency when reusing assertions or facts.
One approach would be to sanitize the rule instance before using it as a reason. This would involve removing the assertion list (easy) and any assertion variables from the bindings. [These would not be reliable as reasons following any replace or modify of tge assertion.]
An alternative is to try to determine which assertion references are still valid following a replace or modity. We could remove any such references (in reason fields) or we could maintain a generation field and have an explicit assertion reference type with generation checking.
For now, I will document the inconsistence problem and live with it. It only affect debugging at the moment anyway.] I will revisit this when I implement truth maintenance in the future.
In any case, a separate retract and assert does not provide any reuse of assertions and the above problems will not occur.
Currently, replace literally implements an assert preceded by a retract as above. I will change this to reuse the assertion object for the next release. This will have the inconsistenct problem noted above.
The new modify functionality will reuse the underlying fact object within the assertion object being modified. Only the fields that are specified will be changed.



Post a Comment

<< Home