The Logic Reasoning System a Brief Introduction Franz Wotawa
Total Page:16
File Type:pdf, Size:1020Kb
The Logic Reasoning System A Brief Introduction Franz Wotawa Technische Universität Graz Institute for Software Technology Inffeldgasse 16b/2, 8010 Graz, Austria [email protected] http://www.ist.tugraz.at/ The Logic Reasoning System – A brief introduction Franz Wotawa1 Graz University of Technology Institute for Software Technology Inffeldgasse 16b/2, A-8010 Graz, Austria [email protected] Abstract. In this article we describe how to use the Logic Reason- ing System that is based on an Assumption-Based Truth Maintenance system. In particular we show by example how models following the consistency-based reasoning and the abductive reasoning methodology can be formulated. We use one example from the boolean circuit domain and give the two different models for the circuit, which can be used for diagnosis. Moreover, we show how the system can be used to compute diagnoses using consistency-based diagnosis and abductive diagnosis re- spectively. Keywords: Logic-based reasoning systems, ATMS, Diagnosis 1 Introduction The Logic Reasoning System (LRS) can be obtained from the author of this article. The system is implemented in Java 1.5 and ships out as an executable JAR file. To install the system the JAR file and the example models should be copied to a directory on your computer. You can open LRS by simple executing the JAR file if the Java runtime engine 1.5 or higher is installed. The system comes with no warranty. Before discussing modeling we briefly recall the related literature behind LRS. The implementation is based on DeKleer’s Assumption-based Truth Main- tenance System (ATMS) [1, 2]. The current implementation uses the original al- gorithm of DeKleer [3]. We expect that the implementation may be not very efficient for larger example instances. An ATMS basically stores all rules, and retains consistency of assumptions and propositions, where both are represented as nodes in the ATMS. For every node all possible set of assumptions are stored, where each of these sets entails the node using the rules. These sets are called environments and are element of the node’s label. The ATMS ensures that the la- bel is minimal, consistent, complete, and valid. Because of the underlying ATMS the LRS allows models to comprise assumptions, proposition, and simple rules. Hence, the whole model has to be represented as set of horn clauses. The ATMS 2 and also the LRS also distinguishes a separate node the NOGOOD node that represent the contradiction. In modeling we might want to say that two propositions cannot be true at the same time. For example it is impossible that it is raining and not raining at the same time. Since horn clause logic does not allow to represent the negation of r as ¬r, we have to represent ¬r as separate proposition n r and state the mentioned condition as rule. This can be easily formulated in logic using the following sentence: r ∧ n r → ⊥ where ⊥ stands for the contradiction or NOGOOD in terms of an ATMS. In our examples we will see how to represent this sentence in LRS. ATMS are used for example in consistency-based diagnosis [4]. Diagnosis is the process of identifying a cause for a detected misbehavior, i.e., a contradiction between expected values and observations. For the purpose of consistency-based diagnosis the correct behavior of a system has to be specified where correctness of system’s components is introduced as an explicit assumption. ATMS well suited for diagnosis of this sort because the label of a NOGOOD represents all conflicts, i.e., assumptions that cannot be true at the same time, which can – accordingly to Reiter [4] – be used for computing diagnoses. For this purpose Reiter uses a hitting set algorithm that has been further improved by Greiner et al. [5]. Although, the question whether the use of ATMS or other specialized rea- soning systems for diagnosis is not solved yet and there is an ongoing debate within the model-based reasoning community, ATMS can be directly used for abductive reasoning. Abductive reasoning has also be used in model-based diag- nosis, see for example [6–8]. Whereas deductive reasoning is the way of deriving facts from hypotheses and the underlying theory, abduction deals with deriving the hypotheses given symptoms and the theory. The main difference between the consistency-based diagnosis and the abductive diagnosis approach is that latter requires knowledge of faulty behavior whereas the first one only requires knowledge related to the correct behavior. The article is structured as follows. In the next section, we briefly discuss the user interface of LRS. Afterwards we show how models can be written in LRS. We further describe an example from the boolean domain, present an abductive model of the system to be used for diagnosis, and an alternative consistency- based model for the same system and purpose. Finally, we conclude the article 2 The LRS The LRS comes as a big ZIP file, which has to be extracted in one directory. This directory comprise a JAR file, the documentation, and example files. To open LRS the JAR file atms vx.jar has to be called where x represents the current version. The currently available LRS has the version number 0 1Beta. After opening LRS the main window is open. Figure 1 shows the main window where users can create their model and run the theorem proving engine. The models can be loaded and saved. Printing is currently not available. To run the theorem proving engine the corresponding menu item in Proving has to be called. 3 Fig. 1. The main window of the LRS system After finishing theorem proving a new window will appear. Figure 2 depicts this window. The window comprises all nodes where a node can be a proposition, an assumption, or the NOGOOD. When clicking a node its label comprising all assumptions necessary for deriving the node are shown in the text field at the bottom of the window. In case of consistency-based reasoning the label of the NOGOOD node is of interest to the user. In case of abductive reasoning the node representing the abductive query stores the requested information. More information regarding modeling in a consistency-based and abductive way can be found in the following sections. 3 Modeling in LRS In LRS models can be represented both as Prolog clauses or as rules where ’,’ is used as and-operator and ’->’ as implication. Both rules and clauses has to be ended with a ’.’. Within a clause or a rule predicates can be used. A predicate (or atom) comprise an identifier and is optionally followed by parentheses, which itself comprise the arguments, i.e., the terms. A term can be a constant, a variable starting with a capitalized letter, or a function with arguments that are itself terms. For example, the logical rule rain → wet stating that if it rains, the streets are wet, can be formalized in LRS as follows: rain -> wet. or wet :- rain. A fact, e.g., stating that it is raining, has to be represented in LRS as follows: 4 Fig. 2. The results window of the LRS system rain. If we want to use LRS for assumption based or abductive reasoning we have to state hypotheses or assumptions. Both of them are treated equivalently. As- sumptions and hypothesis that are represented by a predicate have to start with a capitalized character. For example, if we want to use raining as a hypothesis or assumption we reformulate the rule as follows. Rain -> wet. or wet :- Rain. In this case we would not introduce a fact like rain.. If we want to state that it is impossible that the streets are wet (represented by wet) and that they are not (represented by not wet) we use the following rule: wet, not wet -> false. or false :- wet, not wet. In LRS the special predicate false represents the logical contradiction. It is worth noting that LRS is interpreting predicates as propositions. That means that only the textual representation is used to distinguish predicates. Variables are – in the current version of LRS – ignored. For example in LRS, the predicates val(X,false) and val(Y,false) are different and there is no substitution available like in First Order Logic to make them equivalent. Note also that white spaces are completely ignored. Moreover, everything that comes after ’%’ in a line is ignored until a line feed or carriage return occurs. Hence, we are also able to give comments in a LRS model. The following BNF summarizes the syntax of models used in LRS. atom ::= 5 id opt args opt args ::= ’(’ args ’)’ | ǫ args ::= term args rest | ǫ term ::= id opt args args rest ::= ’,’ term args rest | ǫ rules ::= rule rules | ǫ rule ::= atom rule rest ’.’ rule rest ::= ’:-’ atom list | atom list rest ’->’ atom atom list ::= atom atom list rest | ǫ atom list rest ::= ’,’ atom atom list rest | ǫ 4 Example In this section, we explain how to use LRS to model a system and to obtain explanations someone would like to obtain from such a model. In particular we will model the small boolean circuit BC1, which is depicted in Figure 3. The circuit comprises two inverters I1, I2 and two and-gates A1, A2 as well as three inputs a,b,c and two outputs f,g. Moreover, we will use the following test case where BC1 is computing an output that contradicts the observations: a=true, b=true, c=true, f=false, g=true. The listings of the abductive and the consistency-based model are given in the appendix of this document. In the following two subsections we discuss how 6 A1 a I2 e f b d I1 g c A2 Fig.