# Steps to Using Pyke

1. You provide the following to Pyke's knowledge engine:
   - A set of universally true statements.
     - These statements are true for all time.
   - The text for all questions that you might want Pyke to ask your end user.
   - Multiple sets of rules.
     - Your rules may include both forward-chaining and backward-chaining rules.
2. Repeat for each specific use case:
   1. You provide a set of statements describing this specific use case to Pyke.
   2. You select which set of rules apply to this use case.
   3. Pyke automatically runs all of the selected forward-chaining rules that apply to the statements that you've given to it to deduce new statements.
      - Your forward-chaining rules may interactively ask your end user questions, or get information by executing commands (programs) on the computer that it's running on to help in its decision making.
   4. You ask Pyke a question by having it prove a goal (which is just another statement). This goal may include pattern variables that allow you to ask "for what values is this statement true?".
      - Pyke runs the selected backward-chaining rules against the statements that it has in order to figure out the answer to your question.
      - Your backward-chaining rules may also ask your end user questions and run commands.
      - You may have written Python code at the end of some of your backward-chaining rules. For each such rule, Pyke has compiled this Python code into a Python function called a plan which it has attached to the rule.
      - Once Pyke finds an answer to your question, it gathers all of the plan functions of the rules that it used to find your answer into a complete function call graph. The plan functions are linked together mirroring the way that the rules were linked together to find your answer. In this way, you can write high-level compilers that assemble together and configure a set of Python functions to solve specific problems.
      - Pyke returns the top Python function of this function call graph as a standard Python function along with the answer to your question. You may call this function as may times as you like. You may also pickle the function so that you can send it to another program or save it to disk. You only need one small Pyke module to load and run these pickles.
   5. You reset Pyke to clear out all of these case specific statements and prepare it for the next use case.

Copyright © 2007-2009 Bruce Frederiksen

Page last modified Mon, Oct 27 2008.