Another application of meta-rules is in the manipulation of uncertainty. A full implementation of the uncertain reasoning facility described below is included among the examples distributed with KnowledgeWorks, and also in Uncertain Reasoning Facility.
In this example, we wish to associate a certainty factor with objects in a manner similar to the MYCIN system (see Rule-Based Expert Systems , B. G. Buchanan and E. H. Shortliffe, Addison-Wesley 1984). When we assert an "uncertain" object we wish it to acquire the certainty factor of the instantiation which is firing. We define the certainty factor of an instantiation to be the certainty factor of all the objects making up the instantiation multiplied together. Additionally, we wish rules to have an implication strength associated with them which is a multiplicative modifier to the certainty factor obtained by newly asserted uncertain objects. The general approach is as follows:
*c-factor*to hold the certainty factor of the current instantiation and
*implic-strength*to hold the implication strength of the rule, and a class of "uncertain" KnowledgeWorks objects:
(def-kb-class uncertain-kb-object ()
((c-factor :initform (* *c-factor* *implic-strength*)
The uncertain objects should contain this class as a mixin.
(defun inst-c-factor (inst)
(reduce '* (inst-token inst) :key 'object-c-factor))
(defrule uncertain-context :backward
((setq *c-factor* (inst-c-factor ?inst)))
*implic-strength*so that rules may set their implication strength by calling the action:
A rule could be defined similarly to:
(defrule my-rule :forward
(assert (my-class ?obj3)))
where the certainty factor of the new object
will automatically become:
(* (object-c-factor ?obj1) (object-c-factor ?obj2) 0.6)
While this is an extremely simplistic version of uncertain reasoning, it suggests how a more elaborate treatment might be approached.
KnowledgeWorks and Prolog User Guide (Macintosh version) - 6 Dec 2011