Logic Program Semantics Background Luís Moniz Pereira U.I. at Jakarta, Jan/Feb 2006 AI Centre, Universidade Nova de Lisboa.

Slides:



Advertisements
Similar presentations
Logic Programming Automated Reasoning in practice.
Advertisements

Updates plus Preferences Luís Moniz Pereira José Júlio Alferes Centro de Inteligência Artificial Universidade Nova de Lisboa Portugal JELIA’00, Málaga,
1 Inductive Equivalence of Logic Programs Chiaki Sakama Wakayama University Katsumi Inoue National Institute of Informatics ILP
Automated Reasoning Systems For first order Predicate Logic.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Auto-Epistemic Logic Proposed by Moore (1985) Contemplates reflection on self knowledge (auto-epistemic) Permits to talk not just about the external world,
Well-founded Semantics with Disjunction João Alcântara, Carlos Damásio and Luís Moniz Pereira Centro de Inteligência Artificial.
Logic Concepts Lecture Module 11.
Copyright © Cengage Learning. All rights reserved.
Cs774 (Prasad)L7Negation1 Negation by Failure
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
1 Basic abstract interpretation theory. 2 The general idea §a semantics l any definition style, from a denotational definition to a detailed interpreter.
Rule Updates These languages and methodologies are basically concerned with facts that change –There is a set of fluents (fact) –There are static rules.
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.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
João Alcântara, Carlos Damásio and Luís Moniz Pereira Centro de Inteligência Artificial (CENTRIA) Depto. Informática,
Luís Moniz Pereira CENTRIA, Departamento de Informática Universidade Nova de Lisboa Pierangelo Dell’Acqua Dept. of Science and Technology.
Auto-Epistemic Logic Proposed by Moore (1985) Contemplates reflection on self knowledge (auto-epistemic) Allows for representing knowledge not just about.
José Júlio Alferes Luís Moniz Pereira Centro de Inteligência Artificial - CENTRIA Universidade Nova de Lisboa, Portugal Pierangelo Dell’Acqua Dept. of.
Extended LPs In Normal LPs all the negative information is implicit. Though that’s desired in some cases (e.g. the database with flight connections), sometimes.
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.
Luís Moniz Pereira Centro de Inteligência Artificial - CENTRIA Universidade Nova de Lisboa, Portugal Pierangelo Dell’Acqua Dept. of Science and Technology.
Multi-dimensional Dynamic Knowledge Representation João Alexandre Leite José Júlio Alferes Luís Moniz Pereira CENTRIA – New University of Lisbon Wien,
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.
Chapter 7 Reasoning about Knowledge by Neha Saxena Id: 13 CS 267.
Auto-Epistemic Logic Proposed by Moore (1985) Contemplates reflection on self knowledge (auto-epistemic) Allows for representing knowledge not just about.
KNOWLEDGE REPRESENTATION, REASONING AND DECLARATIVE PROBLEM SOLVING Chitta Baral Arizona State University Tempe, AZ
Belief Revision Lecture 1: AGM April 1, 2004 Gregory Wheeler
Database Systems Normal Forms. Decomposition Suppose we have a relation R[U] with a schema U={A 1,…,A n } – A decomposition of U is a set of schemas.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
1 Knowledge Based Systems (CM0377) Lecture 12 (Last modified 2nd May 2002)
Chapter 9 Integrity. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.9-2 Topics in this Chapter Predicates and Propositions Internal vs.
Ming Fang 6/12/2009. Outlines  Classical logics  Introduction to DL  Syntax of DL  Semantics of DL  KR in DL  Reasoning in DL  Applications.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Web Science & Technologies University of Koblenz ▪ Landau, Germany Stable Models See Bry et al 2007.
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.
Pattern-directed inference systems
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Logical Agents Logic Propositional Logic Summary
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
EVOlving L ogic P rograms J.J. Alferes, J.A. Leite, L.M. Pereira (UNL) A. Brogi (U.Pisa)
LDK R Logics for Data and Knowledge Representation PL of Classes.
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
A Logic of Partially Satisfied Constraints Nic Wilson Cork Constraint Computation Centre Computer Science, UCC.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
KR A Principled Framework for Modular Web Rule Bases and its Semantics Anastasia Analyti Institute of Computer Science, FORTH-ICS, Greece Grigoris.
LDK R Logics for Data and Knowledge Representation ClassL (Propositional Description Logic with Individuals) 1.
NMR98 - Logic Programming1 Learning with Extended Logic Programs Evelina Lamma (1), Fabrizio Riguzzi (1), Luís Moniz Pereira (2) (1)DEIS, University of.
Inverse Entailment in Nonmonotonic Logic Programs Chiaki Sakama Wakayama University, Japan.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
October 19th, 2007L. M. Pereira and A. M. Pinto1 Approved Models for Normal Logic Programs Luís Moniz Pereira and Alexandre Miguel Pinto Centre for Artificial.
Chapter 2 Sets and Functions.
Logics for Data and Knowledge Representation
Back to “Serious” Topics…
Knowledge Representation I (Propositional Logic)
Answer Set Programming
Presentation transcript:

Logic Program Semantics Background Luís Moniz Pereira U.I. at Jakarta, Jan/Feb 2006 AI Centre, Universidade Nova de Lisboa

Language zA Normal Logic Programs P is a set of rules: H   A 1, …, A n, not B 1, … not B m (n,m  0) where H, A i and B j are atoms zLiteral not B j are called default literals zWhen no rule in P has default literal, P is called definite z The Herbrand base H P is the set of all instantiated atoms from program P. zWe will consider programs as possibly infinite sets of instantiated rules.

Declarative Programming zA logic program can be an executable specification of a problem member(X,[X|Y]). member(X,[Y|L])  member(X,L). zEasier to program, compact code zAdequate for building prototypes zGiven efficient implementations, why not use it to “program” directly?

LP and Deductive Databases zIn a database, tables are viewed as sets of facts: zOther relations are represented with rules:

LP and Deductive DBs (cont) zLP allows to store, besides relations, rules for deducing other relations zNote that default negation cannot be classical negation in: zA form of Closed World Assumption (CWA) is needed for inferring non-availability of connections

Default Rules zThe representation of default rules, such as “All birds fly” can be done via the non-monotonic operator not

The need for a semantics zIn all the previous examples, classical logic is not an appropriate semantics  In the 1st, it does not derive not member(3,[1,2]) yIn the 2nd, it never concludes choosing another company yIn the 3rd, all abnormalities must be expressed zThe precise definition of a declarative semantics for LPs is recognized as an important issue for its use in KRR.

2-valued Interpretations zA 2-valued interpretation I of P is a subset of H P  A is true in I (ie. I(A) = 1) iff A  I yOtherwise, A is false in I (ie. I(A) = 0) zInterpretations can be viewed as representing possible states of knowledge. zIf knowledge is incomplete, there might be in some states atoms that are neither true nor false

3-valued Interpretations zA 3-valued interpretation I of P is a set I = T U not F where T and F are disjoint subsets of H P  A is true in I iff A  T  A is false in I iff A  F yOtherwise, A is undefined (I(A) = 1/2) z2-valued interpretations are a special case, where: H P = T U F

Models zModels can be defined via an evaluation function Î: yFor an atom A, Î(A) = I(A) yFor a formula F, Î(not F) = 1 - Î(F) yFor formulas F and G: xÎ((F,G)) = min(Î(F), Î(G))  Î(F  G)= 1 if Î(G)  Î(F), and = 0 otherwise  I is a model of P iff, for all rule H  B of P: Î(H  B) = 1

Minimal Models Semantics zThe idea of this semantics is to minimize positive information. What is implied as true by the program is true; everything else is false.  {pr(s),pr(e),ph(s),ph(e),aM(s),aM(e)} is a model  Lack of information that sampaio is a physicist, should indicate that he isn’t  The minimal model is: {pr(s),ph(e),aM(e)}

Minimal Models Semantics D [Truth ordering] For interpretations I and J, I  J iff for all atom A, I(A)  J(A), i.e. T I  T J and F I  F J T Every definite logic program has a least (truth ordering) model. D [minimal models semantics] An atom A is true in (definite) P iff A belongs to its least model. Otherwise, A is false in P.

T P operator zThe minimal models of a definite P can be computed (bottom-up) via operator T P D [T P ] Let I be an interpretation of definite P. T P (I) = {H: (H  Body)  P and Body  I} T If P is definite, T P is monotone and continuous. Its minimal fixpoint can be built by:  I 0 = {} and I n = T P (I n-1 ) T The least model of definite P is T P  ({})

Stable Models Idea zThe identification of models can be done by guessing a possible model, processing it into P and checking if its least model coincides with the guess. zThis can be applied to non-stratified programs.

Stable Models Idea (cont) z“Guessing a model” corresponds to “assuming default negations not”. This type of reasoning is usual in NMR yAssume some default literals yCheck in P the consequences of such assumptions yIf the consequences completely corroborate the assumptions, they form a stable model zThe stable models semantics is defined as the intersection of all the stable models (i.e. what follows, no matter what stable assumptions)

SMs: preliminary example a  not bc  a p  not q b  not ac  b q  not rr  Assume, e.g., not r and not p as true, and all others as false. By processing this into P: a  falsec  a p  false b  falsec  b q  truer  Its least model is {not a, not b, not c, not p, q, r} zSo, it isn’t a stable model: yBy assuming not r, r becomes true ynot a is not assumed and a becomes false

SMs example (cont) a  not bc  a p  not q b  not ac  b q  not rr  Now assume, e.g., not b and not q as true, and all others as false. By processing this into P: a  truec  a p  true b  falsec  b q  falser  Its least model is {a, not b, c, p, not q, r} zI is a stable model  The other one is {not a, b, c, p, not q, r}  According to Stable Model Semantics:  c, r and p are true and q is false.  a and b are undefined

Stable Models definition D Let I be a (2-valued) interpretation of P. The definite program P/I is obtained from P by: deleting all rules whose body has not A, and A  I deleting from the body all the remaining default literals  P (I) = least(P/I) D M is a stable model of P iffM =  P (M). A is true in P iff A belongs to all SMs of P A is false in P iff A doesn’t belongs to any SMs of P (i.e. not A “belongs” to all SMs of P).

Properties of SMs 3Stable models are minimal models 3Stable models are supported 3If P is locally stratified then its single stable model is the perfect model 3Stable models semantics assign meaning to (some) non-stratified programs yE.g. the one in the example before

Importance of Stable Models Stable Models were an important contribution: yIntroduced the notion of default negation (versus negation as failure) yAllowed important connections to NMR. Started the area of LP&NMR yAllowed for a better understanding of the use of LPs in Knowledge Representation It is considered as THE semantics of LPs by a significant part of the community.

LP representing a static world zThe work on LP allows the (non- monotonic) addition of new knowledge. z But: yMuch of the work does not consider this evolution of knowledge xLPs represent a static knowledge of a given world in a given situation. xThe issues of how to add new information to a logic program are less studied.

Knowledge Evolution zIn real situations knowledge evolves by: ycompleting it with new information (revision) ychanging it according to the changes in the world itself (updates) I know that I have a flight booked for London (either for Heathrow or for Gatwick). y I learn that it is not for Heathrow (revision) y I conclude my flight is for Gatwick y I learn that flights for Heathrow were canceled (update) y Either I have a flight for Gatwick or no flight at all

Model Updates zUpdates are usually performed model by model. zMarek and Truszczynski defined a language for defining updates: in(A 0 ) | out(A 0 )  in(A 1 ), …, out(A n ) yGiven an update program and a model of the current situation, produce model(s) of the new situation. yIf several models of the current situation exist, one has to proceed model by model.

Updates of Logic Programs zWe’ve defined a program transformation to directly obtain P u P M1M1... MnMn M 1,1 M 1,n1 M n,nn M n,1... U PuPu ? U zWe’ve generalized MT’s approach to the 3- valued case

Updates of LPs by LPs zWhen updating LPs, doing it model by model is not desired. It loses the directional information of the LP arrow. P:sleep  not tv_on. watch  tv_on. tv_on. U:not tv_on  p_failure. p_failure. U2:not p_failure. M = {tv,w} Mu = {pf,w} vs Mu 2 = {w} vs {pf,s} {tv,w} zBodies are evaluated in the last state.

Generalized LPs  A generalized logic program P is a set of propositional Horn clauses L  L 1,…, L n where L and L i are atoms from L K, i.e. of the form A or ´ not A ´.  Program P is normal if no head of the clause in P has form not A.

Generalized LP semantics  A set M is an interpretation of L K if for every atom A in K exactly one of A and not A is in M.  Definition: An interpretation M of L K is a stable model of a generalized logic program P if M is the least model of the Horn theory P  { not A: A  M }.

Generalized LPs example  Example: K = { a,b,c,d,e } P : a  not b c  b e  not d not d  a, not c d  not e this program has exactly one stable model: M = Least ( P  not { b, c, d }) = { a, e, not b, not c, not d } N = { not a, not e, b, c, d } is not a stable model since N  Least ( P  { not a, not e })

Relation to stable models  Proposition: An interpretation M of L K is a stable model of a generalized logic program P iff for every A  L K  if P/M |- A then A  M  if A  K  M then P/M |- A where P/M denotes Gelfond-Lifschitz transform of P wrt M  Conclusion: The class of stable models of generalized logic programs extends the class of stable models of normal programs.

Drawbacks of Interpretation Updates  How to update a logic program P by a logic program U obtaining as a result a new, updated logic program P  U.  Interpretation update approach ( H.Katsuno and A.Mendelzon, M.Winslett ) : models of DB’ = updated models of DB  Drawbacks of this approach:  all the models of DB have to be computed and updated separately  no natural way to compute DB’ ( DB’ may not exist)  produces counter-intuitive results when intensional part of DB is allowed to be updated.

Update Example  Example: P : sleep  not tv_on watch_tv  tv_on tv_on   the only stable model is M = { tv_on, watch_tv } U : not tv_on  power_failure power_failure   the only update is M U = { power_failure, watch_tv }  the intended model is M I = { power_failure, sleep } U 2 : not power_failure 

Update Example (2)  Example: P : innocent  not found_guilty  the only stable model is M = { innocent } U : found_guilty   the only update is M U = { innocent, found_guilty }  the intended model is M I = { found_guilty }

Dynamic Program Updates  Program P is semantically equivalent to the program P’ : innocent  the model M U = { innocent, found_guilty } is the only reasonable model of the update of P’ by U.  DB’ depends not only on semantics of DB and update U ( interpretation updates ) but also on their syntax. z We propose a new approach to the problem of updating knowledge bases represented by logic programs that attempts to eliminate the drawbacks of the previous approaches

Dynamic Program Updates zHow to update a logic program with another: A  B 1, …, B m, not C 1, …, not C n not A  B 1, …, B m, not C 1, …, not C n

Program Update  Definition: Let P and U be generalized logic programs in the language L. By the update of P by U we mean the generalized logic program P  U, consisting of the clauses:  (RP) Rewritten original program clauses: A P  B 1, …, B m, C’ 1, …, C’ n A´ P  B 1, …, B m, C’ 1, …, C’ n  (RU) Rewritten updating program clauses: A U  B 1, …, B m, C’ 1, …, C’ n A´ U  B 1, …, B m, C’ 1, …, C’ n

Translation into LP  (UR) Update rules: A  A U and not A  A´ U  (IR) Inheritance rules: A  A P, not A´ U and A´  A´ P, not A U  (DR) Default rules: A´  not A P, not A U and not A  A´

Example  Example: P : sleep  not tv_on watch_tv  tv_on tv_on  U : not tv_on  power_failure power_failure   P  U = (RP)  (RU)  (UR)  (IR)  (DR) RP : sleep P  tv_on´RU : tv_on´ U  power_failure watch_tv P  tv_on power_failure U  tv_on P   M = { power_failure, sleep } is the only stable model of P  U

Semantic characterization  Definition: Let M be a model of the program U in the language L.  Def [ M ] = { not A : M |=  Body,  ( A  Body )  P  U }  Rej [ M ] = { A  Body  P :  ( not A  Body’ )  U and M |= Body’ }  { not A  Body  P :  ( A  Body’ )  U and M |= Body’ }  Res [ M ] = P  U – Rej [ M ].

Equivalence to LP translation  Theorem: An interpretation N is a stable model of the update program P  U iff N is an extension of a model M of U such that: M = Least ( Res [ M ]  Def [ M ])  Conclusion: If N is a stable model of P  U then its restriction M to the language L is a stable model of Res [ M ].

Properties  Proposition: If M is a stable model of the union P  U of programs P and U, then its extension N is a stable model of the update program P  U. Thus, the semantics of the program P  U is always weaker than or equal to the semantics of P  U.  If either P or U is empty, or if both P and U are normal programs, then semantics of P  U and P  U coincide.

Dynamic Program Updates  Definition: Let P = { P s : s  S } be a finite or infinite sequence of generalized logic programs. The dynamic program update over the sequence of programs P and at the state s  S is a logic program  s P resulting from the successive updates.

Dynamic LP example  Example: P = { P 1, P 2, P 3 } P 1 : sleep  not tv_on watch_tv  tv_on tv_on  P 2 : not tv_on  power_failure power_failure  P 3 : not power_failure   M 1 = { tv_on, watch_tv } is the unique stable model of program  1 P

Dynamic LP example (2)  M 2 = { sleep, power_failure } is the unique stable model of the program  2 P.  M 3 = { tv_on, watch_tv } is the unique stable model of the program  3 P.  Program  2 P is semantically equivalent to P 1  P 2.

Dynamic LP example (3)  Example: P = { P 1, P 2, P 3, P 4 } P 1 : not fly(X)  animal(X) P 4 : animal(X)  bird(X) P 2 : fly(X)  bird(X) bird(X)  penguin(X) P 3 : not fly(X)  penguin(X) animal(pluto)  bird(duffy)  penguin(tweety)   Program  4 P has a unique stable model in which fly(duffy) is true and both fly(pluto) and fly(tweety) are false.