Answer Set Programming

Slides:



Advertisements
Similar presentations
Big Ideas in Cmput366. Search Blind Search State space representation Iterative deepening Heuristic Search A*, f(n)=g(n)+h(n), admissible heuristics Local.
Advertisements

Inference Rules Universal Instantiation Existential Generalization
Logic Programming Automated Reasoning in practice.
Standard Logical Equivalences
Justification-based TMSs (JTMS) JTMS utilizes 3 types of nodes, where each node is associated with an assertion: 1.Premises. Their justifications (provided.
Default Reasoning the problem: in FOL, universally-quantified rules cannot have exceptions –  x bird(x)  can_fly(x) –bird(tweety) –bird(opus)  can_fly(opus)
1 DCP 1172 Introduction to Artificial Intelligence Chang-Sheng Chen Topics Covered: Introduction to Nonmonotonic Logic.
Non-Monotonic Reasoning for the Semantic Web. Bertino, Provetti & Salvetti, AGP03 Bertino, Provetti, Salvetti Non-Monotonic Reasoning for the Semantic.
Ontologies Reasoning Components Agents Simulations Default Reasoning and Negation As Failure in General Logic Programming Jacques Robin.
Converting formulas into a normal form Consider the following FOL formula stating that a brick is an object which is on another object which is not a pyramid,
Knowledge Representation CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Knowledge Representation and Reasoning (KR): A vibrant subfield of AI Jia You.
For Friday Finish chapter 10 No homework (get started on program 2)
Cs774 (Prasad)L7Negation1 Negation by Failure
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Auto-Epistemic Logic Proposed by Moore (1985) Contemplates reflection on self knowledge (auto-epistemic) Allows for representing knowledge not just about.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf.
ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf.
Intro to AI Fall 2002 © L. Joskowicz 1 Introduction to Artificial Intelligence LECTURE 11: Nonmonotonic Reasoning Motivation: beyond FOL + resolution Closed-world.
KNOWLEDGE REPRESENTATION, REASONING AND DECLARATIVE PROBLEM SOLVING Chitta Baral Arizona State University Tempe, AZ
ANSWERING CONTROLLED NATURAL LANGUAGE QUERIES USING ANSWER SET PROGRAMMING Syeed Ibn Faiz.
Knowledge Representation and Reasoning University "Politehnica" of Bucharest Department of Computer Science Fall 2010 Adina Magda Florea
NONMONOTONIC LOGIC AHMED SALMAN MALIK. OVERVIEW Monotonic Logic Nonmonotonic Logic Usage and Applications Comparison with other forms of logic Related.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
1 Knowledge Based Systems (CM0377) Lecture 12 (Last modified 2nd May 2002)
Quasigroups Defaults Foundations of AI. Given an N X N matrix, and given N colors, color the matrix in such a way that: -all cells are colored; - each.
For Friday Exam 1. For Monday No reading Take home portion of exam due.
Learning by Answer Sets Chiaki Sakama Wakayama University, Japan Presented at AAAI Spring Symposium on Answer Set Programming, March 2001.
For Wednesday Read chapter 13 Homework: –Chapter 10, exercise 5 (part 1 only, don’t redo) Progress for program 2 due.
Steffen Staab Advanced Data Modeling 1 of 32 WeST Häufungspunkte Bifurkation: x n+1 = r x n (1-x n ) Startwert x 0 = 0,25.
Logical Agents Logic Propositional Logic Summary
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
KR A Principled Framework for Modular Web Rule Bases and its Semantics Anastasia Analyti Institute of Computer Science, FORTH-ICS, Greece Grigoris.
Answer Set Programming (ASP): A new Paradigm for Knowledge Representation and Constraint Programming Some slides are taken from Baral’s talk at AAAI-05.
Uncertainty in AI. Birds can fly, right? Seems like common sense knowledge.
Inverse Entailment in Nonmonotonic Logic Programs Chiaki Sakama Wakayama University, Japan.
1 Knowledge Based Systems (CM0377) Introductory lecture (Last revised 28th January 2002)
For Wednesday Read chapter 13 No homework. Program 2 Any questions?
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
OWL, DL and Rules Based on slides from Grigoris Antoniou, Frank van Harmele and Vassilis Papataxiarhis.
Logic Programming Lecture 2: Unification and proof search.
What is ASP? CSCE 330 Programming Language Presentation JANICE NEIGHBOR, MICHAEL RICKABAUGH, DAVID THOMAS
Goal-directed Execution of Answer Set Programs
Limitations of First-Order Logic
Computer Science cpsc322, Lecture 20
Completeness of the SLD-Resolution
EA C461 – Artificial Intelligence Logical Agent
Contradiction-tolerant TMS
Knowledge Representation
Symbolic Reasoning under uncertainty
Chapter 7: Beyond Definite Knowledge
Logical Inference 2 Rule-based reasoning
Interval Logic Axioms Meet(i, j)  End(i)= Begin(j)
Semantics of Datalog With Negation
Reasoning with Uncertainty
Automated Reasoning in Propositional Logic
Reasoning with Uncertainty Piyush Porwal ( ) Rohit Jhunjhunwala ( ) Srivatsa R. ( ) Under the guidance of Prof. Pushpak Bhattacharyya.
Logic Programming & LPMLN
Computer Science cpsc322, Lecture 20
Bottom Up: Soundness and Completeness
Bottom Up: Soundness and Completeness
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Constraint Handling Rules with Disjunction (CHRv)
Representations & Reasoning Systems (RRS) (2.2)
A Tutorial Summary of Description Logic and Hybrid Rules
Bottom Up: Soundness and Completeness
Presentation transcript:

Answer Set Programming Cleyton Rodrigues, M. Sc.

So Far… Monotonic Logic Programming

Monotonic Logic “[…] Learning a new piece of knowledge cannot reduce the set of what is known.” A logic is monotonic if every thing that is entailed by a KB (Knowledge Base) is entailed by a superset of the KB: KB╞ a  KB  b╞ a

The “Problem”! A Monotonic Logic cannot handle various reasoning tasks; Default Reasoning Typical birds can fly. x bird(X)  flies(X). sparrow? bird(sparrow). flies(sparrow). DR:  (consequences may be derived only because of lack of evidence of the contrary

The “Problem”! A Monotonic Logic cannot handle various reasoning tasks; Default Reasoning Typical birds can fly. x bird(X)  flies(X). sparrow? bird(sparrow). flies(sparrow). peguin? bird(peguin), flies(peguin). (taken by the rule).  flies (peguin). Unsatisfiable! The default assumption must be retracted.

NAF – Negation as Failure Negation-As-Failure enables defaults flies(X) :- bird(X), not penguin(X). bird(tweety). bird(opus). penguin(opus). tweety flies because he isn’t declared a penguin if we also asserted penguin(tweety)... Non-Monotonic Reasoning! Closed-world assumption (CWA) everything that is true is asserted; everything unsaid is assumed to be false Minimal Models – only believe what you have to smallest set of tuples that satisfies KB

Answer Set Programming

Answer Set Programming (ASP) Declarative Programming; Search problems reduced to compute stable models; Non Monotonic Reasoning; “Unlike SLDNF resolution employed in Prolog, such algorithms, in principle, always terminate.”

ASP General Idea Problem Instance I P is a nonmonotonic logic program. Solver Encoding: Program P P is a nonmonotonic logic program. Model (s) Solution (s)

Stable Models Model: Set of Atoms that satisfies every rule in the program. “Informally, a model is stable if every atom in its has a reason to be there: for each atom in the model there has to be some rule that has the atom as a head such that the rule body is true in the model”. Example (Prolog-style Program): PC Configuration System ide_drive :- hard_drive, not scsi_drive. scsi_drive :- hard_drive, not ide_drive. scsi_controller:- scsi_drive. hard_drive.

Stable Models? ide_drive :- hard_drive, not scsi_drive. scsi_drive :- hard_drive, not ide_drive. scsi_controller: scsi_drive. hard_drive.

Stable Models? M1={hard_drive, ide_drive}. ide_drive :- hard_drive, not scsi_drive. scsi_drive :- hard_drive, not ide_drive. scsi_controller: scsi_drive. hard_drive.

Stable Models? M1={hard_drive, ide_drive}. M2={hard_drive, scsi_drive, scsi_controller}. ide_drive :- hard_drive, not scsi_drive. scsi_drive :- hard_drive, not ide_drive. scsi_controller: scsi_drive. hard_drive.

How to Find the Stable Model?

Without negative literals Unique minimal Model. a. b. c :- a. d :- c,b. e :- f. Knaster-Tarski operator TP, where: Tp(M) = {h | h  l1, ..., ln is a rule in the program and l1, ..., ln  M}.

Without negative literals Unique minimal Model. a. b. c :- a. d :- c,b. e :- f. Knaster-Tarski operator TP, where: Tp(M) = {h | h  l1, ..., ln is a rule in the program and l1, ..., ln  M}. SM = {a, b, c, d}.

With Negative Literals. Let SM be a (potentially) stable Model for a Program P. Removing negations from P PSM: Each rule that has a negative literal “not a” in its body when a belongs to M; and All negative literals in the bodies of remaining rules. If SM is a stable model por PSM então SM is a stable model for the program P.

Find the Stable Models... a :- not b. b :- not a.

Formalizing ASP Programs

ASP Programs (Prolog Style Rules) A Program P consists of a set of rules: General Rule <head> :- <body>. Fact <head>.

ASP Programs Example1: A P prolog-style Program consists of the following rules: p :- q. q :- not r. Stable Model SM

ASP Programs Example1: A P prolog-style Program consists of the following rules: p :- q. q :- not r. Stable Model SM SM = {p, q}.

ASP Programs (Extending Prolog) P is a (potentially disjunctive) finite set of rules of the form: a1  ...  ak  b1, ...,bm, not c1,...,not cn. All ax, bi, cj are FOL literals; Arbitrarily Choice {p,q,r} :- t. “If ‘t’ is included in the stable model then chose arbitrarily which of the atoms to include.” None Just One A subset of the individuals;

ASP Programs Example2: A P ASP Program consists of the following rules: p :- q. q :- not r. {s,t}:- p. Stable Model SM

ASP Programs Example2: A P ASP Program consists of the following rules: p :- q. q :- not r. {s,t}:- p. Stable Model SM SM1:{p, q}. SM2:{p, q, s}. SM3:{p, q, t}. SM4:{p, q, t , s}.

ASP Program Arbritrarily Choice Variation Numerical Bounds N {s,t} :- p. N: integer The bound means how many indivuals, at least, must be elected by Stable Models.

ASP Program Example 3: A P ASP Program consists of the following rules: p :- q. q :- not r. 1 {s,t} :- p Stable Models SM1: p q s SM2: p q t SM3: p q t s SM4: p q (error: not allowed due the numerical restriction)

ASP Program Constraint Rule (No Head) :- s, not t. “Prohibits generating ‘s’ if ‘t’ is not generated.”

ASP Program Example 2: A P prolog Program consists of the following rules: p :- q. q :- not r. 1 {s,t} :- p :- s, not t. Stable Models SM1: p q s (error: not allowed due the constraint Rule) SM2: p q t SM3: p q t s

Non-Ground Programs

Non-ground Programs Example: d(a). d(b). foo(X) :- not bar(X). bar(X) :- not foo(X). The set of stable Models for a non-ground logic program is defined to be the set of stable models o the Herbrand Instation of the Program.

Herbrand Instatiation Herbrand Universe (HU): set of all ground terms using fuctions symbols and constants. HU = {a,b}; Herbrand Base (HB): set of ground atoms that can be constructed using the predicates in the program and the HU. HB = {foo(a), foo(b), bar(a), bar(b)}; Herbrand Instantiation (HI): set of ground instances of the rule using HB;

Herbrand Instantiation Example: d(a). d(b). foo(X) :- not bar(X). bar(X) :- not foo(X). Herbrand Instantiantion: foo(a) :- not bar(a). bar(a) :- not foo(a). foo(b) :- not bar(b). bar(b) :- not foo(b).

Herbrand Instation SM? Herbrand Instantiantion: d(a). d(b). foo(a) :- not bar(a). bar(a) :- not foo(a). foo(b) :- not bar(b). bar(b) :- not foo(b).

Herbrand Instantiation Usually, most of the rules in the herbrand Instantiation have unsatisfiable bodies and they may be discarded without affecting the set of stable models. Example: d(a). e(b). e(c). foo(X) :- d(X), not bar(X). bar(X) :- d(X), not foo(X).

Example d(a). e(b). e(c). foo(a) :- d(a), not bar(a). bar(a) :- d(a), not foo(a). foo(b) :- d(b), not bar(b). bar(b) :- d(b), not foo(b). foo(c) :- d(c), not bar(c). bar(c) :- d(c), not foo(c).

Example d(a). e(b). e(c). foo(a) :- d(a), not bar(a). bar(a) :- d(a), not foo(a). foo(b) :- d(b), not bar(b). bar(b) :- d(b), not foo(b). foo(c) :- d(c), not bar(c). bar(c) :- d(c), not foo(c).

How we know which rules can be droped out? Example How we know which rules can be droped out? d(a). e(b). e(c). foo(a) :- d(a), not bar(a). bar(a) :- d(a), not foo(a). foo(b) :- d(b), not bar(b). bar(b) :- d(b), not foo(b). foo(c) :- d(c), not bar(c). bar(c) :- d(c), not foo(c).

Lparse/ SModels

Lparse/ SModels

Exercise p :- not q. q :- not p. r :- p. r :- q. p :- not q. Program 1 Program 2 p :- not q. q :- not p. r :- p. r :- q. p :- not q. q :- not p. r :- not r. r :- p.

Exercise Program 3 Program 4 person(joey). 1{male(X), female(X)} :- person(X). bachleor(X):- male(X), not married(X). :- male(X), female(X).