Expert
Systems are a branch of Artificial Intelligence that attempts to mimic
the decison-making skills of humans. An expert system is, of course,
what Ray Gabriel is building in Prodigal Logic when he attempts
to build a computer program that captures the decision-making heuristics
of Sherlock Holmes.
Excerpts
from the book are provided below to illustrate how the Sherlock-in-a-Box
system use If-Then rules to capture the knowledge of an expert, then
chain these rules together to simulate deductive reasoning. Additional
links to expert system - related
sites can be found at the end of the page.
While
attending Julius Dexter's party, Ray uses Sherlock Holmes' reasoning
to give an example of how one would build an expert system. Here's
an excerpt from the novel:
"Christie's writing
is crap," I said. "Those contrived ten-people-trapped-in-a-room
situations. Her sleuths can't compare when it comes to the real
genius of logic." I held up the Sherlock Holmes book that
I still held in my hand.
As the intensity of
our conversation had risen, several party-goers had wandered into
the study and clustered nearby. Wordsmith said, "If Sherlock
is such a master logician, he should be full of thumbrules. You've
got the book in hand. Why don't you show us some of his brilliance?"
I opened the book
and looked for a typical Sherlock Holmes maxim. "Here, in
The Speckled Band. Sherlock uses a thumbrule to make one of his
brilliant deductions." I read:
I was then much surprised and interested on glancing down to observe
that, though the boots which she was wearing were not unlike each
other, they were really odd ones, the one having a slightly decorated
toe-cap, and the other a plain one. One was buttoned only in the
two lower buttons out of five, and the other at the first, third
and fifth.
"Those are the
facts," I said. "Now Sherlock provides the thumbrule."
I read:
Now
when you see that a young lady, otherwise neatly dressed, has
come away from home with odd boots, half-buttoned, it is obvious
that she came away in a hurry.
"Once you identify
the thumbrules, the trick of getting a computer to think like
a human is easy. Thumbrules are key. 'I thumbrule, therefore I
am.'"
Zelda laughed. "Listen
to you, the Descartes of computer science."
Aquilino slapped his
fist into his open palm. "What do you think, Ray, of using
Sherlock Holmes' deductive process to expand your thumbrule system?
You could feed mysteries into it - novels and short stories -
and train your Sherlock Holmes in a box to solve them."
If Ray were to put these
rules into If-Then form, they might look like this:
If a
person is otherwise neatly dressed and
the person has something unusual about their clothing
Then the person has come away in a hurry.
If a persons boots are unlike each other
Then
the person has something unusual about their clothing
If a person's shoes are not buttoned up completely
Then
the person has something unusual about their clothing.
The inference engine
of an expert system is the internal brain that jumps around among
the If-Then rules to determine if a hypothesis is correct. A hypothesis
is the thing being tested, and equates to the "Then" part
of an If-Then rule. If the hypothesis were "The person has
come away in a hurry," the inference engine would search for
and find the first rule. It then tests the first If statement of
this rule. If this statement is true, it would test the second statement.
In order to test the second statement, it would "chain"
to the hypothesis of either the second or third If-Then rule, since
the hypotheses (the "Then" statements) of these rules
match the If statement that is currently being tested. Either of
these rules could be used to determine that their hypothesis is
true, which in turn would make the first rule true.
The previous excerpt
also introduces the subtle point that for an expert system to be
useful, its construction must have some points in common with a
good mystery: namely, it has to contain all the facts. The strength
of a good mystery is that the reader should have been able to solve
it. Nothing substantial is withheld; the author hasn't played a
trick with the reader by having some long-lost twin show up at the
eleventh hour.
"Agatha Christie
missed the point of a good mystery in Ten Little Indians,"
I explained. "Unlike Christie, Conan Doyle makes sure all
the clues are there for the reader, thanks to Sherlock's keen
powers of observation."
"Heightened by
a dose of cocaine, as I recall," said Wordsmith. The audience,
which had now grown to a dozen or so, cheered heartily. Wordsmith
smirked and fingered a black bishop on the chess board. I glanced
at Zelda for support. She nodded sharply at me in encouragement.
"The mystery
reader as detective should be able to chain the thumbrules and
facts together as well as the computer does. But he doesn't. And
why?"
"He'd probably
be disappointed if he did," said Father Aquilino. "Who
wants to solve the mystery too easily?"
"Exactly,"
I continued. "It's a fine line. If the puzzle is too simple,
the reader is unsatisfied. But if it's not simple, the reader
waits for Sherlock to sift through the clues in creative, imaginative
ways to find answers that fit."
"And that's what
you would call chaining his thumbrules together?" Father
Aquilino asked.
"Yes!" I
said. "The thumbrules represent his sleuthing expertise.
He looks at the clues, chains his thumbrules and facts together,
and crafts a solution. The reader recognizes that the solution
makes perfect sense. He taps his head and thinks, 'Of course!'"
"And kicks himself
in the butt because he didn't guess it," Zelda added.
That kick in the but,
Ray contends, is what separates a good mystery from one that cheats.
After Ray agrees to
help solve a murder, he must expand his system's known universe
from literary mysteries (where, if the novel doesn't cheat, all
the facts are "known"), to the "real" world,
where nothing, especially murder, is in black and white.
After initial success,
he inevitably hits this problem of missing data with his smart sidekick.
He also starts to come up against the "fuzziness" of facts,
which the book refers to as "false clues", "red herring"
or, to stretch the metaphysical point, "belief systems."
Again excerpting from the novel:
I helped
Zelda with the zipper of her black silk dress. She slipped on a
light gold jacket and spun in front of the bedroom mirror. Her hemline
was way too high for a funeral and her mood was up-beat.
"God damn it,
it solved it, Ray. It pulled all those clues together and solved
it, good as Sherlock Holmes himself. You're a genius."
"Thanks for the
encouragement, but we've got a long way to go."
Sherlock had indeed
solved The Speckled Band. I was proud of him but the story was
one of the most straightforward in the Holmes collection; I wasn't
about to count my chickens. I took my turn in front of the mirror.
"God, Ray, what
flea market did you visit to find this tie?" She fastened
the last section of the knot and strung it tight, close to my
neck. Too close.
"There are two
big issues," I said, unblocking my breathing passage. "And
one is belief systems. Dexter put his finger right on the problem.
Sherlock has trouble with false clues. He can deal only with black
and white, not shades of gray. I've somehow got to develop a way
to tell Sherlock how much emphasis to give a fact. Otherwise,
he'll stop at the first plausible solution he finds."
"So it's lazy.
Typical male. What's the second issue?"
"Missing data.
Keep in mind that we knew the answer to Arthur Conan Doyle's riddle
so we made sure that all the sleuthing thumbrules were part of
the program. A mystery with an unknown solution will be a much
bigger challenge. As you're so fond of telling me, a sign of egoism
is that you don't know that you don't know. I don't want Sherlock
to be an egoist."
"So now you want
it to be an atypical male. Make up your mind."
The way that an inference
engine of an expert systems accommodates UNKNOWN data is typically
handled in a couple of ways. The engine will display a question
to the user when, while racing through its knowledge base, there
is missing information. Also, most expert systems will allow the
user to respond, in essence, "I don't know." Rules have
to be constructed to take this absence of knowledge into account.
The following excerpt
is a fun one because, while demonstrating how Sherlock-in-a-Box
acts when it runs out of facts, it shows the system beginning to
reason.
The funeral progressed
through the High Mass. Miriam followed it intently for awhile,
but then shook her head sadly and turned to me as I continued
to play with the computer. "Show me how it works."
I tapped on a
few keys until the Sidney Paget picture of the brooding detective
puffing on his pipe appeared on the screen.
"You might
be a little disappointed," I said. "I ran Sherlock
several times this morning. He asks a few questions that I
can't answer and then grinds to a halt." I shifted the
computer on my lap and typed, "Who performed the cult
ritual?"
"His first
hypothesis is that figuring out the numbers in the boxes will
identify the cultists. When he can't work that out, he stops
and asks us for the answer."
"And we can't
tell him because we don't know."
"Correct.
He poses other questions, but eventually he fails. We can't
get any further until we figure those numbers out, or Sherlock
does."
On the screen,
Sherlock Holmes continued to puff on his pipe. Behind the
detective's unruffled exterior, I knew Sherlock was jumping
in and out of his thumbrules, backward chaining until he came
to a dead end, meaning he had insufficient data. And insufficient
data meant he had to ask a question.
"Any second
now," I said. Finally the graphic of Sherlock Holmes
disappeared, replaced by a question. But it wasn't the one
I expected. It read, What is distance from west portal
to maze?
I looked at Miriam
in surprise. "I entered some facts about the maze while
we've been up here. Sherlock must have connected it with our
mystery."
Miriam seemed
to tremble and looked unsteady. The funeral was taking its
toll.
"Maybe we
should leave," I said. "We can do this later. I'll
measure the distance from the doors to the maze after the
funeral is over."
Miriam hugged
her chest and took a deep breath, as though willing herself
to be calm. "No need to measure it," she said. "It's
one hundred twenty five feet."
===
section removed as Miriam explains how with "sacred geometry"
all distances are derived from a starting length) ===
I was genuinely
impressed. As well as having an aesthetic feel for beauty,
Miriam was obviously mathematically inclined. I realized that
the two were in balance in this building. But I wondered why
Sherlock would care about the distance to the maze. I dutifully
typed in the number that Miriam had given me.
Sherlock digested
the response. "Look what he's asking now," I said,
angling the screen toward her. What is shape of maze?
I typed in "Round."
Does maze have
half-circles on circumference?
Half-circles on
the circumference. I recognized this phrase. I had entered
it into Sherlock to describe the sketch we had found.
I hefted the binoculars
again to examine the maze. Its inner circle had six smaller
half-circles connected to its circumference, reminiscent of
the petals of a flower. The flower illuminates the time
and the place. A chill quivered through me. I entered
"Yes." The program responded with, What number
half-circles has maze?
Six. The same
number as was on the sketch. I temporarily suspended Sherlock-in-a-Box,
and brought up the picture of the Numbers of the Rose sketch
on the computer.
There was indeed
a resemblance between the circles on the sketch and on the
maze. "It looks to me," I said to Miriam, "that
we were wrong to think that the figure on the sketch was a
rose. It's actually the center of the maze."
I checked to see
if she had made the same connection. Her face had gone pale
and she looked as though she were going to faint. I quickly
set the computer down. "Miriam, are you okay?" I
touched her shoulder. "Do you want to leave?"
She pushed my
hand away. Slowly, methodically, she began to tap a closed
fist against her chest. I was afraid she was having trouble
breathing. Then I understood the gesture. She was praying.
"Give Sherlock
his answer," she said.
"Are you
sure, Miriam? Maybe we should..."
"Do it, Ray."
I typed in the
answer. "Six."
Does rose window
have vertical shaft connected to circle?
I looked out to
the distance of the western entrance to the stained glass
window. I typed in "No."
Does maze have
vertical shaft connected to circle?
I looked through
the field glasses at the maze. "I don't see any vertical
shaft coming from the inner circle."
"That's because
of our perspective," Miriam said softly. She took the
binoculars and held them to her eyes. "If you follow
the path of the maze from the opposite end, it joins the circle
just like it shows in the picture." She set the glasses
down and looked at me. "From ground level, no one would
connect the pattern in the maze to the pattern in the sketch
because of the perspective. And you didn't recognize it from
here because you were looking at it upside down."
The use of the
word "you" instead of "we" wasn't lost
on me. Miriam had already deciphered the sketch, probably
when I had shared Jon Matthias' comparison of the boxes to
walking a winding path. "It has to be looked at from
the other direction, from a height," she continued.
"You mean
it has to be looked at from the rose window?"
Miriam
brought a handkerchief to her puffed eyes. I was beginning to
realize that there was more to her grief than the death of an
old friend.
UNDER
CONSTRUCTION - TO BE CONTINUED
This
discussion has attempted to describe the way that Expert Systems mimic
the deductive reasoning of humans. Some links that provide more of
an introduction to Expert System technology are found below.