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
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Graph 3-colouring 2 3 1 4 6 5 Task: Colour the nodes of the graph in three colors such that none of the two adjacent nodes share the same colour. 5 / 45
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 NP NP ) 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 NP NP ) 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 NP NP ) 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: = φ and T ⊆ T ′ , then T ′ | if T | = φ . ❼ Note: inference in description logics is monotonic. Example: Monotonicity of description logics ❼ T = { Bird ⊑ Flier , Bird ( tweety ) } ❼ T | = Flier ( tweety ) ❼ T ′ = T ∪ {¬ Flier ( tweety ) } ❼ T ′ | = Flier ( tweety ) (actually T ′ 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: = φ and T ⊆ T ′ , then T ′ | if T | = φ . ❼ 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
❼ ❼ ❼ 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
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example 16 / 45
Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics Example Graph 3-colorability 2 3 2 3 1 4 1 4 6 5 6 5 node ( 1 . . . 6 ); edge ( 1 , 2 ); . . . col ( V , red ) ← not col ( V , blue ) , not col ( V , green ) , node ( V ); col ( V , green ) ← not col ( V , blue ) , not col ( V , red ) , node ( V ); col ( V , blue ) ← not col ( V , green ) , not col ( V , red ) , node ( V ); ⊥ ← col ( V , C ) , col ( V , C ′ ) , C � = C ′ ; ⊥ ← col ( V , C ) , col ( V ′ , C ) , edge ( V , V ′ ) node ( 1 . . . 6 ); edge ( 1 , 2 ); . . . col ( 1 , red ) , col ( 2 , blue ) , col ( 3 , red ) , col ( 4 , green ) , col ( 6 , green ) , col ( 5 , blue ) 16 / 45
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
❼ ❼ ❼ ❼ ❼ ❼ ❼ ❼ ❼ ❼ Introduction Horn Logic Programming Negation in Logic Programs Answer Set Semantics ASP Applications (cont’d) ❼ Semantic Web 18 / 45
Recommend
More recommend