.. Copyright ÂŠ 2007-2008 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.
crumb: Logic Programming
An tutorial on logic programming in Pyke, including *statements*,
*pattern matching* and *rules*.
section-pages: , statements, pattern_matching/index, rules/index, plans
Logic Programming Tutorial
Pyke is an inference engine that applies rules_ to facts_ to establish
additional facts (through forward-chaining_ rules), and/or to prove *goals*
and optionally assemble Python functions
into customized call graphs, called plans_ (through backward-chaining_ rules).
Pyke may then be reset_, deleting the last set of facts, so that the cycle
may be repeated. For each cycle a different rule base may be activated_.
The plan_ capability allows the postponement of code execution until the
top-level goal has been completely proven. This shields the code from
blind alleys and the backtracking_ that occurs within the rules.
Once a plan_ has been created, it may be executed multiple times with different
arguments. It may also be pickled_, and later run again only requiring one
small Pyke module.
Pyke also provides an end user question_ capability, as well as the capability
to run commands_ on the local system to guide the inferencing.