# Deliberative and Conceptual Inference in Service Robots
## 6 Non-Monotonic Knowledge-Base Service
The story of the whole task is provided by the _SitLog_ interpreter when its execution is finished. The full Prolog's code of the _SitLog_'s interpreter is available as a GitHub repository at [[https://github.com/SitLog/source_code](https://github.com/SitLog/source_code)]([https://github.com/SitLog/source_code](https://github.com/SitLog/source_code)). ```
main:(is,[day(tuesday)]: [date(monday),next_date(tuesday)]) main:(is,[tuesday,'not ok']: ([day(tuesday)]: [date(monday),next_date(tuesday)])) [wait:(is,loop:[1]) wait:(fs2,empty:empty)] main:(rs,fs2: screen(Cont. recursivesit)) [wait:(is,tuesday:[1]) wait:(fs1,empty:empty)] main:(rs,fs1: screen(Back to initial sit)) main:(is,[day(monday)]: [date(tuesday),next_date(monday)]) main:(is,[monday,ok]: [(day(monday)]: [date(tuesday),next_date(monday)])) main:(is,finish:screen(Good Bye)) main:(fs,empty:empty)
``` OutArg:monday OutGlobalVars:[g_count_fs1==>1, g_count_fs2==>1]

## Appendix B Conceptual Inference Scenario

The human experience and the robot's performance is improved during the execution of a task by the robot knowing the things the user likes, social patterns, healthy guidelines, etc. Such aspects can be expressed in the KB as preferences, or conditional defaults, that helps resolving conflicting situations arising from incompatible conclusions. Let \(CD\) be the set of conditional defaults:

\[ \begin{array}{lcl}\{\left[Ant_{11},Ant_{12},\ldots,Ant_{1i}&\rightarrow&Con_{1 },\ W_{1}\right],\\ \left[Ant_{21},Ant_{22},\ldots,Ant_{2j}\right.&\rightarrow&Con_{2},\ W_{2} \right],\\ &\vdots&\\ \left[Ant_{n1},Ant_{n2},\ldots,Ant_{nm}\right.&\rightarrow&Con_{m},\ W_{m} \right]\},\end{array} \]

where each element in \(CD\) is of the form \(\left[Antecedents\rightarrow\mathit{Consequent},\mathit{Weight}\right]\), with _Antecedents_ a list such that the _Consequent_ appended to _Antecedents_ compose a list of either properties or relations alone. Furthermore, assume that at some point in the execution of the task all antecedents are satisfied for some (more than one) conditional defaults; therefore, the corresponding consequents are also satisfied, which may cause a problem since they might be representing incompatible conclusions. This problem is solved by the Principle of Specificity applied to the weight of the conditional defaults; thus, only one consequent will be considered, the one in which its associated weight is the lowest. The structure of the conceptual inference scenario can be broken up in three parts: (i) _retrieving user preferences and getting the order_, (ii) _fetching and delivering items_, and (iii) _updating the KB and applying abductive reasoning_; each one will be explained in detail next. ### Retrieving User Preferences and Getting the Order

The preferences of the human user, and all relevant information for a successful interaction, should be present in the KB. This is likely to be a dynamic process since user preferences, healthy guidelines, designated home locations, items in the shelves, and so on may greatly vary from time to time. One way to keep the KB updated, probably the optimal way, is to directly querying the user. For example, if there are \(k\) different new drinks, the robot proceeds by repeatedly taking two drinks at a time and asking the user to choose the preferred one that he or she would like to be served; thus, the total number of queries is \(O(k^{2})\) to get the appropriate weight of all drinks with respect to the user preference. Once the preferences are known to the robot, it can make use of them in the course of the daily routine to reason about the state of its surroundings, the conduct of the user and the speech acts it is faced with. In the present scenario, the robot offers its assistant to the user, who replies by asking for comestible objects \(o_{1},\ldots,o_{t}\) to be fetched to him. For each object \(o_{i}\), the robot examines whether \(o_{i}\) is the preferred object to be served among the individuals of its class, \(C_{o_{i}}\).