11 November 2005 Foundations of Logic and Constraint Programming 1 Negation: Declarative Interpretation ­An overview First Order Formulas and Logical Truth.

Slides:



Advertisements
Similar presentations
Quantified Invariant Generation using an Interpolating Saturation Prover Ken McMillan Cadence Research Labs TexPoint fonts used in EMF: A A A A A.
Advertisements

Chapter 2 Revision of Mathematical Notations and Techniques
Some important properties Lectures of Prof. Doron Peled, Bar Ilan University.
SLD-resolution Introduction Most general unifiers SLD-resolution
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
Possible World Semantics for Modal Logic
2005conjunctive-ii1 Query languages II: equivalence & containment (Motivation: rewriting queries using views)  conjunctive queries – CQ’s  Extensions.
Automated Reasoning Systems For first order Predicate Logic.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Web Science & Technologies University of Koblenz ▪ Landau, Germany Advanced Data Modeling Minimal Models Steffen Staab TexPoint fonts used in EMF. Read.
1 Conditional XPath, the first order complete XPath dialect Maarten Marx Presented by: Einav Bar-Ner.
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.
Auto-Epistemic Logic Proposed by Moore (1985) Contemplates reflection on self knowledge (auto-epistemic) Allows for representing knowledge not just about.
CS240A: Databases and Knowledge Bases Fixpoint Semantics of Datalog Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
26 October 2006 Foundations of Logic and Constraint Programming 1 Negation: Procedural Interpretation ­An overview Why negation Extended programs and queries.
Winter 2004/5Pls – inductive – Catriel Beeri1 Inductive Definitions (our meta-language for specifications)  Examples  Syntax  Semantics  Proof Trees.
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.
12 October 2006 Foundations of Logic and Constraint Programming 1 Operational Semantics ­An overview The language of programs The computation mechanism.
Monadic Predicate Logic is Decidable Boolos et al, Computability and Logic (textbook, 4 th Ed.)
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.
17 October 2006 Foundations of Logic and Constraint Programming 1 Declarative Semantics ­An overview Algebras (semantics for terms) Interpretations (semantics.
Introduction to Logic for Artificial Intelligence Lecture 2 Erik Sandewall 2010.
Binary Decision Diagrams for First Order Predicate Logic By: Jan Friso Groote Afsaneh Shirazi.
Methods of Proof & Proof Strategies
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Theoretical basis of GUHA Definition 1. A (simplified) observational predicate language L n consists of (i) (unary) predicates P 1,…,P n, and an infinite.
Introduction to Proofs
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
CSE 311 Foundations of Computing I Lecture 8 Proofs and Set Theory Spring
Web Science & Technologies University of Koblenz ▪ Landau, Germany Stable Models See Bry et al 2007.
Logic CL4 Episode 16 0 The language of CL4 The rules of CL4 CL4 as a conservative extension of classical logic The soundness and completeness of CL4 The.
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.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
2.3Logical Implication: Rules of Inference From the notion of a valid argument, we begin a formal study of what we shall mean by an argument and when such.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
Logic Logic can be traced back to Aristotle, and more recently to Frege who introduced predicate logic as a language for representing and reasoning about.
Induction Proof. Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
Automated Reasoning Systems For first order Predicate Logic.
Mathematical Preliminaries
CSE 311 Foundations of Computing I Lecture 9 Proofs and Set Theory Autumn 2012 CSE
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
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,
1 Section 8.3 Higher-Order Logic A logic is higher-order if it allows predicate names or function names to be quantified or to be arguments of a predicate.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Models of Definite Programs.
CS104:Discrete Structures Chapter 2: Proof Techniques.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Models in First Order Logics.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2012 CSE
Models of Definite Programs
Introduction to Logic for Artificial Intelligence Lecture 2
Completeness of the SLD-Resolution
Chapter 5 Induction and Recursion
Semantics of Datalog With Negation
CSE 311: Foundations of Computing
Soundness of SLD-Resolution
Models of Definite Programs
MA/CSSE 474 More Math Review Theory of Computation
Computer Security: Art and Science, 2nd Edition
Negations of quantifiers
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Models of Definite Programs
Advanced Data Modeling Minimal Models
Presentation transcript:

11 November 2005 Foundations of Logic and Constraint Programming 1 Negation: Declarative Interpretation ­An overview First Order Formulas and Logical Truth Completion of Programs SLDNF-resolution: Soundness and restricted completeness Extended Consequence Operator Standard Models [Lloy87] J.W. Lloyd, Foundations of Logic Programming, Second Extended Edition, Springer, [ApBo94] Krzysztof Apt and Roland Bol, Logic Programming and Negation: A Survey, Journal of Logic Programming, 19/20: 9-71, 1994.

11 November 2005 Foundations of Logic and Constraint Programming 2 First-Order Formulas Given ranked alphabets F and  for functiona and predicate symbols, respectively, and a set V of variables, the set of (first-order) formulas (over , F and V ) is inductively defined as follows:  If atom A  TB ,F,V, then A is a formula  If G 1 and G 2 are formulas, then  G 1, G 1  G 2 (written G 1, G 2 ), G 1  G 2, G 1  G 2 and G 1  G 2 are formulas  If G is a formula and x  V, then  x G and  x G are formulas

11 November 2005 Foundations of Logic and Constraint Programming 3 Extended Notion of Logical Truth (1) Given a formula G, and interpretation I with domain D, and a state  : V → D: G is true in I under , written I |=  G :   I |=  p(t 1,..., t n ) :   (t 1 ),...,  (t 1 )  p I  I |=   G :  I |   G  I |=  G 1  G 2 :  I |=  G 1 and I |=  G 2  I |=  G 1  G 2 :  I |=  G 1 or I |=  G 2  I |=  G 1  G 2 :  if I |=  G 2 then I |=  G 1  I |=  G 1  G 2 :  I |=  G 2 iff I |=  G 1  I |=   xG :  for every d  D: I |=  ’ G  I |=   xG :  for some d  D: I |=  ’ G where  ’ : V → D with  ’(x) = d and  ’(y) =   (y) for every y  V – {x}

11 November 2005 Foundations of Logic and Constraint Programming 4 Extended Notion of Logical Truth (2) Given a formula G, sets of Formulas S and T, and interpretation I, and where x 1,..., x k are the variables occurring in G   x 1,..., x k G is the universal closure of G (abbreviated to  G)  I |=  G :  I |=  G for every state   G is true in I (or I is a model of G), written I |= G :  I |=  G  I is a model of S, written I |= S :  I |=G for every G  S T is a semantic (or logical) consequence of S written S |= T :  every model of S is a model of T (  I: I |= S implies I |= T)

11 November 2005 Foundations of Logic and Constraint Programming 5 No Negative Consequences of (Extended) Programs (1) Consider program P mem : member(x,[x|y])  member(x,[y|z])  member(x, z) ­Then, e.g P mem |= member(a, [a,b]) and P mem |  member(a, [ ]). ­But also, P mem |   member(a, [ ]) since HB {member},{|, [], a} |= P mem and HB {member},{|, [], a} |   member(a, [ ]). Nevertheless, the SLDNF tree of P mem  {  member(a, [ ])} is successful  member(a,[]) member(a,[]) failure □ success

11 November 2005 Foundations of Logic and Constraint Programming 6 No Negative Consequences of (Extended) Programs (2) Problem: For every extended program P, the corresponding Herbrand Base is a model. ­Hence, there is no negative ground literal  A as a logical consequence of P. ­But SLDNF tree of P mem  {  A }, may be successful ! (?) Hence, is SLDNF-resolution sound? What does soundness means? Solution: Strengthen P by completion (“replace implication by “equivalences”) to comp(P) and compare SLDNF-resolution and comp(P), instead of P!

11 November 2005 Foundations of Logic and Constraint Programming 7 Completed Definitions (Example 1) Whereas P |= precipitation, cold, snow % the least Herbrand Model comp(P) |= precipitation, cold, snow,  holidays,  sun,  happy P:happy  snow, holidays happy  sun snow  cold, precipitation cold  precipitation  comp(P):happy  ( snow, holidays )  sun snow  cold, precipitation cold  true precipitation  true holidays  false sun  false

11 November 2005 Foundations of Logic and Constraint Programming 8 Completed Definitions (Example 2) Then, e.g. comp(p) |= member(a,[a,b]),  member(a,[ ]),  member(a,[b,c]) P:member(x,[x|y])  member(x,[y|z])  member(x,z) disjoint([],x)  disjoint([x|y],z)   member(x,z), disjoint(y,z) comp(P):  x1  x2 member(x1,x2)   x,y (x1 = x, x2 = [x|y])   x,y,z (x1 = x, x2 = [y|z]), member(x,z)  x1  x2 disjoint(x1,x2)   x (x1 = [], x = x)   x,y,z (x1 = [x|y], x2 = z,  member(x,z), disjoint(y,z)) ( plus the standard axioms for equality and inequality)

11 November 2005 Foundations of Logic and Constraint Programming 9 Completion (1) ­The completion of extended program P (denoted by comp(P)), is the set of formulas constructed from P by the following 6 steps: 1. Associate with every n-ary predicate symbol p a sequence of pairwise distinct variables x 1,..., x n which do not occur in P. 2. Transform each clause c = p(t 1,..., t n )  B into p(x 1,..., x n )  x 1, = t 1,..., x n, = t n, B 3. Transform each resulting formula p(x 1,..., x n )  G into p(x 1,..., x n )   z G where z is a sequence of the elements of Vars(c).

11 November 2005 Foundations of Logic and Constraint Programming 10 Completion (2) 4. For every n-ary predicate symbol p, let p(x 1,..., x n )   z 1 G 1,..., p(x 1,..., x n )   z m G m be all implications obtained in step 3 (m  0). 4.a) If m >0, then replace these by the formula  x 1,..., x n p(x 1,..., x n )   z 1 G 1 ...   z m G m (if some G i is empty, replace it by true.) 4.b)If m = 0, i.e predicate p had no defining clause, then add the formula  x 1,..., x n p(x 1,..., x n )  false.

11 November 2005 Foundations of Logic and Constraint Programming 11 Completion (3) 5. Add the standard axioms of equality 5.1  [ x = x] % reflexivity 5.2  [ x = y → y = x ] % simetry 5.3  [ x = y, y = z → x = z ] % transitivity 5.4  [ x i = y → f(x 1,..., x i,..., x n ) = f(x 1,..., y,..., x n ) ] % substitutivity 5.5  [ x i = y → p(x 1,..., x i,..., x n )  p(x 1,..., y,..., x n ) ] % substitutivity 6. Add the standard axioms of inequality 6.1  [ x 1  y 1 ...  x m  y m → f(x 1,..., x i,..., x n )  f(y 1,..., y i,..., y n ) ] 6.2  [ f(x 1,..., x i,..., x n )  g(y 1,..., y i,..., y n ) ](when f  g ) 6.3  [ x  t ](when x is a proper subterm of t) –Notice that axioms 6.1 to 6.3 are a restriction of FO equality to the UNA (Unique Names Assumptiom) – “different names denote different entities”

11 November 2005 Foundations of Logic and Constraint Programming 12 Soundness of SLDNF-Resolution Given extended program P, extended query Q and substitution  :   | var (Q) is a correct answer substitution of Q :  comp(P) |= Q   Q  is a correct instance of Q :  comp(P) |= Q  Theorem (Lloyd, 1987) If there exists a successful SLDNF-derivation of P  {Q} with CAS  then comp(P) |= Q  Corollary (Lloyd, 1987) If there exists a successful SLDNF-derivation of P  {Q}, then comp(P) |=  Q 

11 November 2005 Foundations of Logic and Constraint Programming 13 Incompleteness of SLDNF (Inconsistency) Thus, comp(P)  { p   p } “=“ { false } Hence, comp(p) |= p and comp(p) |=  p  In this case comp(P) is inconsistent, as it has no model, since for every I, I |  comp(P) In this case of inconsistency, SLDNF-resolution is incomplete, since there is neither a successful SLDNF-derivation for P  {p}, nor for P  {  p}, P: p   p

11 November 2005 Foundations of Logic and Constraint Programming 14 Incompleteness of SLDNF (Non Strictness) Thus, comp(P)  { p  q   q, q  q } “=“ { p  true } Hence, comp(p) |= p. In this case, of non-strictness (see later), SLDNF-resolution is incomplete, since there is no successful SLDNF-derivation for P  {p}. Notice that in the absence of one of the first two clauses, there would be no incompleteness, since p  true would not be in comp(P). P: p  q p   q q  q

11 November 2005 Foundations of Logic and Constraint Programming 15 Incompleteness of SLDNF (Floundering) Thus, comp(P)  {  x 1 p(x 1 )   x (x 1 = x,  q(x)),  x 1 q(x 1 )  false } “=“ {  x 1 p(x 1 )  true,  x 1 q(x 1 )  false } Hence, comp(p) |=  x 1 p(x 1 ). In this case, of floundering, SLDNF-resolution is incomplete, since there is no successful SLDNF-derivation for P  {p(x 1 )} Note: SLDNF blocks query  q(x), contrary to what Prolog does! P: p(x)   q(x)

11 November 2005 Foundations of Logic and Constraint Programming 16 Incompleteness of SLDNF (Unfairness) Thus, comp(P)  { r  p, q, p  p, q  false } “=“ {r  false, q  false } Hence, comp(P) |=  r. In this case, SLDNF-resolution might be incomplete, since there is no successful SLDNF-derivation for P  {  r} when the leftmost selection rule (as in Prolog) is adopted (unfairness of the selection rule). P: r  p, q p  p

11 November 2005 Foundations of Logic and Constraint Programming 17 Dependency Graphs A dependency graph D p of an extended program P :  directed graph with labelled edges, where  The nodes are the predicate symbols of P  The edges are either positive (labelled +) or negative (labelled -);  p → + q edge in Dp :  P contains a clause p(s 1,..., s m )  L, q( t1,.., tn), R  p → - q edge in Dp :  P contains a clause p(s 1,..., s m )  L,  q( t1,.., tn), R

11 November 2005 Foundations of Logic and Constraint Programming 18 Strict, Hierarchical and Stratified Programs Given an extended program P, with dependency graph D p, with predicate symbols p, q, and an extended query Q:  p depends evenly / oddly on q :  There is a path in D p from p to q with an even (including 0) / odd number of negative edges.  P is strict wrt. Q :  No predicate symbol occurring in Q depends both evenly and oddly on a predicate symbol in the head of a clause in P.  P is hierarchical :  No cycle exists in D p  P is stratified :  No cycle with a negative edge exists in D p

11 November 2005 Foundations of Logic and Constraint Programming 19 Strict, Hierarchical and Stratified Examples (1) P 1 : p   p p depends on itself (oddly) P 1 is strict (no even and odd dependency of p on any predicate) P 1 is not hierarchical (there is a cycle in P 1 ) P 1 is not stratified (there is a cycle with a negative edge in P 1 ) p depends evenly (0) and oddly (1) on q, which depends on itself (evenly) P 2 is not strict (there is an even and an odd dependency of p on q P 2 is not hierarchical (there is a cycle in P 2,, as q depends on itself) P 2 is stratified (there is no cycle with a negative edge in P 2 ) P 2 : p  q p   q q  q p + - q + p -

11 November 2005 Foundations of Logic and Constraint Programming 20 Strict, Hierarchical and Stratified Examples (1) p depends oddly on q P 3 is strict (no even and odd dependency of predicate p/1 on any predicate) P 1 is hierarchical (there is no cycle in P 3 ) P 1 is stratified (there is no cycle with a negative edge in P 3 ) r depends evenly on q and p, that depends evenly on itself P 4 is strict (no predicate depends evenly and oddly on another predicate) P 2 is not hierarchical (there is a cycle in P 4, the self dependency of p) P 2 is stratified (there is no cycle with a negative edge in P 1 ) p/1 - P 3 : p(x)   q(x) q/1 P 4 : r  p, q p  p r + + p + q

11 November 2005 Foundations of Logic and Constraint Programming 21 Restricted Completeness of SLDNF-resolution (1) Theorem (Lloyd, 1987) Let P be a hierarchical and allowed program and Q an allowed query. If comp(P) |= Q  for some  such that Q  is ground, then there is a successful SLDNF-derivation of P  {Q} with CAS  Note:Theorem does not hold if an arbitrary selection rule is fixed.  The selection rule must be safe (does not select negative literals that are not ground).

11 November 2005 Foundations of Logic and Constraint Programming 22 Restricted Completeness of SLDNF-resolution (2) Theorem (Lloyd, 1987) Let P be a stratified and allowed program and Q an allowed query, such that P is strict wrt. Q If comp(P) |= Q  for some  such that Q  is ground, then there is a successful SLDNF-derivation of P  {Q}. With CAS  Note: Theorem does not hold if an arbitrary selection rule is fixed.  The selection rule must be safe and fair.

11 November 2005 Foundations of Logic and Constraint Programming 23 Fair Selection Rule An extended selection rule R is fair :  for every SLDNF-tree F via R and for every branch  in F :  Either  is failed; or  For every literal L occurring in a query of , (some further instantiated version of ) L is selected within a finite number of derivation steps Examples:  Selection rule “select leftmost literal” is unfair (depth-first search)  Selection rule “select leftmost literal to the right of the literals introduced in the previous derivation step, if it exists, otherwise select leftmost literal” is fair (breadth-first search)

11 November 2005 Foundations of Logic and Constraint Programming 24 Extended Consequence Operator Let P be an extended program and I a Herbrand interpretation. Then T P (I) :  { H | H  B  ground(P), I |= B} When P is a definite program, then  T P is monotonic  T P Is continuous  T P has the least fixpoint M (P)  M (P) = T P  ­In case of extended programs all these properties are lost, since T P is not monotonic.

11 November 2005 Foundations of Logic and Constraint Programming 25 Extended Consequence Operator is Not Continuous Let I = {q } ­Then T P (I) = { }, ­Hence, it is not the case that I  T P (I). ­Therefore, T P is not monotonic (nor continuous) for P a (due to negation). P a : p   q P b : p  p Let I 1 = { } and I 2 = {p } ­Then T P (I 1 ) = I 1 = { }, and T P (I 2 ) = I 2 = {p}, ­Therefore, T P is monotonic (and continuous) for P b. (and all with no negation)

11 November 2005 Foundations of Logic and Constraint Programming 26 Extended T P -Characterization (1) Lemma 4.3 ([ApBo94]): Let P be an extended program and I a Herbrand interpretation. Then I |= P iff T P (I)  I Proof. I |= P iff for every H  B  ground(P) : I |= B implies I |= H iff for every H  B  ground(P) : I |= B implies H  I iff for every ground atom H : H  T P (I) implies H  I iff T P (I)  I

11 November 2005 Foundations of Logic and Constraint Programming 27 Extended T P -Characterization (2) Definition Let F and  be ranked alphabets of function and predicate symbols, respectively, let =  be a binary predicate symbol (for “equality”), and let I be a Herbrand interpretation for F and . Then I = :  I  { t = t | t  HU F  is called a standardized Herbrand interpretation for F and   {=} Lemma 4.4 ([ApBo94]): Let P be an extended program and I a Herbrand interpretation. Then I |= comp(P) iff T P (I)  I

11 November 2005 Foundations of Logic and Constraint Programming 28 Extended T P -Characterization (3) Proof sketch of Lemma 4.4: I = |= comp(P) iff for every ground atom H: I |= H   (H  B  ground(P) ) B ) (since I = is a model for standard axioms of equality and inequality) iff for every ground atom H: H  I  I |= B for some H  B  ground(P) iff for every ground atom H : H  I implies H  T P (I) iff T P (I)  I

11 November 2005 Foundations of Logic and Constraint Programming 29 Extended T P -Characterization: Example (1) Let I 0 = { }, I 1 = {p }, I 2 = {q }, I 3 = {p, q }, Then T P (I 0 ) = { p }, T P (I 1 ) = { p }, T P (I 2 ) = { }, T P (I 3 ) = { }.  T P (I 1 ) = I 1. Hence, I 1 |= comp(P a ) and I 1 |= P a  T P (I 2 )  I 2. but T P (I 2 )  I 2. Hence, I 2 |= P a, but I 2 |  comp(P a )  T P (I 3 )  I 3. but T P (I 3 )  I 3. Hence, I 3 |= P a, but I 3 |  comp(P a )  T P (I 0 )  I 0. Hence, I 0 |  P a P a : p   q comp(P a ) = {p,  q}

11 November 2005 Foundations of Logic and Constraint Programming 30 Extended T P -Characterization: Example (2) P b :p   q q  q comp(P b ) = {p   q} Let I 0 = { }, I 1 = {p }, I 2 = {q }, I 3 = {p, q }, Then T P (I 0 ) = { p }, T P (I 1 ) = { p }, T P (I 2 ) = { q }, T P (I 3 ) = { q }.  T P (I 1 ) = I 1. Hence, I 1 |= comp(P b ) and I 1 |= P b  T P (I 2 ) = I 2. Hence, I 2 |= comp(P b ) and I 1 |= P b  T P (I 3 )  I 3. but T P (I 3 )  I 3. Hence, I 3 |= P b, but I 3 |  comp(P b )  T P (I 0 )  I 0. Hence, I 0 |  P a

11 November 2005 Foundations of Logic and Constraint Programming 31 Completion may be Inadequate Thus, comp(P)  { ill   ill, infection, infection  true } “=“ {ill   ill, infection  true } is inconsistent (it has no models). Hence, comp(P) |= healthy But, I = { ill, infection } is the only Herbrand model of P. Hence, P |  healthy ill   ill, infection infection 

11 November 2005 Foundations of Logic and Constraint Programming 32 Non-Intended Herbrand Models P 1 has three Herbrand models M 1 = {p}, M 2 = {q}, and M 3 = {p, q} P 1 has no least, but two minimal models: M 1 and M 2. However: M 1 and not M 2, is the “intended“ model of P 1 P 1 : p   q Because Tp is not monotonic nor continuous, it is not possible, in general to get a fixpoint, nor a least model from an extended program. Nevertheless, there are minimal models, although not necessarily unique.

11 November 2005 Foundations of Logic and Constraint Programming 33 Supported Herbrand Interpretations A Herbrand interpretation I is supported :  For every H  I there exists some H  B  ground(P) such that I |= B ( intuitively: B is an explanation for H ) Example: M 1 = {p,  q }, M 2 = {  p, q}, and M 3 = {p, q}  M 1 is a supported model of P 1 (  q is the explanation for p)  M 2 is no supported model of P 1 ( there is no explanation for q) Note that T P (M 2 ) =   M 1 and that T P (M 1 ) = M 1. P 1 : p   q

11 November 2005 Foundations of Logic and Constraint Programming 34 Extended T P -Characterization (4) Lemma 6.2 ([ApBo94]): Let P be an extended program and I a Herbrand interpretation. Then I |= P and I supported iff T P (I)  I Proof (sketch): I |= P and I supported ­iff for every H  B  ground(P) : I |= B implies I |= H and for every H  I: I |=  (H  B  ground(P) ) B ­iff for every ground atom H : I |= ( H   (H  B  ground(P) ) B ) and I |= (H →  (H  B  ground(P) ) B ) ­iff for every ground atom H : I |= ( H   (H  B  ground(P) ) B ) ­iff I = is a model of comp(P) ­iff T P (I)  I (cf. Lemma 4.4)

11 November 2005 Foundations of Logic and Constraint Programming 35 Non-Intended Supported Models ­P 2 has three Herbrand models M 1 = {p}, M 2 = {q}, and M 3 = {p, q} ­P 2 has two supported Herbrand models : M 1 and M 2. In fact, both M1 and M2 are minimal models for comp(P2) = {p   q} ­However: M 1 and not M 2, is the “intended“ model of P 2. M 1 is called the standard model of P 2 ( cf. later slide) ­In general, it is not possible to define standard models, unless the programs are stratified! P 2 :p   q q  q

11 November 2005 Foundations of Logic and Constraint Programming 36 Stratifications Let P be an extended program and D p its dependency graph,  Predicate symbol p is defined in P :  P contains a clause p(t 1,..., t m )  B  P 1 ...  P n = P is a stratification of P :   P i  for every i  1.. n  P i  P j  for every i,j  1.. n, with i  j  for every p defined in P i and edge p → + q in D p : q is not defined in  n j = i+1 P j  for every p defined in P i and edge p → - q in D p : q is not defined in  n j = i P j Lemma 6.5 ([ApBo94]): An extended program is stratified iff it admits a (not necessarily unique) stratification.

11 November 2005 Foundations of Logic and Constraint Programming 37 Stratifications Example (1)  P 1  P 2  P 3 is a stratification of P, where  P 1  = { num(0) , num(s(x))  num(x) }  P 2  = { zero(0)  }  P 3  = { positive(x)  num(x),  zero(x) } zero(0)  positive(x)  num(x),  zero(x) num(0)  num(s(x))  num(x)

11 November 2005 Foundations of Logic and Constraint Programming 38 Stratifications Example (2) P admits no stratification since strat(even) > odd but strat(odd)  strat(even) even(0)  even(x)   odd(x), num(x) odd(s(x))  even(x) num(0)  num(s(x))  num(x)

11 November 2005 Foundations of Logic and Constraint Programming 39 Standard Models (Stratified Programs) Let ­I be an Herbrand interpretation and  a set of predicate symbols: ­I |  :  I  p(t 1,..., t m ) | p  P, t 1,..., t m ground terms) ­P 1 ...  P n be a stratification of a stratification of extended program P, Then  M 1 :  least Herbrand model of P 1 such that M 1 | { p | p not defined in P } =   M 2 :  least Herbrand model of P 2 such that M 2 | { p | p defined nowhere or in P 1 } = M 1...  M n :  least Herbrand model of P n such that M n | { p | p defined nowhere or in P 1 ...  P n-1 } = M n-1 We call M P = M n the standard model of P

11 November 2005 Foundations of Logic and Constraint Programming 40 Standard Models: Example Let P 1  P 2  P 3 with ­P 1  = { num(0) , num(s(x))  num(x) } ­P 2  = { zero(0)  } ­P 3  = { positive(x)  num(x),  zero(x) } be a stratification of P. Then  M 1 = { num(t) | t  HU {s,0} }  M 2 = { num(t) | t  HU {s,0} }  {zero(0)}  M 3 = { num(t) | t  HU {s,0} }  {zero(0)}  {positive(t) | t  HU {s,0} – {0} } Hence M P = M 3 is the standard model of P zero(0)  positive(x)  num(x),  zero(x) num(0)  num(s(x))  num(x)

11 November 2005 Foundations of Logic and Constraint Programming 41 Properties of Standard Models Theorem 6.7 ([ApBo94]): Consider a stratified program P. Then  M P does not depend on the chosen stratification of P,  M P is a minimal model of P,  M P is a supported model of P, Corollary: For a stratified program P, comp(P) admits a Herbrand Model.