.. Copyright ÂŠ 2007 Bruce Frederiksen
.. Permission is hereby granted, free of charge, to any person obtaining a copy
.. of this software and associated documentation files (the "Software"), to deal
.. in the Software without restriction, including without limitation the rights
.. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
.. copies of the Software, and to permit persons to whom the Software is
.. furnished to do so, subject to the following conditions:
.. The above copyright notice and this permission notice shall be included in
.. all copies or substantial portions of the Software.
.. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
.. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
.. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
.. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
.. THE SOFTWARE.
Explanation of rules, forward-chaining and backward-chaining.
section-pages: , forward_chaining, backward_chaining
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.
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
- Backward-chaining_ rules are processed when your program asks pyke to
prove_ a specific *goal*.
- These rules don't assert_ new facts or activate_ more specific rule
bases. But they do have the ability to assemble python functions into
a customized call graph or program, called a plan_, to meet a specific need.
.. _activate: ../../using_pyke.html#setting-up-each-case
.. _activated: activate_
.. _assert: activate_
.. _backward-chaining: backward_chaining.html
.. _facts: ../knowledge_bases/fact_bases.html#facts
.. _forward-chaining: forward_chaining.html
.. _goals: ../../krb_syntax/bc_rule.html#use-clause
.. _patterns: ../../krb_syntax/pattern.html
.. _plan: ../plans.html
.. _prove: ../../using_pyke.html#proving-goals
.. _rule base: ../knowledge_bases/rule_bases.html
.. _rule bases: `rule base`_