Contents of the MANUAL.DOC file
First ApprovalWare release: January 9, 1986
THE EXPERT consists of several files:
READ.ME This file
EX.MNU Mandatory menus file
EX0.HLP Optional online help files
MENU.RUL Demonstration rulebases
NULL.FCT Default factbase
MANUAL.DOC User's Manual (may be TYPEd out)
Please keep THE EXPERT complete and unmodified as you share it!
T H E E X P E R T
ApprovalWare for the Implementation
of User-Specified Expert Systems
Software and Manual
by Stephen Walton
496 Hudson Street, Suite D15
New York, N.Y. 10014
Copyright (C) 1986 by Stephen Walton. All rights reserved.
THE EXPERT is a trademark of Stephen Walton for his expert-
ApprovalWare is Stephen Walton's trademark for his user-supported
Table of Contents
1. Introduction to THE EXPERT................................3
2. Running THE EXPERT........................................7
3. About Rulebases..........................................14
4. About Factbases..........................................18
5. Potential Enhancements...................................19
THE EXPERT is software I once thought I would sell for a lot of
money. It is possible that it's worth a lot of money. But there
was a finite window in which it could be a commercial product,
remain under my control, and make all that money through any
channel available to me. That window -- if it ever really was
there -- has closed. I will catalogue my errors of judgement and
other sins some other time. I will NOT subject you to my course
in non-marketing here.
The software stands, and I feel good about standing by it. It
works, it doesn't trip over its own ambitions, and it's clean.
The gotchas are few and, better yet, documented below. Anyone
who's been programming for a year or more (any language, any
level) should be able to make THE EXPERT do pleasing things. It
does assume that you have access to a text editor that produces
ASCII files (non-document mode, you WordStar fanatics) and know
how to use it. Beyond that, the software, this manual and the
example files should be enough to get you going.
ApprovalWare is my own stupid wrinkle on the "freeware" idea. I
can't call this "freeware" because somebody else made an effort
to trademark the "freeware" name. What ApprovalWare means is that
if, after inspection, you approve of the software, you really
should send me some money. It's a little like those stamp-
collecting "approvals" you get stuck with whem you send away for
the FREE 10,000 all-different citrus-fruits-of-many-lands stamps.
But here there are no extras, and no building-up debt. You don't
owe me anything until you decide you do.
If you like the software and/or you find it useful, you can send
me money. If you don't like it or find it useful, please pass it
along to someone who may like it better (and you can still send
me money, but I'll wonder about you). Your contribution, if you
choose to make one, is a vote. It's a vote for the continued
existence, conscientious support and energetic further
development of this software. Your ongoing use of this software
with no contribution is a vote for minimal or no support, for no
enhancements and for the despair of a programmer who sincerely
thought that ApprovalWare (or whatever alias you prefer) could be
an equitable mode of software distribution.
A couple of questions might arise quite naturally here:
Q. Is THE EXPERT in its present form merely a stalking horse for
a commercial product?
A. Yes -- IF it generates some kind of commercial response. It
would be a pleasure to discuss enhanced software, specific
applications or classes in knowledge engineering. Custom work of
every kind is possible. Every contributor-user will have a
telephone number to use.
THE EXPERT page 1
Q. Is THE EXPERT the precursor of a better ApprovalWare product?
A. For sure -- if there's any approval out there. I've got a few
notions for the next version, but the needs that appear in the
field will take priority, if I'm kept informed. Every
contributor-user will have a telephone number to use.
Q. Will circulation of systems based on THE EXPERT be encouraged?
A. Of course. If enough contributor-users get things going, their
advertisements will be included in the ApprovalWare distribution
of future releases of THE EXPERT. Every contributor-user will
have a telephone number to use. Details are pending, but they
will be limited to one screen each, I will take no responsibility
for their content, AND I may censor or suppress them if I think
they may offend general standards of good taste, or at my own
judgement. Additionally, other tests may be imposed by public-
domain software distribution channels and will not be my
responsibility. Other means by which contributor-users can inform
other contributor-users of available applications, such as a
rudimentary newsletter, will also be explored.
Quite frankly, I really don't know whether THE EXPERT in its
present form is a complete product or just a hobbyists' curiosity
(if that). I'm looking forward to finding out myself. Even if
only hobbyists take an interest in it, that interest would please
me, since the microcomputer hobby has been severely undervalued
in the past few years and deserves more support than it currently
In the text that follows, "we" is used only as an editorial
conceit. I am solely responsible for the contents. Where the
software is concerned, an acknowledgement is owed to Jim Baen who
graciously provided me with an early version of his proprietary
QuickScreen package, which made it easy for me to do the popup
Finally, and whether you ever send a contribution or not, I thank
you for going as far as this in examining THE EXPERT. I hope you
will go farther, and find it worth your trouble.
New York City
January 9, 1986
THE EXPERT page 2
1. Introduction to THE EXPERT
What is knowledge? How do you think a problem through? How
do experts do what they do? How many ideas can a person keep in
mind at one time?
These are practical as well as theoretical questions.
Practical because there is a serious effort under way, in this
country and elsewhere, to work out means of making computers
perform more and more of the functions that we lump together as
"thinking" when they are performed by humans. This effort is
called Artificial Intelligence, nicknamed AI.
A large portion of this effort is in the area of "expert
systems," also known as "knowledge-based systems" -- the
distinction between knowledge and mere data a significant one.
The idea is that of putting useful knowledge, not just random
facts, into a form in which a computer can successfully employ it
to solve real problems as well as human experts do. Bodies of
knowledge addressed so far have included medical diagnosis,
analysis of mass spectrograms, petroleum geology and the
recognition of natural speech.
1.1 What THE EXPERT Is
THE EXPERT is software for the implementation of expert
systems. It has the following features, which in combination we
believe to be unique:
1. It is a framework on which any number of expert systems
can be built, and is not itself a single such system.
2. It runs on microcomputers, and runs fast enough to use
3. The format it requires for a body of knowledge is very
simple (this, in turn, imposes certain limitations which are
4. Its results (conclusions and their justifications) can be
retained for future examination or other use.
5. It works both forward and backward -- either deriving
consequences from new data or testing hypotheses put to it
as queries -- and these modes can be freely mixed by the
6. It can explain what it does -- why it is asking a
particular question or how it arrived at a particular
7. It allows you to change your input at any time, and
THE EXPERT page 3
immediately re-evaluates all its conclusions.
8. Because it permits chained blocks of knowledge, it is not
limited in the complexity of the subjects with which it can
9. It does not require a hard disk or an unusually great
amount of memory (128K RAM suffices).
In AI parlance, THE EXPERT uses knowledge represented as
"production systems." A production is a rule; it specifies that
IF a list of conditions is met, THEN a list of results is true
(sometimes a result is an action to be performed, rather than a
new fact). A production system is a collection of productions,
all presumably relating to a common subject or area of knowledge.
Production systems are explained in detail in Patrick Henry
Winston's textbook, Artificial Intelligence (Addison-Wesley,
1977). We will refer to them here as "rulebases," a term we
consider slightly more congenial.
1.2 What THE EXPERT Can Do
It would be impossible to enumerate here all the possible
applications -- separate expert systems -- that can be done with
THE EXPERT. We will, however, make so bold as to present the
following list of application areas in which THE EXPERT might be
Computer system configuration
Botanical and zoological taxonomy
Intelligent checklist for travel
Hardware troubleshooting -- all types
Training -- all types
Insecticide or herbicide selection and application
Fertilizer selection and application
THE EXPERT page 4
Any application for which decision tables have been used
Engineering materials selection
Insurance policy selection
Licensing checklists for:
Real estate agents
Air transport workers
Selection of tax-advantaged investments
Contract drafting (selection of boilerplate clauses)
Home and car maintenance for the do-it-yourselfer
Advertising media analysis
With that little sales pitch behind us, this is also the
appropriate place to note what, in general terms, THE EXPERT
works with, and to note some of its limitations.
THE EXPERT takes both rules and facts in the form of ASCII
strings, so it is not, at present, suited for any direct
manipulation of graphic information. A rule is a list of
potential facts -- conditions -- and another list of facts --
results -- that become true when the list of conditions is met.
Both conditions and results can be stated in either positive or
negative form. Each list must have at least one member; there is
no structural limitation on the number of members a list may
The results obtained from THE EXPERT can be only as good as
the rulebase used. At present, it is entirely possible to
construct worse-than-useless rulebases. If it proves feasible, a
rulebase-editing utility program will do some testing of logical
consistence and overall quality of rulebases. For now, one should
keep in mind that THE EXPERT does NOT eliminate thinking -- it
merely requires that one do it right just once.
The rationale behind the development of THE EXPERT has been
simple. We considered the emergence of expert systems for
microcomputers inevitable. Taking the highly successful example
of VisiCalc, we felt it would be best to allow users to prepare
their own knowledge bases, just as they prepare their own
spreadsheet templates. We selected formats for rules and facts
that would allow convenient, speedy operation. While much AI work
has gone into means of mediating between short-term and long-term
memory, we felt that the most useful, practicable product would
be one that simply let the computer act as a much-enlarged short-
term memory. And we tried to keep everything very simple.
THE EXPERT page 5
The block diagram below shows the general organization of
| | | |
| Rulebase |---------| | User
| | | | |
|____________| | Inference | |
| ___________ | Engine | |
| | | | | ______|______
| | Factbase |---| | | |
| | | | |-----| |
| |___________| |___________| | |
| | | | User |
__|_________|_______________|_____ | Interface |
| | | |
| Files Manager |-----| |
Diskette(s) and/or hard disk
The Rulebase is the production system or collection of rules
that determines what conclusions can be drawn and what hypotheses
can be tested.
The Factbase is the collection of facts that the user and
THE EXPERT are currently working with.
The Files Manager gets rulebases and factbases from disk and
saves factbases back to disk.
The Inference Engine does the real thinking -- it draws
conclusions from facts given by the user, and also determines
what questions must be asked in order to prove or disprove a
The User Interface mediates between the human user and both
the Inference Engine and the Files Manager. It also provides
menus and review functions.
Everything about THE EXPERT owes a heavy debt to Artificial
Intelligence research. But in our own context we prefer the term
"Intelligence Amplification." That is what THE EXPERT is meant to
THE EXPERT page 6
2. Running THE EXPERT
Although we feel that in many cases menu-driven software can
be stifling, we deliberately set up THE EXPERT as a menu-driven
system, and we still feel no regrets -- especially inasmuch as
the menus are the pop-up type and do not destroy what's below
them on the screen, while the seasoned user can do away with them
This chapter will NOT be a rote transcription of an
operating session, for two reasons. First, because there's enough
online help available to keep you out of trouble. Second, because
we reserve the right to let the software change faster than the
Here we will try to develop the concepts involved in running
THE EXPERT, and to provide you with a sense of the space in which
2.1 The Object of the Game
When you're running an application -- a rulebase -- under
THE EXPERT, you are usually doing one of two things:
1. Presenting a set of facts to see what conclusions, if
any, can be drawn from them. This is forward reasoning.
2. Posing a potential fact as a hypothesis, then affirming
or denying other potential facts (with "don't-know" response
as a valid option) until your original hypothesis can be
either confirmed or disproved, or until it is clear that
neither confirmation nor disproof is possible on the basis
of your answers. This is backward reasoning.
There is a third, "browsing" mode that is a combination of
the two above but requires no specific discussion here. The first
mode above allows you to either type in your facts (if you really
want to) or, more likely, select them from a "pick list" of
potential facts relevant to the particular rulebase. The second
mode above is the one most often actually used, especially since
it ties in with the possibility of a default or "preset"
hypothesis or query written into the rulebase as a suggested goal
to work toward.
Let's restate some of this a little differently. A rulebase
defines implication relations among a set of potential facts, or
what we also call fact formats. When you work with THE EXPERT and
a rulebase, you are assigning truth values to specific fact
formats as you assert or deny them as facts in the particular
case under consideration. (When you attach "don't know" to a fact
format, you are assigning it a special truth value that means it
is a roadblock that THE EXPERT must detour around, if it can;
THE EXPERT page 7
actually, THE EXPERT has four possible truth values for each
fact format: asserted, denied, user-doesn't-know and wholly-
untested.) When you use forward reasoning, you are selected the
fact formats to assert or deny, and letting the conclusions fall
where they may. When you use backward reasoning, you have told
THE EXPERT which fact format to use as a goal, and you are
letting it select the other fact formats which, once asserted or
denied, could lead according to the rulebase to an assertion or a
denial for a the goal fact format. Backward reasoning is more
likely to be used in practice; with a well-constructed rulebase,
it can direct the user to the relevant issues with no time wasted
Perhaps the "case" idea should be made clearer. A rulebase
defines a finite subject area or universe of discourse -- a realm
in which only so many propositions can be true or false. Each use
of THE EXPERT (granting that one session can contain many uses)
is the consideration of a single case in that universe of
discourse -- one set of true and false propositions that is
complete in that universe in that it is the "given facts" you
have provided by your assertions or denials PLUS the full set of
conclusions that can be drawn, according to the rulebase, from
those given facts.
Maybe we'd better break for a visual aid.
2.2 The Cockpit
THE EXPERT is divided into seven separate operating
sections, each with its own menu and its own functions. Because
of the way you use cursor keys to get from one to the other, they
can be imagined to have a specific spatial arrangement. Here's
THE EXPERT page 8
| Main Menu (housekeeping functions) |
^ ^ ^ ^ ^
| | | | |
v v v v v
| | | | | |
| | | | | |
| Rules | Fact | Basic | Given | Derived |
| | | | | |
| Review | Formats | Input | Facts | Facts |
| | | | | |
| | | | | |
| -> | <- -> | <- -> | <- -> | <- |
^ ^ ^ ^ ^
| | | | |
v v v v v
| Exit Menu |
This is what the sections of the control panel are about:
Main Menu: Select and load a rulebase, select and load a
factbase (a partial or complete case), save a factbase; go
to any other section -- but to go to any section but the
Exit Menu, you must load a rulebase first.
Rules Review: Scan the rules of the (loaded) rulebase, one
by one, in an intelligible format; move right (cursor key)
to Fact Formats.
Fact Formats: Scan the fact formats (potential facts) of the
rulebase, with the option of asserting or denying the
current one (the one last printed on the screen), or making
a query (hypothesis) of it; move left or right (cursor keys)
to Rules Review or Basic Input respectively.
Basic Input: Elect to use the rulebase's preset query, if it
has one, type in your own fact format for assertion, denial
or query (if you really want to -- it must match a fact
format in everything except case of alphabetic characters);
move left or right (cursor keys) to Fact Formats or Given
Given Facts: Scan the facts that YOU have provided by
assertion or denial, with the option of erasing or reversing
the truth value of the current one (the one last printed on
THE EXPERT page 9
the screen). This is the really neat thing that we stole
from the spreadsheet people: when you erase or reverse a
given fact, ALL derived facts are wiped out and ALL possible
conclusions that can be drawn from the altered set of given
facts are freshly drawn. Additionally, you can eliminate all
your given facts, or all your previous don't-know responses
so that you can retry a query that wound up blocked, or
both. Move left or right (cursor keys) to Basic Input or
Derived Facts respectively.
Derived Facts: Scan the facts that THE EXPERT worked out for
itself on the basis of your input, display the derivation of
the current one (the one last printed on the screen) showing
the rule involved and which of its conditions were obtained
directly from you and which were themselves obtained by
derivation from rules. Move left (cursor key) to Given
THE EXPERT's menus all work the same way: Press the key
indicated for the function you want OR select the current --
blinking -- function by pressing Enter. You change the current
function by scanning through the menu with the PgUp and PgDn keys
(not the up-arrow and down-arrow keys, because these have other
specific purposes in some sections).
2.2 Outline of Operations
THE EXPERT is a single program, EXPERT.EXE and is invoked
from the DOS command line in the usual way; no options are used.
The software includes no overlays, but it MUST find the file
EX.MNU on the current drive or it will not run past the signon.
The online help files EX0.HLP through EX7.HLP are optional, but
should be kept available on the current drive for at least your
first few sessions.
After its signon material, THE EXPERT goes to the Main Menu
section. From here, you select and load a rulebase to use. Then,
most often, you use option 7 to go to the Basic Input section.
Typically, a rulebase will contain a preset query -- a
default hypothesis or suggested goal for backward-reasoning
operations. Often, the preset query will be something as simple
as "done," and THE EXPERT will attempt to find a route to the
What happens when you reason backward on a query, either
preset or your own? THE EXPERT searches the rulebase for a rule
by means of which the query can be asserted or dell thed as a
consequence or result, assuming all the conditions (which may be
positive or negative) of the rule can be met. If no such rule can
be found, you are told that your query is not deducible. If such
a rule is found, THE EXPERT begins asking you about its
THE EXPERT page 10
You are asked about the fact formats that are the conditions
in the rule that could prove or disprove your query, and you can
assert or deny each with a single keystroke. If the pattern of
assertions and denials that you give (thus turning the fact
formats in question into given facts for this case) matches the
pattern of assertions and denials in the rule's conditions, then
your query is either asserted or denied as a derived fact --
along with any other results that the particular rule calls for.
If this were the whole story, it would be an uninteresting
one. In fact, THE EXPERT lets you do more -- and less -- than
just assert or deny a rule's conditions. It also allows you a
don't-know response, which tags the fact format involved as a
kind of roadblock to further reasoning.
THE EXPERT then finds another way, if it can, to assert or
deny your hypothesis. It looks for another rule that can be used
to prove or disprove the query without using the fact format
about which you professed your ignorance. If it can find no such
rule, it tables your original query, and takes up the fact format
that got the don't-know from you as a new, temporary goal. Once
that goal is satisfied one way or another, it can go back to the
Another way to put it: When a don't-know answer from you
blocks THE EXPERT's progress toward a goal, it finds another
route to the original goal, OR takes the new unkown as an
intermediate goal, "stacking" the original goal to return to when
it can profitably do so.
In the backward-reasoning interrogation, you have two more
options. One is the "Why ask?" response. It makes THE EXPERT show
you the rule it is trying to apply, then return the question. The
other option is the "Stop asking" response, which tells THE
EXPERT to drop a query entirely; this response will be most
useful when you realize you've set the software on a useless and
tedious quest, or when you are debugging a possibly shaky new
THE EXPERT will sometimes get stuck in trying to handle a
query, and will tell you so. Do not confuse this situation with a
bug in THE EXPERT! When the software "can go no further," it's
because the information you have provided, combined with the
rulebase, leaves no reasoning path to the goal. This can easily
happen when you say "don't-know" about a crucial fact format that
cannot be derived from any others (call it "base level" in that
case) or for which no possible derivation path remains open. This
is when the "Clear don't-knows" option in the Given Facts section
becomes valuable, because it lets you retry the original query,
posssibly reconsidering some of your don't-know responses.
One other bit of behavior that may be unsettling if it takes
you by surprise is rulebase chaining. Since not every sphere of
human knowledge and expertise can be compressed into 100 or fewer
if-then rules, it is sometimes necessary (or convenient) to
THE EXPERT page 11
divide an application into "chunks" of up to 100 rules and make
use of THE EXPERT's ability to shift from one rulebase to another
on the fly. When this is happening, you will see derived facts
such as "CHAIN 0 foo" or "CHAIN 1 bar" displayed, followed by a
fair amount of disk activity. Details are in the section on
rulebases below, but what's basically happening is that we're
moving to FOO.RUL or BAR.RUL and making sure that any facts we
had that are also relevant to the new rulebase are available to
it. In the "CHAIN 1 bar" case, we will immediately take up the
preset query in BAR.RUL, if it contains one.
You get to save your work, if you wish. This is what the
"Save factbase" option in the Main Menu is about -- your
opportunity to document and perhaps reuse your work on the case
you've been considering. You can save it to disk, in which case
THE EXPERT will be able to reload it, or you can "save" it to
your printer as documentation of your input and the rulebase's
conclusions. In either case, you get to provide an identifying
2.4 How to Crash
We believe in keeping all the bad news, or potential bad
news, centralized. This is where we keep a list of the hazards
one might encounter in running THE EXPERT. If you come up with a
new one, PLEASE let us know as quickly as possible, whether you
are an enrolled contributor-user or not. You could be saving
others some grief.
Consequences could run from mild annoyance to loss of data.
The ones we know about we hope to fix before any further software
release. The list follows:
* Trying to do ANYTHING with a write-protected diskette. THE
EXPERT sometimes has to create files even when it doesn't
seem to be doing any such thing, and such an attempt made
with a write-protected diskette could lead to subsequent
directory trashing. These days, write-protect tabs should be
used on archival master copies ONLY.
* Trying to run THE EXPERT when the EX.MNU file is not
available on the current drive; produces a polite but
* Trying to load a badly terminated rulebase, one that has
no rule terminator at the end of the last rule (we still do
this from time to time) or contains blank lines after the
last rule's terminator; the effect is that of a system halt
that requires a reboot, but no damage should be done.
* As above, for trying to load a factbase that ends wrong.
* Calling for printer output when no printer is available
(it must be connected to the computer, turned on and on
THE EXPERT page 12
line). Could cause program abort and loss of your work from
* Specifying a nonexistent disk drive for any operation.
Could cause program abort and loss of your work from this
* Trying to run THE EXPERT on a computer that is not CLOSELY
compatible with the IBM PC/XT/AT family.
* Trying to run with too little memory. If you are still
using DOS 1.x, 128K should suffice. For DOS 2.x or 3.x, 192K
or better is recommended or some larger rulebases will be
Please be alert. We try to be user-friendly, but this isn't
THE EXPERT page 13
3. About Rulebases
The rulebase is the heart of a useful application under THE
EXPERT. This chapter is where we get to tell you what they look
like, and a little bit about how they should work.
3.1 The Format
A rulebase is an ASCII file (beware of word processors in
document mode) of type .RUL. It should not contain any extra
blank lines at beginning or end.
Every rulebase has these elements in common:
A three-line header, presumably used to identify the
rulebase in more detail than a filename can provide to the
Zero or more rules, the form of which is detailed below.
We will omit from consideration here those rulebases
containing no rules, since they are less useful than others.
The header is immediately followed by the first rule. A rule
has this format:
One or more condition lines
A separator line, which must begin with the character ">"
and may include a comment following that character
One or more result lines
An end-of-rule line, which must begin with the character "#"
and may include a comment following that character.
The condition lines determine the facts that must be
asserted if the rule is to have effect. They may begin with a
tilde ("~") indicating that the negation of the remainder of the
line is the condition in question (double negatives are no more
proper here than in conversation with educated speakers of
English). Result lines follow the same constraints.
Surprise! Surprise! Condition and result lines had better
not begin with the characters ">" and "#"!
Here's a very primitive sample:
THE EXPERT page 14
Rain and sidewalks [header line]
It's going to rain [single condition line]
> [condition-result separator]
The sidewalks will get wet [single result line]
# [rule terminator]
The notes in square brackets above are not part of the
3.2 Your Options
We tried to keep the rulebase format pretty free. You have a
bundle of options:
1. Number of rules -- as many as 100 in the current version
2. Number of distinct line formats -- as many as 150 in the
3. Length of a single rule -- at least one condition line
and one result line; but as many of each as you need
4. Negation -- is specified with a tilde ("~") at the
beginning of a condition or result line
5. Length of a single condition or result line -- consider
anything over 200 characters potential trouble
6. Comments -- may occur on conditions-results separator
line and rule-terminator line; may be as long as 250
characters; will not be read in or be accessible to rulebase
3.3 PRESET Queries
A special convention applies when you want to nudge your
user toward a specific query when using your rulebase.
When the third line of the rulebase header begins with the
word PRESET, all in capital letters, and the rest of the line is
a valid fact format in the rulebase (it's up to you to ensure
this), then that fact format is the preset or default query for
the rulebase. This is the query that will automatically be used
as a goal when the user calls for "preset query" from the Basic
Input menu, OR when the rulebase is accessed via chaining mode 1
3.4 CHAINed Rulebases
THE EXPERT cannot hold an unlimited number or rules or facts
THE EXPERT page 15
at one time. Some applications, in all the glory of their detail,
may simply be too large to swallow all at once.
But essentially any complex subject can be handled
adequately by means of chained or cascaded rulebases. There is no
reason why one result within Rulebase A cannot be a command (or
request) to next use Rulebase B. The sequence of rulebases thus
invoked, of course, can as well be a branching one as a
The way you make one rulebase use another is by including as
a result of a rule a format like this:
CHAIN n xxxxxxx
where "CHAIN" is the chaining command, n is either 0 or 1 for the
chaining mode, and xxxxxxxx is the name (without ".RUL") of the
rulebase to be used next -- which much be available on the
drive specified for rulebases (the current drive if no explicit
specification has been given).
When a CHAIN result is encountered, THE EXPERT completes any
reasoning that it was doing, saves the current factbase to disk,
loads the rulebase named in the CHAIN result, and reloads the
If the chaining mode was 0, the chaining action is now
If the chaining mode was 1, THE EXPERT now takes up the new
rulebase's preset query (if any) as a new goal.
With either mode, the reason for saving a reloading the
factbase is to make it possible for the two rulebases to share
any facts whose formats appear in both rulebases.
Try out, and then type out the rulebase MENU.RUL, which uses
mode-1 chaining to branch into other rulebases.
3.5 Rulebase Organization and Logic
A lengthy topic that we cannot treat fully here. We hope in
the future to provide a powerful assistant, if not full
automation, for rulebase creation. Below are some of the
important basics for creating your own rulebases with your
favorite text editor.
Consistency: THE EXPERT will effectively not load a
blatantly inconsistent rulebase exactly as given. If two rules
have exactly the same conditions but yield opposite results, only
one (the one occurring later in the rulebase) will be used.
Subtler forms of inconsistency are not trapped by the software,
though, and are the rulebase maker's responsibility. Start your
rulebase in the simplest possible form, let it grow more complex
THE EXPERT page 16
only gradually, and test it thoroughly at each stage.
Binary explosions: Because THE EXPERT's if-then rules are
and-linked only (you can't say "If A or B then C"), you can
easily get into a binary explosion of rules when many different
combinations of conditions can produce a single result. One way
to prevent this is the judicious use of intermediate goals. In
the getting-dressed-for-the-day and will-drafting example
rulebases, you will see fact formats of the form "such-and-such
has been accounted for." These are intermediates and "has been
accounted for" is our code to the user that a don't-know response
is appropriate when the item comes up in a backward-reasoning
A strategy: For most applications, it makes sense to start
with a goal in mind, then to write rules that will make it
possible to reach that goal in specific examples. Remember that
real-world domains will usually NOT involve an exhaustive set of
combinations of conditions. E.g., if you are working on bird
indentification, it is readily apparent that there is not a real
bird for every conceivable combination of size, plumage, beak
THE EXPERT page 17
4. About Factbases
You've worked with some rulebases and some factbases by now.
It's time we told you what a factbase is supposed to look like in
4.1 The Factbase Format
A factbase (filetype .FCT) is an ASCII file and always
contains these elements:
An identifying header line
Zero or more two-line fact statements, consisting of:
A fact assertion or denial (starting with a tilde if a
A provenance value -- "Given" if the fact was given by
the user, otherwise "Rule n" where n is the number of
the rule used to derive the fact.
Except for the header line, a factbase may contain comments
only within the provenance lines (but after the provenance
4.2 Editing Cautions
Since a factbase is an ASCII file, you can use your text
editor on it freely. That may not be a good idea.
A factbase can be thrown fatally out of synchronization with
THE EXPERT's fact-reading routine [present version] if you
eliminate the header line or make it more than one line, or if
you drop either an assertion/denial line or a provenance-value
We urge you to leave your factbases alone. TYPE and read
them, certainly; print them out; amaze your friends and confound
your enemies with them. But DON'T edit them.
THE EXPERT page 18
5. Potential Enhancements
This is the speculative section. We have some possible
improvements in mind for THE EXPERT, and would like to know which
ones you would find valuable. Please vote for your favorites.
Or-linked rules: This would allow THE EXPERT to use rules of
the form If A or B or ... then X and Y and ... This could make
rulebase creation simpler by reducing or eliminating the need for
intermediate (dummy) goals.
Default don't-knows: Where those intermediate (dummy) goals
are to be, they might be flagged in the rulebase in such a way
that they are always automatically set to the don't-know state
when the rulebase is loaded. This could make some operations seem
smoother to the rulebase user -- or could make them rather
Confidence levels: An option for fuzzy or probabilistic
reasoning, in which every rule may be given a trustworthiness
value from 0.00 to 1.00, and every fact you assert or deny may be
given its own confidence level on the same scale. The confidence
level of a derived fact is then the product of the values for the
facts on which it is based and the rule used, with a cutoff
value, a minimum level that much be reached if the derivation is
to be complete. This level could be set by the user or by the
Variables: THE EXPERT is an idiot savant inasmuch as it
cannot do any arithmetic or even numeric comparisons. We might
provide a mechanism by which variable names could be used within
fact formats, for which the user would be asked for values when
those formats occur in reasoning. These values could then be used
in numeric comparisons, if not for more complicated arithmetic.
Multiple cases and relations between cases: We sidetracked
ourselves for a while with a scheme by means of which more than
one case at a time could be handled, along with situations in
which one case could affect general conditions for all. We
abandoned it as irrelevant. If you think otherwise, tell us why.
More action: By chaining from rulebase to rulebase, THE
EXPERT shows that it can DO things, not just draw conclusions,
and thus in some degree approaches the idea of an intelligent
"software agent." What other things might THE EXPERT do that
could be useful? A "shell" command that would permit loading and
execution of other programs, without losing one's place within
THE EXPERT, is a possibility.
Support software: The Rulebase Editor that (embarrassingly)
is mentioned in THE EXPERT's Exit Menu is on hold because it's
worse than useless unless it's really smart. We are considering
THE EXPERT page 19
other approaches, from a fairly simple logic checker for
rulebases to a full-blown knowledge extractor, and do not yet
know what will prove feasible.
Got your own wishlist? Please share it with us!
THE EXPERT page 20