


 
Contents
1	Introduction 
	1.1  KnowledgeWorks 
1.1.1  Background 
1.1.2  Technical Overview 
	1.2  Notation and conventions 
1.2.1  Prolog syntax 
1.2.2  Viewing example files 
1.2.3  Appearance of the graphical tools 
2	Tutorial 
	2.1  Getting Started 
	2.2  Loading the Tutorial 
	2.3  Running the Tutorial 
	2.4  Browsers 
2.4.1  Rule Browser 
2.4.2  Objects Browser 
2.4.3  Class Browser 
2.4.4  Forward Chaining History 
	2.5  KnowledgeWorks Listener 
	2.6  Debugging 
2.6.1  Monitoring Forward Chaining Rules 
2.6.2  Single-Stepping Rules 
2.6.3  Editing Rule Definitions 
	2.7  Lisp Integration 
2.7.1  The LispWorks IDE 
	2.8  Systems 
	2.9  Exiting KnowledgeWorks 
3	Rules 
	3.1  Forward chaining 
3.1.1  Overview 
3.1.2  Forward Chaining Syntax 
3.1.2.1	Example 
3.1.3  Defining Forward Chaining Rules 
3.1.3.1	Example 
3.1.4  The Forward Chaining Interpreter 
3.1.5  Control Flow 
3.1.5.1	The Agenda 
3.1.5.2	Contexts 
3.1.5.3	Conflict Resolution 
3.1.6  Examples 
3.1.6.1	Defining Contexts 
3.1.7  Forward Chaining Debugging 
	3.2  Backward Chaining 
3.2.1  Overview 
3.2.2  Backward Chaining Syntax 
3.2.2.1	Example 
3.2.3  Objects 
3.2.4  Defining Backward Chaining Rules 
3.2.5  The Backward Chaining Interpreter 
3.2.5.1	Examples 
3.2.6  Edinburgh Prolog Translator 
3.2.7  Backward Chaining Debugging 
	3.3  Common Lisp Interface 
4	Objects 
	4.1  CLOS objects 
4.1.1  Unnamed Classes 
4.1.2  Named Classes 
4.1.2.1	Examples 
	4.2   Relational Database Objects 
4.2.1  Example 
4.2.2  Extended Example 
	4.3   KnowledgeWorks Structures 
5	The Programming Environment 
	5.1  The KnowledgeWorks Listener 
	5.2  The Editor 
	5.3  Clearing KnowledgeWorks 
	5.4  The System Browser 
	5.5  The Class Browser 
	5.6  The Objects Browser 
	5.7  The Rule Browser 
	5.8  Debugging with the Environment 
5.8.1  Spy Windows 
	5.9  Monitor Windows 
5.9.1  Forward Chaining History 
6	Advanced Topics 
	6.1  Control Flow 
6.1.1  Meta Rule Protocol 
6.1.1.1	Functions defined on Instantiations 
6.1.1.2	A Simple Example 
6.1.1.3	A Simple Explanation Facility 
6.1.1.4	Reasoning with Certainty Factors 
6.1.2  User-definable Conflict Resolution 
6.1.2.1	Examples 
	6.2  Optimization 
6.2.1  Forward Chaining 
6.2.1.1	KnowledgeWorks Structures 
6.2.1.2	Efficient Forward Chaining Rule Preconditions 
6.2.2  Conflict Resolution 
6.2.2.1	Use of Contexts 
6.2.2.2	Optimization of the Strategy 
6.2.3  Backward Chaining 
6.2.3.1	Pattern Matching 
6.2.3.2	Tail Recursion 
6.2.3.3	Cut 
	6.3  Use of Meta-Classes 
6.3.1  Example 
	6.4  Logical Dependencies and Truth Maintenance 
6.4.1  Example 
	6.5  Inferencing States 
6.5.1  Creating and Maintaining Inferencing States 
6.5.2  The Current Inferencing State 
6.5.3  Uses of Inferencing States 
6.5.3.1	Multiple threads 
6.5.3.2	Interleaved in a Single Thread 
7	Reference Guide 
all-debug 
any 
assert 
clear-all 
clear-rules 
conflict-set 
context 
current-cycle 
cut 
*cycle* 
def-kb-class 
def-kb-struct 
def-named-kb-class 
defcontext 
defrule 
deftactic 
destroy-inferencing-state 
erase 
fail 
find-inferencing-state 
findall 
fire-rule 
get-kb-object 
*in-interpreter* 
infer 
*inferencing-state* 
inferencing-state-name 
inst-bindings 
inst-rulename 
inst-token 
instantiation 
list-all-inferencing-states 
kb-name 
kw-class 
-lex 
lex 
make-inferencing-state 
make-instance 
-mea 
mea 
named-kb-object 
no-debug 
not 
-order 
order 
*print-verbose* 
-priority 
priority 
-recency 
recency 
reset 
return 
*signal-kb-name-clash* 
-specificity 
specificity 
standard-context 
standard-kb-object 
start-cycle 
start-kw 
test 
undefcontext 
undefrule 
with-rule-actions 
Appendix A Common Prolog	 
A.1  Introduction 
A.1.1  Overview 
A.1.1.1  Starting Common Prolog 
A.2  Syntax 
A.3  Defining Relations 
A.4  Using The Logic Interpreter 
A.4.1  Multiple Solutions 
A.4.2  Multiple Goals 
A.4.3  Definitions 
A.4.4  Exiting the Interpreter 
A.5  Accessing Lisp From Common Prolog 
A.5.1  Examples 
A.6  Calling Prolog From Lisp 
A.6.1  Examples 
A.6.2  Interface Functions 
A.6.2.1  any, findall and findallset 
A.6.2.2  deflogfun 
A.6.2.3  with-prolog 
A.7  Debugging 
A.7.1  Tracing 
A.7.1.1  Tracing rules 
A.7.2  Spy Points 
A.7.3  Leashing 
A.7.4   Interactive Debugging 
A.8  Common Prolog Macros 
A.8.1  Example 
A.9  Defining Definite Clause Grammars 
A.9.1  Examples 
A.9.1.1  Example 1: A simple definition. 
A.9.1.2  Example 2: Using extra arguments. 
A.10  Edinburgh Syntax 
A.11  Graphic Development Environment 
A.12  Built-in Predicates 
A.13  Adding Built-in Predicates 
A.13.1  The defdetpred form 
A.13.2  The defdetunipred form 
A.14  Edinburgh Compatibility Predicates 
Appendix B Examples	 
B.1  The Tutorial 
B.2  Explanation Facility 
B.3  Uncertain Reasoning Facility 
B.4  Other Examples 
Appendix C Implementation Notes	 
C.1  Forward Chainer 
C.1.1  Forward Chaining Algorithm 
C.1.2  CLOS and the Forward Chainer 
C.1.3  Forward Chaining and the Backward Chainer 
C.2  Backward Chainer 
C.2.1  Backward Chaining Algorithm 
C.2.2  Term Structure 
C.2.3  The Binding Trail 
Appendix D For More Information	 
D.1  General References 
D.1.1  Forward Chaining 
D.1.2  Backward Chaining and Prolog 
D.1.3  Uncertain Reasoning 
D.1.4  Expert Systems 
D.1.5  Lisp and CLOS 
D.2  The LispWorks manuals 
Appendix E Converting Other Systems	 
E.1  OPS5 
E.2  Prolog 
Glossary	 
Index	 
 
KnowledgeWorks and Prolog User Guide (Macintosh version) - 26 Feb 2015



