Cs774 (Prasad)L7Negation1 Negation by Failure

Slides:



Advertisements
Similar presentations
Some Prolog Prolog is a logic programming language
Advertisements

Logic Programming Automated Reasoning in practice.
1 DCP 1172 Introduction to Artificial Intelligence Chang-Sheng Chen Topics Covered: Introduction to Nonmonotonic Logic.
The ancestor problem For the ancestor problem we have the following rules in AnsProlog: anc(X,Y)
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,
WFSX programming Prolog programming style, but with the WFSX semantics Requires: –A new proof procedure (different from SLDNF), complying with WFS, and.
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)
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
The idea of completion In LP one uses “if” but mean “iff” [Clark78] This doesn’t imply that -1 is not a natural number! With this program we mean: This.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Controlling Backtracking Notes for Ch.5 of Bratko For CSCE 580 Sp03 Marco Valtorta.
Default and Cooperative Reasoning in Multi-Agent Systems Chiaki Sakama Wakayama University, Japan Programming Multi-Agent Systems based on Logic Dagstuhl.
Auto-Epistemic Logic Proposed by Moore (1985) Contemplates reflection on self knowledge (auto-epistemic) Allows for representing knowledge not just about.
Models -1 Scientists often describe what they do as constructing models. Understanding scientific reasoning requires understanding something about models.
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
Using answer set programming to answer complex queries Chitta Baral (joint work with Michael Gelfond and Richard Scherl) Arizona State University Tempe,
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.
First Order Logic (chapter 2 of the book) Lecture 3: Sep 14.
Describing Syntax and Semantics
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
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
NONMONOTONIC LOGIC AHMED SALMAN MALIK. OVERVIEW Monotonic Logic Nonmonotonic Logic Usage and Applications Comparison with other forms of logic Related.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
1 Knowledge Based Systems (CM0377) Lecture 12 (Last modified 2nd May 2002)
FATIH UNIVERSITY Department of Computer Engineering Controlling Backtracking Notes for Ch.5 of Bratko For CENG 421 Fall03.
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.
1 Nonmonotonic Inductive Logic Programming Chiaki Sakama Wakayama University, Japan Invited Talk at LPNMR 2001.
Cs7120 (Prasad)L16-Meaning1 Procedural and Declarative Meaning of Prolog
Logical Inference 2 rule based reasoning
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.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CS4026 Formal Models of Computation Part II The Logic Model Lecture 2 – Prolog: History and Introduction.
CSE 311 Foundations of Computing I Lecture 7 Logical Inference Autumn 2012 CSE
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
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.
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
Cs774 (Prasad)L6Backtracking1 Controlling Backtracking : Cuts
Inverse Entailment in Nonmonotonic Logic Programs Chiaki Sakama Wakayama University, Japan.
1 Knowledge Based Systems (CM0377) Introductory lecture (Last revised 28th January 2002)
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
Matching ® ® ® Global Map Local Map … … … obstacle Where am I on the global map?                                   
Logical Inference 2 Rule-based reasoning
Limitations of First-Order Logic
Chapter 7: Beyond Definite Knowledge
Logical Inference 2 Rule-based reasoning
CS201: Data Structures and Discrete Mathematics I
CS 1502 Formal Methods in Computer Science
Reasoning with Uncertainty
CSE 311 Foundations of Computing I
Prolog syntax + Unification
First Order Logic Rosen Lecture 3: Sept 11, 12.
Logical Entailment Computational Logic Lecture 3
Predicates and Quantifiers
CS201: Data Structures and Discrete Mathematics I
Properties of Relational Logic
Theory of Computation Lecture 13: A Universal Program V
Answer Set Programming
Controlling Backtracking : Cuts
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

cs774 (Prasad)L7Negation1 Negation by Failure

Motivation p(X) :- q(X). q(a). ?-q(a). true ?-p(a). true ?-q(b). false ?-p(b). false ‘false’ really corresponds to ‘cannot prove’. That is, ‘true’ and ‘false’ are responses to the question : “Is it a theorem/logical consequence?” cs774 (Prasad)L7Negation2

Closed World Assumption The database is complete with respect to positive information. That is, all positive atomic consequences are provable. Failure to prove goal G can be interpreted as evidence that G is false, or that negation of G (that is, ~G) is true. cs774 (Prasad)L7Negation3

‘Negation as failure’ operator (in the query) p(X) :- q(X). q(a). ?- q(a). true ?- p(a). true ?- q(b). false ?- \+ q(b). true ?- \+ p(b). true cs774 (Prasad)L7Negation4

Nonmonotonic Reasoning p(X) :- q(X). q(a). q(b). ?-q(b). true ?-p(b). true Previous conclusions (e.g., \+ q(b), \+ p(b), etc ) overturned/overridden when new facts are added. This is in stark contrast with classical logics, where the set of theorems grows monotonically with the axioms. cs774 (Prasad)L7Negation5

Monotonic vs non-monotonic entailment cs774 (Prasad)L7Negation6

‘Negation as failure’ in a rule p(X) :- q(X), \+ r(X). q(a). r(a). q(b). ?-p(a). false ?-p(b). true ?-q(c). false ?-p(c). false ?- \+ p(c). true cs774 (Prasad)L7Negation7

Negation : Theory vs Practice p :- \+ p. ?-p. Computation: infinite loop Translation into logic: {p} Recursion through negation results in a computation that does not fail finitely. cs774 (Prasad)L7Negation8

Negation : Theory vs Practice p(X) :- p(s(X)). ?-p(a). Computation: infinite loop ?- \+ p(a). Computation: infinite loop Ideally, the latter should succeed because p(a) is not provable from the input, but the Prolog query \+ p(a) loops, as p(a) does not fail finitely. cs774 (Prasad)L7Negation9

Negation Meta-predicate: Simulation using Cut not(p) :- p, !, fail. not(p). Informally, if p succeeds, then not(p) fails. Else, not(p) succeeds. p :- \+ q(X). Informally, p succeeds if there is no x such that q(x) succeeds. p fails if there is some x such that q(x) succeeds. cs774 (Prasad)L7Negation10 Negation : Meaning

Example: Correct use of \+ Hotel is full if there are no vacant rooms. Room 13 is vacant. Room 113 is vacant. hotelFull :- \+ vacantRoom(X). vacantRoom(13). vacantRoom(113). ?- hotelFull. No, because there are vacant rooms. –Note that some implementations will complain about variables inside negated goals, as explained later. cs774 (Prasad)L7Negation11

Example: Incorrect use of \+ X is at home if X is not out. Sue is out. John is Sue’s husband. home(X):- \+ out(X). out(sue). husband(john,sue). ?- home(john). True. ?- home(X). False. –Even though John is at home, it is not extracted. –I.e., the query is equivalent to “Is everyone out?” cs774 (Prasad)L7Negation12

Example: Characteristics of \+ student(bill). married(joe). unmarriedStudent(X):- \+ married(X), student(X). ?- unmarriedStudent(X). False. bachelor(X):- student(X), \+ married(X). ?- bachelor(X). X = bill Negated goals do not generate bindings. cs774 (Prasad)L7Negation13

Recursion through Negation Revisited p :- \+ q. q :- \+ p. Logically equivalent to: p v q Ambiguity Minimal models {p} and {q}. cs774 (Prasad)L7Negation14

Stratified Negation cs774 (Prasad)L7Negation15 p1 :- p2, \+ q. … p2 :- p1, \+ r2. q1 :- q2, q3, \+ r1. … q4. r1 :- r2. r2.

Stratified Negation Syntactic restriction for characterizing “good programs” –What is the purpose? Associate unique meaning –How is it obtained? Mutual recursion among same level predicates Negated predicates / atoms must contain lower level predicates No recursion through negation cs774 (Prasad)L7Negation16

Example: Common-sense Reasoning fly(X) :- bird(X). bird(X) :- eagle(X). bird(tweety). eagle(toto). ?- fly(tweety). True. ?- fly(toto). True. Monotonic reasoning? Birds fly. cs774 (Prasad)L7Negation17

Example: Common-sense Reasoning (Exceptions) fly(X) :- bird(X), \+ abnormal(X). abnormal(X) :- penguin(X). bird(X) :- penguin(X). penguin(tweety). ?- fly(tweety). False. Non-monotonic reasoning Typically, birds fly. –Infer abnormality only if it is provable. –Otherwise, assume normal. cs774 (Prasad)L7Negation18