Inference Collection: Reference Manual

PLT Scheme Inference Collection
Reference Manual
Edition 2.0

December 2008

M. Douglas Williams <>

The PLT Scheme Inference Collection implements an inference engine that supports both forward-chaining (data-driven) and backward chaining (goal-driven) for developing rule-based systems in PLT Scheme. The inference engine:

The source code is distributed with the inference collection and licensed under the GNU Lesser General Public License, Version 2.1 [LGPL].

All of the functionality defined in this manual is exported by the inference collection and accessed using the following form:

 (require (planet williams/inference/inference))

© 2006-2008, M. Douglas Williams

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

    1 Introduction

      1.1 Routines Available in the Inference Collection

      1.2 The Inference Collection is Free Software

      1.3 Obtaining the Inference Collection

      1.4 No Warranty

    2 Using the Inference Collection

      2.1 An Example

      2.2 Loading the Inference Collection

    3 Inference Environments (Basic)

      3.1 The inference-environment Structure

      3.2 Current Inference Environment

      3.3 Current Inference Environment Fields

    4 Inference Control (Basic)

      4.1 Rule Set Activation

      4.2 Forward Chaining Control

      4.3 Backward Chaining Control

      4.4 Inference Control

    5 Facts and Assertions

      5.1 Facts

        5.1.1 List Facts

        5.1.2 Association List Facts

        5.1.3 Vector Facts

        5.1.4 Structure Facts

      5.2 The assertion Structure

    6 Rule Sets and Rules

      6.1 Rule Sets

      6.2 Rules

        6.2.1 Forward Chaining (Data-Driven) Rules

        6.2.2 Backward Chaining (Goal-Driven) Rules

      6.3 Pattern Clauses

        6.3.1 Binding Pattern Clauses

        6.3.2 Existential Pattern Clauses

      6.4 Patterns

        6.4.1 List Patterns

        6.4.2 List Pattern Example—Ancestors

        6.4.3 Association List Patterns

        6.4.4 Association List Pattern Example—Ancestors

        6.4.5 Vector Patterns

        6.4.6 Vector Pattern Example—Ancestors

        6.4.7 Structure Patterns

        6.4.8 Structure Pattern Example—Ancestors

      6.5 Conflict Resolution Strategies

        6.5.1 Depth First

        6.5.2 Depth First Example

        6.5.3 Breadth First

        6.5.4 Breadth First Example

        6.5.5 Rule Order

        6.5.6 Rule Order Example

        6.5.7 Specificity

        6.5.8 Specificity Example

        6.5.9 Simplicity

        6.5.10 Simplicity Example

        6.5.11 Complexity

        6.5.12 Complexity Example

        6.5.13 Random

        6.5.14 Random Example