KnowledgeWorks and Prolog User Guide



1 Introduction

1.1 KnowledgeWorks

1.2 Background

1.3 Technical Overview

1.3.1 Appearance of the graphical tools

1.4 Notation Conventions

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 Example

3.1.3 Defining Forward Chaining Rules Example

3.1.4 The Forward Chaining Interpreter

3.1.5 Control Flow The Agenda Contexts Conflict Resolution

3.1.6 Examples Defining Contexts

3.1.7 Forward Chaining Debugging

3.2 Backward Chaining

3.2.1 Overview

3.2.2 Backward Chaining Syntax Example

3.2.3 Objects

3.2.4 Defining Backward Chaining Rules

3.2.5 The Backward Chaining Interpreter 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 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 Functions defined on Instantiations A Simple Example A Simple Explanation Facility Reasoning with Certainty Factors

6.1.2 User-definable Conflict Resolution Examples

6.2 Optimization

6.2.1 Forward Chaining KnowledgeWorks Structures Efficient Forward Chaining Rule Preconditions

6.2.2 Conflict Resolution Use of Contexts Optimization of the Strategy

6.2.3 Backward Chaining Pattern Matching Tail Recursion 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 Multiple threads Interleaved in a Single Thread

7 Reference Guide

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.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




KnowledgeWorks and Prolog User Guide (Windows version) - 22 Dec 2009