85
Symbolic Normalized Acquisition and Representation of Knowledge BERNADE’lTl3 BOUCHON and JEAN-LOUIS LAURIhE Groupe de Recherche C&de - Fraqois Picarrf Universk? Paris VI - TOW 45, 4, place Jwsieu, 75230 Paris Ckdex OS, France
ABSTRACT We present here a declarativelanguagecalled SNARR: (Symbols normalizedacquisitionand representationof knowledge),w&h is based on first order logic and thus involvesvariables.It does not use the resolutionprinciple,but natural deduction,and it accepts severalconclusions in the same rule. Coefficientsof certainty may weightthe facts and the inferences.
1.
INTRODUCTION
An expert system may be considered as a program specialized in a particular domain in which it can work as well as experts themselves. It can explain its functioning at each stage of the execution and receive new information directly from the expert. It contains a knowledge base including rules and me&rules given by the expert in a language as close to its own language as possible. This part of the expert system depends on the domain, contrary to the second part, which is an inference process associating facts of the knowledge base to rules dealing with them, creating new facts, and iterating these operations until a diagnosis is exhibited or a decision is made. The power of the language in which the rules are written is essential for an expert system. We present here a declarative language called SNARK (symbolic normalized acquisition and representation of knowledge), the associated inference process, and some of its applications. 2.
LANGUAGE USED TO REPRESENT THE KNOWLEDGE
The language SNARK is based on first order logic. This means that variables are allowed, defined as entities with universal or existential quantifiers, which @E%evierScience ~b~s~g Co., Inc. 1985 52 VanderbiltAve., New York, NY 10017
OOZO-0255/85/$03.30
86
BEBNADETIE
BOUCHON
AND JEAN-LOUIS
LAUIUERE
can be replaced by elements of the base of facts. For instance, the expression “human-being(x)” means “for every x which is a human being.” Properties may involve several variables, such as x and y in the following example : “age(roof( x)) = min(l50, age(wall( y ))).” These variables are called &inn. For instance, in a geological problem, we may speak of an entity G, located under a sheet C, the nature of which is rift and older than hundred million of years, in the following way: above(G) = C, nature-( G) = rift,
where G and C are djinn. The objects utilized by the expert are generally described by means of the set of properties they satisfy, and it is not necessary to characterize them by a name. This is the reason why SNARK introduces a quark, defined as a general object satisfying a collection of relations. Obviously, several objects of the base of facts may possess the same properties. The djirm may only be replaced by quarks of the same base of facts. We note that djinn and quarks do not have an existence of their own, which justifies their particular names. They can be used as abstract variables in an expert system proving mathematical theorems for instance, such as the transitivity of inclusion, written as follows: included(x)
= (v)
included(y)
= (z)
included( x ) * z . Further, we do not always need a complete fact, but may only need elements of it. Let us consider the sentence: John gives a book to Mary represented
by the relation R(John,book,Mary).
ACQUISITION AND REPRE!SENTATlON OF KNOWLEDGE
87
It corresponds to three attributes: the giver, the given object, and the receiver. In the process, it is possible that we only need to know that “John gives something to Mary.” For this reason, SNARK uses a quark Sd and splits the given sentence in three binary relations Giver(Sd)
= John,
Gift( Sd) = book, Receiver( Sd) = Mary. Any relation of order n greater than 2 must be split into n binary relations. This representation of the knowledge is modular. It entails some awkwardness in the description of the knowledge, which is balanced by several advantages: x”), the meaning of the parameters is (1) In an nary formula R(xi,..., implicit. In SNARK, all the relations are explicit, which makes easier any posterior reading or any correcting of the formulas. (2) SNARK allowsone to add or suppress an argument of the studied relation R without any ambiguity and difficulty. (3) Access to any element of the relation is immediate. We now describe the knowledge base, consisting of a base of facts and a base of rules. 2.2.
BASE
OF FACTS
The facts are defined as triples (object)(object)(object), weighted with a coefficient of certainty belonging to [O,l] and taken equal to 1 by default. The entity (object) represents a constant, a quark, or a relation. In order to arrange the file of facts in an easy way, the quarks are generally the first elements of the relation, for instance: $7, 57, $1, Xl, y,
NATURE, PLACE, INCLUDED, BELONG, GREATER,
LICHEN, 5001, FOREST, A Z.
.6 1 .9
We note the following points: (1) The components of the base of facts do not contain any operator, which means that they implicitly express equalities. (2) There is no operation symbol in these components; calculi, if needed, will be created in the “conclusion” part of the rules.
88
BERNADE’ME
BOUCHON
AND JEAN-LOUIS
LAURIi?RE
(3) Quarks can be viewed as vertices of a graph, the edges of which are associated with relations. The base of facts is isomorphic to a semantic network and will be compiled in this way. (4) If real variables are needed, they are defined by a list of components of the base of facts, such ,as
x2 -X-l, represented
2.3.
by:
NATURE,
e,
LW RHM,
g
e, e,
EQUALITY
1
OPERATOR,
g,
MINUS
TERRI, g, OPERATOR,
t t,
EXP
TERMI,
t,
x
TERH2,
t,
2.
BASE
OF RULES
The rules are characterized by a name and given by the expert in any order. They are made of an antecedent, a set of premises and a consequent. We give hereunder the syntactic description of the base of rules, in a Naur-Backus form: (Rule)
(antecedent) (argument 1) (argument (relation) (object)
(djinni)
2)
(mm name of the rule) := RULE nnn (once or several times) C(antecedent)l* __ > (once or several times) I:(consequent) I* (end rule) := (argument l)(operator)(argument 2) := (relation) (argument 1) := (object)
1: i;t;ent := := := := := :=
1)
(object) NAHE
((djumi)) (numerical constant) (alphanumerical constant) (aIphanumerical constant)
ACQUISITION AND RFPRFiSENTATIONOF KNOWLEDGE
:==I#/< >[>=/>I<= := (object) (object) (assignment op)(assignment) (CV) := CREATE ((djiuni) > :=KILL ((djinni)) :=KILLFACTS (object)~~ject) *=KILLFACT ~obje~t~~object)(object~ :=HARAKIRI :=WRITE C(text)l* := SUCCESS := ‘(any sequence of symbols} t := ( (djiuni) ) := (object) {object) ~gns$$op):=<--I<== ass1 en *= (argument l} := ~opera~~~~ (operation) := (sign op I)(~i~~t~ := (sign op 2) (assignment) (assigument) :=ABS~SIN~&OS~TGJSQRl~*lLOG y; o; ;; :=+I-I*i/1ABS(WIN(RAX &,O := (nothing = I by default) := (real number) (real number between 0 and 1) (‘real number) := . r(c~ffre)~* := (end rule) (end by default) := ER
(operator) (consequent)
:=END
STEP
We give some examples of (1) antecedents: RI Rl Rl RI
(X1 = (Y) (X)=R2 (X1 (R2 (R3 (X)))=Ql (R2 (T>>=KNOWN
(42 (Y))
R tT> < 10 a
Q (Y) # white VALUE (temperature)
< 70
FATHER
(Y)
(Xl
*
(2) 4x3nseqmts: P1 P2
(Xl (X>
<-<==
FATHER
89
90
BERNADETTE P (Y)
<--
+ Ql
P (Z)
<--
MAX
CREATE
2.3.
*
AND JEAN-LOUIS
82
tv1
tZ)
(V)
43
UIDTH
LAURIERE
(Z)
(A)
KILLFACT KILL
(U) LENGTH
BOUCHON
P (Z)
(Y)
(Y)
SEMANTICS
The djinn are variables of the base of rules, which will be replaced by quarks of the base of facts. Since constants may be used as arguments of relations in the rules, SNARK can work in the logic of propositions. Relations are anything chosen by the user, and their sense is not known by the system, except in the case of the relation NAME. It can be seen that a relation may be a djinn, which means that SNARK can work in second-order predicate logic. When the set of relations of the antecedent of a rule may be associated with facts of the base. the system uses the rule and the obtained consequents become new facts added to the base of facts. The exact definition of some particular elements involved in the syntactic description of the base of rules may be found in [7]. Let us simply indicate that CREATE adds a new quark to the base of facts and it is the converse of KILL. The operator <-- replaces the previous value of the left hand side of the consequent by a new one. It must be remarked that these definitions entail a nonmonotonic functioning of SNARK. 3. 3.1.
MANAGEMENT COEFFICIENTS
OF UNCERTAINTY OF CERTAINTY
A coefficient of certainty c, i.e. a real number between 0 and 1, can be associated with every rule, characterizing its strength. It can describe a contradiction or at least a difference in the opinion of several experts, or express the fact that this rule is not satisfied in all the situations. A likelihood coefficient p is also associated with every element of the base of facts, which is also a real number between 0 and 1. It corresponds to a difficulty in the observation or the determination of this fact. When the conjunction of several antecedents constitutes the premise of a rule, the minimum of their coefficients of certainty is taken into account to characterize this premise. Then, the fact obtained as a conclusion from a rule and facts of the base is weighted with a coefficient q - c * p, for a combination law * which is usually
ACQUISITION
AND REPRESENTATION
OF KNOWLEDGE
91
associative and commutative, admits 1 as a neutral element and 0 as a zero element, and further is monotonic with respect to both arguments (c < c’ * c*p
3.2.
UTILIZATION
OF LINGUISTIC
VARIABLES
In the case when the characterization of an object is given by what we can call a linguistic variable, such as “light,” “small,” “far,” when it is used in an antecedent and/or a consequent, then the coefficient of certainty of the rule may be deduced from the description of this linguistic variable by a possibility distribution f defined on a universe of discourse U and taking values in [O,l] (see Figure 1). Then, the strength of the rule is a consequence of the vagueness of this characterization. For instance, the rule WEIGHT (X1 __ >
= LIGHT
LENGTH
<--
(Y)
will be associated
SHALL
with a coefficient
c deduced from fi and fi by means of a
centimeters
Fig. 1. Examples of possibility distributions.
92
BERNADETTE
fuzzy implication the following:
AND JEAN-LOUIS
r [2]; the most classical definitions
1
r(')(y/x) =
BOUCHON
1
fi(Y)
if fi(x) dfr(y) otherwise,
of fuzzy implications
VxE4,
r(“)(y/x)-;max(min(f,(x),f,(y)),l-f,(x))
r”‘(Y/X)
1 if f~(~)~f2~y) othenvise
= { o
are
WY EU2,
vxEUl,
Vx~4,
LAURIBRE
VyEU,,
v+u2,
9
where U, and fi denote the universe of discourse and the possibility distribution of the antecedent, and cl, and jr those of the consequent. Several other definitions could be used. We summarize the values of r by using one of the operators i introduced previously. The choice of r must be made with great care when either an antecedent A or a consequent C of the rule involves a linguistic variable, contrary to the other one. In the case of such a consequent C, the strength of the rule is deduced from the values of r( y/ .) = fi (y) and defined by .* +,, e &.( y) for almost all the fuzzy imp~cations, except r@), which can give a null strength if there is no point in U, corresponding to a possibility distribution equal to 1. Otherwise, all the choices give a strength equal to 1. In the case of an antecedent A defined by a linguistic variable, we obtain a strength cif the rule defined by i Xfu,fi(x) when using d4); and by 1, whatever the values of fi, when using r(l), d2), or P). The implication rc4) produces r( ./x) = m~(~~(x),l-am), which may have a high value even if fi(x) is small, yielding an unsatisfactory definition of the strength of the rule. If there is at least a point x of U, where fi( x) = 1, then all the choices once more give a strength equal to 1. In the general situation where A and C are defined by linguistic variables, the new fact obtained as a conclusion when using this rule is characterized by a possibility distribution g, defined on U, by 82(Y)
=
$yj
(f&)* 1
4Y/X))
where * is one of the operators defined at the beginning
of this paper. We
ACQUISITION
AND REPRESENTATION
OF KNOWLEDGE
93
obtain g, = fi with r(l) and r@), for instance, which means that the description of C in the conclusion is exactly what was expected in the rule. A particular problem appears when the object involved in A is not described in exactly the same way in the base of facts as in the rule. Let gi denote the possibility distribution of the characterization of this object in the base of facts. Thus, we characterize the conclusion by
g*(Y)= x”E”;j;bib) * 4Y/X))
VXEU,,
QYEU,
For instance, WEIGHT (Xl is LIGHT in the rule, but appears as equa 1 to 45 pounds in the base of facts, which means that a point a = 45 of lJ, is exactly determined [g,(a) = 1, and g,(x) = 0 Vx # a]. In this particular situation, it must be remarked that g*(y) is independent of fi(a) if we take r(j), i#3,4, and g2(y)=max(fi(a),l-f,(a)) with ro). This means that if the object appears in the base of facts in such a way that the value of fi is small (i.e., it does not really correspond to the characterization described by fi and corresponding to the antecedent of the rule), then the conclusion has nevertheless a high value of its possibility distribution, which is not acceptable.‘The only solution is to choose rc4), yielding g,(y) = fi(a) Vy E U2, and the strength of the rule is then equal to min(fi(a), f*(y)). Another type of situation concerns the possibility that the description of the considered object is less precise in the base of facts than in the antecedent of the rule (gl>fi). For example, WEIGHT (Xl is LIGHT in the rule, but RATHER LIGHT in the base of facts. The conclusion added in the base of facts after having used the rule will be characterized by a possibility distribution g, 2 f2 corresponding to a less precise description than in the consequent of the rule, such as that LENGTH (Y 1 is RATHER SRALL. 4.
APPLICATIONS
The system SNARK has been used to solve various problems: sorting, diagnosis of failures in a nuclear station, geological prospecting, game of bridge, computer-aided instruction in physics, archeology, etc.
REFERENCES 1. B. Bouchon, Inferences floues dans les systkmes experts, presented at 6th International Congress of Cybernetics and Systems, Paris, 1984. 2. B. Bouchon, On the forms of reasoning in expert systems, in Approximate Reasoning in Expert Sysrems, (M. M. Gupta et al., Eds.), North Holland, 1985. 3. R. 0. Duda, The PROSPECTOR consultation system, final report SRI 8172,1982.
94
BERNADETTE
BOUCHON
AND JEAN-LOUIS
LAURIkRE
4. R. 0. Duda, J. Gas&&g, and P. Hart, Model Design in the PROSPECTOR Consultant System for Mineral Exploration, Michie, 1980, pp. 153-167. 5. J. L. Lauribe, Representation et utilisation des connaissances, Technol. Sci. Informat. 1(1):25-42, 1(2):109-133 (1981). 6. J. L. Lam-i&e, Knowledge representation and use, Technol. Sci. Informat. Part 1: Expert systems; Part 2: Representations, 1(1):9-26, 1(2):79-102 (1983). 7. J. L. Lauribe, Un moteur d’inferences pour systkmes-experts en logique du premier ordre: SNARK; Bulletin de liaison de la recherche en informatique et automatique, No. 97,1984, pp. 24-28. 8. E. Shortliffe, Computer-Based Medical Consultabons: MYCIN, Elsevier, New York, 1976. 9. L. A. Zadeh, The role of fuzzy logic in the management of uncertainty in expert systems, Fuzzy Sets and Systems 11:199-227 (1983). Received 22 May 1985; revised 23 May 1985