[alicebot-style] Simple Logical Deductions in AIML
Dr. Richard S. Wallace
alicebot-style@list.alicebot.org
Wed, 12 Dec 2001 00:01:51 -0800
- Previous message: [alicebot-style] Simple Logical Deductions in AIML
Dr. Richard S. Wallace
Dec. 12, 2001
(c) ALICE A.I. Foundation
The purpose of this exercise is to demonstrate some
simple reasoning capabilities with AIML alone. In particular,
we did not use any logic engine such as Prolog. The results
described here were obtained solely with AIML.
The types of questions under consideration here are
a restricted set of queries exemplified by:
What does a bird have?
What do birds have?
What does a raven do?
What else does a bird have?
What else do ravens do?
Part of what makes it easy to answer these questions in AIML
is that the questions tend to have multiple answers. A bird
has a beak, a tail, lungs, eyes, wings, feathers, and cold blood.
It also has all the properties of any superclasses, such as animals
or prokaryotes. The AIML program does not need to find all of
these solutions; it merely has to find one.
1. ISA Hierarchy
The first step is to construct an Isa hierarchy in AIML.
The simples entries look like this:
<category>
<pattern>ISA RAVEN</pattern>
<template>A Bird.</template>
</category>
<category>
<pattern>ISA BIRD</pattern>
<template>An animal.</template>
</category>
Basically, the AIML expression is equivalent to the assertion
Isa(raven, bird).
But the Isa function is one to many. For example, chicken is
both a bird and a food. We use the AIML <random> tag to group
these assertions:
<category>
<pattern>ISA CHICKEN</pattern>
<template>
<random>
<li>A Bird.</li>
<li>A Food.</li>
</random>
</template>
</category>
Finally, the AIML set should provide a default case for the
Isa relation, in case the first argument can not be identified:
<category>
<pattern>ISA *</pattern>
<template>Unknown</template>
</category>
2. Knowledge Base
The second step was to program the knowledge base with Has and
Does relations. It is not necessary to use an abbreviated predicate
name in an AIML pattern, so we can actually encode the knowledge base
quite conveniently in natural language. So, rather than write
"does(bird, fly)" we can express the relation in AIML as:
<category>
<pattern>WHAT DOES A BIRD DO</pattern>
<template>Fly.
</template>
</category>
[The fact that not all birds fly should not distract you from
understanding this example.]
As was the case with the Isa relation, the Has and Does relations
are many-to-one. We again use the <random> tag to group the
many assertions together:
<category>
<pattern>WHAT DOES A BIRD HAVE</pattern>
<template>
<random>
<li>Lungs.</li>
<li>An eye.</li>
<li>A beak.</li>
<li>A tail.</li>
<li>A wing.</li>
<li>A feather.</li>
<li>Cold blood.</li>
</random>
</template>
</category>
3. Defaults
Some default replies are also necessary to prevent infinite loops.
Here "the Art of AIML writing" comes into play. The ultimate default
Isa relation returns "Unknown", so the symbol "UNKNOWN" appears in
the patters of these defaults.
<category>
<pattern>WHAT DOES UNKNOWN HAVE</pattern>
<template>
<random>
<li>Imagine no possessions.</li>
<li>I don't know</li>
<li>The same as everyone else?</li>
</random>
</template>
</category>
<category>
<pattern>WHAT DOES UNKNOWN DO</pattern>
<template>
<random>
<li>Exist.</li>
<li>I don't know.</li>
<li>The same as everyone else?</li>
</random>
</template>
</category>
4. Reductions
In this step, we apply symbolic reductions to transform a variety
of grammatical forms into simpler inputs.
<category>
<pattern>WHAT DO * DO</pattern>
<template><srai>WHAT DOES A <star/> DO</srai>
</template></category>
<category>
<pattern>WHAT DOES A * DO</pattern>
<template><srai>WHAT DOES <star/> DO</srai>
</template></category>
These reductions, along with others like them,
will transform many grammatical variants like
"WHAT DOES A X DO", "WHAT DOES AN X DO" and "WHAT DO X DO"
into a single canonical form like "WHAT DOES X DO".
5. Deductions
Provided that the AIML interpreter is capable of
executing nested <srai> tags, it is quite possible
to make simple inferences in AIML. The logic presented
here is that if the client asks "WHAT DOES X DO", and
there is no specific answer for X, then the program
will try to answer the question "WHAT DOES Y DO" where
Isa(X, Y).
The corresponding logical deduction would be:
If X is a Y and Y does Z then X does Z.
The deduction may be written in AIML as:
<category>
<pattern>WHAT DOES * DO</pattern>
<template>
<srai>WHAT DOES <srai>ISA <star/></srai> DO</srai>
</template>
</category>
The similar category for "WHAT DOES X HAVE" is:
<category>
<pattern>WHAT DOES * HAVE</pattern>
<template>
<srai>WHAT DOES <srai>ISA <star/></srai> HAVE</srai>
</template>
</category>
Using these deductions, we can now ask the robot
"What does a raven have?" and, even though there is
no explicit answer, the program can infer that, since
a raven is a bird, it must also have anything a bird has:
feathers, beak, tail, eyes, lungs, wings, and cold blood.
6. Plurals
A slight modification to the above categories allows
us to handle plurals as well as singular forms, in this
class of questions. If we replace the ISA string with ISB
inside the <srai> tags above, we can define an Isb relation
as a gateway or filter on top of Isa. The Isb function simply
transforms its argument to a singular form, and recursively
applies Isa.
<category>
<pattern>ISB *</pattern>
<template><srai>ISA <srai>SINGULAR <star/></srai></srai>
</template></category>
The knowledge base for the Singular relation is just like
the category sets for Isa, Does, and Has.
<category>
<pattern>SINGULAR WOLVES</pattern>
<template>wolf
</template></category>
<category>
<pattern>SINGULAR WOMEN</pattern>
<template>woman
</template></category>
<category>
<pattern>SINGULAR WORKS OF ART</pattern>
<template>work of art
</template></category>
<category>
<pattern>SINGULAR WRENCHES</pattern>
<template>wrench
</template></category>
The singular function also requires a default case, when
the word or words are not recognized in the function domain:
<category>
<pattern>SINGULAR *</pattern>
<template><star/>
</template></category>
Notice that, if Singular(X, Y) is not defined, i.e. this
last category matches, then Isb(X, Y) = Isa(X, Y).
7. Random Inferences
The categories described in sections 1-5 provide answers
to questions like WHAT DOES X HAVE by first checking to
see if there is an explicit match for WHAT DOES X HAVE.
If not, the program proceed to WHAT DOES Y HAVE where
Isa(X, Y). If no match is found there, the program proceeds
to WHAT DOES Z HAVE, where Isa(Y, Z). Because there is
an ultimate WHAT DOES UNKNOWN HAVE category, the procedure
will always terminate.
The inferences will not however find ALL instances of
the logical reply to WHAT DOES X HAVE. For example, if
we know that all animals have a mother, then one answer
to "What does a bird have?" should logically be "a mother".
The following two categories show a crude but simple way
to overcome this obstacle. If the client asks "What else
do birds have?", the random function will select between two
possible alternative questions: "What do birds have?" and,
for some X such that Isa(bird, X), "What else do X have?".
If the program chooses the second form, the question itself
becomes the input to this same category.
<category>
<pattern>WHAT ELSE DO * DO</pattern>
<template><random>
<li><srai>WHAT DO <star/> DO</srai></li>
<li><srai>WHAT ELSE DO <srai>ISB <star/></srai> DO</srai></li>
</random>
</template></category>
<category>
<pattern>WHAT ELSE DO * HAVE</pattern>
<template><random>
<li><srai>WHAT DO <star/> HAVE</srai></li>
<li><srai>WHAT ELSE DO <srai>ISB <star/></srai> HAVE</srai></li>
</random>
</template></category>
8. Sample Dialog
The following dialog demonstrates the categories described in this
technical note.
Client: What does a bird have?
Robot: Feathers.
Client: What does a bird have?
Robot: Lungs.
Client: What does a bird have?
Robot: A beak.
Client: What do birds have?
Robot: A beak.
Client: What does a raven do?
Robot: Fly.
Client: What else does a bird have?
Robot: A tail.
Client: What else does a bird have?
Robot: Nuclear membranes.
Client: What else does a bird have?
Robot: A body.
Client: What else does a bird have?
Robot: Imagine no possessions.
Client: What else does a chicken do?
Robot: Get eaten.
Client: What else does a chicken do?
Robot: Cluck.
Client: What else do chickens do?
Robot: Peck.
A bird has a nuclear membrane because it is a prokaryote. All
animals have a body, so birds have a body too. Chicken is both
a food and a bird, so it can both cluck and be eaten. Ravens can
fly because the robot believes all birds can fly.
9. Conclusion
We have shown how to make certain simple logical deductions
in AIML alone, without the need for an external Prolog or
other reasoning program.
The ALICE brain set was augmented with more than 1000 Isa
relations, and several hundred categories encoding Has and Does.
These categories will be made public in the next release
of the ALSimple Logical Deductions in AIML
- Next message: [alicebot-style] Simple Logical Deductions in AIML
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Many apologies for the long Subject: line. Please reply to this one
not the original post with the long Subject:
>
> Simple Logical Deductions in AIML
>
> Dr. Richard S. Wallace
> Dec. 12, 2001
> (c) ALICE A.I. Foundation
>
> The purpose of this exercise is to demonstrate some
> simple reasoning capabilities with AIML alone. In particular,
> we did not use any logic engine such as Prolog. The results
> described here were obtained solely with AIML.
>
> The types of questions under consideration here are
> a restricted set of queries exemplified by:
>
> What does a bird have?
> What do birds have?
> What does a raven do?
> What else does a bird have?
> What else do ravens do?
>
> Part of what makes it easy to answer these questions in AIML
> is that the questions tend to have multiple answers. A bird
> has a beak, a tail, lungs, eyes, wings, feathers, and cold blood.
> It also has all the properties of any superclasses, such as animals
> or prokaryotes. The AIML program does not need to find all of
> these solutions; it merely has to find one.
>
> 1. ISA Hierarchy
>
> The first step is to construct an Isa hierarchy in AIML.
> The simples entries look like this:
>
> <category>
> <pattern>ISA RAVEN</pattern>
> <template>A Bird.</template>
> </category>
>
> <category>
> <pattern>ISA BIRD</pattern>
> <template>An animal.</template>
> </category>
>
> Basically, the AIML expression is equivalent to the assertion
> Isa(raven, bird).
>
> But the Isa function is one to many. For example, chicken is
> both a bird and a food. We use the AIML <random> tag to group
> these assertions:
>
> <category>
> <pattern>ISA CHICKEN</pattern>
> <template>
> <random>
> <li>A Bird.</li>
> <li>A Food.</li>
> </random>
> </template>
> </category>
>
> Finally, the AIML set should provide a default case for the
> Isa relation, in case the first argument can not be identified:
>
> <category>
> <pattern>ISA *</pattern>
> <template>Unknown</template>
> </category>
>
> 2. Knowledge Base
>
> The second step was to program the knowledge base with Has and
> Does relations. It is not necessary to use an abbreviated predicate
> name in an AIML pattern, so we can actually encode the knowledge base
> quite conveniently in natural language. So, rather than write
> "does(bird, fly)" we can express the relation in AIML as:
>
> <category>
> <pattern>WHAT DOES A BIRD DO</pattern>
> <template>Fly.
> </template>
> </category>
>
> [The fact that not all birds fly should not distract you from
> understanding this example.]
>
> As was the case with the Isa relation, the Has and Does relations
> are many-to-one. We again use the <random> tag to group the
> many assertions together:
>
> <category>
> <pattern>WHAT DOES A BIRD HAVE</pattern>
> <template>
> <random>
> <li>Lungs.</li>
> <li>An eye.</li>
> <li>A beak.</li>
> <li>A tail.</li>
> <li>A wing.</li>
> <li>A feather.</li>
> <li>Cold blood.</li>
> </random>
> </template>
> </category>
>
> 3. Defaults
>
> Some default replies are also necessary to prevent infinite loops.
> Here "the Art of AIML writing" comes into play. The ultimate default
> Isa relation returns "Unknown", so the symbol "UNKNOWN" appears in
> the patters of these defaults.
>
> <category>
> <pattern>WHAT DOES UNKNOWN HAVE</pattern>
> <template>
> <random>
> <li>Imagine no possessions.</li>
> <li>I don't know</li>
> <li>The same as everyone else?</li>
> </random>
> </template>
> </category>
> <category>
> <pattern>WHAT DOES UNKNOWN DO</pattern>
> <template>
> <random>
> <li>Exist.</li>
> <li>I don't know.</li>
> <li>The same as everyone else?</li>
> </random>
> </template>
> </category>
>
> 4. Reductions
>
> In this step, we apply symbolic reductions to transform a variety
> of grammatical forms into simpler inputs.
>
> <category>
> <pattern>WHAT DO * DO</pattern>
> <template><srai>WHAT DOES A <star/> DO</srai>
> </template></category>
>
> <category>
> <pattern>WHAT DOES A * DO</pattern>
> <template><srai>WHAT DOES <star/> DO</srai>
> </template></category>
>
> These reductions, along with others like them,
> will transform many grammatical variants like
> "WHAT DOES A X DO", "WHAT DOES AN X DO" and "WHAT DO X DO"
> into a single canonical form like "WHAT DOES X DO".
>
> 5. Deductions
>
> Provided that the AIML interpreter is capable of
> executing nested <srai> tags, it is quite possible
> to make simple inferences in AIML. The logic presented
> here is that if the client asks "WHAT DOES X DO", and
> there is no specific answer for X, then the program
> will try to answer the question "WHAT DOES Y DO" where
> Isa(X, Y).
>
> The corresponding logical deduction would be:
> If X is a Y and Y does Z then X does Z.
> The deduction may be written in AIML as:
>
> <category>
> <pattern>WHAT DOES * DO</pattern>
> <template>
> <srai>WHAT DOES <srai>ISA <star/></srai> DO</srai>
> </template>
> </category>
>
> The similar category for "WHAT DOES X HAVE" is:
>
> <category>
> <pattern>WHAT DOES * HAVE</pattern>
> <template>
> <srai>WHAT DOES <srai>ISA <star/></srai> HAVE</srai>
> </template>
> </category>
>
> Using these deductions, we can now ask the robot
> "What does a raven have?" and, even though there is
> no explicit answer, the program can infer that, since
> a raven is a bird, it must also have anything a bird has:
> feathers, beak, tail, eyes, lungs, wings, and cold blood.
>
> 6. Plurals
>
> A slight modification to the above categories allows
> us to handle plurals as well as singular forms, in this
> class of questions. If we replace the ISA string with ISB
> inside the <srai> tags above, we can define an Isb relation
> as a gateway or filter on top of Isa. The Isb function simply
> transforms its argument to a singular form, and recursively
> applies Isa.
>
> <category>
> <pattern>ISB *</pattern>
> <template><srai>ISA <srai>SINGULAR <star/></srai></srai>
> </template></category>
>
> The knowledge base for the Singular relation is just like
> the category sets for Isa, Does, and Has.
>
> <category>
> <pattern>SINGULAR WOLVES</pattern>
> <template>wolf
> </template></category>
> <category>
> <pattern>SINGULAR WOMEN</pattern>
> <template>woman
> </template></category>
> <category>
> <pattern>SINGULAR WORKS OF ART</pattern>
> <template>work of art
> </template></category>
> <category>
> <pattern>SINGULAR WRENCHES</pattern>
> <template>wrench
> </template></category>
>
> The singular function also requires a default case, when
> the word or words are not recognized in the function domain:
>
> <category>
> <pattern>SINGULAR *</pattern>
> <template><star/>
> </template></category>
>
> Notice that, if Singular(X, Y) is not defined, i.e. this
> last category matches, then Isb(X, Y) = Isa(X, Y).
>
> 7. Random Inferences
>
> The categories described in sections 1-5 provide answers
> to questions like WHAT DOES X HAVE by first checking to
> see if there is an explicit match for WHAT DOES X HAVE.
> If not, the program proceed to WHAT DOES Y HAVE where
> Isa(X, Y). If no match is found there, the program proceeds
> to WHAT DOES Z HAVE, where Isa(Y, Z). Because there is
> an ultimate WHAT DOES UNKNOWN HAVE category, the procedure
> will always terminate.
>
> The inferences will not however find ALL instances of
> the logical reply to WHAT DOES X HAVE. For example, if
> we know that all animals have a mother, then one answer
> to "What does a bird have?" should logically be "a mother".
>
> The following two categories show a crude but simple way
> to overcome this obstacle. If the client asks "What else
> do birds have?", the random function will select between two
> possible alternative questions: "What do birds have?" and,
> for some X such that Isa(bird, X), "What else do X have?".
>
> If the program chooses the second form, the question itself
> becomes the input to this same category.
>
> <category>
> <pattern>WHAT ELSE DO * DO</pattern>
> <template><random>
> <li><srai>WHAT DO <star/> DO</srai></li>
> <li><srai>WHAT ELSE DO <srai>ISB <star/></srai> DO</srai></li>
> </random>
> </template></category>
> <category>
> <pattern>WHAT ELSE DO * HAVE</pattern>
> <template><random>
> <li><srai>WHAT DO <star/> HAVE</srai></li>
> <li><srai>WHAT ELSE DO <srai>ISB <star/></srai> HAVE</srai></li>
> </random>
> </template></category>
>
> 8. Sample Dialog
>
> The following dialog demonstrates the categories described in this
> technical note.
>
> Client: What does a bird have?
> Robot: Feathers.
> Client: What does a bird have?
> Robot: Lungs.
> Client: What does a bird have?
> Robot: A beak.
> Client: What do birds have?
> Robot: A beak.
> Client: What does a raven do?
> Robot: Fly.
> Client: What else does a bird have?
> Robot: A tail.
> Client: What else does a bird have?
> Robot: Nuclear membranes.
> Client: What else does a bird have?
> Robot: A body.
> Client: What else does a bird have?
> Robot: Imagine no possessions.
> Client: What else does a chicken do?
> Robot: Get eaten.
> Client: What else does a chicken do?
> Robot: Cluck.
> Client: What else do chickens do?
> Robot: Peck.
>
> A bird has a nuclear membrane because it is a prokaryote. All
> animals have a body, so birds have a body too. Chicken is both
> a food and a bird, so it can both cluck and be eaten. Ravens can
> fly because the robot believes all birds can fly.
>
> 9. Conclusion
>
> We have shown how to make certain simple logical deductions
> in AIML alone, without the need for an external Prolog or
> other reasoning program.
>
> The ALICE brain set was augmented with more than 1000 Isa
> relations, and several hundred categories encoding Has and Does.
> These categories will be made public in the next release
> of the ALICE Brain AIML set.
>
> An online demonstration of ALICE with logical inferences may
> be found intermittently at http://206.184.206.210:2001
> _______________________________________________
> alicebot-style mailing list
> alicebot-style@list.alicebot.org
> http://list.alicebot.org/mailman/listinfo.cgi/alicebot-style
- Previous message: [alicebot-style] Simple Logical Deductions in AIML
Dr. Richard S. Wallace
Dec. 12, 2001
(c) ALICE A.I. Foundation
The purpose of this exercise is to demonstrate some
simple reasoning capabilities with AIML alone. In particular,
we did not use any logic engine such as Prolog. The results
described here were obtained solely with AIML.
The types of questions under consideration here are
a restricted set of queries exemplified by:
What does a bird have?
What do birds have?
What does a raven do?
What else does a bird have?
What else do ravens do?
Part of what makes it easy to answer these questions in AIML
is that the questions tend to have multiple answers. A bird
has a beak, a tail, lungs, eyes, wings, feathers, and cold blood.
It also has all the properties of any superclasses, such as animals
or prokaryotes. The AIML program does not need to find all of
these solutions; it merely has to find one.
1. ISA Hierarchy
The first step is to construct an Isa hierarchy in AIML.
The simples entries look like this:
<category>
<pattern>ISA RAVEN</pattern>
<template>A Bird.</template>
</category>
<category>
<pattern>ISA BIRD</pattern>
<template>An animal.</template>
</category>
Basically, the AIML expression is equivalent to the assertion
Isa(raven, bird).
But the Isa function is one to many. For example, chicken is
both a bird and a food. We use the AIML <random> tag to group
these assertions:
<category>
<pattern>ISA CHICKEN</pattern>
<template>
<random>
<li>A Bird.</li>
<li>A Food.</li>
</random>
</template>
</category>
Finally, the AIML set should provide a default case for the
Isa relation, in case the first argument can not be identified:
<category>
<pattern>ISA *</pattern>
<template>Unknown</template>
</category>
2. Knowledge Base
The second step was to program the knowledge base with Has and
Does relations. It is not necessary to use an abbreviated predicate
name in an AIML pattern, so we can actually encode the knowledge base
quite conveniently in natural language. So, rather than write
"does(bird, fly)" we can express the relation in AIML as:
<category>
<pattern>WHAT DOES A BIRD DO</pattern>
<template>Fly.
</template>
</category>
[The fact that not all birds fly should not distract you from
understanding this example.]
As was the case with the Isa relation, the Has and Does relations
are many-to-one. We again use the <random> tag to group the
many assertions together:
<category>
<pattern>WHAT DOES A BIRD HAVE</pattern>
<template>
<random>
<li>Lungs.</li>
<li>An eye.</li>
<li>A beak.</li>
<li>A tail.</li>
<li>A wing.</li>
<li>A feather.</li>
<li>Cold blood.</li>
</random>
</template>
</category>
3. Defaults
Some default replies are also necessary to prevent infinite loops.
Here "the Art of AIML writing" comes into play. The ultimate default
Isa relation returns "Unknown", so the symbol "UNKNOWN" appears in
the patters of these defaults.
<category>
<pattern>WHAT DOES UNKNOWN HAVE</pattern>
<template>
<random>
<li>Imagine no possessions.</li>
<li>I don't know</li>
<li>The same as everyone else?</li>
</random>
</template>
</category>
<category>
<pattern>WHAT DOES UNKNOWN DO</pattern>
<template>
<random>
<li>Exist.</li>
<li>I don't know.</li>
<li>The same as everyone else?</li>
</random>
</template>
</category>
4. Reductions
In this step, we apply symbolic reductions to transform a variety
of grammatical forms into simpler inputs.
<category>
<pattern>WHAT DO * DO</pattern>
<template><srai>WHAT DOES A <star/> DO</srai>
</template></category>
<category>
<pattern>WHAT DOES A * DO</pattern>
<template><srai>WHAT DOES <star/> DO</srai>
</template></category>
These reductions, along with others like them,
will transform many grammatical variants like
"WHAT DOES A X DO", "WHAT DOES AN X DO" and "WHAT DO X DO"
into a single canonical form like "WHAT DOES X DO".
5. Deductions
Provided that the AIML interpreter is capable of
executing nested <srai> tags, it is quite possible
to make simple inferences in AIML. The logic presented
here is that if the client asks "WHAT DOES X DO", and
there is no specific answer for X, then the program
will try to answer the question "WHAT DOES Y DO" where
Isa(X, Y).
The corresponding logical deduction would be:
If X is a Y and Y does Z then X does Z.
The deduction may be written in AIML as:
<category>
<pattern>WHAT DOES * DO</pattern>
<template>
<srai>WHAT DOES <srai>ISA <star/></srai> DO</srai>
</template>
</category>
The similar category for "WHAT DOES X HAVE" is:
<category>
<pattern>WHAT DOES * HAVE</pattern>
<template>
<srai>WHAT DOES <srai>ISA <star/></srai> HAVE</srai>
</template>
</category>
Using these deductions, we can now ask the robot
"What does a raven have?" and, even though there is
no explicit answer, the program can infer that, since
a raven is a bird, it must also have anything a bird has:
feathers, beak, tail, eyes, lungs, wings, and cold blood.
6. Plurals
A slight modification to the above categories allows
us to handle plurals as well as singular forms, in this
class of questions. If we replace the ISA string with ISB
inside the <srai> tags above, we can define an Isb relation
as a gateway or filter on top of Isa. The Isb function simply
transforms its argument to a singular form, and recursively
applies Isa.
<category>
<pattern>ISB *</pattern>
<template><srai>ISA <srai>SINGULAR <star/></srai></srai>
</template></category>
The knowledge base for the Singular relation is just like
the category sets for Isa, Does, and Has.
<category>
<pattern>SINGULAR WOLVES</pattern>
<template>wolf
</template></category>
<category>
<pattern>SINGULAR WOMEN</pattern>
<template>woman
</template></category>
<category>
<pattern>SINGULAR WORKS OF ART</pattern>
<template>work of art
</template></category>
<category>
<pattern>SINGULAR WRENCHES</pattern>
<template>wrench
</template></category>
The singular function also requires a default case, when
the word or words are not recognized in the function domain:
<category>
<pattern>SINGULAR *</pattern>
<template><star/>
</template></category>
Notice that, if Singular(X, Y) is not defined, i.e. this
last category matches, then Isb(X, Y) = Isa(X, Y).
7. Random Inferences
The categories described in sections 1-5 provide answers
to questions like WHAT DOES X HAVE by first checking to
see if there is an explicit match for WHAT DOES X HAVE.
If not, the program proceed to WHAT DOES Y HAVE where
Isa(X, Y). If no match is found there, the program proceeds
to WHAT DOES Z HAVE, where Isa(Y, Z). Because there is
an ultimate WHAT DOES UNKNOWN HAVE category, the procedure
will always terminate.
The inferences will not however find ALL instances of
the logical reply to WHAT DOES X HAVE. For example, if
we know that all animals have a mother, then one answer
to "What does a bird have?" should logically be "a mother".
The following two categories show a crude but simple way
to overcome this obstacle. If the client asks "What else
do birds have?", the random function will select between two
possible alternative questions: "What do birds have?" and,
for some X such that Isa(bird, X), "What else do X have?".
If the program chooses the second form, the question itself
becomes the input to this same category.
<category>
<pattern>WHAT ELSE DO * DO</pattern>
<template><random>
<li><srai>WHAT DO <star/> DO</srai></li>
<li><srai>WHAT ELSE DO <srai>ISB <star/></srai> DO</srai></li>
</random>
</template></category>
<category>
<pattern>WHAT ELSE DO * HAVE</pattern>
<template><random>
<li><srai>WHAT DO <star/> HAVE</srai></li>
<li><srai>WHAT ELSE DO <srai>ISB <star/></srai> HAVE</srai></li>
</random>
</template></category>
8. Sample Dialog
The following dialog demonstrates the categories described in this
technical note.
Client: What does a bird have?
Robot: Feathers.
Client: What does a bird have?
Robot: Lungs.
Client: What does a bird have?
Robot: A beak.
Client: What do birds have?
Robot: A beak.
Client: What does a raven do?
Robot: Fly.
Client: What else does a bird have?
Robot: A tail.
Client: What else does a bird have?
Robot: Nuclear membranes.
Client: What else does a bird have?
Robot: A body.
Client: What else does a bird have?
Robot: Imagine no possessions.
Client: What else does a chicken do?
Robot: Get eaten.
Client: What else does a chicken do?
Robot: Cluck.
Client: What else do chickens do?
Robot: Peck.
A bird has a nuclear membrane because it is a prokaryote. All
animals have a body, so birds have a body too. Chicken is both
a food and a bird, so it can both cluck and be eaten. Ravens can
fly because the robot believes all birds can fly.
9. Conclusion
We have shown how to make certain simple logical deductions
in AIML alone, without the need for an external Prolog or
other reasoning program.
The ALICE brain set was augmented with more than 1000 Isa
relations, and several hundred categories encoding Has and Does.
These categories will be made public in the next release
of the ALSimple Logical Deductions in AIML
- Next message: [alicebot-style] Simple Logical Deductions in AIML
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]