Expand description
Defines a dictionary of predicates (facts and rules).
The dictionary is implemented as a HashMap. Each entry is a list
(vector)
of facts and/or rules, indexed by predicate name.
A predicate’s name consists of its functor and its arity, separated by a slash.
For example, for the rule,
grandfather($X, $Y) :- father($X, $Z), father($Z, $Y).
the predicate name is: grandfather/2
.
Functions§
- add_
rules - Adds facts and rules to a knowledge base.
- count_
rules - Counts the number of facts and rules for the given predicate.
- format_
kb - Formats the knowledge base for display. Use for debugging.
- get_
rule - Fetches a rule (or fact) from the knowledge base.
- make_
fact - Makes a fact.
- make_
rule - Makes a rule.
- print_
kb - Prints a formatted knowledge base. Use for debugging.
- test_kb
- Creates a knowledge base with a few facts and rules for testing.