rule-base content verification using a digraph-based ... · by the rule-based system depends not...

16
Rule-base content verification using a digraph-based modelling approach G.S. Gursaran a, * , S. Kanungo b , A.K. Sinha a a Department of Mathematics, Faculty of Science, Dayalbagh Educational Institute, Dayalbagh, Agra 282 005, India b Department of Management, Indian Institute of Technology, Hauz Khas, New Delhi, India Received 11 November 1998; accepted 8 March 1999 Abstract Ensuring that the content of a rule-base, which is being encoded, is free from problems of consistency, completeness, and conciseness, is necessary to avoid any performance errors that might occur during consultation sessions with the rule-based system. In this paper we have described, formally, content verification of a specific type of rule-base using a digraph-based modelling approach. Through analytic formulations it is demonstrated that problems in the rule-base lead to the existence of certain properties in the digraph and various rule- base model representations that have been devised in this work. These properties, in turn, as is also shown through an example, can be examined for rule-base content verification. q 1999 Elsevier Science Ltd. All rights reserved. Keywords: Rule-base verification; Rule-based systems 1. Introduction Rule-based (expert) systems (RBSs) have now been applied to assist in a variety of engineering tasks ranging from scheduling production [1], to assisting in effective product life-cycle implementations, e.g. design for manu- facturing [2]. However, the quality of assistance provided by the rule-based system depends not only on the appropri- ateness and comprehensiveness of knowledge encoded in the rule-base, but also on the fact that the rule-base is free from errors, either domain-dependent or domain-indepen- dent. This makes verification of rule-based systems an extremely important issue. The rule-base of a RBS is constructed through a colla- borative effort of the knowledge engineer and the applica- tion-domain experts. Problems, however, can occur at any stage in the knowledge encoding process which are then reflected in the content of the rule-base, i.e. in the domain-independent structural characteristics of the rules actually stored in the rule-base [3]. Since a rule-base cannot be tested, even on simple cases, until much of it is encoded, most researchers [4–8], contend that the ability to verify content, during rule-base construction, would be an invalu- able aid in ensuring that it is free from the problems of consistency 1 , completeness 2 , conciseness 3 that usually remain dormant until performance errors occur. In fact the ability to content verify rule-bases, as Nazareth [7] argues, would enhance the viability of rule-based system technol- ogy itself. TEIRESIAS [9], represents the first attempt to automate rule-base verification. It examines the completed MYCIN [10] rule set and builds rule models against which new rules or refined rules can be verified. The Rule Checker Program of Suwa [4,11], was built to check consistency and comple- teness of rules in the ONCOCIN system (a rule-based system for clinical oncology). The rule checker works as the system is being built and also hypothesises missing rules and thus addresses an important aspect of complete- ness. CHECK [5] and ARC [12] are rule-base content veri- fication tools that have been developed for the LES (Lockheed’s rule-based expert system) and ART expert system development packages, respectively. CHECK is an extension of the rule checking program of [4]. It differs from the ONCOCIN rule checker in that it is applied to the entire set of rules for a goal and not just subsets that determine the value of each attribute. It can handle both backward Artificial Intelligence in Engineering 13 (1999) 321–336 0954-1810/99/$ - see front matter q 1999 Elsevier Science Ltd. All rights reserved. PII: S0954-1810(99)00013-8 www.elsevier.com/locate/aieng * Corresponding author. E-mail address: [email protected] (G.S. Gursaran) 1 A rule-base is consistent if there is no way to derive a contradiction from valid input data [3]. 2 A rule-base is complete if it can cope up with all possible situations that can arise in its domain [3]. 3 A rule-base is concise if it does not contain any unnecessary or useless piece of knowledge [3].

Upload: others

Post on 23-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

Rule-base content verification using a digraph-based modelling approach

G.S. Gursarana,* , S. Kanungob, A.K. Sinhaa

aDepartment of Mathematics, Faculty of Science, Dayalbagh Educational Institute, Dayalbagh, Agra 282 005, IndiabDepartment of Management, Indian Institute of Technology, Hauz Khas, New Delhi, India

Received 11 November 1998; accepted 8 March 1999

Abstract

Ensuring that the content of a rule-base, which is being encoded, is free from problems of consistency, completeness, and conciseness, isnecessary to avoid any performance errors that might occur during consultation sessions with the rule-based system. In this paper we havedescribed, formally, content verification of a specific type of rule-base using a digraph-based modelling approach. Through analyticformulations it is demonstrated that problems in the rule-base lead to the existence of certain properties in the digraph and various rule-base model representations that have been devised in this work. These properties, in turn, as is also shown through an example, can beexamined for rule-base content verification.q 1999 Elsevier Science Ltd. All rights reserved.

Keywords:Rule-base verification; Rule-based systems

1. Introduction

Rule-based (expert) systems (RBSs) have now beenapplied to assist in a variety of engineering tasks rangingfrom scheduling production [1], to assisting in effectiveproduct life-cycle implementations, e.g. design for manu-facturing [2]. However, the quality of assistance providedby the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded inthe rule-base, but also on the fact that the rule-base is freefrom errors, either domain-dependent or domain-indepen-dent. This makes verification of rule-based systems anextremely important issue.

The rule-base of a RBS is constructed through a colla-borative effort of the knowledge engineer and the applica-tion-domain experts. Problems, however, can occur at anystage in the knowledge encoding process which are thenreflected in the content of the rule-base, i.e. in thedomain-independent structural characteristics of the rulesactually stored in the rule-base [3]. Since a rule-base cannotbe tested, even on simple cases, until much of it is encoded,most researchers [4–8], contend that the ability to verifycontent, during rule-base construction, would be an invalu-able aid in ensuring that it is free from the problems of

consistency1, completeness2, conciseness3 that usuallyremain dormant until performance errors occur. In fact theability to content verify rule-bases, as Nazareth [7] argues,would enhance the viability of rule-based system technol-ogy itself.

TEIRESIAS [9], represents the first attempt to automaterule-base verification. It examines the completed MYCIN[10] rule set and builds rule models against which new rulesor refined rules can be verified. The Rule Checker Programof Suwa [4,11], was built to check consistency and comple-teness of rules in the ONCOCIN system (a rule-basedsystem for clinical oncology). The rule checker works asthe system is being built and also hypothesises missingrules and thus addresses an important aspect of complete-ness. CHECK [5] and ARC [12] are rule-base content veri-fication tools that have been developed for the LES(Lockheed’s rule-based expert system) and ART expertsystem development packages, respectively. CHECK is anextension of the rule checking program of [4]. It differs fromthe ONCOCIN rule checker in that it is applied to the entireset of rules for a goal and not just subsets that determine thevalue of each attribute. It can handle both backward

Artificial Intelligence in Engineering 13 (1999) 321–336

0954-1810/99/$ - see front matterq 1999 Elsevier Science Ltd. All rights reserved.PII: S0954-1810(99)00013-8

www.elsevier.com/locate/aieng

* Corresponding author.E-mail address:[email protected] (G.S. Gursaran)

1 A rule-base isconsistentif there is no way to derive a contradictionfrom valid input data [3].

2 A rule-base iscompleteif it can cope up with all possible situations thatcan arise in its domain [3].

3 A rule-base isconciseif it does not contain any unnecessary or uselesspiece of knowledge [3].

Page 2: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

chaining and forward chaining rule forms. ARC converts allrules to forward chaining rule forms first.

UVT [6] is a unification-based tool for rule-base contentverification. Apart from the usual checks, it checks forproblems caused byinferred rulesby computing the transi-tive closure of the rule-base first. The method does notassume any control strategy on the part of the rule-basedsystem. Nazareth [7] shows how to model a rule-base, usedwith forward chaining, with petri-nets. Rigorous proofscertifying content verification capabilities have beenpresented by him. PREPARE [8] is an automated tool fordetecting potential errors in a rule-base. PREPARE modelsthe rule-base using a Predicate/Transition net (assumes ruleelements to be first-order logic based predicates). Inconsis-tent, redundant, subsumed, circular and incomplete rules aredetected through a syntactic pattern recognition method.

Nazareth [7] notes that most methods for content verifi-cation of rule-bases can be placed in the following threecategories: (i) pairwise comparison methods (e.g. Refs.[5,6]); (ii) decision context based methods (e.g. Refs.[11,13]); and (iii) model based methods (e.g. Refs. [7,8]).Numerous problems associated with the methods in the firsttwo categories make their application difficult [7]. However,the alternative model based methods hold much promise.Methods in this category usually transform the rule-baseinto a model in another format. For example, rule-basesmay be modelled as petri-nets [7], or as inference nets[12]. Modelling is usually based on the structural connec-tivity of rule components and the verification process isreduced to specifics within the model. One definite advan-tage, though not exploited by most researchers, is that theapplicability of a model based method to content verifica-tion can be formally proved.

Since most of the available methods do not present formalmathematical proofs certifying applicability, we in thispaper have used a digraph-based modelling approach todescribe a formal content verification of a specific type ofrule-base. Through analytic formulations it is demonstratedthat problems in the rule-base lead to the existence of certainproperties in the digraph and various rule-base model repre-sentations that have been devised in this work, which, inturn, can be examined for rule-base content verification. Thework is different from Ref. [7] in that it examines the rule-base of an RBS that employs a backward chaining inferencecontrol strategy.

2. The assumed rule-based system

The essential characteristics of the RBS, on whichcontent verification is researched, is described in thissection. All references to a “rule-based system” in thispaper are taken to be a reference to the rule-based systemdescribed in this section unless stated otherwise.

In the rule-based system,atomic propositionsare booleanvaluedstatementsandclausesare atomic propositions or the

negation of atomic propositions. Arule is of the form

IF c1&c2&…&cn THEN cn11 �1�and is simply written as

c1&c2&…&cn ! cn11 �2�wherec1;…; cn11 aredistinctclauses withn $ 1. In a rule,the set of clauses in the antecedent is called thepremise setofthe rule, while each clause in the antecedent is called apremiseof the rule.Sometimes,a premiseofa rulemay be referred toasIF condition and the consequent asconclusionor THENcondition. The consequent is always a single clause and nota conjunction of clauses. This is a restriction. Note that in thesystem, the use of the disjunctive form is explicitly dis-allowed. Furthermore, it is assumed that rules arestrictlydeterministicin nature and do not involve any probabilities.

The finite collection of all rules that constitute the rule-base of the system is calledrule-collectionwhich is alsodenoted R. Furthermore, in the system, inferencing isstrictly throughbackward chaining. The clauses are thusclassified as:

Fact clauses(or external clauses)These are clauses whose truth values are determined by query-ing the user or from a database of facts known to the system.Such clauses do not constitute the consequent of any rule.Goal clausesThese are clauses that match system goals. Such clauses donot appear as a premise in the antecedent of any rule in therule-base. It is assumed that a system goal must alwaysmatch a goal clause.Intermediate clausesThese are the remaining clauses. They are chained to theconsequent of other rules, in the rule-base, in backwardchaining.

It may be noted that modelling and verification has beenlimited to a system without uncertainty. This is because ageneral verification of a rule-base can then be described.The domain knowledge is also taken to be of the proposi-tional form. This is because knowledge in propositionalform can be easily obtained and encoded. Furthermore, itameliorates error detection. These views are not any differ-ent from those in Ref. [7].

3. Basic modelling concepts

In this section we define the basic concepts necessary formodelling the rule-base, i.e. an element setC, calledclau-seset, and the modelling relationRpc, calledpc-relation.

Definition 1. Rule-collection R � { r1; r2;…; rt} is anordered collectionof rules wheret is the number of rulesin rule-collection. The ordering of rules inR, denotedrule-order, is defined by the sequence in which rules are physically

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336322

Page 3: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

stored in the rule-base of the rule-based system. For rulerk,k [ {1 ;…; t}, in rule-collectionR, the premise set ofrk isdenotedPk and the consequent is denotedCk which is asingle clause.

Definition 2. The setC � { c1; c2;…; cs}, calledclauseset,is the set of clauses such that for each clausec [ C thereexists at least one rule in rule-collectionR in which clausecis either a premise or the consequent.

Definitions 1 and 2 together imply that

C �[t

k�1

�Pk < { Ck} �: �3�

Definition 3. The modelling relationRpc, calledpc-relation,is a binary relation in clausesetC such that for clausesci ; cj [C; �ci ; cj� [ Rpc if and only if clauseci is a premise in a rulein rule-collectionR which has clausecj as its consequent.

In the case of a content verified rule-collectionR, Rpc isclearly irreflexive4 and asymmetric5.

Definition 4. A finite sequence of distinct clausesx1; x2;…; xk [ C, 1 , k # s, such that x1Rpcx2;

x2Rpcx3;…; xk21 Rpcxk, is called aclause chain. A clausechain in whichx1 is a fact clause andxk a goal clause iscalled acomplete clause chain. A finite sequence of clausesx1; x2;…; xk [ C, 1 , k # s, such that x1Rpcx2;

x2Rpcx3;…; xk21Rpcxk, is called acircular clause chainifx1 � xk and clausesx2; x3;…; xk21 are all distinct.

Definition 5 [14]. In a partially ordered set (B,P), thereachability set, R(x), of an elementx [ B is defined asR�x� � { yuy [ B andxPy} and theantecedent set, A(x), ofan elementx [ B is defined asA�x� � { yuy [ B andyPx}.

In Definition 5, asP is reflexive,x [ R�x�. This, togetherwith antisymmetry ofP ensures that reachability sets of notwo distinct elements inB are equal, although the reach-ability set of one element may be a proper subset of theother. Thus, for allx; y [ B, x ± y, R�x� ± R�y�. Also, forall x; y [ B, x ± y, A�x� ± A�y�.

With respect toP, above, setB can be partitionedinto a level hierarchy such that all the elements at agiven level are contained in the same block6 [14]. The

partition can be written as

�L1;L2;…;Ll� �4�where l is the number of levels. Clearly an elementc isa top-level element if

R�c� � R�c�> A�c�: �5�Given a partial order set (B,P), the transitive reduction7

of P in B can be represented as a levelled directedgraph (or digraph). This levelled digraph is called thestructural modelof P in B. Furthermore, a structuralmodel in which the nodes are labelled by the elementsthey represent is called theinterpretive structural model[14,15].

4. The modelling and verification steps

Content verification of a rule-base is integrated intothe framework of modelling and model property identi-fication. The basic steps in modelling and verificationare:

1. Construction ofrule matrix N� �nij �, redundancy set(RS) andconflict set(CS).The rule matrix N is a matrix of orderuCu, where uCudenotes cardinality of clausesetC. The ith row andithcolumn in N correspond to clauseci in C. The matrixentries are made by reading rules from rule-collectionR

in rule-order. The exact process is outlined in Procedure1 below.The redundancy setRS is a set of 3-tuples. In a 3-tuple(x,y,c) in RS,c is a clause that is in both the premise setsPx andPy of rule rx andry, respectively. Furthermore, inthe 3-tuple (x,y,c), x , y, i.e. rulerx precedes rulery inrule-order.Theconflict setCS is a set of ordered pairs. In an orderedpair (c,x) in CS,c is a clause whose negation is also inCandx is a rule index which represents the position of arule in rule-order and that is determined as described inProcedure 1 below.The following procedure is adopted to make entries inNand constructRSandCS. Statements enclosed within “/*” and “*/” denote comments.It can be noticed in Procedure 1 that steps 3 through 14are repeated for every rule, read in rule-order, in rule-collection R. Steps 7 through 10 ensure that for everypair of rulesri , rj [ R, wherei , j, with the same conse-quent clause and a common clause, sayc, in their premisesets, the 3-tuple (i,j,c) is included in the redundancy setRS. Furthermore, it follows from step 7 and step 9 thatProcedure 1 does not store any 3-tuple in RS that violates

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336 323

4 Any rule rk in which clauseCk � c [ Pk, leads to an infinite inferenceloop when backward chaining is attempted with it; Also follows from thedefinition of the rule which is given in Section 2.

5 For clausesci ; cj [ C, if �ci ; cj � [ Rpc then �cj ; ci � Ó Rpc. This alsofollows from the arguments presented for irreflexivity.

6 If a 0th level is defined as the empty set,L0 � B, the iterative levelidentification algorithm may be written as [14]

Lj � { c [ B–L0–L1–…–Lj21uRj21�c� � Rj21�c�> Aj21�c�} :whereRj21�c� andAj21�c� are the reachability and antecedent sets deter-mined for the elements inB–L0–L1–…–Lj21.

7 Let #1 be a strict partial order relation corresponding to the partialorder relation # . If relation u is the transitive reductionof # then forevery relations such that the transitive closures1 �#1, we haveu # s.In other words the transitive reduction is theleast relationwhose transitiveclosure is#1 [16].

Page 4: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

the definition of RS. Fig. 1 illustrates the rule matrixN,redundancy set RS, and conflict set CS for an example.

The worst-case time complexity is clearly decided bythe loop 3–15 with allt rules, in rule collectionR havingthe same premise set, of sayn 2 1 clauses, and the sameconclusion, i.e. all thet rules are redundant. Let usassume that the redundancy set is indexed by the rulenumber pair (i,j) in 3-tuple (i,j,c) and that clauses arestored in linear lists in the indexed positions with inser-tions taking place in front of the list. For the first rulethere aren 2 1 entries to be made in the rule matrix. Forthe second rule, there aren 2 1 insertions made in theclause list at index position (1,2) in the redundancy set.For the third rule, in the redundancy set, there are a totalof O(n2) comparisons made at index position (1,2) along

with the insertions at index positions (1,3) and (2,3)which is O(1) time for each insertion. For the fourthrule, in the redundancy set, there are O(n2) comparisonsmade at index position (1,2) followed by O(n2) compar-isons made at index position (1,3) along with the inser-tions at index positions (1,4), (2,4) and (3,4), i.e. the timetaken is 2O(n2). For the fifth rule it is 3O(n2) and so on.Since there aret 2 1 rules for which insertions are madein the redundancy set, the time complexity for the loop inlines 3–15 is clearly O�n2t2�.

2. Construction of an adjacency matrixA� �aij �. Theentries in the adjacency matrixA are derived directlyfrom N as follows:

aij �1 if nij ± 0

0 if nij � 0:

(�6�

The adjacency matrix represents the pc-relationRpc.3. Development of a reachability matrixX which represents

the transitive–reflexive closure,R*pc; of pc-relationRpc

in clausesetC.4. Identification of various partitions induced by the reach-

ability matrix on the set and subsets of clausesetC � { ci}. These partitions are: (i) the relation partition;(ii) the level partition; (iii) the separate parts partition;(iv) the disjoint and the strong subsets partition of each

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336324

Fig. 1. An example.

Page 5: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

level identified in (ii); and (v) the strongly connectedsubsets partition as per identification in (iv). They aredescribed in detail in Section 6. Identification of eachpartition is followed by verification.

5. Construction of the structural model ofR*pc in clausesetC. This may be accomplished by first constructing aminimum edge adjacency matrix,M � �mij �, that repre-sents the transitive reduction ofR*pc in clausesetC, andthen using the connectivity information in the minimumedge adjacency matrix to derive the minimum edgedigraph structural model. Construction is followed by acorrection procedure, which is described in Section 6.5,and then by verification.

5. Problems in content of rule-collectionR

The subsequent subsections describe how consistency,completeness, and conciseness may be compromised8 inrule-collection R. The description is strictly within theframework of the chosen rule-based system.

5.1. Consistency

Consistency in rule-collectionR is compromised bycircularity and conflicts.

Conflicts: A conflict may occur in the form of:

Self-Contradictory RuleA rule in rule-collectionR is a self-contradictory rule if itsconsequent clause is the negation of a premise in its ante-cedent.Directly Contradictory RulesTwo rules in rule-collectionR are directly contradictory ifthey have the same antecedent and the consequent clause ofone rule is a negation of the consequent clause of the other.Contradictory Clause ChainA clause chainx1; x2;…; xk [ C, k . 2, is a contradictoryclause chain if clausexk is the negation of clausex1.

Circularity: Circularity may occur in the form of:

Self-Referent RuleA rule in rule-collectionR is a self-referent rule if its conse-quent clause is also a premise in its antecedent.Circular Clause ChainSee Definition 4 in Section 3.

Circularity is undesirable for the simple reason that itmoves a rule-based system into an infinite inference loopwhen backward chaining is attempted.

5.2. Completeness

Compromises in completeness refer to knowledge gapsin the rule-collection. Such gaps usually lead to incom-plete chains of inference thereby leading to inconclusive

inference sessions. The situations that are indicative ofknowledge gaps are as follows:

Unreachable Conclusion: In backward chaining, theconsequent clause of a rule in rule-collectionR shouldeither match a system goal or match a premise in the ante-cedent of another rule in rule-collectionR. If there are nomatches for the consequent clause, it is said to be anunreachable conclusion.

Dead End Goal: In order to achieve a system goal (or asub-goal) in the backward chaining system, it is necessarythat either the truth of the goal be determined by queryingthe user or it should match the consequent clause of somerule in rule-collectionR. If neither is achievable, then thegoal is said to be a dead end goal.

Dead End IF Conditions: For a rule premise in the ante-cedent of a rule in rule-collectionR, it is required that either,

• the truth of the premise be determined by querying theuser or through a database of facts, or

• the premise should match the consequent clause of someother rule in rule-collectionR.

If neither is achievable then the premise is said to be a deadend IF condition.

Missing Rules: There are missing rules, if a situationexists in which a particular inference is required but thereis no rule in rule-collectionR to produce the desired infer-ence, i.e. there are knowledge gaps in rule-collectionR.

As clauses have been assumed to be boolean valued, theproblems ofunreferenced attribute values, andillegal attri-bute values(e.g. as in Refs. [5,12]) are not considered.These are specific to first-order predicate logic-based rulerepresentations.

In the knowledge engineering process a large number ofrules may be overlooked by the expert or by the knowledgeengineer. Rules that have been overlooked are also said tobe missing rules. As Suwa et al. [4] note “missing rules canbe detected if it is possible to enumerate all circumstances inwhich a given decision should be made or a given actionshould be taken.” However, the problem of detecting miss-ing rules, in general, is known to be hard and it is for thisreason that most verification methods have avoided addres-sing it [7].

5.3. Conciseness

Conciseness deals with situations in which rules arepresent in rule-collectionR that logically serve no purpose.Compromises in conciseness may not really poseproblems in rule-based systems, in general, in whichrules are deterministic in nature and only the firstapplicable rule is guaranteed to succeed. However, ifrules involve probabilities, conciseness errors mightpose considerable problems [17]. For example, if tworules have the same antecedent, but rule probabilitiesthat are different, then they may cause the same

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336 325

8 Descriptions of these problems can also be found in Refs. [3–8,12].

Page 6: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

evidence (factual or conclusive) to be counted twice[4,17].

Conciseness is compromised in the followingsituations:

Redundant RulesTwo rules in rule-collectionR are said to be redundant rulesif they have the same antecedent and the same consequent,i.e. there are two instances of the same rule.Subsumed RulesA rule ri is subsumed by another rulerj in rule-collectionR

if both the rules have the same consequent and the premiseset of ruler j is a proper subset of the premise set of ruleri .Unnecessary IF ConditionsTwo rules in rule-collectionR contain unnecessary IFconditions if the rules have the same consequent, a premisein one rule is in conflict with a premise in the otherrule, and all the other premises in the two rules are thesame. The two rules in fact should be replaced by asingle rule that does not contain either of the conflictingpremises. A special case occurs when two rules havethe same consequent, one rule has a single premise inits antecedent that is also in conflict with a premise inthe other rule which in turn has two or more premises

in its antecedent. For example, ifA! B and C&D! Bare two rules in rule-collectionR with A�: C, thenclause C is an unnecessary premise. But, both therules A! B and D! B are still required in rule-collection R.

5.4. Rule-base content verification: a case study

Content verification is illustrated with a small examplerule-base. The example has been kept small so as to beable to display the matrices generated through the model-ling process. The rules in the rule-base, called ER-BASE,are

1 : A! B

2 : A & C! B

3 : B! D

4 : E! F

5 : F ! D

6 : H ! I

7 : J! K

8 : L! M

9 : M ! N

10 : N ! L

: �7�

Let A, C, E, H, L be fact clauses, and letD, K, N be goalclauses. Further, letA�: D, i.e. they are contradictoryclauses. The following errors are then present in ER-BASE:

1. Rule 1 subsumes rule 2.2. The backward chaining of rules 1 and 3 gives rise to a

contradictory clause chain.3. The backward chaining of rules 8, 9 and 10 gives rise to a

circular clause chain.

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336326

Fig. 2. Rule matrix for ER-BASE.

Fig. 3. ER-BASE matrices.

Page 7: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

4. Clause I, in rule 6, represents an unreachable conclusion.5. In rule 7, the goal corresponding to goal clauseK repre-

sents a dead end goal and clauseJ is a dead end IFcondition.

In the modelling of ER-BASE,

R � {rule 1; rule 2; rule 3; rule 4; rule 5; rule 6; rule 7; rule 8;

rule 9; rule 10}; and

C � { A;B;C;D;E;F;H; I ; J;K; L;M;N} : �8�Fig. 2 shows the rule matrixN for ER-BASE. The adja-

cency matrix derived fromN is shown in Fig. 3, along withthe reachability matrix. Fig. 4 illustrates the interpretivestructural model of ER-BASE. Content verification of ER-BASE is discussed in the subsequent sections.

6. Partitions and content verification

This section describes the content verification of rule-collection R through the partitions induced by the reach-ability matrixX on the set and subsets of clausesetC � { ci}.

6.1. The level partition

ClausesetC is partitioned into a level hierarchy such thatall the clauses at a given level are contained in the sameblock. For each clauseci the reachability setR�ci� � { cj [CuciR

*pccj} ; and the antecedent setA�ci� � { cj [ CucjR

*pcci} :

A clause is a top level clause if and only ifR�ci� � R�ci�> A�ci�. The level partition is written as

p1�C� � �L1; L2;…; Ll� �9�wherel is the number of levels,L1 is the top level block, andLl is the lowest level block.

Lemma 1. Let c be a top level clause. R�c�> A�c� �R�c� � { c} if and only if there is no circular clause chainx1; x2;…; xk � x1 � c, k . 2, in any backward chaining ofrules in rule-collectionR.

Proof. Let us assume thatR�c�> A�c� � R�c� � { c} for ca top level clause. Now let us suppose there exists a circularclause chainx1, x2, …, xk � x1 � c, k . 2. From thetransitivity of R*pc it follows that R�c�> A�c� $

{ c; x2; x3;…; xk21}. This contradicts our assumption thatR�c�> A�c� � R�c� � { c}. Conversely, let us assume thatthere is no circular clause chainx1; x2;…; xk � x1 � c in anybackward chaining of rules inR. Then for top level clausec,it follows from the definition ofR�c� that R�c� � { c}. Alsofrom the definition ofA�c� it follows that c [ A�c�. Hence,R�c�> A�c� � R�c� � { c}. This proves the lemma. B

Lemma 1 shows that the level partition does not give atrue picture of the level distribution of clauses in thepresence of circular clause chains. Hence any backwardchaining of rules that leads to the creation of a circularclause chain must be corrected to eliminate this circularityproblem.

In the level partition it is always the case that the numberof levelsl . 1, asl � 1 implies one or more of the follow-ing: (a) the rule-base is nothing but a collection of clausesand no rules which then violates our assumption that rule-collectionR is a finite nonempty collection of rules only; (b)all the clauses inC form a clause chain (or may be a set ofdisjoint clause chains) that is also circular (this follows fromLemma 1); (c) all rules in rule-collectionR are self-referentrules and each rule has a single clause in its antecedent andthat this clause is also its consequent.

The detection of circular clause chains is described inSection 6.3. It is, however, hereafter, assumed for the restof this paper thatR is free of all circularity problems9 (seeSection 5.1). This assumption is also referred to asno-circu-lar-clause-chain assumption.

SetB is the set of bottom level clauses. A clausec [ Cbelongs to setB if and only if A�c� � R�c�> A�c�. In thelevel partitioning of clausesLl # B.

Lemma 2. In a content verified rule-collectionR, ifclause c[ C is a fact clause then c[ B.

Proof. Clausec is a fact clause implies that there exists atleast one rulerj [ R such thatc [ Pj . Furthermore, thereexists no rulerk [ R with consequentCk � c. This impliesthat clausec, in rule rj , cannot be chained to the consequentof any rule inR in backward chaining. ThusA�c� � { c}, andA�c�> R�c� � A�c�. B

From Lemma 2 we know that clauses inB should all befact clauses. This set of clauses can be checked against theactual set of facts known to the system. If the truth of aparticular clause at this level cannot be determined byquerying the user or through a database of facts then theclause represents adead end IF condition. This clauseshould have matched the consequent clause of some rule

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336 327

9 It may be noted that this assumption also implies that there are no self-referent rules in rule-collectionR.

Fig. 4. Interpretive structural model of ER-BASE.

Page 8: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

in rule-collectionR which it cannot being in the bottomlevel setB. Formally,

Corollary 1 (of Lemma 2). If clause c[ C is a dead endIF condition then c[ B.

Proof. Since clausec is adead end IF conditionthere doesnot exist a ruler j [ R such thatCj � c. ThusA�c� � { c} #R�c� and hencec [ B. B

Similarly,

Lemma 3. In a content verified rule-collectionR, ifclause c[ C is a goal clause then c[ L1.

Proof. Clausec is a goal clause implies that there exists norule rk [ R such thatc [ Pk, and there exists at least onerule r j [ R, such thatCj � c. ThusR�c� � { c} # A�c� andhencec [ L1. B

Corollary 2 (of Lemma 3). If a system goal g does notmatch any clause in L1, then g is a dead end goal.

Lemmas 2 and 3 suggest that a fact or goal clause shouldbelong its appropriate level partition block. If this is not thecase, i.e. a known goal clause does not belong toL1 or aknown fact clause does not belong toB, then the systemknowledge is not correct. This follows as rule-collectionR

includes rules that specify these clauses as intermediateclauses. Moreover, if there are system goals that do notmatch any clause inL1 and there are known facts that donot match any clause inB, then it may imply that there aremissing rules. Furthermore,

Lemma 4. The system goal corresponding to consequentclause cj , of rule rk [ R, is a dead end goal if rk is the onlyrule with cj as its consequent clause, cj [ L1, and there is aclause ci [ Pk that is a dead end IF condition.

Proof. Since the truth ofci cannot be determined, the truthof cj also cannot be determined. Hence, the system goalcorresponding to goal clausecj is a dead end goal. B

The top level partition blockL1 comprises goal clauses. Ifa clause in this partition cannot be matched to a system goalthen the clause represents anunreachable conclusion. Theclause should have matched a premise of some rule in rule-collectionR which it cannot being in the top level blockL1.

Lemma 5. If clause c[ C is a unreachable conclusionthen c[ L1.

Proof. Since clausec represents anunreachable conclu-sion, there does not exist a ruler j [ R such thatc [ Pj .ThusR�c� � { c} and hencec [ L1. B

Clauses in partitions other thanL1 andB are intermediateclauses.

In ER-BASE, level partition isp1 � �{ D; I ;K;L;M;N} ; { B;F;H; J} ; { A;C;E} �, whereL1 � { D; I ;K;L;M;N}, L2 � { B;F;H; J}, andL3 � { A;C;E}. Level partition block L1 contains all thegoal clausesD, K, andN. Additionally it contains the clauseI, which does not correspond to a system goal and thusrepresents anunreachable conclusion. ClausesL and Mare fact and intermediate clauses, respectively, but bothbelong to blockL1 as they are contained in the circularclause chainL,M,N,L which is formed in a backward chain-ing of rules 8, 9 and 10. The bottom level setB� { A;C;E;H; J; L;M;N}. The circular clause chain, asone can see, has corrupted the bottom level set also. ClauseJ in setB is not a fact clause and represents adead end IFconditionand hence the system goal corresponding to clauseK is adead end goal.

It is obvious now that the level partition has an importantrole to play, not only in the verification of the rule-base butin also organising clauses for effective visual presentation.

6.2. The separate parts partition

The separate parts partition identifies the set of clauses inclausesetC that constitute a smaller digraph and which isseparate. The partitioning begins with the identification ofthe bottom level setB. Any two clausesci , cj [ B are in thesame block if and only ifR�ci�> R�cj� ± B. The remainingclauses of the reachability sets for each block are thenappended to the block. Thus, the separate parts partition is

p3�C� � �D1;D2;…;Dd� �10�whered is the number of disjoint digraphs.

The separate parts partition delineates blocks of rulessuch that within each block rules are intertwined. Basedon this partitioning the knowledge engineer can suggestmeta-rules that can help the system identify a block ofrules first and then begin its reasoning task. This will helpreduce search, specially in comparison to an exhaustive goalhypothesising scheme. If the partition is not correct andrules in two or more blocks are in fact intertwined then itimplies that there are missing rules. If the partitions arecorrect, then they can also be used to create smaller reach-ability matrices for the purpose of further content verifica-tion.

In ER-BASE the separate parts partition is,p3 ��{ A;B;C;D;E;F} ; { H; I } ; { J;K} ; { L;M;N} �. Using thispartition, the rule collections {rule 1, rule 2, rule 3, rule 4,rule 5}, {rule 6}, {rule 7}, and {rule 8, rule 9, rule 10} canbe delineated.

Since it has been assumed that no self-referent rules existin rule-collectionR, no partition block in the separate partspartition can be a singleton set. The conditions that may leadto the existence of a singleton block are formally charac-terised as follows.

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336328

Page 9: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

Lemma 6. If in p3(C) there exists a singleton blockD � { c}, for some clause c[ C, then there exists a self-referent rule in rule-collectionR with its consequent clauseas clause c and with a premise set that is the singleton{ c}.

Proof. The existence of a singleton blockD � { c} impliesthat R�c� � A�c� � { c}. Since only rules belong to rule-collection R, as per the rule-base structure assumed inSection 2, and since each rule in rule-collectionR has atleast one premise in its antecedent, this implies that thereexists a rule in rule-collectionR with its consequent clauseas clausec and with a premise set that is the singleton {c}. Inother words there exists a self-referent rule with a singlepremise in its antecedent, which is clausec, and with aconsequent clause which also is clausec. B

In Lemma 6, if clausec is a goal clause then the truth ofclausec cannot be determined and the system goal corre-sponding to clausec is a dead end goal.

6.3. The disjoint and strongly connected subsets partition

The reachability matrix induces a two block partitionp4�Lk� on each level partition block,Lk, depending onwhether a clause belongs to or does not belong to a stronglyconnected subset. If a clausec is not a part of a stronglyconnected set then RLk�c� � { c} where RLk�c� denotesreachability ofc with respect to the elements ofLk. Thetwo block partition is denoted by

p4�Lk� � �I ;S�: �11�A clausec [ Lk is contained in blockI if it satisfies theequation RLk�c� � { c}, otherwise it is contained in blockS.

The reachability matrix also induces a partitionp5�S�such that a group of clauses are in the same block if everyclause in the group is reachable from and antecedent toevery other clause in the group. Thus

p5�S� � �MC1;MC2;…;MCy� �12�where MCi denotes amaximal cycle setandy is the numberof maximal cycle sets.

Given the no-circular-clause-chain assumption, theSblock at each level should be empty. Furthermore,

Corollary 3 (of Lemma 1). Let x1; x2;…; xk � x1, k . 2,be a circular clause chain then there exists a maximal cycleset MC at some level such that MC$ { x1; x2;…; xk21}.

Proof. The circular clause chainx1; x2;…; xk � x1, k . 2,implies that R�x1�> …> R�xk21� >A �x1�> …> A�xk21� $ { x1; x2;…; xk21}. Thus the set {x1; x2;…; xk21} isa subset of a maximal cycle set at some level.B

The knowledge engineer can, and should, assure that theno-circular-clause-chain assumption is satisfied. This is

possible with the help of thep4 andp5 partitions at eachlevel with which the knowledge engineer can detect thosecircular clause chains that do not result from self-referentrules.

Self-referent rules can be detected in rule matrixN andthe redundancy set RS as follows. Let rulerk [ R be self-referent in clausec [ C. Let rk be the first rule in rule-orderthat is self-referent in clausec. It follows from Procedure 1thatnii � k in rule matrixN, and, furthermore, for each rulerq that is redundant withrk in clausec, q . k, the 3-tuple(k,q,c) exists in redundancy set RS.

In ER-BASE, p4�L1� � �{ D; I ;K} ; { L;M;N} �,p4�L2� � �{ B;F;H; J} ; B�, and p4�L3� � �{ A;C;E} ; B�.It can be seen thatp4�L1� indicates the presence of acircular clause chain which is corroborated by thep 5

partition of its S block. Partitionp5�{ L;M;N} � � �{ L;M;N} �. In a backward chaining ofrules 8, 9, 10, the clausesL, M, and N form a circularclause chainL,M,N,L which leads to the maximal cycleset of {L,M,N}. In Fig. 4, it can be seen that all thethree clausesL, M, and N appear at level 1 therebygiving an incorrect picture of the level distribution ofclauses.

6.4. The relation partition

The reachability matrix induces a partition on the orderedpairs ofC × C into two blocksZ andZ0. An ordered pair�ci ; cj� belongs toZ if ci R*pc cj else�ci ; cj� belongs toZ0. Therelation partition is written as

p2�C × C� � �Z;Z 0�: �13�The relation partition together with the level partition can

help in hypothesising missing rules in rule-collectionR.An attempt at hypothesising missing rules was made by

Suwa et al. [4] in their rule checker program for the ONCO-CIN system—a rule-base system for clinical oncology. Therule checker supposes that there should be a rule for everycombination of values of the condition parameters of thepremises of a rule. However, this supposition results inthe rule checker program hypothesising rules that at timeshave semantically impossible combinations of conditionparameter values. But as Suwa et al. [4] note, the methodwas extremely helpful in helping them debug the developingknowledge-base.

Since in our system, clauses are boolean valuedpropositions or their negations, the method of enumer-ating rules for missing condition parameter valuecombinations does not make sense. However, if it isassumed that there exists a requirement of hypothesisingrules for every 2-combination of clauses in clausesetCand that, at the same time, do not introduce any of theproblems described in Section 5, then such rules can behypothesised, to some extent, with the help of the rela-tion and the level partition.

Initially an ordered pair inZ0 is taken as a candidate for

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336 329

Page 10: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

hypothesising a rule for inclusion in rule-collectionR10. It is

then verified that the rule hypothesised from the ordered pairdoes not fall in any of the problem categories describedbelow. On successful verification the rule is considered tobe a candidate for inclusion in rule-collectionR. The finalinclusion of the hypothesised rule inR is, however, contin-gent to its acceptance by the expert.

Let us assume, for this section, that rule-collectionR iscompletely content verified11, i.e. R has none of theproblems mentioned in Section 5. For each ordered pair�ci ; cj� [ Z 0, the ruleci ! cj is hypothesised and consideredas a candidate for inclusion inR if �ci ; cj� does not fall in anyof the following categories:

1. Circular Rule Inconsistency Category: The ordered pair�ci ; cj� belongs to this category

• if �cj ; ci� [ Z. The inclusion of the hypothesised ruleci ! cj leads to the creation of the circular clausechain,cj ;…ci , cj in a backward chaining of rules inrule-collectionR; or else

• if both �ci ; cj� and �cj ; ci� belong toZ0 and �cj ; ci� ismore likely to be accepted as a valid rule.Since forevery c [ C, the ordered pair (c,c) belong to theZblock, self-referent rules are not hypothesised.

2. Level Inconsistency Category: The ordered pair�ci ; cj�belongs to this category

• if both ci , cj [ B or both ci , cj [ L1, i.e. both theclauses are either fact clauses or goal clauses, respec-tively. In rule-collectionR a fact clause cannot be theconsequent of any rule and a goal clause cannot be apremise in the antecedent of any rule. Moreover, if

both ci andcj belong toB and the hypothesised ruleci ! cj is acceptable thencj is actually adead end IFconditionand not a fact clause. This contradicts ourassumption that rule-collectionR is completelycontent verified. Furthermore, if bothci andcj belongto L1 and hypothesised ruleci ! cj is acceptable thenci is actually anunreachable conclusionand not a goalclause. This again contradicts our assumption thatrule-collectionR is completely content verified; orelse

• if cj [ B and ci [ �C–L1–B�, i.e. clausecj is a factclause and clauseci is an intermediate clause. This isbecause a fact clause would then be the consequent inthe hypothesised rule, implying that it was actually adead end IF condition. Furthermore, as mentionedabove, clauseci cannot be a goal clause (i.e. inL1)as it would then imply that it was actually anunreach-able conclusion; or else

• if ci [ L1 andcj [ �C–L1–B�, i.e. ci is a goal clauseand cj is any intermediate clause. This is because agoal clause would then be a premise in the hypothe-sised rule implying that it was actually anunreachableconclusion. Furthermore, as mentioned above,cj

cannot be a fact clause (i.e. inB) as it would thenimply that it was andead end IF condition.

3. Contradictory Rules Inconsistency Category: Theordered pair�ci ; cj� belongs to this category

• if clausecj is the negation of clauseci . The ruleci !cj then implies a self-contradictory rule; or else

• if the inclusion of the hypothesised rule,ci ! cj , leadsto the creation of a clause chain in which either clauseci or clausecj is a negation of some other clause in theclause chain.

In both the cases backward chaining leads to contra-dictory conclusions.

4. Rule Premise Redundancy Category: The ordered pair�ci ; cj� belongs to this category, if clausesci and cj arepremises in the same rule in rule-collectionR. For exam-ple, if rule A! B is hypothesised and rule-collectionR

contains the rule A&B! C, then the two rulestautologically imply the ruleA! C. ClauseB is thus aredundant premise (this may be proved by simplyconstructing a truth table).

It is not claimed that testing for the membership ofan ordered pair, inZ0, in the above categories wouldcompletely prevent a rule from being hypothesisedwhose inclusion in rule-collection R leads toproblems. However, by not hypothesising rules fromordered pairs inZ and by not hypothesising rules thatfall in any of the above categories, most problems areavoided.

Fig. 5 illustrates rule hypothesising. In ER-BASE,rule hypothesising can proceed only after its complete

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336330

10 The very fact that ordered pairs inZ are not selected for rule hypothe-sising, rules out the possibility of the introduction of subsumption andredundancy in rule-collectionR. Furthermore, this also excludes, thoughnot completely, the possibility ofknowledge compilation[18]. An orderedpair in Z may have been transitively inferred from ordered pairs inRpc. Arule hypothesised with such an ordered pair then represents ashort cutovera collection of rules chained in backward chaining in rule-collectionR.

11 This assumption is to a large extent valid, as hypothesising rules inrule-collection with problems can only lead to more problems.

Fig. 5. Rule hypothesising: An example.

Page 11: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

content verification. Each rule that is hypothesised mustbe verified by the expert also. Such a verification is neces-sary as our rule hypothesising scheme is based on syntacticconsiderations only. However, the suggested method can bean important step in filling knowledge gaps in rule-collectionR.

6.5. The structural model

The above partitions are used to create the minimum edgeadjacency matrixM. However, sinceM is minimum edge,edges that are present in the adjacency matrixA, but not inM, have to be restored in the structural model that is derivedfrom M. Only then will the structural model be a truedigraph representation of the relationRpc in clausesetC.The interpretive structural model is derived from thecorrected structural model.

The interpretive structural model is a visual modelthat provides an insightful look at the inference struc-ture of the rule-base. For example, see Fig. 4. It ispossible to detect some of the problems, visually, inrule-collection R, by comparing the resultant interpre-tive structural model with an ideal interpretive structuralmodel. Any deviation from the ideal then implies thepossible existence of problems. This is quite obvious inthe interpretive structural model of ER-BASE in Fig. 4.The circular clause chain is clearly visible and so is thecontradictory chain of inference (also discussed in alater section).

7. Further content verification

This section describes the detection of the problems ofredundant rules, subsumed rules, conflicting rules, andunnecessary IF conditions. The no-circular-clause-chainassumption, as already stated in Section 6.1, holds goodfor the discussion in this section.

7.1. Redundancy

The detection of redundant rules in any rule-base, ingeneral, is difficult. The ordering of premises in theantecedents of redundant rules may be different and the

rules themselves may be physically placed at different loca-tions in the rule-base. However, in rule-collectionR, redun-dant rules can be detected with the help of rule matrixN andredundancy set RS.

Let rulesrk1; rk2;…; rkn [ R be redundant rules such that1 # k1 , k2 , … , kn # t. Furthermore, let the conse-quent of each of the redundant rulesrk1; rk2;…; rkn be theclausec [ C, say. It follows from Procedure 1 that

1. in redundancy set RS there exists 3-tuple�k1; kp; x� forx [ Pk1 � Pk2 �…� Pkn andp� 2;3;…; n,

2. if rk1 is the first rule in rule-order with consequent clausec then in rule matrixN we havenxc � k1 for x [ Pk1, and

3. there do not exist any of the rule indexesk2; k3;…; kn inthe column corresponding to clausec in rule matrix N.This follows as Pk1 � Pk2 �…� Pkn in redundantrulesrk1, rk2;…; rkn.

As a special case,

Lemma 7. Let rules ri , rj ;[ R, i , j, have the sameconsequent clause and let this consequent clause be c[C. Furthermore, let ri and rj be the first two rules in rule-order in rule-collectionR with clause c as their consequent.The two rules ri and rj are redundant if and only if inredundancy set RS there exists 3-tuple(i,j,x) for x [ Pi,and there does not exist an entry of rule index j in thecolumn corresponding to clause c in rule matrix N.

Proof. Let us assume that rulesri and rj are redundant.Thus Pi � Pj and by Procedure 1 it follows that in RSthere exists 3-tuple (i,j,x) for x [ Pi � Pj . SincePj 2 Pi � B, it follows from Procedure 1 that there is noclausey [ Pj for which nyc � j in N. Conversely, the exis-tence of 3-tuple (i,j,x) in RS for every clausex [ Pi impliesPi # Pj . Since the column corresponding to clausec in Ndoes not contain an entry of rule indexj and since both ruleri and rulerj have the same consequent in clausec, it impliesthat Pj # Pi . Pi # Pj andPj # Pi together implyPi � Pj .Pi � Pj andCi � Cj together imply thatri andrj are redun-dant rules. B

It may be noted that in Lemma 7 the assumption that ruleri precedes rulerj in rule-order and that the two rules are thefirst two in rule-collectionR with the same consequentclausec, always implies, by Procedure 1, that in rule matrixN we havenxc � i for x [ Pi . Lemma 7 is illustrated withthe help of an example in Fig. 6.

7.2. Subsumption

Let rulesri , rj [ R be two rules, and let ruleri subsumerule rj . From the definition of subsumption we know thatPi , Pj and the consequent clause of both the rulesri andrj

is the same. Now letri precederj in rule-order in rule-collectionR. It follows from Procedure 1 that in redundancyset RS there exists 3-tuple (i,j,x) for x [ Pi , and there exists

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336 331

Fig. 6. Illustration of Lemma 7.

Page 12: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

at least one clause, sayb [ Pj , for which the 3-tuple (i,j,b)does not belong to RS.

As a corollary to Lemma 7, there can be two cases. Theseare as follows.

Corollary 4 (of Lemma 7). Let rules ri , rj [ R, i , j,have the same consequent clause and let this consequentclause be c[ C. Furthermore, let ri and rj be the firsttwo rules in rule-order in rule-collectionR with clause cas their consequent. Rule ri subsumes rule rj if and only if inredundancy set RS there exists 3-tuple(i,j,x) for x [ Pi , andin rule matrix N we have nyc � j for y [ Pj 2 Pi wherePj 2 Pi ± B.

Corollary 5 (of Lemma 7). Let rules ri , rj [ R, i , j,have the same consequent clause and let this consequentclause be c[ C. Furthermore, let ri and rj be the firsttwo rules in rule-order in rule-collectionR with clause cas their consequent. If rule rj subsumes rule ri , then

1. in rule matrix N we have nxc � i for x [ Pi ,2. there is no entry of j in the column corresponding to

clause c in N,3. in redundancy set RS there exists 3-tuple(i,j,y) for

y [ Pj , and4. there exists at least one clause, say z[ Pi , such that

(i,j,z) Ó RS.

The proofs of the above corollaries follow from the proofof Lemma 7. Corollary 4 is applicable to the example ER-BASE. The rule matrixN for ER-BASE (see Fig. 2) has theentries of 1 and 2 in the column of clauseB, and (1,2,A)[RS. Both the rules, 1 and 2, have a common premise inclauseA and concludeB, rule 2 has an additional premisein clauseC, giving nCB� 2, and is thus subsumed by rule 1.

7.3. Conflicts

Throughout the discussion in this section, in addition to theno-circular-clause-chain assumption, it is also assumed thatthere are no conciseness problems in rule-collectionR.Conflicts may then be detected as follows:

1. Self-Contradictory Rule:Let rule rk [ R be a self-contradictory rule and let clausec [ C be its consequentclause. Since rulerk is self-contradictory, there existsclauseb [ Pk such thatc�: b. From Procedure 1 itfollows that ordered pair (b,k) exists in conflict set CS.Furthermore, if rulerk is the first rule in rule-order inrule-collectionR with consequent clausec, thennbc �k in rule matrixN. It may be noted in the above case, thatif the no conciseness problem assumption is relaxed andif rule rk is the first rule in rule-order in rule-collectionRwith consequent clausec and rulerm, m . k, is redundantwith rule rk, then by Procedure 1 it follows that theordered pair (b,m) also exists in conflict set CS, and 3-tuple (k,m,b) exists in redundancy set RS.

2. Self-Contradictory Clause Chain:Let x1; x2;…; xk,k . 2, be a clause chain formed in a backward chainingof rules in rule-collectionR and let xk �: x1, i.e. theclause chainx1; x2;…; xk is a self-contradictory clausechain. Then,

• it follows that in the relation partition,p1�C × C� (seeSection 6.4),�x1; xk� [ Z. Furthermore, there exists apath from clausex1 to clausexk in the interpretivestructural model; and

• if there is no self-contradictory rule in rule-collectionR with clausex1 as a premise and clausexk as theconsequent, then from Procedure 1 it follows thateither ordered pair (x1,0) or else (xk,0) exists inconflict set CS.

3. Directly Contradictory Rules: Let rules ri , rj [ R betwo directly contradictory rules. From definition ofdirectly contradictory rules we havePi � Pj and theconsequent clause ofri , say clausea [ C, is thenegation of the consequent clause of ruler j, sayclause b [ C. Now, let us assume thatri is thefirst rule in rule-order in rule-collectionR with conse-quent clausea, andrj is the first rule in rule-order in rule-collection R with consequent clauseb. It follows fromProcedure 1 that

• in rule matrixN we havenxb � j for x [ Pi , andnya �i for y [ Pj , and

• either one of the following is applicable:

(a) If no self-contradictory rule exists inR that is self-contradictory in clausea and clauseb, then either(a,0) or else (b,0) exists in conflict set CS.(b) If there exists a self-contradictory rulerk in R thatis self-contradictory in clausea and clauseb theneither (a,k) or else (b,k) exists in conflict set CS(depending on which clause is in the premise of theself-contradictory rulerk).

It is also possible to detect conflicts in a visual presentationof the interpretive structural model. For example, a self-contradictory clause chain can be detected by tracing clausechains in the presentation. Furthermore, the knowledgeengineer can look for certain graph structures, in thepresentation, to detect possible directly contradictoryrules, e.g. see Fig. 7.

In ER-BASE, clausesA,B,D constitute a contradictoryclause chain in a backward chaining of the rules 1, and 3as well as the rules 2 and 3. It can be seen that (A,0) [ CS,and there exists a path from clauseA to clauseD (� : A) inthe interpretive structural model of Fig. 4.

7.4. Unnecessary IF conditions

Let rulesri , rj [ R, i , j, be two rules with unnecessaryIF conditions. From the definition of unnecessary IF condi-tions, ri and rj each have a clause, say clausea [ Pi andclauseb [ Pj , respectively, such thata�: b. Furthermore,

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336332

Page 13: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

rules ri and rj have the same consequent clause, andPi 2{ a} � Pj 2 { b} (assumed here to be nonempty). It thenfollows from Procedure 1 that in redundancy set RS thereexists 3-tuple (i,j,x) for x [ Pi 2 { a} � Pj 2 { b}, andeither one of the following is applicable:

1. If no self-contradictory rule exists inR that is self-contradictory in clausea and clauseb then either (a,0)or else (b,0) exists in conflict set CS.

2. If there exists a self-contradictory rulerk in R with clausea as its premise and clauseb as its consequent, say, thenordered pair (a,k) exists in conflict set CS.

A corollary to Lemma 7 is now stated as a particular case:

Corollary 6 (of Lemma 7). Let rules ri , rj [ R, i , j,have the same consequent clause and let this consequentclause be c[ C. Furthermore, let ri andrj be the first tworules in rule-order in rule-collectionR with clause c as theirconsequent. If rules ri andrj have an unnecessary IF condi-tion in clause a and clause b respectively, say, andPi 2 { a} � Pj 2 { b} ± B, then in redundancy set RSthere exists 3-tuple(i,j,x) for x [ Pi 2 { a} � Pj 2 { b}, inrule matrix N: nyc ± j for y [ Pj 2 { b}, nzc � i for z [ Pi ,and the only entry of j in the column corresponding to clausec is in nbc.

8. Another example in content verification

Let us suppose that a rule-base for a backward chainingexpert system, which explains the behaviour of a simpledoor latch [19], as depicted in Fig. 8(a), is under develop-ment. Such a system could later be used to precipitate acausal network for deep reasoning in an model basedreasoning system [18]. In the operation of the door latch,as the door is pushed in from the left side of the figure, thelocking arm moves up and compresses the spring. When thedoor is fully in, the arm falls back into the slot in the wedgeof the door. To open the latch, you either press the mechan-ical knob or the electrical switch.

In a high level specification of the rule-base, rules may bedescribed to encapsulate the behaviour of this device, asshown in Fig. 8(b), with the goal of establishing the truthof door_can_move. Rule 9 is added redundantly. Rule 14may get added as the behaviour of the latch suggests that

locking_arm_up implies door_can_move and also door_-can_move implies locking_arm_up. Rule 13 may havebeen added erroneously and is self-referent. Rule 10 mayhave been added to emphasise that spring_compressed isenough for locking_arm_up and rule 12 to emphasise thatboth door_push and spring_compressed together also implylocking_arm_up.

Fig. 9(a) shows the interpretive structural model for thisinitial set of rules. The important partitions are as follows:p1 � [L1� {door_can_move, locking_arm_up, core_mag-netised, NOT core_magnetised}, …, L5];p4(L1) � [I �{core_magnetised, NOT core_magnetised}, S� {door_-can_move, locking_arm_up}];p5(S) � [{door_can_move,locking_arm_up}]. Clearly, there is a maximal cycle set atlevel 1 and the errant rules are identified to be rule 5 and rule14 from the rule matrix. Since rule 5 captures the behaviourof the latch appropriately, we retain it and delete rule 14from the rule-base. Since, in the rule matrix, the diagonalentry corresponding to clause knob_down is the rule number13, rule 13 is deleted from the rule-base. With all circularityeliminated, we can now reconstruct the rule matrix andproceed further.

Fig. 10 shows the rule matrix, redundancy set, conflict set,and the various partitions induced by the reachability matrixfor the rule-base with rules 1–12 of Fig. 8(b). Fig. 9(b)shows the interpretive structural model for the same.Since the goal is to establish the truth of door_can_move,block L1 of partitionp1 clearly shows that NOT core_mag-netised and core_magnetised are unreachable conclusions.A missing rule is identified is:IF core_magnetised THEN

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336 333

Fig. 7. Directly contradictory rules.

Fig. 8. A door latch system.

Page 14: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

locking_arm_up. That there are missing rules is also identi-fiable in the separate parts partition,p3, as there are twoblocks in the partition whereas the goal for the system isonly one. Checking for redundancy, we find that theredundancy set records a redundancy in rule 2 and rule 9in clause knob_press. These rules have the conclusionknob_down and are the first two rules in the rule-basewith that conclusion. In the redundancy set there is onlyone 3-tuple, with rule number 2 and rule number 9, (2, 9,knob_press). Furthermore, in the rule matrix there is onlyone entry of rule number 2 in the column of knob_down andno entry of rule number 9. Thus according to Lemma 7, rule2 and rule 9 are redundant and rule 9 must be deleted fromthe rule-base.

As per the redundancy set, rules 4, 10, and 12 areredundant in clause spring_compressed. Rule 4 has noother premise besides spring_compressed. This is knownas rule number 4 occurs once in the column of lock-ing_arm_up and does not occur in the redundancy setwith any other premise besides spring_compressed. Inrule 10 there is a premise NOT door_push and (4,10,NOT door_push) is not in the redundancy set. Hencerule 4 subsumes rule 10. Rule 4 also subsumes rule 12as rule 12 has an additional premise in door_push.Similarly, rule 6 also subsumes rule 12 as rule 12 hasan additional premise in spring_compressed. On exam-ining rule 10 and rule 12, since there is an entry in the

redundancy set of (10, 12, spring_compressed), we seethat they satisfy the conditions for unnecessary IF condi-tions (see Section 7.4). In first eliminating the unnecessaryIF conditions NOT door_push and door_push, we find thatthe two rules 10 and 12 become completely redundant withrule 4. Hence rule 10 and rule 12 are deleted from the rule-base. In doing so we eliminate all conciseness problemssince we have now accounted for all entries in the redun-dancy set.

The presence of (coil_magnetised, 0) in the conflict setand an examination of the rules that have core_magnetisedand NOT core_magnetised as a premise or conclusionshows that rule 8 and rule 11 satisfy all the conditions fordirectly contradictory rules (see Section 7.3). Since rule 11is in error we delete it from the rule-base.

Fig. 9(c) shows the interpretive structural model of therule-base after the addition of the missing rule and the dele-tion of the rules as suggested above. The interpretivestructural model clearly depicts the inference structure ofthe rule-base. In this example the model also shows causalconnections which can be used for deep reasoning [18].

9. An informal summary of the proposed verificationapproach

The approach assumes the following essential character-istics of the RBS:

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336334

Fig. 9. Interpretive structural models.

Fig. 10. Rule-base representations.

Page 15: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

1. A rule in the rule-base is of the IF–THEN form, in whichthe rule antecedent is a conjunction of distinct, andfinitely many (at least one), clauses (atomic propositionsor their negations) and the consequent is a single clause,which is a restriction.

2. The use of rules of the disjunctive form is explicitlydisallowed.

3. Rules are strictly deterministic in nature and do notinvolve any probabilities.

4. Inferencing is through backward chaining.5. Rules are numbered, beginning with ‘1’, which reflects

an ordering among the rules as defined by their physicalorder in the rule-base.

Given these characteristics of the rule-based system, in theapproach, content verification of a rule-base is integratedinto the framework of modelling and model property iden-tification. The basic steps are:

1. Representation of the rule-base: This step involves theconstruction of (i) a rule matrix which records the exis-tence of a premise-conclusion relation (pc-relation) in aclause pair, as the rule number of the first rule in which itis observed, (ii) a redundancy set that keeps an account ofrules that are redundant in any premise-conclusion pair,(iii) a conflict set which keeps a record of rules that havea conflicting premise and conclusion and also the exis-tence of conflicting clauses in the rule-base that are notpc-related, and (iv) a clause adjacency matrix which isderived from the rule matrix and which represents the pc-relation. These representations are necessary to record allrelevant information, pertaining to the rule-base, for thepurpose of content verification.

2. Development of the reachability matrix: This matrix,which is derived from the adjacency matrix, makes expli-cit all clause reachabilities that are obtained in a chainingof rules.

3. Identification of various partitions induced by the reach-ability matrix on the set and subsets of the set of clausesin the rule-base and then using them for content verifica-tion. These partitions are:

(i) The level partition: This partition makes explicit thedistribution of clauses across levels as defined by thepc-relation. Since circularity problems corrupt thispartition, we assume, as a first step in verification,that circularity is eliminated. This can be done withthe help of partitions described in (iii) below. Subse-quently, the level partition can be used to eliminatedead end IF conditions, dead end goals and unreachableconclusions.(ii) The separate parts partition: This partition identifiesdisjoint sets of clauses that are not pc-related, directlyor indirectly. Disjointness of rule sets can be used toaddress completeness in the form of missing rules, andidentify stand alone, single clause, self-referent rules.(iii) (a) The disjoint and the strong subsets partition of

each level identified in (i), and (b) the stronglyconnected subsets partition as per identification in (a):These partitions help identify and eliminate circularityin the rule-base.(iv) The relation partition: In a content verified rule-base, this partition is used in conjunction with the levelpartition to hypothesise missing rules which if intro-duced in the rule-base do not precipitate any contentproblems. Inclusion of an hypothesised rule is,however, contingent to its acceptance by the expert.

4. Development of the interpretive structural model of therule-base: A minimum edge matrix is first derived fromthe adjacency matrix, described in step 1 above, which isfollowed by the development of a visual structuralmodel. Since the structural model is minimum edge,clause adjacency edges that are subsumed are firstrestored and then its vertices are interpreted as clausesto obtain the interpretive structural model. The interpre-tive structural model is a visual model that provides aninsightful look at the inference structure of the rule-base.Some of the content problems can also be detected,visually, in the model.

5. Further content verification: Assuming that there are nocircularity problems, the rule-base representations devel-oped through step 1 can be used effectively to detect theproblems of redundant rules, subsumed rules, and unne-cessary IF conditions. Further assuming that there are noconciseness problems, the rule representations can alsobe used to detect conflicts in the rule-base.

10. Conclusion

This paper has analytically examined the application of adigraph-based modelling approach to the content verifica-tion of a specific type of rule-base. In the beginning basicmodelling concepts, i.e. the set of clauses which make upthe rules in the rule-base, and the pc-relation (premise–conclusion relation) which is defined in the set of clauses,are developed. A modelling process in then defined not onlyto develop a digraph model of the rule-base, but also todevelop other rule-base representations to keep track ofrules that have common premises and consequent, and tokeep track of rules with conflicting premises and conse-quent. Through various partitions induced by the reachabil-ity matrix, which is derived from the pc-relation set, on theset and subset of the set of clauses, it is shown that problemsin completeness can be formally detected. Furthermore, it isshown that the various rule-base model representations canbe used to detect problems in conciseness and consistency.Although no exact procedures are described to detectproblems, the analytic formulations provide a necessaryand sufficient basis for the development of such procedures.

It had been our objective to develop a strong theorem,using the various lemmas put down in this paper, that would

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336 335

Page 16: Rule-base content verification using a digraph-based ... · by the rule-based system depends not only on the appropri-ateness and comprehensiveness of knowledge encoded in the rule-base,

lay claim to the completeness of the modelling method vis-a-vis content verification. However, the development ofsuch a theorem, as is obvious from the presented work,needs further research.

References

[1] Bruno G, Bruno G, Laface P. A rule-based system to schedule produc-tion. IEEE Computer 1986;July:32–40.

[2] Molina A, et al. Review of computer-aided simultaneous engineeringsystems. Research in Engineering Design 1995;7:38–62.

[3] Guida G, Mauri G. Evaluating performance and quality of knowl-edge-based system: foundation and methodology. IEEE Transactionson Knowledge and Data Engineering 1993;5(2):204–224.

[4] Suwa M, Scott AC, Shortliffe EH. An approach to verifying consis-tency and completeness in a rule based system. In: Buchanan BG,Shortliffe EH, editors. Rule based expert systems, Reading, MA:Addison-Wesley, 1984.

[5] Nguyen TA, Perkins WA, Laffey TJ, Pecora D. Knowledge-baseverification. AI Magazine 1987;8(2):69–75.

[6] Polat F, Guvenir HA. UVT: a unification-based tool for knowledge-base verification. IEEE Expert 1993;June:69–75.

[7] Nazareth DL. Investigating the applicability of petri nets for rule-based system verification. IEEE Transactions on Knowledge andData Engineering 1993;5(3):402–415.

[8] Zhang D, Nguyen D. PREPARE: a tool for knowledge-base verifica-tion. IEEE Transactions on Knowledge and Data Engineering1994;6(6):983–990.

[9] Davis R. Interactive transfer of expertise. In: Buchanan BG, ShortliffeEH, editors. Rule based expert systems, Reading, MA: Addison-Wesley, 1984. pp. 171–205.

[10] Buchanan BG, Shortliffe EH, editors. Rule based expert systemsReading, MA: Addison-Wesley, 1984.

[11] Suwa M, Scott AC, Shortliffe EH. An approach to verifying consis-tency and completeness in a rule based system. AI Magazine1982;3(4):16–21.

[12] Nguyen TA. Verifying consistency of production systems. Proceed-ings of the Conference on Artificial Intelligence Applications1987:4–8.

[13] Cragun B, Steudel HJ. A decision-table-based processor for checkingcompleteness and consistency in rule-based expert systems. Interna-tional Journal of Man–Machine Studies 1987;26(2):633–648.

[14] Sage AP. Methodology for large scale systems. New York: McGraw-Hill, 1977.

[15] Warfield JN. Societal systems: planning, policy and complexity. NewYork: Wiley–Interscience, 1976.

[16] Fejer PA, Simovici DA. Mathematical foundations of computerscience, volume I: sets, relations, and induction. New York: Springer,1991.

[17] Perkins WA, Laffey TJ, Pecora D, Nguyen TA. Knowledge baseverification. In: Guida G, Tasso C, editors. Topics in expert systemdesign, Amsterdam: Elsevier Science, North Holland, 1989. pp. 363–376.

[18] Steels L. Second generation expert systems. Future generationcomputer systems 1985;1(4):213–221.

[19] Sasikumar M, Ramani S, Muthu Raman S, Anjaneyulu KSR,Chandrashekhar R. Rule based expert systems. New Delhi: Narosa,1993.

G.S. Gursaran et al. / Artificial Intelligence in Engineering 13 (1999) 321–336336