# Deliberative and Conceptual Inference in Service Robots
## 6 Non-Monotonic Knowledge-Base Service
When an error arises taking an object, moving to a new location, or realizing that the object is not found after visiting all shelves, then a recovery protocol can be invoked or the daily life inference cycle triggered. At this point two important observations have to be made:

1. As a side effect of searching for an object, the properties of other objects in the robot's KB may change. Suppose that the robot makes an observation in the shelf located at \(loc_{j}\) trying to find object \(o_{i}\). Regardless of recognizing \(o_{i}\), the robot may have seen a set \(O=\{o_{i1},\ldots,o_{in}\}\) of objects. Hence, the robot is now aware of the precise shelf where such objects are placed. So, the property _last seen_ for these objects is assigned to \(loc_{j}\) in the KB. Therefore, for any \(obj\in O\) the first element of its list of preferred locations has to be \(loc_{j}\). The KB works in this way since a conditional default for the object \(obj\) is defined with antecedent _last seen_, consequent \(loc\) and weight 1, as it is seen in Figure 6.
2. When the robot takes two objects, using its two hands, or when it is holding one object and there are no more left to take, the objects must be delivered to the user. But first, the robot needs to determine the room where the user may have gone based on his or her preferences and properties. The preferred room is retrieved from the KBby an operation that can be derived from the steps explained above. In the current scenario, two conditional defaults for the individual _user_ have been defined in which consequent is the property _found in_ that indicates the room where the user is located, and in which antecedents are conditions that cause him or her to go to one room or to another depending on the user's mood or physical state, as shown also in Figure 6. After this delivery, the robot examines the list \(L_{final}\) to know whether there are more objects to be fetched or not. Noticeably, the inference mechanism on conditional defaults handles chained implications, so it is plausible to have a conditional default such that its antecedents may be satisfied by the consequents of other conditional defaults. Let \(Prop\) be the list of known closed propositions (properties or relations) and \(L_{CD}\) be the list \([Ant\to Consequent\mid More_{CD}]\) of conditional defaults of a class or individual, such that the conditional defaults in \(L_{CD}\) are sorted in increasing order with respect to their weight, value that is omitted in \(L_{CD}\). The mechanism proceeds recursively over the head element \(Ant\to Consequent\) of \(L_{CD}\) according to the cases:

* \(Ant\) is a single property or relation. Examine all valid pattern matching situations for \(Ant\to Consequent\) as follows: (a) Since \(Ant\) and \(Consequent\) are both properties or both relations, their pattern is \(\alpha=>\beta\); nonetheless, \(\beta\) may be a variable, and the pattern becomes \(\alpha=>^{\prime}-^{\prime}\). (b) A property may be a single label with no associated value. (c) \(Ant\) may be absent, which is represented as \({}^{\prime}-^{\prime}\to Consequent\), indicating that the consequent of the conditional default is always satisfied. 1. Now, execute a backward analysis checking whether \(Ant\) is already part of \(Prop\); if so, add the corresponding \(Consequent\) to \(Prop\). 2. Otherwise, execute a forward analysis verifying if \(Ant\) occurs as the consequent of a conditional default in \(More_{CD}\); in that case, apply the current analysis to the list \(More_{CD}\), in which output is a temporary set of new closed propositions \(Tem_{Prop}\), such that \(Consequent\) is added to \(Prop\) whenever \(Ant\) is part of \(Tem_{Prop}\). Remarkably, matching \(Ant\) with an element of \(Prop\) or \(Tem_{Prop}\) instantiates the variable that \(Ant\) might have. Since the variable in the antecedent is bound in the consequent, instantiating the variable in \(Ant\) provides a value for the variable in \(Consequent\). * \(Ant\) is a list of properties or relations.