Professional Documents
Culture Documents
in
Artificial Intelligence
KR Using rules
IF . . THEN
ECA (Event Condition Action)
RULES
. APLLICATIONS
EXAMPLES
1. If flammable liquid was spilled, call the fire
department.
2. If the pH of the spill is less than 6, the spill
material is an acid.
3. If the spill material is an acid, and the spill smells
like vinegar, the spill material is acetic acid.
( are used to represent rules)
FACTS
[][][]
MATCH EXECUTE
[][][]
EXECUTE
MATCH
New fact added to the KB
RULES
MATCH
RULES
EXECUTE Fire
MATCH dept
is
called
RULES
Fig.4 Rule execution can affect the real world
The spill
The pH of
material is
the spill is < 6
an acid
The spill
material is
an acetic
acid
Spill smells
like vinegar
…… ……
……
…… ……
Rn If if1
if2
:
then then1
then2
:
Z1 If ?x has hair
then ?x is a mammal
Z2 If ?x gives milk
then ?x is a mammal
Z3 If ?x has feathers
then ?x is a bird
Z4 If ?x flies
?x lays eggs
then ?x is a bird
Matching
Z5 If ?x is a mammal
?x eats meat
then ?x is carnivore
Z6 If ?x is a mammal
?x has pointed teeth
?x has claws
?x has forward-pointing eyes
then ?x is carnivore
Z7 If ?x is a mammal
?x has hoops
then ?x is an ungulate
Z8 If ?x is a mammal
?x chews cud
then ?x is an ungulate
Z9 If ?x is a carnivore
?x has tawny color
?x has dark spots
then ?x is a cheetah
Z10 If ?x is a carnivore
?x has tawny color
?x has dark spots
then ?x is a tiger
Z11 If ?x is an ungulate
?x has long legs
?x has long neck
?x has tawny color
?x has dark spots
then ?x is a giraffe
Z12 If ?x is a ungulate
?x has white color
?x has black strips
then ?x is a zebra
Z13 If ?x is a bird
?x does not fly
?x has long legs
?x has long neck
?x is black and white
then ?x is a ostrich
Z14 If ?x is a bird
?x does not fly
?x has swim
?x is black and white
Z15 If ?x is a bird
?x is a good flyer
then ?x is an albatross
Fired second
Chews cud is an ungulate
Z8
Fired third
Has long legs
is a
Has long neck Z11
giraffe
Has tawny color
FIGURE: 2
Has forward-pointing eyes Fourth rule used
Has claws
Has pointed teeth
Z6 is a carnivore