An overview of the knowledge module's role and abilities.


§1. Prerequisites. The knowledge module is a part of the Inform compiler toolset. It is presented as a literate program or "web". Before diving in:

§2. The Model. This module's task is to build the "model world", the initial state of the world as it is chosen by an Inform author.1 This consists of:

But the model does not contain:

§3. The model is constructed entirely from a stream of logical propositions sent here by the assertions module. Those propositions may be mutually inconsistent — either flatly contradictory or just impossible to reconcile.

The stream of supposed truthful statements comes to this module through calls to either Assert::true or Assert::true_about. These reduce a proposition to a set of facts concerning things in the model; as we have seen, the model includes kinds, variables, instances and relations, and so we need a unified type for "something you can know a fact about". That type is called inference_subject. Each subject has its own list of known facts: we call such a fact an inference because it has (usually) been inferred from a proposition.

Chapter 3: Properties implements our system of properties: each different value or either-or property is a property object. There might be a puritan case for abolishing this type in favour of regarding either-or properties as special cases of unary_predicate and value properties as special cases of binary_predicate (by identifying a predicate with its setting relation), but I do not think this would clarify anything.

Chapter 4: Subjects gives a general API for dealing with Inference Subjects, and then works systematically through the various categories of these. Kinds and binary predicates already exist from other modules (see Chapter 2: Kinds (in kinds) and Chapter 3: Binary Predicates (in calculus) respectively), but Instances and Nonlocal Variables are new.

Finally, Chapter 5: Modelling deals with the actual inferences, and with how the model world is constructed. The core of Inform does nothing very interesting here, but features from the if module add some domain-specific savvy.