[2bb500]: doc / source / about_pyke / steps_to_using_pyke.txt  Maximize  Restore  History

Download this file

101 lines (79 with data), 4.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.. $Id$
..
.. 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.
restindex
crumb: Steps to Using Pyke
page-description:
A brief list of the steps involved in programming in Pyke (with lots
of links).
/description
format: rest
encoding: utf8
output-encoding: utf8
include: yes
initialheaderlevel: 2
/restindex
====================
Steps to Using Pyke
====================
#. 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.
#. Repeat for each specific use case:
#. You provide a set of statements_ describing this specific use case to
Pyke.
#. You select which set of rules apply to this use case.
#. 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.
#. 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.
#. You reset_ Pyke to clear out all of these case specific statements and
prepare it for the next use case.