Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics
Knowledge Representation for the Semantic Web
Lecture 6: Answer Set Programming I
Daria Stepanova
partially based on slides by Thomas Eiter
D5: Databases and Information Systems Max Planck Institute for Informatics
WS 2017/18
1 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Unit Outline
Introduction
Horn Logic Programming
Negation in Logic Programs
Answer Set Semantics
2 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics French Phrases, Italian Soda
Six people sit at a round table. Each drinks a different kind of soda. Each plans to visit a different French-speaking country. The person who is planning a trip to Quebec, who drank either blueberry or lemon soda, didn’t sit in seat number one. Jeanne didn’t sit next to the person who enjoyed the kiwi soda. The person who has a plane ticket to Belgium, who sat in seat four or seat five, didn’t order the cherry soda. ...
Question: What is each of them drinking, and where is each of them going?
3 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Sudoku
6 1 4 5 8 3 5 6 2 1 8 4 7 6 6 3 7 9 1 4 5 2 7 2 6 9 4 5 8 7
Task: Fill in the grid so that every row, every column, and every 3x3 box contains the digits 1 through 9.
4 / 45 + – a rule r, if Head(r) S = whenever Body (r) S and Body−(r) S = ; ∩ 6 ∅ ⊆ ∩ ∅ – a logic program (I is a model of ), if it satisfies all rules r of . P P P Definition 8. A model I of a logic program is called minimal, if there is no model I0 of , such that I0 I. P P ⊂ The semantics of ASP programs is given in terms of answer sets (or stable models). Definition 9. Given a positive logic program , an interpretation I is an answer set (stable model) of if I = and P P | P there does not exist I0 I, such that I0 = . AS( ) denotes the set of all answer sets. ⊂ | P P The notion of answer sets for logic programs with negation is defined using the Gelfond-Lifshitz reduct. Definition 10. Given a logic program and an interpretation I of the Gelfond-Lifshitz (GL-)reduct denoted by I is P P PGL constructed from ground( ) by P – deleting all rules r from ground( ) s.t. Body−(r) I = , and P ∩ 6 ∅ – deleting the negative body for all of the remaining rules. Note that for any program and interpretation the GL-reduct is positive. The definition of answer sets for arbitrary logic programs is then as follows: Definition 11. An answer set of a program is an interpretation I HB , such that I is an answer set of the positive P ⊆ P program I . PGL The availability of advanced reasoners makes the ASP formalism applicable to solving practical tasks. The standard reasoner comprises two components: a grounder and a solver. The list of the most well-known grounders include: dlv4, gringo5, lparse6, etc. Among the solvers one can mention dlv, clasp7, claspd8, gnt9. Potassco10 represents a collection of ASP reasoning tools, combining clasp and gringo into a system architecture. We now present an exampleIntroduction that illustratesHorn Logic Programming the basic notionsNegation of in the Logic Answer Programs Set ProgrammingAnswer Set Semantics that we have inroduced. Example 10. Consider a graph 3-colourability problem,Graph in 3-colouring which we are given a graph and three colours, e.g. red, blue and green, and we aim at finding the assignment of colours to the nodes of a graph in such a way that no adjacent nodes share the same color. The encoding of this problem is as follows.
2 3
1 4
6 5
(1) node(1 ... 6 ); (2) edge(1 , 2 ); ... (8) edge(5 , 6 ); Task: (9) coloured(V , red) not coloured(V , blue), not coloured(V , green), node(V ); Colour← the nodes of the graph in three colors such that none of the two (10) coloured(V , green) not coloured(V , blue), not coloured(V , red), node(V ); I = adjacent← nodes share the same colour. P (11) coloured(V , blue) not coloured(V , green), not coloured(V , red), node(V ); ← (12) coloured(V , C), coloured(V , C 0),C = C0; ⊥ ← 6 (13) coloured(V , C), coloured(V 0, C), edge(V , V 0) 5 / 45 ⊥ ← The facts of the programs describe the nodes and edges of the graph from above. The rules (9)-(11) state that each P node has to be colored in at least one of the three colours. The constraint (12) forbids the nodes to be colored in more then one color, while the constraint (13) says that two nodes connected via an edge must have different colours. 4 http://www.dlvsystem.com/ 5 http://potassco.sourceforge.net/ 6 http://www.tcs.hut.fi/Software/smodels/ 7 http://potassco.sourceforge.net/ 8 http://www.cs.uni-potsdam.de/claspD/ 9 http://www.tcs.hut.fi/Software/gnt/ 10 http://potassco.sourceforge.net/ Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Wanted!
A general-purpose approach for modeling and solving these and many other problems. Issues: Diverse domains Spatial and temporal reasoning Constraints Incomplete information Frame problem
Proposal: Answer-set programming (ASP) paradigm!
6 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Answer Set Programming
Answer Set Programming (ASP) is a recent problem solving approach, based on declarative programming.
The term was coined by Vladimir Lifschitz [1999,2002].
Proposed by other people at about the same time, e.g., by Marek and Truszczy´nski[1999] and Niemel¨a[1999].
It has roots in knowledge representation, logic programming, and nonmonotonic reasoning.
At an abstract level, ASP relates to SAT solving and constraint satisfaction problems (CSPs).
7 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Answer Set Programming (cont’d)
Important logic programming method
Developed in the early 1990s by Gelfond and Lifschitz.
Left: Michael Gelfond (Texas Tech Univ., Lubbock) Right: Vladimir Lifschitz (Univ. of Texas, Austin) Both are graduates from the Steklov Mathematical Institute, St.Petersburg (then: Leningrad).
8 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Answer Set Programming (cont’d)
ASP is an approach to declarative programming, combining a rich yet simple modeling language with high-performance solving capacities
ASP has its roots in deductive databases logic programming with negation knowledge representation and nonmonotonic reasoning constraint solving (in particular, SATisfiability testing)
ASP allows for solving all search problems in NP (and NPNP) in a uniform way
9 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Answer Set Programming (cont’d)
ASP is an approach to declarative programming, combining a rich yet simple modeling language with high-performance solving capacities
ASP has its roots in deductive databases logic programming with negation knowledge representation and nonmonotonic reasoning constraint solving (in particular, SATisfiability testing)
ASP allows for solving all search problems in NP (and NPNP) in a uniform way
9 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Declarative Programming
10 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Answer Set Programming (cont’d)
ASP is an approach to declarative programming, combining a rich yet simple modeling language with high-performance solving capacities
ASP has its roots in deductive databases logic programming with negation knowledge representation and nonmonotonic reasoning constraint solving (in particular, SATisfiability testing)
ASP allows for solving all search problems in NP (and NPNP) in a uniform way
11 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Nonmonotonic Reasoning
Nonmonotonicity means that conclusions may be invalidated in the light of new information. More specifically, an inference relation |= is nonmonotonic if it violates the monotonicity principle:
if T |= φ and T ⊆ T 0, then T 0 |= φ.
Note: inference in description logics is monotonic.
Example: Monotonicity of description logics T = {Bird v Flier, Bird(tweety)} T |= F lier(tweety) T 0 = T ∪ {¬Flier(tweety)} T 0 |= F lier(tweety) (actually T 0 is inconsistent)
12 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Nonmonotonic Reasoning
Nonmonotonicity means that conclusions may be invalidated in the light of new information.
More specifically, an inference relation |= is nonmonotonic if it violates the monotonicity principle:
if T |= φ and T ⊆ T 0, then T 0 |= φ.
Note: inference in description logics is monotonic.
Example: Nonmonotonic inference If bird(x) holds and there is no evidence for ¬flies(x), then infer flies(x). I.e., if bird(x), assume flies(x) by default.
12 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP Systems
ASP gains increasing importance for knowledge representation High expressiveness Efficient solvers available: DLV, clasp,...
Source: Wikipedia (Dec 6, 2017) 13 / 45 Fundamental characteristics: models, not proofs, represent solutions; requires techniques to compute models (rather than techniques to compute proofs)
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP: General Idea
ASP are logic programs; Their semantics adheres to the multiple preferred models approach: given as a selection of the collection of all classical models; selected (intended) models are called stable models or answer sets.
14 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP: General Idea
ASP are logic programs; Their semantics adheres to the multiple preferred models approach: given as a selection of the collection of all classical models; selected (intended) models are called stable models or answer sets.
Fundamental characteristics: models, not proofs, represent solutions; requires techniques to compute models (rather than techniques to compute proofs)
14 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP: General Idea (cont’d)
Given a search problem Π and an instance I, reduce it to the problem of computing intended models of a logic program:
1. Encode (Π,I) as a logic program P such that the solutions of Π for the instance I are represented by the intended models of P . 2. Compute some intended model M of P . 3. Extract a solution for I from M.
Variant: Compute multiple/all intended models to obtain multiple/all solutions
15 / 45 IntroductionMotivation OntologiesHorn and Rules Logic ProgrammingInconsistencies in DL-programsNegation inNonmonotonic Logic Programs Rule Mining AnswerOngoing Set and Semantics Future Work Declarative ProgrammingExample Paradigm
16 / 45 26 / 38 + – a rule r, if Head(r) S = whenever Body (r) S and Body−(r) S = ; ∩ 6 ∅ ⊆ ∩ ∅ – a logic program (I is a model of ), if it satisfies all rules r of . P P P Definition 8. A model I of a logic program is called minimal, if there is no model I0 of , such that I0 I. P P ⊂ The semantics of ASP programs is given in terms of answer sets (or stable models). For the logic program , the grounding ground( ) is obtained by substituting the variables V,V 0,C,C0 with constants Definition 9. Given a positive logic program , an interpretation I is an answer set (stable model) of if I = P and P P from the set 1,P2, 3, 5,| 6,P blue, green, red in all possible ways. there does not exist I0 I, such that I0 = . AS( ) denotes the set of all answer sets. { } ⊂ | P P Let us now look at the interpretation I = coloured(1 , red), node(1 ), node(2 ) and the following ground rules of { } The notion of answer sets for logic programs with negation is defined using the Gelfond-Lifshitzground( ) reduct: . P I Definition 10. Given a logic program and an interpretation I of the Gelfond-Lifshitzr(GL-)reduct: coloured( denoted1 , red) bynotGL colouredis (1 , blue), not coloured(1 , green), node(1 ); P P 1 ← P constructed from ground( ) by r : coloured(2 , green) not coloured(1 , blue), not coloured(1 , red), node(2 ) P 2 ← – deleting all rules r from ground( ) s.t. Body−(r) I = , and We have that I = node(1 ). Furthermore, I = r , and I = r . P ∩ 6 ∅ | | 1 6| 2 – deleting the negative body for all of the remaining rules. Consider now an interpretation I, which apart from the graph description contains the facts: coloured(1 , red), coloured(2 , blue), coloured(3 , red), coloured(4 , green), coloured(6 , green), coloured(5 , blue). Note that for any program and interpretation the GL-reduct is positive. The definition of answer sets for arbitrary logic The GL-reduct I of is as follows: programs is then as follows: PGL P Definition 11. An answer set of a program is an interpretation I HB , such that I is an answer(1) node set of(1 the... 6 positive); ... (8) edge(5 , 6 ); I P ⊆ P program GL. (9) coloured(1 , red) node(1 ); P ← IntroductionMotivation OntologiesHorn and Rules Logic ProgrammingInconsistencies in DL-programs (10)Negationcoloured (3 , inredNonmonotonic Logic) node Programs(3 ); Rule Mining AnswerOngoing Set and Semantics Future Work The availability of advanced reasoners makes the ASP formalism applicable to solving practical tasks. The standard← I = (11) coloured(4 , green4) node(4 ); reasoner comprises two components: a grounder and a solver. The list of the most well-knownPGL grounders include: dlv , ← 5 6 7 8 9 10 (12) coloured(6 , green) node(6 ); gringo , lparse , etc. Among the solvers one can mention dlv, clasp , claspd , gnt . Potassco represents a collection of ← ASP reasoning tools, combining clasp and gringo into a system architecture. (13) coloured(2 , blue) node(2 ); ← We now present an example that illustrates the basicDeclarative notions of the Answer Set Programming ProgrammingExample that(14) wecoloured have inroduced.(5 , blue) node(5 ) Example ← Example 10. Consider a graph 3-colourability problem, in which we are given a graph and threeOne colours, can see e.g. that red,I is blue the and minimal model of the positive program I , and thus an answer set of . Furthermore, it PGL P green, and we aim at finding the assignment of colours to the nodes of a graph in such a wayencodes that no the adjacent following nodes valid share graph coloring: the same color. The encoding of this problemGraph is as follows. 3-colorability 2 3 2 3
1 4 1 4
6 5 6 5
(1) node(1 ... 6 ); (2) edge(1 , 2 ); ... (8) edge(5 , 6 ); (9) coloured(V , red) not coloured(V , blue), not coloured(V , green), node(V ); ← (10) coloured(V , green) not coloured(V , blue), not colourednode(V ,(red1 ...), node6);(V ); edge(1, 2); ... I = ← B Related Work P (11) coloured(V , blue) not coloured(V , green), not colouredcol(V(V, red, red), node) (V );not col(V , blue), not col(V , green), node(V ); ← ← (12) coloured(V , C), coloured(V , C 0),C = C0; From the theoretical side the problem of learning nonmonotonic rules from the data has been studied in several works both ⊥ ← 6 col(V , green) not col(V , blue), not col(V , red), node(V ); (13) coloured(V , C), coloured(V 0, C), edge(V , V 0) ←in discrete and probabilistic settings. However, many available techniques are heavily based on CWA, and thus can not ⊥ ← col(V , blue) not col(V , green), not col(V , red), node(V ); be directly applied to our setting. For example, Bain and Muggleton [3] developed the algorithm called Closed World ← The facts of the programs describe the nodes and edges of the graph fromcol( above.V , C) The,Specializationcol rules(V , (9)-(11)C0), (CWS),C state= C that in0; which each an initial program and an intended interpretation that a learned program should satisfy are P ⊥ ← 6 node has to be colored in at least one of the three colours. The constraint (12)col forbids(V , theC), nodesgiven.col(V to In0 be, thisC colored) setting,, edge in any( moreV , atomV then0) which is not included in the interpretation is considered false. For example, let the program one color, while the constraint (13) says that two nodes connected via⊥ an ← edge must have differentcontain the colours. rule flies(X) bird(X). Furthermore, let the KB be as follows: bird(eagle), flies(eagle), bird(emu) . { ← } { } 4 The CWS algorithm would interpret flies(emu) as false, and would specialize P to flies(X) bird(X), not ab(X) , http://www.dlvsystem.com/ { ← } 5 from which the fact ab(emu) would be learned. http://potassco.sourceforge.net/ { } 6 http://www.tcs.hut.fi/Software/smodels/ The Open World Specialization (OWS) [9] is a modification of the CWS algorithm, which avoids using CWA to derive 7 http://potassco.sourceforge.net/ negative instances by considering a three-valued setting. The OWS technique does not involve confidence degrees of the 8 rules that are mined, which prevents it from being used for our purpose. http://www.cs.uni-potsdam.de/claspD/ node(1 ... 6); edge(1, 2); ... 9 http://www.tcs.hut.fi/Software/gnt/ col(1, red), col(2, blue), 10 http://potassco.sourceforge.net/ col(3, red), col(4, green), col(6, green), col(5, blue)
16 / 45 26 / 38 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP Applications
Use ASP to solve search problems, like
k-colourability: assign one of k colours to each node of a given graph such that adjacent nodes always have different colours
Sudoku: find a solution to a given Sudoku puzzle Satisfiability (SAT): find all models of a propositional formula Time Tabling: find a lecture room assignment for courses
17 / 45 games, puzzles information integration constraint satisfaction, configuration planning, routing, scheduling diagnosis, repair security, verification systems biology / biomedicine knowledge management musicology ... See AI Magazine article on ASP [Erdem et al., 2016] for overview
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP Applications (cont’d)
Semantic Web
18 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP Applications (cont’d)
Semantic Web games, puzzles information integration constraint satisfaction, configuration planning, routing, scheduling diagnosis, repair security, verification systems biology / biomedicine knowledge management musicology ... See AI Magazine article on ASP [Erdem et al., 2016] for overview
18 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP Applications (cont’d)
USA-Advisor [Nogueira et al., 2001] decision support system to control the Space Shuttle during flight issue: problems with the oxygen transport (pipes and valves) failure scenario: also multiple system failures occur
Biological Network Repair [Kaminski et al., 2013] model nodes (substances, etc) in a large scale biological influence graph, with roles (e.g. inhibitor, activator) repair inconsistencies (modify roles, add links between nodes, etc)
Anton [Boenn et al., 2011] http://www.cs.bath.ac.uk/~mjb/anton/ automatic system for the composition of renaissance-style music. musical knowledge ≈ 500 ASP rules (melody, harmony, rhythm) can generate musical pieces, check pieces for violations.
19 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics
Horn Logic Programming
Alfred Horn
20 / 45 A term is either a variable, a constant, or inductively built from other terms using function symbols.
An atom is an expression of form p(t1, . . . , tn), where p is a predicate symbol of arity n ≥ 0 from Φ, and t1, . . . , tn are terms. (e.g., connected(frankfurt))
A term or an atom is ground if it contains no variable. (e.g., connected(frankfurt) is ground, connected(X ) is nonground.)
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Syntax
Assume a vocabulary Φ comprised of nonempty finite sets of constants (e.g., frankfurt) variables (e.g., X) predicate symbols (e.g., connected)
21 / 45 An atom is an expression of form p(t1, . . . , tn), where p is a predicate symbol of arity n ≥ 0 from Φ, and t1, . . . , tn are terms. (e.g., connected(frankfurt))
A term or an atom is ground if it contains no variable. (e.g., connected(frankfurt) is ground, connected(X ) is nonground.)
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Syntax
Assume a vocabulary Φ comprised of nonempty finite sets of constants (e.g., frankfurt) variables (e.g., X) predicate symbols (e.g., connected)
A term is either a variable, a constant, or inductively built from other terms using function symbols.
21 / 45 A term or an atom is ground if it contains no variable. (e.g., connected(frankfurt) is ground, connected(X ) is nonground.)
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Syntax
Assume a vocabulary Φ comprised of nonempty finite sets of constants (e.g., frankfurt) variables (e.g., X) predicate symbols (e.g., connected)
A term is either a variable, a constant, or inductively built from other terms using function symbols.
An atom is an expression of form p(t1, . . . , tn), where p is a predicate symbol of arity n ≥ 0 from Φ, and t1, . . . , tn are terms. (e.g., connected(frankfurt))
21 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Syntax
Assume a vocabulary Φ comprised of nonempty finite sets of constants (e.g., frankfurt) variables (e.g., X) predicate symbols (e.g., connected)
A term is either a variable, a constant, or inductively built from other terms using function symbols.
An atom is an expression of form p(t1, . . . , tn), where p is a predicate symbol of arity n ≥ 0 from Φ, and t1, . . . , tn are terms. (e.g., connected(frankfurt))
A term or an atom is ground if it contains no variable. (e.g., connected(frankfurt) is ground, connected(X ) is nonground.)
21 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Positive Logic Programs Def.: Positive logic programs A positive logic program, P , is a finite set of rules (clauses) of the form
a ← b1, . . . , bm, (1)
where a, b1,..., bm are atoms. a is the head of the rule
b1, . . . , bm is the body of the rule. If m = 0, the rule is a fact (written shortly a)
Intuitively, (1) can be seen as material implication
∀~xb1 ∧ · · · ∧ bm → a, where ~x is the list of all variables occurring in (1).
22 / 45 Non-ground rule: “All airports with a link to a hub airport are connected.”
connected(X ) ←hub airport(Y ), link(Y , X )
can be read as a universally quantified clause
∀X,Y hub airport(Y ) ∧ link(Y,X) → connected(X).
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example Ground rule: “If Franfurt is a hub airport, and there is a link between Frankfurt and Saarbr¨ucken, then Saarbr¨ucken is a connected airport.”
connected(srb)←hub airport(frankfurt), link(frankfurt, srb)
23 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example Ground rule: “If Franfurt is a hub airport, and there is a link between Frankfurt and Saarbr¨ucken, then Saarbr¨ucken is a connected airport.”
connected(srb)←hub airport(frankfurt), link(frankfurt, srb)
Non-ground rule: “All airports with a link to a hub airport are connected.”
connected(X ) ←hub airport(Y ), link(Y , X )
can be read as a universally quantified clause
∀X,Y hub airport(Y ) ∧ link(Y,X) → connected(X).
23 / 45 A (Herbrand) interpretation is a first-order interpretation I = (D, ·I ) of the vocabulary with domain D = HU(P ) where each term t ∈ HU(P ) is interpreted by itself, i.e., tI = t.
I I I I is identified with the set { p(t1, . . . , tn) ∈ HB(P ) | ht1, . . . , tni ∈ p }.
Informally, a (Herbrand) interpretation can be seen as a set denoting which ground atoms are true in a given scenario.
Named after logician Jacques Herbrand.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Herbrand Semantics Def.: Herbrand universe, base, interpretation Given a logic program P , the Herbrand universe of P , HU(P ), is the set of all terms which can be formed from constants and functions symbols in P (resp., the vocabulary Φ of P , if explicitly known).
The Herbrand base of P , HB(P ), is the set of all ground atoms which can be formed from predicates and terms t ∈ HU(P ).
24 / 45 I I I I is identified with the set { p(t1, . . . , tn) ∈ HB(P ) | ht1, . . . , tni ∈ p }.
Informally, a (Herbrand) interpretation can be seen as a set denoting which ground atoms are true in a given scenario.
Named after logician Jacques Herbrand.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Herbrand Semantics Def.: Herbrand universe, base, interpretation Given a logic program P , the Herbrand universe of P , HU(P ), is the set of all terms which can be formed from constants and functions symbols in P (resp., the vocabulary Φ of P , if explicitly known).
The Herbrand base of P , HB(P ), is the set of all ground atoms which can be formed from predicates and terms t ∈ HU(P ).
A (Herbrand) interpretation is a first-order interpretation I = (D, ·I ) of the vocabulary with domain D = HU(P ) where each term t ∈ HU(P ) is interpreted by itself, i.e., tI = t.
24 / 45 Informally, a (Herbrand) interpretation can be seen as a set denoting which ground atoms are true in a given scenario.
Named after logician Jacques Herbrand.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Herbrand Semantics Def.: Herbrand universe, base, interpretation Given a logic program P , the Herbrand universe of P , HU(P ), is the set of all terms which can be formed from constants and functions symbols in P (resp., the vocabulary Φ of P , if explicitly known).
The Herbrand base of P , HB(P ), is the set of all ground atoms which can be formed from predicates and terms t ∈ HU(P ).
A (Herbrand) interpretation is a first-order interpretation I = (D, ·I ) of the vocabulary with domain D = HU(P ) where each term t ∈ HU(P ) is interpreted by itself, i.e., tI = t.
I I I I is identified with the set { p(t1, . . . , tn) ∈ HB(P ) | ht1, . . . , tni ∈ p }.
24 / 45 Named after logician Jacques Herbrand.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Herbrand Semantics Def.: Herbrand universe, base, interpretation Given a logic program P , the Herbrand universe of P , HU(P ), is the set of all terms which can be formed from constants and functions symbols in P (resp., the vocabulary Φ of P , if explicitly known).
The Herbrand base of P , HB(P ), is the set of all ground atoms which can be formed from predicates and terms t ∈ HU(P ).
A (Herbrand) interpretation is a first-order interpretation I = (D, ·I ) of the vocabulary with domain D = HU(P ) where each term t ∈ HU(P ) is interpreted by itself, i.e., tI = t.
I I I I is identified with the set { p(t1, . . . , tn) ∈ HB(P ) | ht1, . . . , tni ∈ p }.
Informally, a (Herbrand) interpretation can be seen as a set denoting which ground atoms are true in a given scenario.
24 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Herbrand Semantics Def.: Herbrand universe, base, interpretation Given a logic program P , the Herbrand universe of P , HU(P ), is the set of all terms which can be formed from constants and functions symbols in P (resp., the vocabulary Φ of P , if explicitly known).
The Herbrand base of P , HB(P ), is the set of all ground atoms which can be formed from predicates and terms t ∈ HU(P ).
A (Herbrand) interpretation is a first-order interpretation I = (D, ·I ) of the vocabulary with domain D = HU(P ) where each term t ∈ HU(P ) is interpreted by itself, i.e., tI = t.
I I I I is identified with the set { p(t1, . . . , tn) ∈ HB(P ) | ht1, . . . , tni ∈ p }.
Informally, a (Herbrand) interpretation can be seen as a set denoting which ground atoms are true in a given scenario.
Named after logician Jacques Herbrand. 24 / 45 Constant symbols: 0, a, b, r. Herbrand universe HU(P ): {0, a, b, r} Herbrand base HB(P ): { p(0, 0, 0), p(0, 0, a), . . . , p(r, r, r), h(0, 0), h(0, a), . . . , h(r, r, r), t(0, 0, 0), t(0, 0, a), . . . , t(r, r, r)} Some Herbrand interpretations:
I1 = ∅; I2 = HB(P ); I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
25 / 45 Herbrand universe HU(P ): {0, a, b, r} Herbrand base HB(P ): { p(0, 0, 0), p(0, 0, a), . . . , p(r, r, r), h(0, 0), h(0, a), . . . , h(r, r, r), t(0, 0, 0), t(0, 0, a), . . . , t(r, r, r)} Some Herbrand interpretations:
I1 = ∅; I2 = HB(P ); I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Constant symbols: 0, a, b, r.
25 / 45 Herbrand base HB(P ): { p(0, 0, 0), p(0, 0, a), . . . , p(r, r, r), h(0, 0), h(0, a), . . . , h(r, r, r), t(0, 0, 0), t(0, 0, a), . . . , t(r, r, r)} Some Herbrand interpretations:
I1 = ∅; I2 = HB(P ); I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Constant symbols: 0, a, b, r. Herbrand universe HU(P ): {0, a, b, r}
25 / 45 Some Herbrand interpretations:
I1 = ∅; I2 = HB(P ); I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Constant symbols: 0, a, b, r. Herbrand universe HU(P ): {0, a, b, r} Herbrand base HB(P ): { p(0, 0, 0), p(0, 0, a), . . . , p(r, r, r), h(0, 0), h(0, a), . . . , h(r, r, r), t(0, 0, 0), t(0, 0, a), . . . , t(r, r, r)}
25 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Constant symbols: 0, a, b, r. Herbrand universe HU(P ): {0, a, b, r} Herbrand base HB(P ): { p(0, 0, 0), p(0, 0, a), . . . , p(r, r, r), h(0, 0), h(0, a), . . . , h(r, r, r), t(0, 0, 0), t(0, 0, a), . . . , t(r, r, r)} Some Herbrand interpretations:
I1 = ∅; I2 = HB(P ); I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}.
25 / 45 The ground instances of the first rule are
p(0, 0, 0)← p(0, 0, 0), h(0, 0), t(0, 0, r).X = Y = Z = Z0 = 0 ... p(0, r, 0)← p(0, r, 0), h(0, r), t(0, 0, r).X = Z = Z0 = 0,Y = r ... p(r, r, r)← p(r, r, r), h(r, r), t(r, r, r).X = Y = Z = Z0 = r
The single ground instance of the last rule is
t(a, b, r)
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Grounding Example Program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
26 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Grounding Example Program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
The ground instances of the first rule are
p(0, 0, 0)← p(0, 0, 0), h(0, 0), t(0, 0, r).X = Y = Z = Z0 = 0 ... p(0, r, 0)← p(0, r, 0), h(0, r), t(0, 0, r).X = Z = Z0 = 0,Y = r ... p(r, r, r)← p(r, r, r), h(r, r), t(r, r, r).X = Y = Z = Z0 = r
The single ground instance of the last rule is
t(a, b, r) 26 / 45 Proposition For every positive logic program P , HB(P ) is a model of P .
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Herbrand Models
Def.: Herbrand models
An interpretation I is a (Herbrand) model of
a ground (variable-free) clause C = a ← b1, . . . , bm, symbolically I |= C, if either {b1, . . . , bm} * I or a ∈ I;
a clause C, symbolically I |= C, if I |= C0 for every C0 ∈ grnd(C);
a program P , symbolically I |= P , if I |= C for every clause C in P .
27 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Herbrand Models
Def.: Herbrand models
An interpretation I is a (Herbrand) model of
a ground (variable-free) clause C = a ← b1, . . . , bm, symbolically I |= C, if either {b1, . . . , bm} * I or a ∈ I;
a clause C, symbolically I |= C, if I |= C0 for every C0 ∈ grnd(C);
a program P , symbolically I |= P , if I |= C for every clause C in P .
Proposition For every positive logic program P , HB(P ) is a model of P .
27 / 45 no yes no
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Reconsider program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Which of the following interpretations are models of P ?
I1 = ∅
I2 = HB(P )
I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}
28 / 45 yes no
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Reconsider program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Which of the following interpretations are models of P ?
I1 = ∅ no
I2 = HB(P )
I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}
28 / 45 no
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Reconsider program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Which of the following interpretations are models of P ?
I1 = ∅ no
I2 = HB(P ) yes
I3 = {h(0, 0), t(a, b, r), p(0, 0, b)}
28 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Reconsider program P :
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
Which of the following interpretations are models of P ?
I1 = ∅ no
I2 = HB(P ) yes
I3 = {h(0, 0), t(a, b, r), p(0, 0, b)} no
28 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Minimal Model Semantics
A logic program has multiple models in general. Select one of these models as the canonical model. Commonly accepted: truth of an atom in model I should be “founded” by clauses.
Given: P1 = {a ← b.b ← c.c }, truth of a in the model I = {a, b, c} is “founded”.
Given: P2 = {a ← b.b ← a.c }, truth of a in the model I = {a, b, c} is not founded.
29 / 45 Theorem Every positive logic program P has a single minimal model (called the least model), denoted LM(P ).
This is a consequence of the following property: Proposition (Intersection closure) If I and J are models of a positive program P , then I ∩ J is also a model of P .
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Minimal Model Semantics (cont’d)
Semantics follows Occam’s razor principle: prefer models with true-part as small as possible. Def: Minimal models A model I of P is minimal, if there exists no model J of P such that J ⊂ I.
30 / 45 This is a consequence of the following property: Proposition (Intersection closure) If I and J are models of a positive program P , then I ∩ J is also a model of P .
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Minimal Model Semantics (cont’d)
Semantics follows Occam’s razor principle: prefer models with true-part as small as possible. Def: Minimal models A model I of P is minimal, if there exists no model J of P such that J ⊂ I.
Theorem Every positive logic program P has a single minimal model (called the least model), denoted LM(P ).
30 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Minimal Model Semantics (cont’d)
Semantics follows Occam’s razor principle: prefer models with true-part as small as possible. Def: Minimal models A model I of P is minimal, if there exists no model J of P such that J ⊂ I.
Theorem Every positive logic program P has a single minimal model (called the least model), denoted LM(P ).
This is a consequence of the following property: Proposition (Intersection closure) If I and J are models of a positive program P , then I ∩ J is also a model of P .
30 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
For P1 = { a ← b. b ← c. c }, we have LM(P1) = {a, b, c}.
For P2 = { a ← b. b ← a. c }, we have LM(P2) = {c}.
For P from above,
p(X,Y,Z) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). h(X,Z0) ← p(X,Y,Z0), h(X,Y ), t(Z,Z0, r). p(0, 0, b).h (0, 0).t (a, b, r).
we have
LM(P ) = {h(0, 0), t(a, b, r), p(0, 0, b), p(0, 0, a), h(0, b)}.
31 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics
Negation in Logic Programs
32 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Negation in Logic Programs Why negation?
Natural linguistic concept.
Facilitates convenient, declarative descriptions (definitions). E.g., “Men who are not husbands are singles”.
Def: Normal logic program A normal logic program is a set of rules of the form
a ← b1, . . . , bm, not c1,..., not cn (n, m ≥ 0) (2)
where a and all bi, cj are atoms. The symbol“ not ” is called negation as failure (or default negation, weak negation).
33 / 45 Different from classical negation in first-order logic!
Negation as failure (default negation) not
At a rail road crossing cross the road if no train is known to approach walk ← at(X ), crossing(X ), not train approaches(X )
Classical negation ¬
At a rail road crossing cross the road if no train approaches walk ← at(X ), crossing(X ), ¬train approaches(X )
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Programs with Negation Prolog: logic-based programming language (developed in the 1970s), with particular algorithm for proving goals (queries) hXi
Negation in Prolog:“not hXi” means “negation as failure (to prove) hXi”.
Closed World Assumption (CWA): whatever cannot be derived is false.
34 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Programs with Negation Prolog: logic-based programming language (developed in the 1970s), with particular algorithm for proving goals (queries) hXi
Negation in Prolog:“not hXi” means “negation as failure (to prove) hXi”.
Closed World Assumption (CWA): whatever cannot be derived is false. Different from classical negation in first-order logic!
Negation as failure (default negation) not
At a rail road crossing cross the road if no train is known to approach walk ← at(X ), crossing(X ), not train approaches(X )
Classical negation ¬
At a rail road crossing cross the road if no train approaches walk ← at(X ), crossing(X ), ¬train approaches(X )
34 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Programs with Negation (cont’d)
Example: man(dilbert). single(X) ← man(X), not husband(X).
Can not prove husband(dilbert) from rules.
Single intended minimal model: {man(dilbert), single(dilbert)}.
35 / 45 Two intuitive Herbrand models:
M1= {man(dilbert), single(dilbert)}, and
M2= {man(dilbert), husband(dilbert)}. Which one to choose?
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Programs with Negation (cont’d)
Example:
Modifying the last rule of P5, let the result be P1:
man(dilbert). single(X) ← man(X), not husband(X). husband(X) ← man(X), not single(X). Semantics???
Problem: not a single intuitive model!
36 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Programs with Negation (cont’d)
Example:
Modifying the last rule of P5, let the result be P1:
man(dilbert). single(X) ← man(X), not husband(X). husband(X) ← man(X), not single(X). Semantics???
Problem: not a single intuitive model! Two intuitive Herbrand models:
M1= {man(dilbert), single(dilbert)}, and
M2= {man(dilbert), husband(dilbert)}. Which one to choose?
36 / 45 Single model vs. multiple model semantics
To date:
Well-Founded Semantics by Gelder, Ross & Schlipf (1991) Partial model: man(dilbert) is true, single(dilbert), husband(dilbert) are unknown
Stable Model (alias Answer Set) Semantics by Gelfond and Lifschitz (1990)
Alternative models: M1 = {man(dilbert), single(dilbert)}, M2 = {man(dilbert), husband(dilbert)}.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Semantics of Negation in Logic Programs
“War of Semantics” in LP (1980/90ies): Meaning of programs like the Dilbert example above
37 / 45 To date:
Well-Founded Semantics by Gelder, Ross & Schlipf (1991) Partial model: man(dilbert) is true, single(dilbert), husband(dilbert) are unknown
Stable Model (alias Answer Set) Semantics by Gelfond and Lifschitz (1990)
Alternative models: M1 = {man(dilbert), single(dilbert)}, M2 = {man(dilbert), husband(dilbert)}.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Semantics of Negation in Logic Programs
“War of Semantics” in LP (1980/90ies): Meaning of programs like the Dilbert example above
Single model vs. multiple model semantics
37 / 45 Stable Model (alias Answer Set) Semantics by Gelfond and Lifschitz (1990)
Alternative models: M1 = {man(dilbert), single(dilbert)}, M2 = {man(dilbert), husband(dilbert)}.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Semantics of Negation in Logic Programs
“War of Semantics” in LP (1980/90ies): Meaning of programs like the Dilbert example above
Single model vs. multiple model semantics
To date:
Well-Founded Semantics by Gelder, Ross & Schlipf (1991) Partial model: man(dilbert) is true, single(dilbert), husband(dilbert) are unknown
37 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Semantics of Negation in Logic Programs
“War of Semantics” in LP (1980/90ies): Meaning of programs like the Dilbert example above
Single model vs. multiple model semantics
To date:
Well-Founded Semantics by Gelder, Ross & Schlipf (1991) Partial model: man(dilbert) is true, single(dilbert), husband(dilbert) are unknown
Stable Model (alias Answer Set) Semantics by Gelfond and Lifschitz (1990)
Alternative models: M1 = {man(dilbert), single(dilbert)}, M2 = {man(dilbert), husband(dilbert)}.
37 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Semantics of Negation in Logic Programs
“War of Semantics” in LP (1980/90ies): Meaning of programs like the Dilbert example above
Single model vs. multiple model semantics
To date:
Well-Founded Semantics by Gelder, Ross & Schlipf (1991) Partial model: man(dilbert) is true, single(dilbert), husband(dilbert) are unknown
Stable Model (alias Answer Set) Semantics by Gelfond and Lifschitz (1990)
Alternative models: M1 = {man(dilbert), single(dilbert)}, M2 = {man(dilbert), husband(dilbert)}.
37 / 45 Consider M 0 = {man(dilbert)}. Assuming that man(dilbert) is true and husband(dilbert) is false, by r1 also single(dilbert) should be true. M 0 does not represent a coherent or “stable” view of the information given by P1. Consider M 00 = {man(dilbert), single(dilbert), husband(dilbert)}. 00 The bodies of r1 and r2 are not true w.r.t. M , hence there is no evidence for single(dilbert) and husband(dilbert) being true. M 00 is not “stable” either.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Stable Models: Intuition
Consider program P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
38 / 45 Consider M 00 = {man(dilbert), single(dilbert), husband(dilbert)}. 00 The bodies of r1 and r2 are not true w.r.t. M , hence there is no evidence for single(dilbert) and husband(dilbert) being true. M 00 is not “stable” either.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Stable Models: Intuition
Consider program P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Consider M 0 = {man(dilbert)}. Assuming that man(dilbert) is true and husband(dilbert) is false, by r1 also single(dilbert) should be true. M 0 does not represent a coherent or “stable” view of the information given by P1.
38 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Stable Models: Intuition
Consider program P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Consider M 0 = {man(dilbert)}. Assuming that man(dilbert) is true and husband(dilbert) is false, by r1 also single(dilbert) should be true. M 0 does not represent a coherent or “stable” view of the information given by P1. Consider M 00 = {man(dilbert), single(dilbert), husband(dilbert)}. 00 The bodies of r1 and r2 are not true w.r.t. M , hence there is no evidence for single(dilbert) and husband(dilbert) being true. M 00 is not “stable” either.
38 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Stable Models
Def: Gelfond-Lifschitz reduct, stable models, answer sets The GL-reduct (or simply reduct) of a ground program P w.r.t. an interpretation M, denoted P M , is the program obtained from P by performing the following two steps:
1. remove all rules with some not a in its body s.t. a ∈ M; and 2. remove all default negated literals from the remaining rules.
An interpretation M of P is a stable model (or answer set) of P if
M = LM(P M ).
39 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Stable Models (cont’d)
Intuition behind GL-reduct:
M makes an assumption about what is true and what is false. The GL-reduct P M incorporates this assumption. As a “not”-free program, P M derives positive facts, given by the least model LM(P M ). If this coincides with M, then the assumption of M is “stable”.
Observe:
P M = P for any“ not”-free program P . For any positive program P , LM(P ) (=LM(P M )) is its single stable model.
40 / 45 M1 and M2 are stable models.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Consider again the grounding of P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Candidate interpretations:
M1 = {man(dilbert), single(dilbert)},
M2 = {man(dilbert), husband(dilbert)},
M3 = {man(dilbert), single(dilbert), husband(dilbert)},
M4 = {man(dilbert)}.
41 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example
Consider again the grounding of P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Candidate interpretations:
M1 = {man(dilbert), single(dilbert)},
M2 = {man(dilbert), husband(dilbert)},
M3 = {man(dilbert), single(dilbert), husband(dilbert)},
M4 = {man(dilbert)}.
M1 and M2 are stable models.
41 / 45 M1 GL-reduct P1 of M1 is as follows: man(dilbert). single(dilbert) ← man(dilbert).
M1 The least model of P1 is {man(dilbert), single(dilbert)} = M1. By symmetry of husband and single, also M2 = {man(dilbert), husband(dilbert)} is stable.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example (cont’d)
Recall the program P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Consider M1 = {man(dilbert), single(dilbert)}:
42 / 45 M1 The least model of P1 is {man(dilbert), single(dilbert)} = M1. By symmetry of husband and single, also M2 = {man(dilbert), husband(dilbert)} is stable.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example (cont’d)
Recall the program P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Consider M1 = {man(dilbert), single(dilbert)}:
M1 GL-reduct P1 of M1 is as follows: man(dilbert). single(dilbert) ← man(dilbert).
42 / 45 By symmetry of husband and single, also M2 = {man(dilbert), husband(dilbert)} is stable.
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example (cont’d)
Recall the program P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Consider M1 = {man(dilbert), single(dilbert)}:
M1 GL-reduct P1 of M1 is as follows: man(dilbert). single(dilbert) ← man(dilbert).
M1 The least model of P1 is {man(dilbert), single(dilbert)} = M1.
42 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example (cont’d)
Recall the program P1:
man(dilbert). (f1)
single(dilbert) ← man(dilbert), not husband(dilbert). (r1)
husband(dilbert) ← man(dilbert), not single(dilbert). (r2)
Consider M1 = {man(dilbert), single(dilbert)}:
M1 GL-reduct P1 of M1 is as follows: man(dilbert). single(dilbert) ← man(dilbert).
M1 The least model of P1 is {man(dilbert), single(dilbert)} = M1. By symmetry of husband and single, also M2 = {man(dilbert), husband(dilbert)} is stable. 42 / 45 Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Summary
1. Introduction and background 2. Horn logic programming Positive logic programs Minimal model semantics
3. Negation in logic programs Negation in prolog Semantics of negation in logic programs
4. Answer-Set semantics Semantic properties of stable models Computational properties
43 / 45 ReferencesI
Georg Boenn, Martin Brain, Marina De Vos, and John ffitch. Anton - A rule-based composition system. In Proceedings of the 2011 International Computer Music Conference, ICMC 2011, Huddersfield, UK, July 31 - August 5, 2011. Michigan Publishing, 2011.
Esra Erdem, Michael Gelfond, and Nicola Leone. Applications of answer set programming. AI Magazine, 37(3):53–68, 2016.
Roland Kaminski, Torsten Schaub, Anne Siegel, and Santiago Videla. Minimal intervention strategies in logical signaling networks with ASP. TPLP, 13(4-5):675–690, 2013. ReferencesII
Vladimir Lifschitz. Answer set planning. In Proc. 16th International Conference on Logic Programming (ICLP),, pages 23–37, 1999.
Vladimir Lifschitz. Answer Set Programming and Plan Generation. Artificial Intelligence, 138:39–54, 2002.
Victor W. Marek and Miroslaw Truszczy´nski. Stable Models and an Alternative Logic Programming Paradigm. In K. Apt, V. W. Marek, M. Truszczy´nski,and D. S. Warren, editors, The Logic Programming Paradigm – A 25-Year Perspective, pages 375–398. Springer, 1999. ReferencesIII
Ilkka Niemel¨a. Logic Programming with Stable Model Semantics as Constraint Programming Paradigm. Annals of Mathematics and Artificial Intelligence, 25(3–4):241–273, 1999.
Monica Nogueira, Marcello Balduccini, Michael Gelfond, Richard Watson, and Matthew Barry. An a-prolog decision support system for the space shuttle. In I. V. Ramakrishnan, editor, Practical Aspects of Declarative Languages, Third International Symposium, PADL 2001, Las Vegas, Nevada, March 11-12, 2001, Proceedings, volume 1990 of Lecture Notes in Computer Science, pages 169–183. Springer, 2001.