# 5.5.3 Consistency-Based Diagnosis

Making assumptions about what is working normally, and deriving what components could be abnormal, is the basis of consistency-based diagnosis. Suppose a fault is something that is wrong with a system. The aim of consistency-based diagnosis is to determine the possible faults based on a model of the system and observations of the system. By making the absence of faults assumable, conflicts can be used to prove what is wrong with the system.

###### Example 5.23.

Consider the house wiring example depicted in Figure 5.2 and represented in Example 5.7. A background knowledge base suitable for consistency-based diagnosis is given in Figure 5.8. Normality assumptions, specifying that switches, circuit breakers, and lights must be ok to work as expected, are added to the clauses. There are no clauses for the $ok$ atoms, but they are made assumable.

The user is able to observe the switch positions and whether a light is lit or dark.

A light cannot be both lit and dark. This knowledge is stated in the following integrity constraints:

 $\displaystyle{\mbox{false}\leftarrow\mbox{}\mbox{dark\_l}_{1}\wedge\mbox{}% \mbox{lit\_l}_{1}.}$ $\displaystyle{\mbox{false}\leftarrow\mbox{}\mbox{dark\_l}_{2}\wedge\mbox{}% \mbox{lit\_l}_{2}.}$

Suppose the user observes that all three switches are up, and that $l_{1}$ and $l_{2}$ are both dark. This is represented by the atomic clauses

 $\displaystyle{\mbox{up\_s}_{1}.}$ $\displaystyle{\mbox{up\_s}_{2}.}$ $\displaystyle{\mbox{up\_s}_{3}.}$ $\displaystyle{\mbox{dark\_l}_{1}.}$ $\displaystyle{\mbox{dark\_l}_{2}.}$

Given the knowledge of Figure 5.8 together with the observations, there are two minimal conflicts:

 $\displaystyle{\{\mbox{ok\_cb}_{1},\mbox{ok\_s}_{1},\mbox{ok\_s}_{2},\mbox{ok\_% l}_{1}\}}$ $\displaystyle{\{\mbox{ok\_cb}_{1},\mbox{ok\_s}_{3},\mbox{ok\_l}_{2}\}.}$

Thus, it follows that

 $\displaystyle{\mbox{KB}\models\neg\mbox{ok\_cb}_{1}\vee\neg\mbox{ok\_s}_{1}% \vee\neg\mbox{ok\_s}_{2}\vee\neg\mbox{ok\_l}_{1}}$ $\displaystyle{\mbox{KB}\models\neg\mbox{ok\_cb}_{1}\vee\neg\mbox{ok\_s}_{3}% \vee\neg\mbox{ok\_l}_{2},}$

which means that at least one of the components $cb_{1}$, $s_{1}$, $s_{2}$, or $l_{1}$ must not be ok, and least one of the components $cb_{1}$, $s_{3}$, or $l_{2}$ must not be ok.

Given the set of all conflicts, a user can determine what may be wrong with the system being diagnosed. However, given a set of conflicts, it is often difficult to determine whether all of the conflicts could be explained by a few faults. Some of the questions that a user may want to know are whether all of the conflicts could be accounted for a by a single fault or a pair of faults.

Given a set of conflicts, a consistency-based diagnosis is a set of assumables that has at least one element in each conflict. A minimal diagnosis is a diagnosis such that no subset is also a diagnosis. For one of the diagnoses, all of its elements must be false in the world being modeled.

###### Example 5.24.

In Example 5.23, the disjunction of the negation of the two conflicts is a logical consequence of the clauses. Thus, the conjunction

 $\displaystyle{(\neg\mbox{ok\_cb}_{1}\vee\neg\mbox{ok\_s}_{1}\vee\neg\mbox{ok\_% s}_{2}\vee\neg\mbox{ok\_l}_{1})}$ $\displaystyle\ \ \ \ {\mbox{}\wedge\mbox{}(\neg\mbox{ok\_cb}_{1}\vee\neg\mbox{% ok\_s}_{3}\vee\neg\mbox{ok\_l}_{2})}$

follows from the knowledge base. This conjunction of disjunctions in conjunctive normal form (CNF) can be distributed into disjunctive normal form (DNF), a disjunction of conjunctions, here of negated atoms:

 $\displaystyle{\neg\mbox{ok\_cb}_{1}\vee\mbox{}}$ $\displaystyle{(\neg\mbox{ok\_s}_{1}\wedge\mbox{}\neg\mbox{ok\_s}_{3})\vee(\neg% \mbox{ok\_s}_{1}\wedge\mbox{}\neg\mbox{ok\_l}_{2})\vee\mbox{}}$ $\displaystyle{(\neg\mbox{ok\_s}_{2}\wedge\mbox{}\neg\mbox{ok\_s}_{3})\vee(\neg% \mbox{ok\_s}_{2}\wedge\mbox{}\neg\mbox{ok\_l}_{2})\vee\mbox{}}$ $\displaystyle{(\neg\mbox{ok\_l}_{1}\wedge\mbox{}\neg\mbox{ok\_s}_{3})\vee(\neg% \mbox{ok\_l}_{1}\wedge\mbox{}\neg\mbox{ok\_l}_{2}).}$

Thus, either $cb_{1}$ is broken or there is at least one of six double faults.

The propositions that are disjoined together correspond to the seven minimal diagnoses: $\{\mbox{ok\_cb}_{1}\}$, $\{\mbox{ok\_s}_{1},\mbox{ok\_s}_{3}\}$, $\{\mbox{ok\_s}_{1},\mbox{ok\_l}_{2}\}$, $\{\mbox{ok\_s}_{2},\mbox{ok\_s}_{3}\}$, $\{\mbox{ok\_s}_{2},\mbox{ok\_l}_{2}\}$, $\{\mbox{ok\_l}_{1},\mbox{ok\_s}_{3}\}$, $\{\mbox{ok\_l}_{1},\mbox{ok\_l}_{2}\}$. The system has proved that one of these combinations must be faulty.