text:
# Local Diagnosis

## Introduction

In (?), we have shown how consistency-based diagnosis relates to belief revision and how Reiter’s algorithm can be used for kernel operations of belief change. In (?), we presented the idea of local change and characterized operations of belief change that only affect the relevant part of a belief base. In (?), we presented an algorithm for retrieving the relevant part of a belief base which can be used for implementing local change. In the present paper, we close the circle by showing how local change can be used for focusing the diagnosis process on the relevant part of the domain.

We will show how a diagnosis problem can be translated into an operation of kernel semi-revision. Kernel semi-revision (?) consists in adding new information to a database and restoring consistency if necessary. To restore consistency, the expanded database is contracted by $``$.

Then we will show how to use information about the structure of the device being examined in order to obtain more efficient methods of diagnosis. For this, we will use the operation of local kernel semi-revision, presented in (?), that considers only the relevant part of the database. In (?), we have presented a simple method for extracting the relevant part of a structured database, which will be used in this paper.

This paper proceeds as follows: in the next two sections we give a brief introduction to kernel operations of belief change and consistency-based diagnosis. Then we show the relation between kernel semi-revision and Reiter diagnosis. Using this relation, we show how to use information about the system to focus on its relevant part during the process of diagnosis.

In the rest of this paper we consider $`L`$ to be a propositional language closed under the usual truth-functional connectives and containing a constant $``$ denoting falsum.

## Kernel Semi-Revision

Hansson introduced a construction for contraction operators, called kernel contraction (?), which is a generalization of the operation of safe contraction defined in (?). The idea behind kernel contraction is that, if we remove from the belief base $`B`$ at least one element of each $`\alpha `$-kernel (minimal subset of $`B`$ that implies $`\alpha `$), then we obtain a belief base that does not imply $`\alpha `$ (?). To perform these removals of elements, we use an incision function, i.e., a function that selects at least one sentence from each kernel.

###### Definition 1

(?) The kernel operation $``$ is the operation such that for every set $`B`$ of formulas and every formula $`\alpha `$, $`XB\alpha `$ if and only if:

1. $`XB`$
2. $`\alpha Cn(X)`$
3. for all $`Y`$, if $`YX`$ then $`\alpha Cn(Y)`$

The elements of $`B\alpha `$ are called $`\alpha `$-kernels.

###### Definition 2

(?) An incision function for $`B`$ is any function $`\sigma `$ such that for any formula $`\alpha `$:

1. $`\sigma (B\alpha )(B\alpha )`$, and
2. If $`\mathrm{}XB\alpha `$, then $`X\sigma (B\alpha )\mathrm{}`$.

Semi-revision consists in adding new information to a database and restoring consistency if necessary. To restore consistency, the expanded database is contracted by $``$. Semi-revision consists of two steps: first the belief $`\alpha `$ is added to the base, and then the resulting base is consolidated, i.e., contracted by $``$. Kernel semi-revision uses kernel contraction for the second step.

###### Definition 3

(?) The kernel semi-revision of $`B`$ based on an incision function $`\sigma `$ is the operator $`\mathrm{?}_\sigma `$ such that for all sentences $`\alpha `$:

$`B\mathrm{?}_\sigma \alpha =(B\{\alpha \})\sigma ((B\{\alpha \}))`$

## Consistency-Based Diagnosis

Diagnosis is a very active area within the artificial intelligence community. The problem of diagnosis consists in, given an observation of an abnormal behavior, finding the components of the system that may have caused the abnormality (?).

In the area known as model-based diagnosis (?), a model of the device to be diagnosed is given in some formal language. In this paper, we will concentrate on model-based diagnosis methods that work by trying to restore the consistency of the system description and the observations.

Although Reiter’s framework is based on first-order logic, most of the problems studied in the literature do not make use of full first-order logic and can be easily represented in a propositional language. For the sake of simplicity, we will adapt the definitions given in (?) to only mention formulas in the propositional language $`L`$.

### Basic Definitions

The systems to be diagnosed will be described by a set of propositional formulas. For each component $`X`$ of the system, we use a propositional variable of the form $`okX`$ to indicate whether the component is working as it should. If there is no evidence that the system is not working, we can assume that variables of the form $`okX`$ are true.

###### Definition 4

A system is a pair (SD,ASS), where:

1. SD, the system description, is a finite set of formulas of $`L`$ and
2. ASS, the set of assumables, is a finite set of propositional variables of the form $`okX`$.

An observation is a formula of $`L`$. We will sometimes represent a system by (SD,ASS,OBS), where OBS is an observation for the system (SD,ASS).

The need for a diagnosis arises when an abnormal behavior is observed, i.e., when SD$``$ASS$``${OBS} is inconsistent. A diagnosis is a minimal set of assumables that must be negated in order to restore consistency.

###### Definition 5

A diagnosis for (SD,ASS,OBS) is a minimal set $`\mathrm{\Delta }`$ASS such that:

SD $``$ {OBS} $``$ ASS$`\mathrm{\Delta }`$ $``$ {$`\neg okX|okX\mathrm{\Delta }`$} is consistent.

A diagnosis for a system does not always exist:

###### Proposition 1

(?) A diagnosis exists for (SD,ASS,OBS) if and only if SD$``${OBS} is consistent.

Definition 5 can be simplified as follows:

###### Proposition 2

(?) The set $`\mathrm{\Delta }`$ASS is a diagnosis for (SD,ASS,OBS) if and only if $`\mathrm{\Delta }`$ is a minimal set such that SD $``$ {OBS} $``$ (ASS$`\mathrm{\Delta }`$) is consistent.

### Computing Diagnoses

In this section we will present Reiter’s construction for finding diagnoses. Reiter’s method for computing diagnosis makes use of the concepts of conflict sets and hitting sets. A conflict set is a set of assumables that cannot be all true given the observation:

###### Definition 6

(?) A conflict set for (SD,ASS,OBS) is a set Conf $`=\{okX_1,`$ $`okX_2,`$ $`\mathrm{},`$ $`okX_n\}`$ $``$ ASS such that SD $``$ {OBS} $``$ Conf is inconsistent.

From Proposition 2 and Definition 6 it follows that $`\mathrm{\Delta }`$ASS is a diagnosis for (SD,ASS,OBS) if and only if $`\mathrm{\Delta }`$ is a minimal set such that ASS$`\mathrm{\Delta }`$ is not a conflict set for (SD,ASS,OBS).

A hitting set for a collection of sets is a set that intersects all sets of the collection:

###### Definition 7

(?) Let $`𝒞`$ be a collection of sets. A hitting set for $`𝒞`$ is a set $`H_{S𝒞}S`$ such that for every $`S𝒞`$, $`HS`$ is nonempty. A hitting set for $`𝒞`$ is minimal if and only if no proper subset of it is a hitting set for $`𝒞`$.

The following theorem presents a constructive approach for finding diagnoses:

###### Theorem 1

(?) $`\mathrm{\Delta }`$ASS is a diagnosis for (SD,ASS,OBS) if and only if $`\mathrm{\Delta }`$ is a minimal hitting set for the collection of minimal conflict sets for (SD,ASS,OBS).

Consider the circuit in Figure 1. The system description of this circuit is given by (SD,ASS), where:

$`\text{ASS}=\{okX,okY,okZ\}`$

$`\begin{array}{cc}\text{SD}=\hfill & \{(AB)okXD,\hfill \\ & \neg (AB)okX\neg D,\hfill \\ & CokY\neg E,\hfill \\ & \neg CokYE,\hfill \\ & (DE)okZF,\hfill \\ & \neg (DE)okZ\neg F\}\hfill \end{array}`$

Suppose we have OBS=$`\neg C\neg F`$. This observation is inconsistent with $`\text{SD}\text{ASS}`$. There is only one minimal conflict set for (SD,ASS,OBS): {$`okY,okZ`$}. There are three possible hitting sets: {$`okY`$},{$`okZ`$}, and {$`okY,okZ`$}. Reiter considers only minimal hitting sets as diagnoses, that is, either Y or Z is not working well.

## Diagnosis via Kernel Semi-Revision

In (?), we have shown that the standard method for finding consistency-based diagnosis, due to Reiter (?), is very similar to the construction of kernel semi-revision, except for the fact that Reiter only considers minimal diagnosis, which correspond to minimal values for incision functions. In this section we summarize these results.

Recall that kernel operations are based on two concepts: kernels and incision functions. The kernels are the minimal subsets of a belief base implying some sentence, while the incision functions are used to decide which elements of the kernels should be given up. Let (SD,ASS,OBS) be a system. The belief base that we are going to semi-revise corresponds to SD$``$ASS and the input sentence is OBS. The conflict sets are the assumables in the inconsistent kernels of SD$``$ASS$``${OBS}. So, if $`B`$=SD$``$ASS, the conflict sets are given by {$`X`$ASS$`|X`$ ($`B+`$OBS)$``$$``$}. Incision functions correspond loosely to hitting sets, the minimal hitting sets being the values of minimal incisions that return only assumables. Note that there is a difference in the status of formulas in SD and those in ASS: formulas in ASS represent expectations and are more easily retracted than those in SD (cf. Definition 8).

We can model the diagnosis problem as a kernel semi-revision by the observation. Semi-revision can be divided in two steps. First the observation is added to the system description together with the assumables. In case the observation is consistent with the system description together with the assumables, no formula has to be given up. Otherwise, we take the inconsistent kernels and use an incision function to choose which elements of the kernels should be given up.

In the case of diagnosis, we do not wish to give up sentences belonging to the system description or the observation. We prefer to give up the formulas of the form $`okX`$, where $`X`$ is a component of the system. Moreover, we are interested in minimal diagnosis, so the incision should be minimal. For this, we use a special variant of incision function. We modify Definition 2 so that incisions are minimal and elements of a given set $`A`$ are prefered over the others:

###### Definition 8

Given a set $`A`$, an $`A`$-minimal incision function is any function $`\sigma _A`$ from sets of sets of formulas into sets of formulas such that for any set $`S`$ of sets of formulas:

1. $`\sigma _A(S)S`$,
2. If $`\mathrm{}XS`$, then $`X\sigma _A(S)\mathrm{}`$,
3. If for all $`XS`$, $`XA\mathrm{}`$, then $`\sigma _A(S)A`$, and
4. $`\sigma _A(S)`$ is a minimal set satisfying 1,2, and 3.

If we take $`A`$ to be the set of assumables, we obtain an incision function that prefers to select formulas of the form $`okX`$ over the others.

We can show that for (SD,ASS,OBS), whenever a diagnosis exists, an ASS-minimal incision function will select only elements of ASS:

###### Proposition 3

Let (SD,ASS,OBS) be a system with an observation and $`\sigma _{ASS}`$ an ASS-minimal incision function. If a diagnosis exists, then $`\sigma _{ASS}((\text{SD}\text{ASS}\text{OBS}))`$ASS.

###### Lemma 1

The assumables that occur in an inconsistent kernel of the set SD$``$ASS$``$OBS form a conflict set for (SD,ASS,OBS) and all minimal conflict sets can be obtained in this way, i.e.:

(i) For every $`X(`$SD$``$ASS$``$OBS$`)`$, $`X`$ASS is a conflict set, and

(ii) For every minimal conflict set $`Y`$, there is some $`X(`$SD$``$ASS$``$OBS$`)`$ such that $`X`$ASS$`=Y`$.

Note that not every inconsistent kernel determines a minimal conflict set, since for conflict sets only the elements of ASS matter, i.e., there may be two inconsistent kernels $`X_1`$ and $`X_2`$ such that $`X_1`$ASS is a proper subset of $`X_2`$ASS.

Recall that given an incision function $`\sigma `$, the semi-revision of a set $`B`$ by a formula $`\alpha `$ was given by $`B\mathrm{?}_\sigma \alpha =(B+\alpha )\sigma ((B+\alpha ))`$. A diagnosis is given by the elements of ASS that are given up in a kernel semi-revision by the observation.

###### Proposition 4

Let S=(SD,ASS,OBS) be a system and $`\sigma _{ASS}`$ an ASS-minimal incision function.

(SD $``$ASS)$``$((SD $``$ASS)$`\mathrm{?}_{\sigma _{ASS}}`$OBS) = $`\sigma _{ASS}`$((SD $``$ASS $``$OBS)$``$$``$) is a diagnosis.

## Using System Structure

Suppose that instead of the circuit depicted in Figure 1, we have the circuit in Figure 2. Suppose also that we get the same observation, i.e., OBS$`=\neg C\neg F`$. Intuitively, only a small part of the circuit (roughly the sub-circuit at figure 1) has to be considered in order to arrive to a diagnosis.

In (?), we have extended the definition of kernel semi-revision to an operation that considers only the relevant part of a database, local kernel semi-revision. In (?), we have shown how to use structure present in a database in order to find compartments and implement local kernel operations more efficiently. The key idea of the method described is to use a relation of relatedness between formulas of the belief base. In some applications, as we will see, such a relation is given with the problem. In the case of the circuit shown in Figure 2, there is a very natural dependence relation. The output of each of the components depends on the input and on whether the component is working well.

The only observation we have is $`\neg C\neg F`$. Since this observation is inconsistent with the system description together with the assumption that all components are working well, there must be some faulty component. Moreover, the faulty component must be in the path between $`C`$ and $`F`$ (of course, there may be other faulty components, but we are only searching for the abnormality that explains the observation). We only need to consider the descriptions of components $`y`$ and $`z`$ in order to find the diagnosis.

In the next section we will show how to use the framework described in (?) in order to find diagnoses without having to check the entire system description for consistency.

## Local Kernel Diagnosis

As we have seen, diagnosis problems fit very well in the framework for local change that we proposed in (?) and (?). Besides the fact that the traditional method for finding diagnosis based on the notion of consistency is almost identical to the construction of kernel semi-revision, in most diagnosis problems there is a very natural notion of relatedness that can be used to structure the belief base so that the search for diagnoses becomes more efficient.

In this section we formalize the example in Figure 2 in order to show how to derive a concrete relatedness relation from the given database.

We will use a relatedness relation between atoms, as illustrated in Figure 3. The relation is not symmetric. We can easily adapt the definitions presented in (?) to deal with a directed graph.

The basic algorithm is as follows: we start from the propositional variables that occur in the observation and spread the activation in the graph, following the direction of the arcs. The spreading finishes either when the end of the paths are reached or when we run out of resources (time or memory). This is done by the algorithm Retrieve below, an adaptation of the algorithm given in (?). The algorithm uses the function Adjacent to collect all nodes related to a given node, i.e., given a relatedness relation $`R`$, Adjacent($`x`$)=$`\{y`$Var(SD)$``$ASS$`|R(x,y)\}`$, where Var($`X`$) is the set of propositional variables ocurring in the formulas of set $`X`$. For a set $`Y`$ of propositional variables, Adjacent($`Y`$)= $`\{`$Adjacent($`y`$)$`|yY\}`$.

Retrieve(OBS,ASS,Relevant):

1. For all $`p`$ Var(OBS), mark($`p`$)

2. $`\mathrm{\Delta }^1`$(OBS) := Adjacent(Var(OBS))

3. Relevant := Var(OBS)$``$ASS

4. $`i`$ := 1; stop := false

5. While not stop do

5.1. For all $`p\mathrm{\Delta }^i`$(OBS), mark($`p`$)

If $`p`$ASS,

then Relevant := Relevant $`\{p\}`$

5.2. i := i+1; $`\mathrm{\Delta }^i`$(OBS)=$`\mathrm{}`$

5.3 For all $`p\mathrm{\Delta }^{i1}`$(OBS),

$`\mathrm{\Delta }^i`$(OBS) := $`\mathrm{\Delta }^i`$(OBS) $`\{q`$Adjacent($`p`$)

s.t. not marked$`(q)\}`$

5.4 If $`\mathrm{\Delta }^i`$(OBS)$`=\mathrm{}`$, then stop := true

After we have retrieved the relevant assumables, the relevant compartment is taken to be the observation together with all formulas in SD$``$ASS which mention the relevant assumables.

Compartment(OBS,SD,ASS,Comp):

1. Retrieve(OBS,ASS,Relevant)

2. Comp=OBS

3. For all $`p`$Relevant,

Comp:= Comp$`\{\alpha `$SD$``$ASS$`|p`$Var($`\alpha `$)$`\}`$.

As we have seen in (?), the algorithm for Retrieve is an anytime algorithm. The algorithm for Compartment is not, at least in principle. But if one keeps the order in which the relevant atoms are retrieved and uses them in this order in line 3 of algorithm Compartment, one can be sure that the description of the most relevant components will be retrieved first.

For the circuit in Figure 2, we have:

SD={$`(AB)okXD`$, $`\neg (AB)okX\neg D`$,

$`CokY\neg E`$, $`\neg CokYE`$,

$`(DE)okZF`$, $`\neg (DE)okZ\neg F`$,

$`G1okW1\neg A`$, $`\neg G1okW1A`$,

$`(G2G3)okW2B`$, $`\neg (G2G3)okW2\neg B`$,

$`(G4G5)okW3C`$, $`\neg (G4G5)okW3\neg C`$,

$`G6okW4\neg G9`$, $`\neg G6okW4G9`$,

$`(G7G8)okW5G10`$,

$`\neg (G7G8)okW5\neg G10`$,

$`(G9G10)okW6G11`$,

$`\neg (G9G10)okW6\neg G11`$,

$`G11okW7G12`$, $`\neg G11okW7\neg G12`$,

$`(FG12)okW8G13`$,

$`\neg (FG12)okW8\neg G13`$}

ASS ={$`okX,okY,okZ,okW1,okW2,okW3,okW4,`$

$`okW5,okW6,okW7,okW8`$}

If we apply the algorithm Retrieve($`\neg C\neg F`$,ASS,Relevant) to the graph depicted in Figure 3, we get Relevant={okY,okZ,okW8}. For Compartment(OBS, SD, ASS, Comp) we get

Comp=$`\{\neg C\neg F,CokY\neg E,`$

$`\neg CokYE,(DE)okZF,`$

$`\neg (DE)okZ\neg F,`$

$`(FG12)okW8G13,`$

$`\neg (FG12)okW8\neg G13,okY,okZ,okW8\}`$.

The diagnosis can be searched using only the formulas in Comp. Note that the component w8 was not really relevant for the diagnosis but, nevertheless, we have reduced the set to be semi-revised.

This is a very general method for focusing on a small part of the system description. One can add to it some domain specific heuristics to improve its efficiency. The system IDEA (?), used by FIAT repair centers works on dependence graphs that show graphically the relation between the several components of a device.

In (?) we have shown that Reiter’s algorithm for consistency-based diagnosis can be used for kernel semi-revision. The algorithm for kernel operations can be easily combined with the algorithm Compartment presented in this section.

Applying Reiter’s algorithm to Comp, given the observation $`\neg C\neg F`$, we get as possible diagnoses: $`\{okY\}`$ and $`\{okZ\}`$.

## Conclusions

In this paper we have shown how to combine Reiter’s algorithm for consistency-based diagnosis with the algorithm for finding the relevant compartment of a database. The result is a method for finding diagnosis which focuses on the relevant part of the system description.

Making clear the similarities between diagnosis and belief revision can be very profitable for both areas of research. As shown in (?), the computational tools developed in the field of diagnosis can be adapted to be used for belief revision. And as we show in this paper, theories developed for belief revision can be applied on diagnosis for obtaining more efficient methods.

Future work includes the study of other approaches to diagnosis as well as the study of the computational complexity of the method proposed.