Rules
Premises and Conclusions
Rules have two parts to them: an if part (the premises), and a then part (the conclusions). (Though pyke uses different names for these). Each of these if and then parts contain one or more facts or goals represented by patterns.
Logically, the rule says that if all of the premises in the if part of the rule are true, then each of the conclusions in the then part of the rule must also be true.
Inferencing
Rules are specified individually within a rule base. They are not nested or explicitly linked to each other. So pyke must automatically figure out how to combine these rules to accomplish some larger task. This is called inferencing and there are two different approaches that pyke uses, depending on the rule's type.
- All forward-chaining rules are processed when a rule base is activated.
- Forward-chaining rules may assert new facts, and activate more specific rule bases.
- Backward-chaining rules are processed when your program asks pyke to prove a specific goal.