Keywords

1 Introduction

Intellectual decision making systems (IDMS) are used in wide range of areas: industry, medicine, research activities, education, classification tasks including critical areas. It demands reliability of making decisions by these systems what depends on all components of the IDMS. Methods and algorithms of improvement of the reliability of the software and hardware components are well developed but providing of the quality of the knowledge base (KB) is still a problem which has not been solved yet. Methods of knowledge bases (KB) debugging are still not formalized. Algorithms of the traditional software debugging cannot be used for the knowledge bases and most of the developers use expert approach for the debugging of the knowledge bases.

Quality of KB is a multi-criteria problem, there are different approaches for the checking of the correctness and completeness including methods of detecting of various types of errors [1,2,3,4,5,6,7], but debugging of the KB is still considered to be the most complicated stage of the IDMS development. There are errors in the knowledge base which are connected with the inconsistency of the knowledge area – for example, errors of forgetting-about-the-exception type [2] and which can be detected by the testing only. At the same time, so called, structural errors can be detected and deleted from the KB on the stage of the static debugging (the formal checking of the KB) which does not demand the running of the intellectual system.

The absence of the structural errors does not guarantee the absence of the errors connected with the inconsistency of the knowledge area but it increases the effectiveness of the decision making due to the reducing of the solution time, so the first necessary step of the debugging of the KB is the formal checking (static analysis).

In the papers [3,4,5,6,7] several structural errors in the KB and algorithms for their detecting are described but no errors formalization has been made and the current paper accumulates full information on structural errors and provides formal models of the errors which can be used as a basis for automatic verification of knowledge bases structure.

2 Formal Models of Structural Errors of the Rule-Based Knowledge Base

Rules are widely used for representing of the knowledge bases of intellectual decision making systems. Rule-based knowledge base is set as:

$$ P\, = \,\left( {F,\,R,\,G,\,C,\,I} \right) , $$
(1)

where F is a finite set of the facts in the concrete field about the problem.

R – a set of rules where

$$ r_{m} :IF\,f_{i} \,and\,f_{j} \ldots \,and\,f_{n} \,then\,f_{k} , $$
(2)

G – set of goals or the IDMS terminal facts; C is the set of the permitted combination of the facts; I – the interpreter of the rules, realizes the goal solution.

Let S is the set of input facts, i.e. facts specified by the user in the input of the intellectual system. \( S \subset F \).

The logic of the knowledge base can be presented by the AND/OR graph. For example, let’s build AND/OR graph for a set of the following rules:

  • \( r_{1} :\,if\,s_{1} \,and\,s_{2} ,\,then\,f_{1} ; \)

  • \( r_{2} :\,if\,s_{2} \,and\,s_{3} ,\,then\,f_{2} ; \)

  • \( r_{3} :\,if\,s_{3} \,and\,s_{4} \,and\,s_{5} ,\,then\,f_{3} ; \)

  • \( r_{4} :\,if\,f_{1} ,\,then\,g_{1} ; \)

  • \( r_{5} :\,if\,f_{2} \,and\,f_{3} ,\,then\,g_{2} . \)

Figure 1 provides an example of AND/OR graph, where:

Fig. 1.
figure 1

AND/OR graph example

  • \( s_{1} ,\,s_{2} ,\,s_{3} ,\,s_{4} ,\,s_{5} \, \in \,S;\,f_{1} ,\,f_{2} ,\,f_{3} \, \in \,F;\,r_{1} ,\,r_{2} ,\,r_{3} ,\,r_{4} ,\,r_{5} \, \in \,R;g_{1} ,\,g_{2} \, \in \,G. \)

Rule \( r_{i} \) as

$$ r_{i:} \,{\text{if}}\,f_{{r_{\text{i}} 1}} \,{\text{and}}\,f_{{r_{\text{i}} 2}} \, \ldots f_{{r_{\text{i}} n}} ,\,{\text{then}}\,f_{{r_{\text{i}} m}} $$

can be represented as a pair \( {\text{r}}_{\text{i}} = (D_{{r_{\text{i}} }} ;\,Q_{{r_{\text{i}} }} ) \), where \( D_{{r_{\text{i}} }} = \left\{ {f_{{r_{\text{i}} 1}} ,\,f_{{r_{\text{i}} 2}} ,\, \ldots f_{{r_{\text{i}} n}} } \right\} \) and \( Q_{{r_{\text{i}} }} = \left\{ {f_{{r_{\text{i}} m}} } \right\} \). \( Q_{{r_{\text{i}} }} \) has a single element, henceforward defined as \( q_{{r_{\text{i}} }} \).

Let L is a set of inference chains.

Definition 1.

An inference chain l i – is a sequence of rules \( (r_{{l_{\text{i}} 1}} ,\,r_{{l_{\text{i}} 2}} ,\, \ldots ,r_{{l_{\text{i}} n}} ) \), if \( \forall r_{{l_{\text{i}} k}} ,\,r_{{l_{\text{i}} \left( {k + 1} \right)}} \,,\,q_{{r_{{l_{i} k}} }} \, \in \,\,D_{{r_{{l_{i} \left( {{\text{k}} + 1} \right)}} }} \), where \( k = 2, \ldots ,\,\left( {n - 1} \right) \).

Then, the graph on Fig. 1 has \( L = \left\{ {l_{1} ,\,l_{2} ,\,l_{3} ,\,l_{4} ,\,l_{5} ,\,l_{6} ,\,l_{7} ,\,l_{8} } \right\} \), where

  • \( {l_1} = \,\textit{(} {r_1} \textit{)};\,{l_2} = \,\textit{(} {r_2} \textit{)};{l_3} = \,\textit{(} {r_3} \textit{)};{l_4} = \,\textit{( }{r_4} \textit{)};{l_5} = \,\textit{(} {r_5}\textit{)}; {l_6} = \,\textit{(} {{r_{1,}}{r_4}} \textit{)};{l_7} = \,\textit{(} {{r_2},\,{r_5}} \textit{)};{l_8} = \,\textit{(} {{r_3},\,{r_5}} \textit{)}. \)

Definition 2.

The start of inference chain l i as \( (r_{{l_{\text{i}} 1}} ,\,r_{{l_{\text{i}} 2}} ,\, \ldots ,\,r_{{l_{\text{i}} n}} ) \), is a set of the facts in condition of the first rule of the chain, \( D_{{l_{i} }} = \,D_{{r_{{l_{i} 1}} }} \).

Definition 3.

The end of inference chain l i as \( (r_{{l_{\text{i}} 1}} ,\,r_{{l_{\text{i}} 2}} , \ldots ,\,r_{{l_{\text{i}} n}} ) \) is a result of the last rule of the chain, \( Q_{{l_{i} }} = \,Q_{{r_{{l_{i} n}} }} \).

Definition 4.

Structural error in the rule-based system is an error which can be detected during AND/OR graph analysis. Knowledge base which doesn’t have any structural errors is considered as a statically correct one.

The classification of structural errors is provided in Fig. 2.

Fig. 2.
figure 2

Structural errors classification

2.1 Redundancy Errors

2.1.1 Duplicates

Definition 5.

Rules r i and r j are considered as duplicates, if \( D_{{r_{\text{i}} }} \cap D_{{r_{j} }} \, \ne \,\emptyset \) and \( q_{{r_{\text{i}} }} \, = q_{{r_{\text{j}} }} \).

There are three types of duplicates:

  • inclusive duplicates;

  • complete duplicates;

  • incomplete duplicates.

Definition 6.

Rules r i and r j are considered as inclusive duplicates, if \( D_{{r_{\text{i}} }} \subset D_{{r_{j} }}\,.\,D_{{r_{\text{i}} }}\,\ne\,D_{{r_{\text{j}} }} \) and \( q_{{r_{\text{i}} }} = q_{{r_{j} }} \), r i is defined as included one in this case.

Rules r 1 and r 2 in the Fig. 3. are inclusive duplicates:

  • \( r_{1} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{4} ; \)

  • \( r_{2} :\,if\,f_{1} \,and\,f_{2} \,and\, \, f_{3} ,\,then\,f_{4} ; \)

  • \( D_{{r_{1} }} = \left\{ {f_{1} ,\,f_{2} } \right\};\quad D_{{r_{2} }} = \left\{ {f_{1} ,\,f_{2} ,\,f_{3} } \right\};\quad D_{{r_{1} }} \,\&\,D_{{r_{2} }} \)

  • \( q_{{r_{1} }} = \,f_{4} ;\quad q_{{r_{2} }} = \,f_{4} ; \)

Fig. 3.
figure 3

Inclusive duplicates

The solution to correct inclusive duplicates error is to remove all duplicating rules except included one.

Definition 7.

Rules r i and r j are considered as complete duplicates, if \( D_{{r_{\text{i}} }} = D_{{r_{\text{j}} }} \) and \( q_{{r_{\text{i}} }} = q_{{r_{j} }} \).

Rules r 1 and r 2 in the Fig. 4. are complete duplicates:

  • \( r_{1} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{3} ; \)

  • \( r_{2} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{3} ; \)

Fig. 4.
figure 4

Complete duplicates

The solution to correct complete duplicates error is to remove all duplicating rules except one.

Definition 8.

Rules r i and r j are considered as incomplete duplicates, if \( D_{{r_{\text{i}} }} \cap D_{{r_{j} }} \, \ne \,\emptyset \), \( q_{{r_{\text{i}} }} = q_{{r_{\text{j}} }} \), \( D_{{r_{\text{i}} }} \backslash D_{{r_{j} }} \, \ne \,\emptyset \) and \( D_{{r_{\text{j}} }} \backslash D_{{r_{\text{i}} }} \, \ne \,\emptyset \).

The Fig. 5. provides an example of incomplete duplicates:

  • \( r_{1} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{4} ; \)

  • \( r_{2} :\,if\,f_{2} \,and\,f_{3} ,\,then\,f_{4} ; \)

  • \( D_{{l_{1} }} \cap D_{{l_{2} }} = f_{2} ; \)

Fig. 5.
figure 5

Incomplete duplicates

There is no single solution for correcting incomplete duplicates errors, so the concrete decision on the way of the improvement of the KB and correctness the error should be made by the expert in each particular case.

2.1.2 Redundant Inference Chains

Definition 9.

An inference chain l i is as considered redundant, if \( q_{{l_{\text{i}} }} \notin \,G \) and ¬Ǝl j , where \( q_{{l_{\text{i}} }} \, \in \,D_{{l_{\text{j}} }} \) and \( q_{{l_{\text{j}} }} \, \in \,G \).

The Fig. 6 provides an example of redundant inference chain \( {-}l_{1} = \,\left( {r_{1} ,\,r_{2} } \right) \), where:

  • \( r_{1} :\,if\,s_{1} \,and\,s_{2} ,\,then\,f_{2} ; \)

  • \( r_{2} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{3} ; \)

  • \( q_{{l_{1} }} = f_{3} ;\,f_{3} \notin \,G; \)

Fig. 6.
figure 6

Redundant inference chain

Redundant inference chains can be removed from a knowledge base.

2.1.3 Insignificant Inference Chains

Definition 10.

An inference chain l i as \( (r_{{l_{\text{i}} 1}} ,\,r_{{l_{\text{i}} 2}} ,\, \ldots ,\,r_{{l_{\text{i}} n}} ) \) is considered as insignificant one, if \( \forall \,r_{{l_{\text{i}} j}} ,\,\left| {D_{{r_{{{\text{l}}_{i} j}} }} } \right| = 1 \), where \( j = 1,\, \ldots ,\,n \).

\( l_{1} = \,\left( {r_{1} } \right) \) in the Fig. 7. is an insignificant inference chain:

  • \( D_{{r_{1} }} = \,\left\{ {f_{1} } \right\};\quad \left| {D_{{r_{1} }} } \right| = 1; \)

Fig. 7.
figure 7

Insignificant inference chain

There are two types of insignificant inference chains:

  • explicit chains;

  • implicit chains.

Definition 11.

An insignificant inference chain l i is as considered explicit one, if Ǝr j , where \( r_{j} = (D_{{l_{\text{i}} }} ;\,Q_{{l_{\text{i}} }} ) \).

The Fig. 8 provides an example of explicit insignificant inference chain \( l_{1} = \,\left( {r_{2} ,\,r_{3} } \right) \), where:

  • \( r_{2} :\,if\,f_{3} ,\,then\,f_{4} ; \)

  • \( r_{3} :\,if\,f_{4} ,\,then\,f_{5} ; \)

  • \( D_{{l_{1} }} = \,\left\{ {f_{3} } \right\};q_{{l_{1} }} = \,\left\{ {f_{5} } \right\}; \)

  • And the rule \( r_{5} = \left\{ {D_{{l_{1} }} ;\,q_{{l_{1} }} } \right\} \) exists.

Fig. 8.
figure 8

Explicit insignificant inference chain

The solution is to remove explicit insignificant inference chain.

Definition 12.

An insignificant inference chain l i is as considered implicit one, if ¬Ǝr j where \( r_{j} = (D_{{l_{i} }} ;\,Q_{{l_{i} }} ) \).

The Fig. 9. provides an example of implicit insignificant inference chain \( l_{1} = \left( {r_{2} ,\,r_{3} } \right) \), where:

  • \( r_{2} :\,if\,f_{3} ,\,then\,f_{4} ; \)

  • \( r_{3} :\,if\,f_{4} ,\,then\,f_{5} ; \)

  • \( D_{{l_{1} }} = \,\left\{ {f_{3} } \right\};q_{{l_{1} }} = \,\left\{ {f_{5} } \right\};r_{5} = \left\{ {D_{{l_{1} }} ;\,q_{{l_{1} }} } \right\} \)

  • And the rule \( r_{k} = \left\{ {D_{{l_{1} }} ;\,q_{{l_{1} }} } \right\} \) doesn’t exist.

Fig. 9.
figure 9

Implicit insignificant inference chain

An implicit insignificant inference chain is not a critical one for the knowledge base, but it allows optimization by transforming to the preceding or succeeding rule.

Definition 13.

Transforming to the preceding rule r n of the insignificant inference chain l i where \( q_{{r_{\text{n}} }} \in D_{{l_{\text{i}} }} \), is a creation of a rule r m , where \( r_{m} = (D_{{r_{n} }} ;\,Q_{{l_{i} }} ) \), and deletion of l i and r n from the knowledge base.

The transformation to the preceding rule of the insignificant inference chain in the Fig. 9 is shown in the Fig. 10. A new rule r 5 has been added:

  • \( r_{5} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{5} ; \)

Fig. 10.
figure 10

Transforming to the preceding rule

Definition 14.

Transforming to the succeeding rule r n of the insignificant inference chain l i where \( q_{{l_{\text{i}} }} \in D_{{r_{\text{n}} }} \), is a creation of the rule r m , where \( r_{m} = ((D_{{r_{n} }} - \,q_{{l_{i} }} )\, \cup \, D_{{l_{i} }} ;\,Q_{{r_{n} }} ) \), and deletion of l i and r n from the knowledge base.

The transformation to the succeeding rule of the insignificant inference chain in the Fig. 9 is shown in the Fig. 11. A new rule r 5 has been added:

  • \( r_{5} :\,if\,f_{3} \,and\,f_{6} ,\,then\,f_{7} ; \)

Fig. 11.
figure 11

Transforming to the succeeding rule

2.1.4 Incorrect Inference Chains

There are two types of incorrect inference chains:

  • redundant for input;

  • redundant for output.

Definition 15.

An inference chain li is considered as redundant for input one, if \( D_{{l_{\text{i}} }} \cap G \ne {\emptyset } \).

The Fig. 12 provides an example of a redundant for input inference chain \( l_{1} = \left( {r_{1} } \right) \), where:

  • \( r_{1} :\,if\,g_{1} \,and\,f_{1} ,\,then\,f_{2} ;\,g_{1} \, \in \,G \)

Fig. 12.
figure 12

Inference chain redundant for input

The solution is to remove the inference chain redundant for input.

Definition 16.

An inference chain l i is considered as redundant for output one, if \( q_{{l_{\text{i}} }} \in S \).

The Fig. 13. provides an example of a redundant for output inference chain \( l_{1} = \left( {r_{1} } \right) \), where:

  • \( r_{1} :\,if\,f_{1} \,and\,f_{2} ,\,then\,s_{1} ;s_{1} \, \in \,S. \)

Fig. 13.
figure 13

Inference chain redundant for output

The solution is to remove the inference chain redundant for output one.

2.1.5 Cycles

Definition 17.

An inference chain l i is considered as a cycle, if \( q_{{l_{\text{i}} }} \in D_{{l_{\text{i}} }} \).

The Fig. 14. provides an example of a cycle \( l_{1} = \left( {r_{1} ,\,r_{2} ,\,r_{3} } \right) \), where:

  • \( r_{1} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{3} ; \)

  • \( r_{2} :\,if\,f_{3} \,and\,f_{4} ,\,then\,f_{5} ; \)

  • \( r_{3} :\,if\,f_{5} \,and\,f_{6} ,\,then\,f_{2} ; \)

  • \( D_{{l_{1} }} = \,\left\{ {f_{1} ,\,f_{2} } \right\};\,q_{{l_{1} }} = \left\{ {f_{2} } \right\};\,q_{{l_{1} }} \in D_{{l_{1} }} ; \)

Fig. 14.
figure 14

Cycle

Any cycle discovered in the knowledge base is a structural error, but incorrect rule cannot be selected automatically, so an expert should choose what rule to be removed from the KB.

Definition 18.

A rule r i is considered as a simple cycle, if \( q_{{r_{\text{i}} }} \in D_{{r_{\text{i}} }} \)

The rule r 1 in the Fig. 15 provides an example of a simple cycle:

  • \( r_{1} :\,if\,f_{1} \,and\,f_{2} ,\,then\,f_{1} ; \)

Fig. 15.
figure 15

Simple cycle

A simple cycle should be removed from the knowledge base.

2.2 Incompleteness Errors

2.2.1 Isolated Vertices

Definition 19.

A vertex \( f_{i} \in F \cup G \) is considered isolated, if ¬Ǝr j , where \( f_{i} \in D_{{r_{\text{j}} }} \) or \( f_{i} \in Q_{{r_{\text{j}} }} \).

The vertex g 1 in the Fig. 16 is an isolated one, because there is no rule connected to it.

Fig. 16.
figure 16

Isolated vertex

The correction depends on type of the vertex. If the isolated vertex is an input fact or a goal, the solution is to add rules by the expert. Otherwise the vertex should be removed from the knowledge base.

2.3 Inconsistency

C is a set of allowed combinations of facts, so \( c_{i} = \left\{ {f_{{c_{\text{i}} 1}} ,\,f_{{c_{\text{i}} 2}} ,\, \ldots ,\,f_{{c_{\text{i}} n}} } \right\} \).

2.3.1 Conflicting Inference Chains

Definition 20.

Inference chains li and lj are considered as conflicting ones, if Ǝ \( f_{k} \), where \( f_{k} \in D_{{l_{\text{i}} }} \) and \( f_{k} \in D_{{l_{\text{j}} }} \), and ¬Ǝc m , where \( q_{{l_{\text{i}} }} \in c_{m} \) and \( q_{{l_{j} }} \in c_{m} \).

There are inference chains \( l_{1} = \,\left( {r_{1} ,\,r_{2} } \right)\,{\text{and}}\,l_{2} = \,\left( {r_{3} } \right) \) in the Fig. 17:

Fig. 17.
figure 17

Conflicting inference chains

  • \( D_{{l_{1} }} = \,\left\{ {f_{1} ,\,f_{2} } \right\};q_{{l_{1} }} = \,\{ f_{7} \} \)

  • \( D_{{l_{2} }} = \,\left\{ {f_{2} ,\,f_{3} } \right\};q_{{l_{2} }} = \,\left\{ {f_{6} } \right\}; \)

There is no \( c_{k} = \,\left( {f_{6} ,\,f_{7} } \right) \) and \( D_{{l_{1} }} \cap D_{{l_{2} }} = f_{2} \), so l 1 and l 2 are considered conflicting inference chains.

The correction of conflicting chains error should be done by the expert, either by adding a new allowed combination of facts, or by rewriting or deleting rules.

3 Conclusion

The paper provides formal classification of structural errors in the knowledge bases of intellectual decision making systems. It describes 3 types of structural errors: redundancy errors, incompleteness errors and inconsistency. For each of group examples are provided. Duplicates, redundant inference chains, insignificant inference chains, incorrect inference chains and cycles are considered as redundancy errors, and isolated vertices error type is incompleteness. Inconsistency in knowledge bases is represented by conflicting inference chains. All errors are formalized in terms of the AND/OR graph model and ways of correction are provided for each defined structural error.

The formal model of structural errors can be used as a basis for performing of automatic verification of rule-based knowledge bases structure.