NextPrevUpTopContentsIndex

6.4 Logical Dependencies and Truth Maintenance

When a rule creeates an object that depends on a specific set of preconditions, it is sometimes necessary to erase that object when those preconditions no longer hold. This is an example of truth maintainence .

KnowledgeWorks provides a mechanism to track logical dependencies between objects and preconditions which cause any dependent objects to be erased automatically. This is achieved using a logical clause in a forward chaining rule, with a precondition of the form

(logical <forward-condition>+)

The enclosed forward conditions in this clause are matched as normal, but if the rule fires and creates new objects (by assert or make-instance ) then these objects are associated with the enclosed conditions. If the conditions are found to be false in the future, then the created objects are erased automatically (see erase).

NB: There can be at most one logical clause in a rule (though it can contain multiple subclauses) and it must be the first clause in the rule. Other clauses can follow the logical clause, but they are not part of the logical dependency.

6.4.1 Example


KnowledgeWorks and Prolog User Guide (Windows version) - 29 Feb 2008

NextPrevUpTopContentsIndex