Applications of Answer Set Programming
Total Page:16
File Type:pdf, Size:1020Kb
Articles Applications of Answer Set Programming Esra Erdem, Michael Gelfond, Nicola Leone I Answer set programming (ASP) has nswer set programming (ASP) is a knowledge represen- been applied fruitfully to a wide range tation and reasoning (KR) paradigm. It has rich high- of areas in AI and in other fields, both Alevel representation languages that allow recursive def- in academia and in industry, thanks to initions, aggregates, weight constraints, optimization the expressive representation languages statements, default negation, and external atoms. With such of ASP and the continuous improve- ment of ASP solvers. We present some expressive languages, ASP can be used to declaratively repre- of these ASP applications, in particular, sent knowledge (for example, mathematical models of prob- in knowledge representation and rea- lems, behaviour of dynamic systems, beliefs and actions of soning, robotics, bioinformatics, and agents) and solve combinatorial search problems (for exam- computational biology as well as some ple, planning, diagnosis, phylogeny reconstruction) and industrial applications. We discuss the knowledge-intensive problems (for example, query answer- challenges addressed by ASP in these ing, explanation generation). The idea is to represent a prob- applications and emphasize the strengths of ASP as a useful AI para- lem as a “program” whose models (called “answer sets” [Gel- digm. fond and Lifschitz 1988, 1991]) correspond to the solutions of the problem. The answer sets for the given program can then be computed by special software systems called answer set solvers, such as DLV, Smodels, or clasp. Due to the continuous improvement of ASP solvers and the expressive representation languages of ASP, ASP has been applied fruitfully to a wide range of areas in AI and in other Copyright © 2016, Association for the Advancement of Artificial Intelligence. All rights reserved. ISSN 0738-4602 FALL 2016 53 Articles fields. Areas of AI that include applications of ASP are nic. Though not encountered in mathematics, non- planning, probabilistic reasoning, data integration monotonicity seems to be a prevailing feature of and query answering, multiagent systems, natural commonsense reasoning. It is especially relevant to language processing and understanding, learning, reasoning with so called defaults — statements of the theory update/revision, preferences, diagnosis, form “Normally (typically, as a rule) elements of class description logics, semantic web, multicontext sys- C have property P.” We all learn rather early in life tems, and argumentation. Other areas that include that parents normally love their children, citizens are applications of ASP are, for instance, computational normally required to pay taxes, and so forth. We also biology, systems biology, bioinformatics, automatic learn, however, that these rules are not absolute and music composition, assisted living, software engi- allow various types of exceptions. It is natural to neering, bounded model checking, and robotics. assume that these and other defaults should be ASP has also been used in industry, for instance, for included in a reasoner’s KB. Learning correct ways to decision support systems (Nogueira et al. 2001) (used reason with defaults and their exceptions is necessary by United Space Alliance), automated product con- for building an agent capable of using such a KB. One figuration (Tiihonen, Soininen, and Sulonen 2003) of the best available solutions to this problem uses (used by Variantum Oy), intelligent call routing the knowledge representation language CR-Prolog (Leone and Ricca 2015) (used by Italia Telecom) and (Balduccini and Gelfond 2003) — a simple extension configuration and reconfiguration of railway safety of the original ASP language of logic programs with systems (Aschinger et al. 2011) (used by Siemens). two types of negation and epistemic disjunction. In this article, we will describe only some of these A program Π of CR-Prolog consists of a first-order ASP applications, in particular, in knowledge repre- signature, a collection Πr of standard ASP rules of the sentation and reasoning, robotics, bioinformatics, as form well as some industrial applications. For a wide vari- l |…| l l ,…,l ,not l ,…,not l ety of ASP applications and relevant references, we 0 k k+1 m m+1 n refer the reader to the ASP applications table.1 and a collection Πcr of consistency-restoring rules (or simply cr-rules)2 of the form: ASP and Knowledge Representation + l0 lk+1,…,lm ,not lm+1,…,not ln. One of the main goals of AI is to better understand how to build software components of agents capable Here each li is a literal, that is, an atom p(¯)t or its of reasoning and acting in a changing environment. negation ¬p(¯).t The last statement says that ¯t does not Most AI researchers agree that to exhibit such behav- have property p. In contrast, default negation not has ior the agent should have a mathematical model of an epistemic character — not l is often read as “it is its environment and its own capabilities and goals. A not believed that l is true.” Similarly, the connective logic-based approach to AI (McCarthy 1990) suggests | (also denoted by or) is often called epistemic dis- that this model should contain a knowledge base junction with l1 | l2 being read as “l1 is believed to be (KB) — a collection of statements in some declarative true or l2 is believed to be true.” Intuitively, a regular language with precisely defined syntax and seman- ASP rule Head ← Body says that if the body of the rule tics. As a rule, such a KB should include common- is believed then the reasoner must believe its head. A sense knowledge — information an ordinary person cr-rule says that if the body of the rule is believed, is expected to know — as well as some specialized then the reasoner may possibly believe its head; how- knowledge pertinent to a particular set of activities ever, this possibility may be used only if Πr is incon- the agent is built to perform. Early proponents of log- sistent. ic-based AI believed that such a KB could be built in Informally, program Π can be viewed as a specifi- classical first-order logic (FOL) which, at the time, cation for answer sets — sets of beliefs that could be was commonly used for formalization of mathemat- held by a rational reasoner associated with Π. Answer ical reasoning. It was quickly discovered, however, sets are represented by collections of ground literals. that this logic may not be a fully adequate tool for In forming such sets the reasoner must satisfy the representing nonmathematical (especially common- rules of Π together with a so-called rationality princi- sense) knowledge. The main problem was difficulty ple, which says that the reasoner associated with the with using FOL for defeasible (or nonmonotonic) rea- program shall believe nothing that he is not forced to soning. In precise terms, a consequence relation A ⊨ believe by the program’s rules. In the absence of cr- F between statements of a declarative language is rules this idea is captured by the standard answer set called monotonic if, for every A, B, and F, if A ⊨ F semantics. then (A ⋀ B) ⊨ F. This property guarantees that, once The definition of an answer set for an arbitrary CR- proven, a statement stays proven. If this condition is Prolog program is as follows. For a collection R of cr- not satisfied, that is, if addition of new information rules, by α(R) we denote the collection of regular rules can force a reasoner to withdraw its previous conclu- obtained by replacing labeled arrows in cr-rules of R sion, the consequence relation is called nonmonoto- by ←. A minimal (with respect to the preference rela- 54 AI MAGAZINE Articles Π tion of the program) collection R of cr-rules of such ¬loves(P,C) + parent(P,C). that Πr ⋃α(R) is consistent (that is has an answer set) Π is called an abductive support of . A set A is called The new program P consisting of regular rules (1), Π 4 an answer set of if it is an answer set of the regular (2), and (4) and cr-rule (6) entails that Mary cares ASP program Πr ⋃α(R) for some abductive support R about John. A consistent answer set of the program of Π. can be obtained from its regular rules only and cr- In the following, we assume that the rules that are rule (6) is not used. If, however, we expand P4 by in sans-serif font are in the ASP Core language ASP- statement (5), regular rules of the program are not Core-2,3 whereas the rules in math font (for example, sufficient to avoid the contradiction. Consistency cr-rules) are in languages (for example, CR-Prolog) restoring rule (6) will be activated and the reasoner that extend the ASP Core language in different ways. will conclude that Mary does not love John. The schematic variables (respectively, object con- The previous example is rather general and allows stants) in rules are denoted by strings whose first let- for representation of different types of exceptions to ters are in uppercase (resp. in lowercase). defaults. More information on this can be found in Example 1 [Representing Defaults] Gelfond and Kahl (2014). A default “parents normally love their children” can be represented by the following rule: Reasoning about Effects of Actions (1) loves(P,C) :- Gaining better understanding of basic principles and parent(P,C), not -loves(P,C). mathematical models of default reasoning helped researchers to move forward in solving a number of Consider a program P1 consisting of this rule and a fact: other longstanding problems of AI and KR. In this (2) parent(mary,john). section we briefly describe an ASP-based solution of one such problem — finding logical means for repre- Since the answer set semantics of CR-Prolog incorpo- senting and reasoning about direct and indirect rates the rationality principle and no rule of the pro- effects of actions.